示例#1
0
        public static ResourceDeclarationToken Parse(BytecodeReader reader)
        {
            var token0 = reader.ReadUInt32();

            var resourceDimension = token0.DecodeValue <ResourceDimension>(11, 15);

            byte sampleCount;

            switch (resourceDimension)
            {
            case ResourceDimension.Texture2DMultiSampled:
            case ResourceDimension.Texture2DMultiSampledArray:
                sampleCount = token0.DecodeValue <byte>(16, 22);
                break;

            default:
                sampleCount = 0;
                break;
            }

            var operand    = Operand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10));
            var returnType = ResourceReturnTypeToken.Parse(reader);

            return(new ResourceDeclarationToken
            {
                ResourceDimension = resourceDimension,
                SampleCount = sampleCount,
                Operand = operand,
                ReturnType = returnType
            });
        }
示例#2
0
        public static TypedUnorderedAccessViewDeclarationToken Parse(BytecodeReader reader)
        {
            var token0 = reader.ReadUInt32();

            return(new TypedUnorderedAccessViewDeclarationToken
            {
                ResourceDimension = token0.DecodeValue <ResourceDimension>(11, 15),
                Coherency = token0.DecodeValue <UnorderedAccessViewCoherency>(16, 16),
                Operand = Operand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10)),
                ReturnType = ResourceReturnTypeToken.Parse(reader)
            });
        }
        public static TypedUnorderedAccessViewDeclarationToken Parse(BytecodeReader reader, ShaderVersion version)
        {
            var token0 = reader.ReadUInt32();

            var result = new TypedUnorderedAccessViewDeclarationToken
            {
                ResourceDimension     = token0.DecodeValue <ResourceDimension>(11, 15),
                Coherency             = token0.DecodeValue <UnorderedAccessViewCoherency>(16, 16),
                IsRasterOrderedAccess = token0.DecodeValue <bool>(17, 17),
                Operand    = Operand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10)),
                ReturnType = ResourceReturnTypeToken.Parse(reader)
            };

            if (version.IsSM51)
            {
                result.SpaceIndex = reader.ReadUInt32();
            }
            return(result);
        }