public static ImmediateConstantBufferDeclarationToken Parse(BytecodeReader reader)
        {
            var token0 = reader.ReadUInt32();
            var length = reader.ReadUInt32() - 2;

            var result = new ImmediateConstantBufferDeclarationToken
            {
                DeclarationLength = length,
                Data = new Number[length]
            };

            for (int i = 0; i < length; i++)
            {
                result.Data[i] = Number.Parse(reader);
            }

            return(result);
        }
Beispiel #2
0
        public static CustomDataToken Parse(BytecodeReader reader, uint token0)
        {
            var             customDataClass = token0.DecodeValue <CustomDataClass>(11, 31);
            CustomDataToken token;

            switch (customDataClass)
            {
            case CustomDataClass.DclImmediateConstantBuffer:
                token = ImmediateConstantBufferDeclarationToken.Parse(reader);
                break;

            case CustomDataClass.ShaderMessage:
                token = ShaderMessageDeclarationToken.Parse(reader);
                break;

            default:
                throw new ParseException("Unknown custom data class: " + customDataClass);
            }

            token.CustomDataClass = customDataClass;
            return(token);
        }