コード例 #1
0
        public static DebugInterfaceDeclarationToken Parse(DebugBytecodeReader reader)
        {
            uint token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("DynamicallyIndex", token0.DecodeValue(11, 11) == 1);
            var result = new DebugInterfaceDeclarationToken
            {
                DynamicallyIndexed          = (token0.DecodeValue(11, 11) == 1),
                Identifier                  = reader.ReadUInt32("Identifier"),
                ExpectedFunctionTableLength = reader.ReadUInt32("ExpectedFunctionTableLength")
            };

            uint token3 = reader.ReadUInt32("token3");

            result.TableLength = token3.DecodeValue <ushort>(00, 15);
            result.ArrayLength = token3.DecodeValue <ushort>(16, 31);
            reader.AddNote("TableLength", result.TableLength);
            reader.AddNote("ArrayLength", result.ArrayLength);

            for (int i = 0; i < result.TableLength; i++)
            {
                result.FunctionTableIdentifiers.Add(reader.ReadUInt32($"FunctionTableIdentifiers[{i}]"));
            }

            return(result);
        }
コード例 #2
0
        public static DebugShaderMessageDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var member = reader.LocalMembers.Last();
            var length = reader.ReadUInt32("length") - 2;

            var result = new DebugShaderMessageDeclarationToken
            {
                DeclarationLength  = length,
                InfoQueueMessageID = reader.ReadUInt32("InfoQueueMessageID"),
                MessageFormat      = reader.ReadEnum32 <ShaderMessageFormat>("MessageFormat"),
                NumCharacters      = reader.ReadUInt32("NumCharacters"),
                NumOperands        = reader.ReadUInt32("NumOperands"),
                OperandsLength     = reader.ReadUInt32("OperandsLength")
            };

            for (int i = 0; i < result.NumOperands; i++)
            {
                result.Operands.Add(DebugOperand.Parse(reader, OpcodeType.CustomData));
            }

            result.Format = reader.ReadString("Format");

            // String is padded to a multiple of DWORDs.
            uint remainingBytes = (4 - ((result.NumCharacters + 1) % 4)) % 4;

            reader.ReadBytes("StringPadding", (int)remainingBytes);

            return(result);
        }
コード例 #3
0
        public static DebugCustomDataToken Parse(DebugBytecodeReader reader, uint token0)
        {
            DebugOpcodeHeader.AddNotes(reader, token0);
            var customDataClass = token0.DecodeValue <CustomDataClass>(11, 31);
            var member          = reader.LocalMembers.Last();
            DebugCustomDataToken token;

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

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

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

            token.CustomDataClass = customDataClass;
            member.AddNote("CustomDataClass", customDataClass);
            return(token);
        }
コード例 #4
0
        public static DebugFunctionBodyDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugFunctionBodyDeclarationToken
            {
                Identifier = reader.ReadUInt32("Identifier")
            });
        }
コード例 #5
0
        public static DebugTempRegisterDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugTempRegisterDeclarationToken
            {
                TempCount = reader.ReadUInt32("TempCount")
            });
        }
コード例 #6
0
        public static DebugGeometryShaderMaxOutputVertexCountDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugGeometryShaderMaxOutputVertexCountDeclarationToken
            {
                MaxPrimitives = reader.ReadUInt32("MaxPrimitives")
            });
        }
        public static DebugControlPointCountDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugControlPointCountDeclarationToken
            {
                ControlPointCount = reader.ReadUInt32("ControlPointCount")
            });
        }
        public static DebugHullShaderMaxTessFactorDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugHullShaderMaxTessFactorDeclarationToken
            {
                MaxTessFactor = reader.ReadSingle("MaxTessFactor")
            });
        }
        public static DebugGeometryShaderInstanceCountDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugGeometryShaderInstanceCountDeclarationToken
            {
                InstanceCount = reader.ReadUInt32("InstanceCount")
            });
        }
        public static DebugGeometryShaderOutputPrimitiveTopologyDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("PriomitiveTopology", token0.DecodeValue <PrimitiveTopology>(11, 17));
            return(new DebugGeometryShaderOutputPrimitiveTopologyDeclarationToken
            {
                PrimitiveTopology = token0.DecodeValue <PrimitiveTopology>(11, 17)
            });
        }
コード例 #11
0
        public static DebugStreamDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("OpcodeType", token0.DecodeValue <OpcodeType>(0, 10));
            return(new DebugStreamDeclarationToken
            {
                Operand = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10))
            });
        }
コード例 #12
0
        public static DebugGlobalFlagsDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var result = new DebugGlobalFlagsDeclarationToken();

            result.Flags = token0.DecodeValue <GlobalFlags>(11, 18);
            reader.AddNote("Flags", result.Flags);
            return(result);
        }
        public static DebugGeometryShaderInputPrimitiveDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("Primitive", token0.DecodeValue <Primitive>(11, 16));
            return(new DebugGeometryShaderInputPrimitiveDeclarationToken
            {
                Primitive = token0.DecodeValue <Primitive>(11, 16)
            });
        }
コード例 #14
0
        public static DebugTessellatorPartitioningDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("Partitioning", token0.DecodeValue <TessellatorPartitioning>(11, 13));
            return(new DebugTessellatorPartitioningDeclarationToken
            {
                Partitioning = token0.DecodeValue <TessellatorPartitioning>(11, 13)
            });
        }
        public static DebugTessellatorOutputPrimitiveDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("OutputPrimitive", token0.DecodeValue <TessellatorOutputPrimitive>(11, 13));
            return(new DebugTessellatorOutputPrimitiveDeclarationToken
            {
                OutputPrimitive = token0.DecodeValue <TessellatorOutputPrimitive>(11, 13)
            });
        }
        public static DebugTessellatorDomainDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("Domain", token0.DecodeValue <TessellatorDomain>(11, 12));
            return(new DebugTessellatorDomainDeclarationToken
            {
                Domain = token0.DecodeValue <TessellatorDomain>(11, 12)
            });
        }
コード例 #17
0
        public static DebugIndexableTempRegisterDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            return(new DebugIndexableTempRegisterDeclarationToken
            {
                RegisterIndex = reader.ReadUInt32("RegisterIndex"),
                RegisterCount = reader.ReadUInt32("RegisterCount"),
                NumComponents = reader.ReadUInt32("NumComponents")
            });
        }
コード例 #18
0
        public static DebugThreadGroupDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var result = new DebugThreadGroupDeclarationToken();

            result.Dimensions[0] = reader.ReadUInt32("Dimensions[0]");
            result.Dimensions[1] = reader.ReadUInt32("Dimensions[1]");
            result.Dimensions[2] = reader.ReadUInt32("Dimensions[2]");

            return(result);
        }
        public static DebugStructuredThreadGroupSharedMemoryDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);

            return(new DebugStructuredThreadGroupSharedMemoryDeclarationToken
            {
                Operand = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10)),
                StructByteStride = reader.ReadUInt32("StructByteStride"),
                StructCount = reader.ReadUInt32("StructCount")
            });
        }
コード例 #20
0
        public static DebugIndexingRangeDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var operand       = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10));
            var registerCount = reader.ReadUInt32("RegisterCount");

            return(new DebugIndexingRangeDeclarationToken
            {
                Operand = operand,
                RegisterCount = registerCount
            });
        }
コード例 #21
0
        public static DebugRawThreadGroupSharedMemoryDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("OpcodeType", token0.DecodeValue <OpcodeType>(0, 10));

            var result = new DebugRawThreadGroupSharedMemoryDeclarationToken
            {
                Operand      = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10)),
                ElementCount = reader.ReadUInt32("ElementCount")
            };

            return(result);
        }
コード例 #22
0
        public static DebugRawShaderResourceViewDeclarationToken Parse(DebugBytecodeReader reader, DebugShaderVersion version)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var result = new DebugRawShaderResourceViewDeclarationToken
            {
                Operand = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10))
            };

            if (version.IsSM51)
            {
                result.SpaceIndex = reader.ReadUInt32("SpaceIndex");
            }
            return(result);
        }
コード例 #23
0
        public static DebugInputRegisterDeclarationToken Parse(DebugBytecodeReader reader)
        {
            uint token0     = reader.ReadUInt32("token0");
            var  opcodeType = token0.DecodeValue <OpcodeType>(0, 10);

            DebugOpcodeHeader.AddNotes(reader, token0);

            DebugInputRegisterDeclarationToken result;

            switch (opcodeType)
            {
            case OpcodeType.DclInput:
            case OpcodeType.DclInputSgv:
            case OpcodeType.DclInputSiv:
                result = new DebugInputRegisterDeclarationToken();
                break;

            case OpcodeType.DclInputPs:
            case OpcodeType.DclInputPsSgv:
            case OpcodeType.DclInputPsSiv:
                result = new DebugPixelShaderInputRegisterDeclarationToken
                {
                    InterpolationMode = token0.DecodeValue <InterpolationMode>(11, 14)
                };
                reader.AddNote("InterpolationMode", token0.DecodeValue <InterpolationMode>(11, 14));
                break;

            default:
                throw new ParseException("Unrecognised opcode type: " + opcodeType);
            }

            result.Operand = DebugOperand.Parse(reader, opcodeType);

            switch (opcodeType)
            {
            case OpcodeType.DclInputSgv:
            case OpcodeType.DclInputSiv:
            case OpcodeType.DclInputPsSgv:
            case OpcodeType.DclInputPsSiv:
                result.SystemValueName = DebugNameToken.Parse(reader);
                break;
            }

            return(result);
        }
コード例 #24
0
        public static DebugConstantBufferDeclarationToken Parse(DebugBytecodeReader reader, DebugShaderVersion version)
        {
            var token0 = reader.ReadUInt32("Token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("AccessPattern", token0.DecodeValue <ConstantBufferAccessPattern>(11, 11));
            var result = new DebugConstantBufferDeclarationToken
            {
                AccessPattern = token0.DecodeValue <ConstantBufferAccessPattern>(11, 11),
                Operand       = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10))
            };

            if (version.IsSM51)
            {
                result.m_ConstantBufferSize = reader.ReadUInt32("SM51_ConstantBufferSize");
                result.SpaceIndex           = reader.ReadUInt32("SpaceIndex");
            }
            return(result);
        }
コード例 #25
0
        public static DebugSamplerDeclarationToken Parse(DebugBytecodeReader reader, DebugShaderVersion version)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("SamplerMode", token0.DecodeValue <SamplerMode>(11, 14));
            var operand = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10));
            var result  = new DebugSamplerDeclarationToken
            {
                SamplerMode = token0.DecodeValue <SamplerMode>(11, 14),
                Operand     = operand
            };

            if (version.IsSM51)
            {
                result.SpaceIndex = reader.ReadUInt32("SpaceIndex");
            }
            return(result);
        }
コード例 #26
0
        public static DebugFunctionTableDeclarationToken Parse(DebugBytecodeReader reader)
        {
            uint token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var result = new DebugFunctionTableDeclarationToken
            {
                Identifier = reader.ReadUInt32("Identifier")
            };

            uint tableLength = reader.ReadUInt32("tableLength");

            for (int i = 0; i < tableLength; i++)
            {
                result.FunctionBodyIndices.Add(reader.ReadUInt32($"FunctionBodyIndices[{i}]"));
            }

            return(result);
        }
コード例 #27
0
        public static DebugImmediateConstantBufferDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("Token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var length = reader.ReadUInt32("Length") - 2;

            var result = new DebugImmediateConstantBufferDeclarationToken
            {
                DeclarationLength = length,
                Data = new DebugNumber[length]
            };

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

            return(result);
        }
コード例 #28
0
        public static DebugResourceDeclarationToken Parse(DebugBytecodeReader reader, DebugShaderVersion version)
        {
            var token0 = reader.ReadUInt32("token0");

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

            reader.AddNote("resourceDimension", resourceDimension);

            byte sampleCount;

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

            default:
                sampleCount = 0;
                break;
            }

            var operand    = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10));
            var returnType = DebugResourceReturnTypeToken.Parse(reader);
            var result     = new DebugResourceDeclarationToken
            {
                ResourceDimension = resourceDimension,
                SampleCount       = sampleCount,
                Operand           = operand,
                ReturnType        = returnType
            };

            if (version.IsSM51)
            {
                result.SpaceIndex = reader.ReadUInt32("SpaceIndex");
            }
            return(result);
        }
コード例 #29
0
        public static DebugRawUnorderedAccessViewDeclarationToken Parse(DebugBytecodeReader reader, DebugShaderVersion version)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            reader.AddNote("Coherency", token0.DecodeValue <UnorderedAccessViewCoherency>(16, 16));
            reader.AddNote("IsRasterOrderedAccess", token0.DecodeValue <bool>(17, 17));
            reader.AddNote("OpcodeType", token0.DecodeValue <OpcodeType>(0, 10));

            var result = new DebugRawUnorderedAccessViewDeclarationToken
            {
                Coherency             = token0.DecodeValue <UnorderedAccessViewCoherency>(16, 16),
                IsRasterOrderedAccess = token0.DecodeValue <bool>(17, 17),
                Operand = DebugOperand.Parse(reader, token0.DecodeValue <OpcodeType>(0, 10))
            };

            if (version.IsSM51)
            {
                result.SpaceIndex = reader.ReadUInt32("SpaceIndex");
            }
            return(result);
        }
コード例 #30
0
        public static DebugOutputRegisterDeclarationToken Parse(DebugBytecodeReader reader)
        {
            uint token0     = reader.ReadUInt32("token0");
            var  opcodeType = token0.DecodeValue <OpcodeType>(0, 10);

            DebugOpcodeHeader.AddNotes(reader, token0);

            var result = new DebugOutputRegisterDeclarationToken
            {
                Operand = DebugOperand.Parse(reader, opcodeType)
            };

            switch (opcodeType)
            {
            case OpcodeType.DclOutputSgv:
            case OpcodeType.DclOutputSiv:
                result.SystemValueName = DebugNameToken.Parse(reader);
                break;
            }

            return(result);
        }