Stub out PSV structures for external access

* We move some commonly used enums to more general spots for ease of use in the
  encoded data.
This commit is contained in:
baldurk
2024-08-16 14:34:51 +01:00
parent 8cb615e217
commit b82ee6ac14
12 changed files with 419 additions and 166 deletions
@@ -577,7 +577,7 @@ D3D_PRIMITIVE_TOPOLOGY Program::GetOutputTopology()
return decl.geomOutputTopology;
if(decl.declaration == DXBCBytecode::OPCODE_DCL_TESS_DOMAIN)
{
if(decl.tessDomain == DXBCBytecode::DOMAIN_ISOLINE)
if(decl.tessDomain == DXBC::TessellatorDomain::DOMAIN_ISOLINE)
return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
else
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+5 -95
View File
@@ -540,96 +540,6 @@ enum CBufferAccessPattern
NUM_PATTERNS,
};
enum TessellatorDomain
{
DOMAIN_UNDEFINED = 0,
DOMAIN_ISOLINE,
DOMAIN_TRI,
DOMAIN_QUAD,
NUM_DOMAINS,
};
enum TessellatorPartitioning
{
PARTITIONING_UNDEFINED = 0,
PARTITIONING_INTEGER,
PARTITIONING_POW2,
PARTITIONING_FRACTIONAL_ODD,
PARTITIONING_FRACTIONAL_EVEN,
NUM_PARTITIONINGS,
};
enum TessellatorOutputPrimitive
{
OUTPUT_PRIMITIVE_UNDEFINED = 0,
OUTPUT_PRIMITIVE_POINT,
OUTPUT_PRIMITIVE_LINE,
OUTPUT_PRIMITIVE_TRIANGLE_CW,
OUTPUT_PRIMITIVE_TRIANGLE_CCW,
NUM_OUTPUT_PRIMITIVES,
};
enum InterpolationMode
{
INTERPOLATION_UNDEFINED = 0,
INTERPOLATION_CONSTANT,
INTERPOLATION_LINEAR,
INTERPOLATION_LINEAR_CENTROID,
INTERPOLATION_LINEAR_NOPERSPECTIVE,
INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID,
INTERPOLATION_LINEAR_SAMPLE,
INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE,
NUM_INTERPOLATIONS,
};
enum PrimitiveType
{
PRIMITIVE_UNDEFINED = 0,
PRIMITIVE_POINT,
PRIMITIVE_LINE,
PRIMITIVE_TRIANGLE,
PRIMITIVE_LINE_ADJ,
PRIMITIVE_TRIANGLE_ADJ,
PRIMITIVE_1_CONTROL_POINT_PATCH,
PRIMITIVE_2_CONTROL_POINT_PATCH,
PRIMITIVE_3_CONTROL_POINT_PATCH,
PRIMITIVE_4_CONTROL_POINT_PATCH,
PRIMITIVE_5_CONTROL_POINT_PATCH,
PRIMITIVE_6_CONTROL_POINT_PATCH,
PRIMITIVE_7_CONTROL_POINT_PATCH,
PRIMITIVE_8_CONTROL_POINT_PATCH,
PRIMITIVE_9_CONTROL_POINT_PATCH,
PRIMITIVE_10_CONTROL_POINT_PATCH,
PRIMITIVE_11_CONTROL_POINT_PATCH,
PRIMITIVE_12_CONTROL_POINT_PATCH,
PRIMITIVE_13_CONTROL_POINT_PATCH,
PRIMITIVE_14_CONTROL_POINT_PATCH,
PRIMITIVE_15_CONTROL_POINT_PATCH,
PRIMITIVE_16_CONTROL_POINT_PATCH,
PRIMITIVE_17_CONTROL_POINT_PATCH,
PRIMITIVE_18_CONTROL_POINT_PATCH,
PRIMITIVE_19_CONTROL_POINT_PATCH,
PRIMITIVE_20_CONTROL_POINT_PATCH,
PRIMITIVE_21_CONTROL_POINT_PATCH,
PRIMITIVE_22_CONTROL_POINT_PATCH,
PRIMITIVE_23_CONTROL_POINT_PATCH,
PRIMITIVE_24_CONTROL_POINT_PATCH,
PRIMITIVE_25_CONTROL_POINT_PATCH,
PRIMITIVE_26_CONTROL_POINT_PATCH,
PRIMITIVE_27_CONTROL_POINT_PATCH,
PRIMITIVE_28_CONTROL_POINT_PATCH,
PRIMITIVE_29_CONTROL_POINT_PATCH,
PRIMITIVE_30_CONTROL_POINT_PATCH,
PRIMITIVE_31_CONTROL_POINT_PATCH,
PRIMITIVE_32_CONTROL_POINT_PATCH,
NUM_PRIMITIVES,
};
enum SemanticName
{
SEMANTIC_UNDEFINED = 0,
@@ -1068,7 +978,7 @@ struct Declaration
struct
{
// only used for PS inputs
InterpolationMode inputInterpolation;
DXBC::InterpolationMode inputInterpolation;
DXBC::SVSemantic systemValue;
} inputOutput;
@@ -1079,19 +989,19 @@ struct Declaration
SamplerMode samplerMode;
// OPCODE_DCL_TESS_DOMAIN
TessellatorDomain tessDomain;
DXBC::TessellatorDomain tessDomain;
// OPCODE_DCL_INPUT_CONTROL_POINT_COUNT
uint32_t controlPointCount;
// OPCODE_DCL_TESS_PARTITIONING
TessellatorPartitioning tessPartition;
DXBC::TessellatorPartitioning tessPartition;
// OPCODE_DCL_TESS_OUTPUT_PRIMITIVE
TessellatorOutputPrimitive tessOutputPrimitive;
DXBC::TessellatorOutputPrimitive tessOutputPrimitive;
// OPCODE_DCL_GS_INPUT_PRIMITIVE
PrimitiveType geomInputPrimitive;
DXBC::PrimitiveType geomInputPrimitive;
// OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY
D3D_PRIMITIVE_TOPOLOGY geomOutputTopology;
@@ -2218,11 +2218,11 @@ bool Program::DecodeDecl(uint32_t *&tokenStream, Declaration &retDecl, bool frie
retDecl.tessDomain = Decl::TessDomain.Get(OpcodeToken0);
retDecl.str += " ";
if(retDecl.tessDomain == DOMAIN_ISOLINE)
if(retDecl.tessDomain == DXBC::TessellatorDomain::DOMAIN_ISOLINE)
retDecl.str += "domain_isoline";
else if(retDecl.tessDomain == DOMAIN_TRI)
else if(retDecl.tessDomain == DXBC::TessellatorDomain::DOMAIN_TRI)
retDecl.str += "domain_tri";
else if(retDecl.tessDomain == DOMAIN_QUAD)
else if(retDecl.tessDomain == DXBC::TessellatorDomain::DOMAIN_QUAD)
retDecl.str += "domain_quad";
else
RDCERR("Unexpected Tessellation domain");
@@ -2232,13 +2232,13 @@ bool Program::DecodeDecl(uint32_t *&tokenStream, Declaration &retDecl, bool frie
retDecl.tessPartition = Decl::TessPartitioning.Get(OpcodeToken0);
retDecl.str += " ";
if(retDecl.tessPartition == PARTITIONING_INTEGER)
if(retDecl.tessPartition == DXBC::PARTITIONING_INTEGER)
retDecl.str += "partitioning_integer";
else if(retDecl.tessPartition == PARTITIONING_POW2)
else if(retDecl.tessPartition == DXBC::PARTITIONING_POW2)
retDecl.str += "partitioning_pow2";
else if(retDecl.tessPartition == PARTITIONING_FRACTIONAL_ODD)
else if(retDecl.tessPartition == DXBC::PARTITIONING_FRACTIONAL_ODD)
retDecl.str += "partitioning_fractional_odd";
else if(retDecl.tessPartition == PARTITIONING_FRACTIONAL_EVEN)
else if(retDecl.tessPartition == DXBC::PARTITIONING_FRACTIONAL_EVEN)
retDecl.str += "partitioning_fractional_even";
else
RDCERR("Unexpected Partitioning");
@@ -2248,22 +2248,22 @@ bool Program::DecodeDecl(uint32_t *&tokenStream, Declaration &retDecl, bool frie
retDecl.geomInputPrimitive = Decl::InputPrimitive.Get(OpcodeToken0);
retDecl.str += " ";
if(retDecl.geomInputPrimitive == PRIMITIVE_POINT)
if(retDecl.geomInputPrimitive == DXBC::PRIMITIVE_POINT)
retDecl.str += "point";
else if(retDecl.geomInputPrimitive == PRIMITIVE_LINE)
else if(retDecl.geomInputPrimitive == DXBC::PRIMITIVE_LINE)
retDecl.str += "line";
else if(retDecl.geomInputPrimitive == PRIMITIVE_TRIANGLE)
else if(retDecl.geomInputPrimitive == DXBC::PRIMITIVE_TRIANGLE)
retDecl.str += "triangle";
else if(retDecl.geomInputPrimitive == PRIMITIVE_LINE_ADJ)
else if(retDecl.geomInputPrimitive == DXBC::PRIMITIVE_LINE_ADJ)
retDecl.str += "line_adj";
else if(retDecl.geomInputPrimitive == PRIMITIVE_TRIANGLE_ADJ)
else if(retDecl.geomInputPrimitive == DXBC::PRIMITIVE_TRIANGLE_ADJ)
retDecl.str += "triangle_adj";
else if(retDecl.geomInputPrimitive >= PRIMITIVE_1_CONTROL_POINT_PATCH &&
retDecl.geomInputPrimitive <= PRIMITIVE_32_CONTROL_POINT_PATCH)
else if(retDecl.geomInputPrimitive >= DXBC::PRIMITIVE_1_CONTROL_POINT_PATCH &&
retDecl.geomInputPrimitive <= DXBC::PRIMITIVE_32_CONTROL_POINT_PATCH)
{
retDecl.str +=
StringFormat::Fmt("control_point_patch_%u",
1 + int(retDecl.geomInputPrimitive - PRIMITIVE_1_CONTROL_POINT_PATCH));
retDecl.str += StringFormat::Fmt(
"control_point_patch_%u",
1 + int(retDecl.geomInputPrimitive - DXBC::PRIMITIVE_1_CONTROL_POINT_PATCH));
}
else
RDCERR("Unexpected primitive type");
@@ -2299,13 +2299,13 @@ bool Program::DecodeDecl(uint32_t *&tokenStream, Declaration &retDecl, bool frie
retDecl.tessOutputPrimitive = Decl::OutputPrimitive.Get(OpcodeToken0);
retDecl.str += " ";
if(retDecl.tessOutputPrimitive == OUTPUT_PRIMITIVE_POINT)
if(retDecl.tessOutputPrimitive == DXBC::OUTPUT_PRIMITIVE_POINT)
retDecl.str += "output_point";
else if(retDecl.tessOutputPrimitive == OUTPUT_PRIMITIVE_LINE)
else if(retDecl.tessOutputPrimitive == DXBC::OUTPUT_PRIMITIVE_LINE)
retDecl.str += "output_line";
else if(retDecl.tessOutputPrimitive == OUTPUT_PRIMITIVE_TRIANGLE_CW)
else if(retDecl.tessOutputPrimitive == DXBC::OUTPUT_PRIMITIVE_TRIANGLE_CW)
retDecl.str += "output_triangle_cw";
else if(retDecl.tessOutputPrimitive == OUTPUT_PRIMITIVE_TRIANGLE_CCW)
else if(retDecl.tessOutputPrimitive == DXBC::OUTPUT_PRIMITIVE_TRIANGLE_CCW)
retDecl.str += "output_triangle_ccw";
else
RDCERR("Unexpected output primitive");
@@ -166,26 +166,26 @@ static MaskedElement<DXBC::ResourceRetType, 0x0000F000> ReturnTypeW;
// OPCODE_DCL_INPUT_PS
// OPCODE_DCL_INPUT_PS_SIV
static MaskedElement<InterpolationMode, 0x00007800> InterpolationMode;
static MaskedElement<DXBC::InterpolationMode, 0x00007800> InterpolationMode;
// OPCODE_DCL_INPUT_CONTROL_POINT_COUNT
// OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT
static MaskedElement<uint32_t, 0x0001F800> ControlPointCount;
// OPCODE_DCL_TESS_DOMAIN
static MaskedElement<TessellatorDomain, 0x00001800> TessDomain;
static MaskedElement<DXBC::TessellatorDomain, 0x00001800> TessDomain;
// OPCODE_DCL_TESS_PARTITIONING
static MaskedElement<TessellatorPartitioning, 0x00003800> TessPartitioning;
static MaskedElement<DXBC::TessellatorPartitioning, 0x00003800> TessPartitioning;
// OPCODE_DCL_GS_INPUT_PRIMITIVE
static MaskedElement<PrimitiveType, 0x0001F800> InputPrimitive;
static MaskedElement<DXBC::PrimitiveType, 0x0001F800> InputPrimitive;
// OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY
static MaskedElement<D3D_PRIMITIVE_TOPOLOGY, 0x0001F800> OutputPrimitiveTopology;
// OPCODE_DCL_TESS_OUTPUT_PRIMITIVE
static MaskedElement<TessellatorOutputPrimitive, 0x00003800> OutputPrimitive;
static MaskedElement<DXBC::TessellatorOutputPrimitive, 0x00003800> OutputPrimitive;
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED
static MaskedElement<bool, 0x00010000> GloballyCoherent;
+93 -2
View File
@@ -56,7 +56,7 @@ struct CountOffset
};
// matches D3D11_SHADER_VERSION_TYPE from d3d11shader.h
enum class ShaderType : uint32_t
enum class ShaderType : uint8_t
{
// D3D10 Shaders
Pixel = 0,
@@ -106,7 +106,7 @@ enum ResourceRetType : uint8_t
NUM_RETURN_TYPES,
};
enum SigCompType
enum class SigCompType : uint8_t
{
COMPONENT_TYPE_UNKNOWN = 0,
COMPONENT_TYPE_UINT32,
@@ -122,6 +122,20 @@ enum SigCompType
NUM_COMP_TYPES,
};
enum class InterpolationMode : uint8_t
{
INTERPOLATION_UNDEFINED = 0,
INTERPOLATION_CONSTANT,
INTERPOLATION_LINEAR,
INTERPOLATION_LINEAR_CENTROID,
INTERPOLATION_LINEAR_NOPERSPECTIVE,
INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID,
INTERPOLATION_LINEAR_SAMPLE,
INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE,
NUM_INTERPOLATIONS,
};
enum SVSemantic
{
SVNAME_UNDEFINED = 0,
@@ -238,6 +252,83 @@ enum VariableType
VARTYPE_UINT64,
};
enum class TessellatorDomain : uint8_t
{
DOMAIN_UNDEFINED = 0,
DOMAIN_ISOLINE,
DOMAIN_TRI,
DOMAIN_QUAD,
NUM_DOMAINS,
};
enum TessellatorPartitioning
{
PARTITIONING_UNDEFINED = 0,
PARTITIONING_INTEGER,
PARTITIONING_POW2,
PARTITIONING_FRACTIONAL_ODD,
PARTITIONING_FRACTIONAL_EVEN,
NUM_PARTITIONINGS,
};
enum TessellatorOutputPrimitive
{
OUTPUT_PRIMITIVE_UNDEFINED = 0,
OUTPUT_PRIMITIVE_POINT,
OUTPUT_PRIMITIVE_LINE,
OUTPUT_PRIMITIVE_TRIANGLE_CW,
OUTPUT_PRIMITIVE_TRIANGLE_CCW,
NUM_OUTPUT_PRIMITIVES,
};
enum PrimitiveType
{
PRIMITIVE_UNDEFINED = 0,
PRIMITIVE_POINT,
PRIMITIVE_LINE,
PRIMITIVE_TRIANGLE,
// 4 and 5 are skipped
PRIMITIVE_LINE_ADJ = 6,
PRIMITIVE_TRIANGLE_ADJ,
PRIMITIVE_1_CONTROL_POINT_PATCH,
PRIMITIVE_2_CONTROL_POINT_PATCH,
PRIMITIVE_3_CONTROL_POINT_PATCH,
PRIMITIVE_4_CONTROL_POINT_PATCH,
PRIMITIVE_5_CONTROL_POINT_PATCH,
PRIMITIVE_6_CONTROL_POINT_PATCH,
PRIMITIVE_7_CONTROL_POINT_PATCH,
PRIMITIVE_8_CONTROL_POINT_PATCH,
PRIMITIVE_9_CONTROL_POINT_PATCH,
PRIMITIVE_10_CONTROL_POINT_PATCH,
PRIMITIVE_11_CONTROL_POINT_PATCH,
PRIMITIVE_12_CONTROL_POINT_PATCH,
PRIMITIVE_13_CONTROL_POINT_PATCH,
PRIMITIVE_14_CONTROL_POINT_PATCH,
PRIMITIVE_15_CONTROL_POINT_PATCH,
PRIMITIVE_16_CONTROL_POINT_PATCH,
PRIMITIVE_17_CONTROL_POINT_PATCH,
PRIMITIVE_18_CONTROL_POINT_PATCH,
PRIMITIVE_19_CONTROL_POINT_PATCH,
PRIMITIVE_20_CONTROL_POINT_PATCH,
PRIMITIVE_21_CONTROL_POINT_PATCH,
PRIMITIVE_22_CONTROL_POINT_PATCH,
PRIMITIVE_23_CONTROL_POINT_PATCH,
PRIMITIVE_24_CONTROL_POINT_PATCH,
PRIMITIVE_25_CONTROL_POINT_PATCH,
PRIMITIVE_26_CONTROL_POINT_PATCH,
PRIMITIVE_27_CONTROL_POINT_PATCH,
PRIMITIVE_28_CONTROL_POINT_PATCH,
PRIMITIVE_29_CONTROL_POINT_PATCH,
PRIMITIVE_30_CONTROL_POINT_PATCH,
PRIMITIVE_31_CONTROL_POINT_PATCH,
PRIMITIVE_32_CONTROL_POINT_PATCH,
NUM_PRIMITIVES,
};
struct ShaderInputBind
{
rdcstr name;
@@ -1949,23 +1949,23 @@ DXBCContainer::DXBCContainer(const bytebuf &ByteCode, const rdcstr &debugInfoPat
SigCompType compType = (SigCompType)el->componentType;
desc.varType = VarType::Float;
if(compType == COMPONENT_TYPE_UINT32)
if(compType == DXBC::SigCompType::COMPONENT_TYPE_UINT32)
desc.varType = VarType::UInt;
else if(compType == COMPONENT_TYPE_SINT32)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_SINT32)
desc.varType = VarType::SInt;
else if(compType == COMPONENT_TYPE_FLOAT32)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_FLOAT32)
desc.varType = VarType::Float;
else if(compType == COMPONENT_TYPE_UINT16)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_UINT16)
desc.varType = VarType::UShort;
else if(compType == COMPONENT_TYPE_SINT16)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_SINT16)
desc.varType = VarType::SShort;
else if(compType == COMPONENT_TYPE_FLOAT16)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_FLOAT16)
desc.varType = VarType::Half;
else if(compType == COMPONENT_TYPE_UINT64)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_UINT64)
desc.varType = VarType::ULong;
else if(compType == COMPONENT_TYPE_SINT64)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_SINT64)
desc.varType = VarType::SLong;
else if(compType == COMPONENT_TYPE_FLOAT64)
else if(compType == DXBC::SigCompType::COMPONENT_TYPE_FLOAT64)
desc.varType = VarType::Double;
desc.regChannelMask = (uint8_t)(el->mask & 0xff);
+10 -12
View File
@@ -4730,12 +4730,12 @@ void LookupSRVFormatFromShaderReflection(const DXBC::Reflection &reflection,
}
}
DXBCBytecode::InterpolationMode GetInterpolationModeForInputParam(const SigParameter &sig,
const DXBC::Reflection &psDxbc,
const DXBCBytecode::Program *program)
DXBC::InterpolationMode GetInterpolationModeForInputParam(const SigParameter &sig,
const DXBC::Reflection &psDxbc,
const DXBCBytecode::Program *program)
{
if(sig.varType == VarType::SInt || sig.varType == VarType::UInt)
return DXBCBytecode::InterpolationMode::INTERPOLATION_CONSTANT;
return DXBC::InterpolationMode::INTERPOLATION_CONSTANT;
if(sig.varType == VarType::Float)
{
@@ -4744,10 +4744,10 @@ DXBCBytecode::InterpolationMode GetInterpolationModeForInputParam(const SigParam
for(size_t j = 0; j < numInputs; j++)
{
if(sig.regIndex == psDxbc.InputSig[j].regIndex && psDxbc.InputSig[j].varType != VarType::Float)
return DXBCBytecode::InterpolationMode::INTERPOLATION_CONSTANT;
return DXBC::InterpolationMode::INTERPOLATION_CONSTANT;
}
DXBCBytecode::InterpolationMode interpolation = DXBCBytecode::INTERPOLATION_UNDEFINED;
DXBC::InterpolationMode interpolation = DXBC::InterpolationMode::INTERPOLATION_UNDEFINED;
if(program)
{
@@ -4768,7 +4768,7 @@ DXBCBytecode::InterpolationMode GetInterpolationModeForInputParam(const SigParam
}
RDCERR("Unexpected input signature type: %s", ToStr(sig.varType).c_str());
return DXBCBytecode::InterpolationMode::INTERPOLATION_UNDEFINED;
return DXBC::InterpolationMode::INTERPOLATION_UNDEFINED;
}
void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
@@ -4906,9 +4906,8 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
nextreg = sig.regIndex + 1;
DXBCBytecode::InterpolationMode interpolation =
GetInterpolationModeForInputParam(sig, psDxbc, program);
if(interpolation != DXBCBytecode::INTERPOLATION_UNDEFINED)
DXBC::InterpolationMode interpolation = GetInterpolationModeForInputParam(sig, psDxbc, program);
if(interpolation != DXBC::InterpolationMode::INTERPOLATION_UNDEFINED)
psInputDefinition += ToStr(interpolation) + " ";
psInputDefinition += ToStr(sig.varType);
@@ -4951,8 +4950,7 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
int jNumCols = (jSig.regChannelMask & 0x1 ? 1 : 0) + (jSig.regChannelMask & 0x2 ? 1 : 0) +
(jSig.regChannelMask & 0x4 ? 1 : 0) + (jSig.regChannelMask & 0x8 ? 1 : 0);
DXBCBytecode::InterpolationMode jInterp =
GetInterpolationModeForInputParam(jSig, psDxbc, program);
DXBC::InterpolationMode jInterp = GetInterpolationModeForInputParam(jSig, psDxbc, program);
// if it's the same size, type, and interpolation mode, then it could potentially be
// packed into an array. Check if it's using the first channel component to tell whether
@@ -434,9 +434,9 @@ rdcstr DoStringise(const DXBCBytecode::ResinfoRetType &el)
}
template <>
rdcstr DoStringise(const DXBCBytecode::InterpolationMode &el)
rdcstr DoStringise(const DXBC::InterpolationMode &el)
{
BEGIN_ENUM_STRINGISE(DXBCBytecode::InterpolationMode)
BEGIN_ENUM_STRINGISE(DXBC::InterpolationMode)
{
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_UNDEFINED, "undefined");
// differs slightly from fxc but it's very convenient to use the hlsl terms, which are used in
@@ -40,20 +40,6 @@ class BitcodeWriter;
namespace DXIL
{
enum class DXILResourceType
{
Unknown,
Sampler,
CBuffer,
TypedSRV,
ByteAddressSRV,
StructuredSRV,
TypedUAV,
ByteAddressUAV,
StructuredUAV,
StructuredUAVWithCounter,
};
enum class HandleKind
{
SRV = 0,
+53 -1
View File
@@ -26,7 +26,7 @@
namespace DXBC
{
enum class ShaderType : uint32_t;
enum class ShaderType : uint8_t;
enum class GlobalShaderFlags : int64_t;
};
@@ -89,6 +89,58 @@ enum class ResourceKind
SamplerComparison,
};
// different semantic enum
enum class SigSemantic : uint8_t
{
Undefined = 0,
VertexIndex,
InstanceIndex,
Position,
RTIndex,
ViewportIndex,
ClipDistance,
CullDistance,
OutputControlPointIndex,
DomainLocation,
PrimitiveIndex,
GSInstanceIndex,
MSAASampleIndex,
IsFrontFace,
MSAACoverage,
IsFullyCovered,
ColorOutput,
DepthOutput,
DepthOutputLessEqual,
DepthOutputGreaterEqual,
StencilReference,
DispatchThreadIndex,
GroupIndex,
GroupFlatIndex,
GroupThreadIndex,
OuterTessFactor,
InsideTessFactor,
MultiViewIndex,
Barycentrics,
PackedFragRate,
CullPrimitive,
BaseVertex,
BaseInstance,
};
enum class DXILResourceType : uint32_t
{
Unknown,
Sampler,
CBuffer,
TypedSRV,
ByteAddressSRV,
StructuredSRV,
TypedUAV,
ByteAddressUAV,
StructuredUAV,
StructuredUAVWithCounter,
};
enum class SamplerKind
{
Default = 0,
@@ -161,7 +161,11 @@ struct EncodedFunctionInfo
IndexReference unmangledName;
IndexReference globalResourcesIndexArrayRef;
IndexReference functionDependenciesArrayRef;
DXBC::ShaderType type;
union
{
DXBC::ShaderType type;
uint32_t type_padding_; // pad to 32-bit so the enum can be 8-bit
};
uint32_t payloadBytes;
uint32_t attribBytes;
// extremely annoyingly this is two 32-bit integers which is relevant since 64-bit alignment
@@ -267,6 +271,14 @@ namespace DXBC
{
bool DXBCContainer::GetPipelineValidation(DXIL::PSVData &psv) const
{
RDCCOMPILE_ASSERT(sizeof(DXIL::PSVData0) == DXIL::PSVData0::ExpectedSize,
"PSVData0 is not sized/packed correctly");
RDCCOMPILE_ASSERT(sizeof(DXIL::PSVData1) == DXIL::PSVData1::ExpectedSize,
"PSVData1 is not sized/packed correctly");
RDCCOMPILE_ASSERT(sizeof(DXIL::PSVData2) == DXIL::PSVData2::ExpectedSize,
"PSVData2 is not sized/packed correctly");
RDCCOMPILE_ASSERT(offsetof(DXIL::PSVData1, inputSigElems) == sizeof(DXIL::PSVData0) + 4, "!!!");
using namespace DXIL;
if(m_PSVOffset == 0)
+207 -3
View File
@@ -24,19 +24,222 @@
#pragma once
#include "driver/dx/official/d3dcommon.h"
#include "driver/shaders/dxbc/dxbc_common.h"
#include "dxil_common.h"
namespace DXBC
{
enum class ShaderType : uint32_t;
enum class ShaderType : uint8_t;
enum class GlobalShaderFlags : int64_t;
};
namespace DXIL
{
struct PSVData
struct PSVData0
{
struct VSInfo
{
bool SVPositionOutput;
};
struct HSInfo
{
uint32_t inputCPs;
uint32_t outputCPs;
DXBC::TessellatorDomain tessDomain;
DXBC::TessellatorOutputPrimitive outPrim;
};
struct DSInfo
{
uint32_t inputCPs;
bool SVPositionOutput;
DXBC::TessellatorDomain tessDomain;
};
struct GSInfo
{
DXBC::PrimitiveType inputPrim;
D3D_PRIMITIVE_TOPOLOGY outputTopo;
uint32_t outputStreams;
bool SVPositionOutput;
};
struct PSInfo
{
bool SVDepthOutput;
bool SampleRate;
};
struct ASInfo
{
uint32_t payloadBytes;
};
struct MSInfo
{
uint32_t groupsharedBytes;
uint32_t groupsharedViewIDDepBytes;
uint32_t payloadBytes;
uint16_t maxVerts;
uint16_t maxPrims;
};
union
{
VSInfo vs;
HSInfo hs;
DSInfo ds;
GSInfo gs;
PSInfo ps;
ASInfo as;
MSInfo ms;
};
uint32_t minWaveCount;
uint32_t maxWaveCount;
static const size_t ExpectedSize = sizeof(uint32_t) * 6;
};
struct PSVData1 : public PSVData0
{
static const uint32_t NumOutputStreams = 4;
DXBC::ShaderType shaderType;
bool useViewID;
union
{
struct
{
uint16_t maxVerts;
} gs1;
struct
{
uint8_t sigPatchConstVectors;
} hs, gs;
struct
{
uint8_t sigPrimVectors;
DXBC::TessellatorDomain topology;
} ms;
};
uint8_t inputSigElems;
uint8_t outputSigElems;
uint8_t patchConstPrimSigElems;
uint8_t inputSigVectors;
uint8_t outputSigVectors[NumOutputStreams]; // one per geometry stream
static const size_t ExpectedSize = sizeof(PSVData0) + sizeof(uint16_t) + 10 * sizeof(uint8_t);
};
struct PSVData2 : public PSVData1
{
uint32_t threadCount[3];
static const size_t ExpectedSize = sizeof(PSVData1) + 3 * sizeof(uint32_t);
};
struct PSVResource0
{
DXILResourceType type;
uint32_t space; // register space
uint32_t regStart; // start register (inclusive - for single register bind it's == reg)
uint32_t regEnd; // end register (inclusive - for single register bind it's == reg)
};
enum class PSVResourceFlags
{
None = 0x0,
Atomic64 = 0x1,
};
struct PSVResource1 : public PSVResource0
{
DXIL::ResourceKind kind;
PSVResourceFlags flags;
};
using PSVResource = PSVResource1;
struct PSVSignature0
{
rdcstr name;
rdcarray<uint32_t> semIndices;
uint8_t rows;
uint8_t firstRow;
uint8_t cols; // : 4
uint8_t startCol; // :2
uint8_t alloc; // :2
SigSemantic semantic;
DXBC::SigCompType compType;
DXBC::InterpolationMode interpMode;
uint8_t dynamicMask; // :4
uint8_t stream; // :2
uint8_t padding;
};
using PSVSignature = PSVSignature0;
inline const uint32_t VectorBitmaskBitSize(uint32_t numVectors)
{
return AlignUp(numVectors * 4, 64U);
}
struct PSVData : public PSVData2
{
enum class Version
{
Version0 = 0,
Version1,
Version2,
VersionLatest = Version2,
} version = Version::VersionLatest;
rdcarray<PSVResource> resources;
// stringtable
// semanticindexs
rdcarray<PSVSignature> inputSig;
rdcarray<PSVSignature> outputSig;
rdcarray<PSVSignature> patchConstPrimSig;
// in the tables below we assume no more than 64 dwords in any signature (16 vectors) so store
// bitmasks as 64-bit.
// if view ID is used, a bitmask per output stream, the bitmask containing one bit per dword as
// in PSVData1::outputSigVectors indicating if that output vector depends on view ID
struct
{
uint64_t outputMask;
uint64_t patchConstMask;
} viewIDAffects[PSVData1::NumOutputStreams];
// for each stream, a bitmask for each input vector with the bitmask containing which output
// vectors have a dependency on the input vector.
struct
{
rdcarray<uint64_t> dependentOutputsForInput;
} IODependencies[PSVData1::NumOutputStreams];
// same as above, but for patch constant outputs on inputs - HS only
struct
{
rdcarray<uint64_t> dependentPCOutputsForInput;
} PCOutDependencies;
// same as above, but for outputs on patch constant inputs - DS only
struct
{
rdcarray<uint64_t> dependentOutputsForPCInput;
} PCInDependencies;
};
struct RDATData
@@ -116,7 +319,7 @@ struct RDATData
uint16_t minType; // looks to always be equal to type above
};
struct FunctionInfo2 : FunctionInfo
struct FunctionInfo2 : public FunctionInfo
{
FunctionInfo2(FunctionInfo &info) : FunctionInfo(info)
{
@@ -233,5 +436,6 @@ struct RDATData
};
BITMASK_OPERATORS(DXIL::PSVResourceFlags);
BITMASK_OPERATORS(DXIL::RDATData::ResourceFlags);
BITMASK_OPERATORS(DXIL::RDATData::ShaderBehaviourFlags);