#include "xgfxpixelshaderloaddef.h"

XGfxPixelShaderLoadDef::XGfxPixelShaderLoadDef()
    : XAsset()
    , mCachedPart()
    , mPhysicalPart()
    , mCachedPartSize(0)
    , mPhysicalPartSize(0)
{
    
}

XGfxPixelShaderLoadDef::~XGfxPixelShaderLoadDef()
{
    
}

quint16 XGfxPixelShaderLoadDef::GetPhysicalPartSize() const
{
    return mPhysicalPartSize;
}

quint16 XGfxPixelShaderLoadDef::GetCachedPartSize() const
{
    return mCachedPartSize;
}

void XGfxPixelShaderLoadDef::Clear()
{
    mCachedPart.clear();
    mPhysicalPart.clear();
    mCachedPartSize = 0;
    mPhysicalPartSize = 0;
}

void XGfxPixelShaderLoadDef::ParseData(QDataStream *aStream)
{
    qint32 cachedPartPtr, physicalPartPtr;
    *aStream
        >> cachedPartPtr
        >> physicalPartPtr
        >> mCachedPartSize
        >> mPhysicalPartSize;

    if (physicalPartPtr)
    {
        aStream->readRawData(mPhysicalPart.data(), mPhysicalPartSize);
    }
    if (cachedPartPtr)
    {
        aStream->readRawData(mCachedPart.data(), mCachedPartSize);
    }
}
