#include "xd3dresource.h"

XD3DResource::XD3DResource()
    : XAsset()
    , mCommon(0)
    , mReferenceCount(0)
    , mFence(0)
    , mReadFence(0)
    , mIdentifier(0)
    , mBaseFlush(0)
{
    SetName("D3D Resource");
}

XD3DResource::~XD3DResource()
{

}

void XD3DResource::ParseData(XDataStream *aStream)
{
    *aStream >> mCommon;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mCommon = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mCommon);
    }

    *aStream >> mReferenceCount;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mReferenceCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mReferenceCount);
    }

    *aStream >> mFence;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mFence = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mFence);
    }

    *aStream >> mReadFence;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mReadFence = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mReadFence);
    }

    *aStream >> mIdentifier;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mIdentifier = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mIdentifier);
    }

    *aStream >> mBaseFlush;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mBaseFlush = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mBaseFlush);
    }
}

void XD3DResource::Clear()
{
    mCommon = 0;
    mReferenceCount = 0;
    mFence = 0;
    mReadFence = 0;
    mIdentifier = 0;
    mBaseFlush = 0;
}
