HRESULT DrVertexStatus::ParseProperty(DrPropertyReaderPtr reader, UINT16 enumID,
                                      UINT32 /* unused dataLen */)
{
    HRESULT err;

    switch (enumID)
    {
    default:
        DrLogW("Unknown property in vertex status message enumID %u", (UINT32) enumID);
        err = reader->SkipNextPropertyOrAggregate();
        break;

    case DrProp_VertexState:
        err = reader->ReadNextProperty(enumID, m_state);
        break;

    case DrProp_BeginTag:
        UINT16 tagValue;
        err = reader->PeekNextAggregateTag(&tagValue);
        if (err != S_OK)
        {
            DrLogW("Error reading DrProp_BeginTag %d", err);
        }
        else
        {
            switch (tagValue)
            {
            case DrTag_VertexProcessStatus:
                err = reader->ReadAggregate(tagValue, m_processStatus);
                break;

            default:
                DrLogW("Unexpected tag %d", tagValue);
                err = reader->SkipNextPropertyOrAggregate();
            }
        }
        break;
    }

    return err;
}
Beispiel #2
0
HRESULT DrVertexCommandBlock::ParseProperty(DrPropertyReaderPtr reader, UINT16 enumID,
                                            UINT32 /* unused dataLen */)
{
    HRESULT err;

    switch (enumID)
    {
    default:
        DrLogW("Unknown property in vertex command message enumID %u", (UINT32) enumID);
        err = reader->SkipNextPropertyOrAggregate();
        break;

    case DrProp_VertexCommand:
        UINT32 marshaledCommand;
        err = reader->ReadNextProperty(enumID, marshaledCommand);
        if (err == S_OK)
        {
            if (marshaledCommand < DrVC_Max)
            {
                m_command = (DrVertexCommand) marshaledCommand;
            }
            else
            {
                DrLogW("Unknown vertex command %u", marshaledCommand);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
        }
        break;

    case DrProp_VertexArgumentCount:
        UINT32 nArguments;
        err = reader->ReadNextProperty(enumID, nArguments);
        if (err == S_OK)
        {
            if (nArguments < 0x80000000)
            {
                SetArgumentCount((int) nArguments);
            }
            else
            {
                DrLogW("Too large argument count %u", nArguments);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
        }
        break;

    case DrProp_VertexArgument:
        if (m_nextArgumentToRead >= m_argument->Allocated())
        {
            DrLogW("Too many arguments nextArgumentToRead=%d, nArguments=%d",
                   m_nextArgumentToRead, m_argument->Allocated());
            err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
        }
        else
        {
            DrString arg;
            err = reader->ReadNextProperty(enumID, arg);
            if (err == S_OK)
            {
                m_argument[m_nextArgumentToRead] = arg;
                ++m_nextArgumentToRead;
            }
        }
        break;

    case DrProp_VertexSerializedBlock:
        UINT32 blockLength;
        err = reader->PeekNextPropertyTag(&enumID, &blockLength);
        if (err == S_OK)
        {
            if (blockLength < 0x80000000)
            {
                DrByteArrayRef block = DrNew DrByteArray((int) blockLength);
                {
                    DRPIN(BYTE) data = &(block[0]);
                    err = reader->ReadNextProperty(enumID, (UINT32) blockLength, data);
                }
                if (err == S_OK)
                {
                    m_serializedBlock = block;
                }
            }
            else
            {
                DrLogW("Block too large %u", blockLength);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
        }
        break;

    case DrProp_DebugBreak:
        err = reader->ReadNextProperty(enumID, m_setBreakpointOnCommandArrival);
        break;

    case DrProp_BeginTag:
        UINT16 tagValue;
        err = reader->PeekNextAggregateTag(&tagValue);
        if (err != S_OK)
        {
            DrLogW("Error reading DrProp_BeginTag %d", err);
        }
        else
        {
            switch (tagValue)
            {
            case DrTag_VertexProcessStatus:
                err = reader->ReadAggregate(tagValue, m_processStatus);
                break;

            default:
                DrLogW("Unexpected tag %d", tagValue);
                err = reader->SkipNextPropertyOrAggregate();
            }
        }
        break;
    }

    return err;
}
Beispiel #3
0
HRESULT DrVertexProcessStatus::ParseProperty(DrPropertyReaderPtr reader,
                                             UINT16 enumID, UINT32 /* unused dataLen */)
{
    HRESULT err;

    switch (enumID)
    {
    default:
        DrLogW("Unknown property in vertex status message enumID %u", (UINT32) enumID);
        err = reader->SkipNextPropertyOrAggregate();
        break;

    case DrProp_VertexId:
        UINT32 id;
        err = reader->ReadNextProperty(enumID, id);
        if (err == S_OK)
        {
            if (id >= 0x80000000)
            {
                DrLogW("Vertex ID out of range %u", id);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
            else
            {
                m_id = id;
            }
        }
        break;

    case DrProp_VertexVersion:
        UINT32 version;
        err = reader->ReadNextProperty(enumID, version);
        if (err == S_OK)
        {
            if (version >= 0x80000000)
            {
                DrLogW("Vertex version out of range %u", version);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
            else
            {
                m_version = version;
            }
        }
        break;

    case DrProp_VertexErrorCode:
        err = reader->ReadNextProperty(enumID, m_errorCode);
        break;

    case DrProp_VertexErrorString:
        {
            DrString errorString;
            err = reader->ReadNextProperty(enumID, errorString);
            if (err == S_OK)
            {
                SetVertexErrorString(errorString);
            }
        }
        break;

    case DrProp_VertexInputChannelCount:
        UINT32 nInputChannels;
        err = reader->ReadNextProperty(enumID, nInputChannels);
        if (err == S_OK)
        {
            if (nInputChannels >= 0x80000000)
            {
                DrLogW("Too many input channels %u", nInputChannels);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
            else
            {
                SetInputChannelCount((int) nInputChannels);
            }
        }
        break;

    case DrProp_VertexMaxOpenInputChannelCount:
        UINT32 maxInputChannels;
        err = reader->ReadNextProperty(enumID, maxInputChannels);
        if (err == S_OK)
        {
            if (maxInputChannels >= 0x80000000)
            {
                DrLogW("Too many max input channels %u", maxInputChannels);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
            else
            {
                m_maxInputChannels = (int) maxInputChannels;
            }
        }
        break;

    case DrProp_VertexOutputChannelCount:
        UINT32 nOutputChannels;
        err = reader->ReadNextProperty(enumID, nOutputChannels);
        if (err == S_OK)
        {
            if (nOutputChannels >= 0x80000000)
            {
                DrLogW("Too many output channels %u", nOutputChannels);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
            else
            {
                SetOutputChannelCount((int) nOutputChannels);
            }
        }
        break;

    case DrProp_VertexMaxOpenOutputChannelCount:
        UINT32 maxOutputChannels;
        err = reader->ReadNextProperty(enumID, maxOutputChannels);
        if (err == S_OK)
        {
            if (maxOutputChannels >= 0x80000000)
            {
                DrLogW("Too many max output channels %d", maxOutputChannels);
                err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
            }
            else
            {
                m_maxOutputChannels = (int) maxOutputChannels;
            }
        }
        break;

    case DrProp_CanShareWorkQueue:
        err = reader->ReadNextProperty(enumID, m_canShareWorkQueue);
        break;

    case DrProp_BeginTag:
        UINT16 tagValue;
        err = reader->PeekNextAggregateTag(&tagValue);
        if (err != S_OK)
        {
            DrLogW("Error reading DrProp_BeginTag %d", err);
        }
        else
        {
            switch (tagValue)
            {
            case DrTag_InputChannelDescription:
                if (m_nextInputChannelToRead >= m_inputChannel->Allocated())
                {
                    DrLogW("Too many input channel descriptions nextInputChannelToRead=%d, nInputChannels=%d",
                           m_nextInputChannelToRead, m_inputChannel->Allocated());
                    err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
                }
                else
                {
                    err = reader->ReadAggregate(tagValue, m_inputChannel[m_nextInputChannelToRead]);
                    if (err == S_OK)
                    {
                        ++m_nextInputChannelToRead;
                    }
                }
                break;

            case DrTag_OutputChannelDescription:
                if (m_nextOutputChannelToRead >= m_outputChannel->Allocated())
                {
                    DrLogW("Too many output channel descriptions nextOutputChannelToRead=%d, nOutputChannels=%d",
                           m_nextOutputChannelToRead, m_outputChannel->Allocated());
                    err = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
                }
                else
                {
                    err = reader->ReadAggregate(tagValue, m_outputChannel[m_nextOutputChannelToRead]);
                    if (err == S_OK)
                    {
                        ++m_nextOutputChannelToRead;
                    }
                }
                break;

            case DrTag_VertexMetaData:
                {
                    DrMetaDataRef metaData = DrNew DrMetaData();
                    err = reader->ReadAggregate(tagValue, metaData);
                    if (err == S_OK)
                    {
                        m_metaData = metaData;
                    }
                }
                break;

            default:
                DrLogW("Unexpected tag %d", tagValue);
                err = reader->SkipNextPropertyOrAggregate();
            }
        }
        break;
    }

    return err;
}
Beispiel #4
0
HRESULT DrChannelDescription::ParseProperty(DrPropertyReaderPtr reader,
                                            UINT16 enumID, UINT32 /* unused dataLen */)
{
    HRESULT err;

    switch (enumID)
    {
    default:
        DrLogW("Unknown property in channel description enumID %u", (UINT32) enumID);
        err = reader->SkipNextPropertyOrAggregate();
        break;

    case DrProp_ChannelState:
        err = reader->ReadNextProperty(enumID, m_state);
        break;

    case DrProp_ChannelURI:
        {
            DrString URI;
            err = reader->ReadNextProperty(enumID, URI);
            if (err == S_OK)
            {
                SetChannelURI(URI);
            }
        }
        break;

    case DrProp_ChannelErrorCode:
        err = reader->ReadNextProperty(enumID, m_errorCode);
        break;

    case DrProp_ChannelErrorString:
        {
            DrString errorString;
            err = reader->ReadNextProperty(enumID, errorString);
            if (err == S_OK)
            {
                SetChannelErrorString(errorString);
            }
        }
        break;

    case DrProp_ChannelTotalLength:
        err = reader->ReadNextProperty(enumID, m_totalLength);
        break;

    case DrProp_ChannelProcessedLength:
        err = reader->ReadNextProperty(enumID, m_processedLength);
        break;

    case DrProp_BeginTag:
        {
            UINT16 tagID;
            err = reader->PeekNextAggregateTag(&tagID);
            if (err == S_OK)
            {
                if (tagID == DrTag_ChannelMetaData)
                {
                    DrMetaDataRef mData = DrNew DrMetaData();
                    err = reader->ReadAggregate(tagID, mData);
                    if (err == S_OK)
                    {
                        SetChannelMetaData(mData);
                    }
                }
                else
                {
                    DrLogW("Unknown aggregate in channel description tagID %u", (UINT32) tagID);
                }
            }
        }
        break;
    }

    return err;
}