Reduce size of DXBC operation/declaration/operand structs

This commit is contained in:
baldurk committed 2021-07-09 16:27:45 +01:00
1 parent cb2d459eff
commit 161c16385a
11 files changed
+595 -522

No files matched your search

+5 -4
View File
@@ -77,9 +77,10 @@ public:
DXBCDebug::SampleGatherResourceData resourceData,
DXBCDebug::SampleGatherSamplerData samplerData, ShaderVariable uv,
ShaderVariable ddxCalc, ShaderVariable ddyCalc,
const int texelOffsets[3], int multisampleIndex, float lodOrCompareValue,
const uint8_t swizzle[4], DXBCDebug::GatherChannel gatherChannel,
const char *opString, ShaderVariable &output);
const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4],
DXBCDebug::GatherChannel gatherChannel, const char *opString,
ShaderVariable &output);
private:
DXBC::ShaderType GetShaderType() { return m_dxbc ? m_dxbc->m_Type : DXBC::ShaderType::Pixel; }
@@ -991,7 +992,7 @@ ShaderVariable D3D11DebugAPIWrapper::GetResourceInfo(DXBCBytecode::OperandType t
bool D3D11DebugAPIWrapper::CalculateSampleGather(
DXBCBytecode::OpcodeType opcode, DXBCDebug::SampleGatherResourceData resourceData,
DXBCDebug::SampleGatherSamplerData samplerData, ShaderVariable uv, ShaderVariable ddxCalc,
ShaderVariable ddyCalc, const int texelOffsets[3], int multisampleIndex,
ShaderVariable ddyCalc, const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4], DXBCDebug::GatherChannel gatherChannel,
const char *opString, ShaderVariable &output)
{
+5 -4
View File
@@ -88,9 +88,10 @@ public:
DXBCDebug::SampleGatherResourceData resourceData,
DXBCDebug::SampleGatherSamplerData samplerData, ShaderVariable uv,
ShaderVariable ddxCalc, ShaderVariable ddyCalc,
const int texelOffsets[3], int multisampleIndex, float lodOrCompareValue,
const uint8_t swizzle[4], DXBCDebug::GatherChannel gatherChannel,
const char *opString, ShaderVariable &output);
const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4],
DXBCDebug::GatherChannel gatherChannel, const char *opString,
ShaderVariable &output);
private:
DXBC::ShaderType GetShaderType() { return m_dxbc ? m_dxbc->m_Type : DXBC::ShaderType::Pixel; }
@@ -1101,7 +1102,7 @@ ShaderVariable D3D12DebugAPIWrapper::GetResourceInfo(DXBCBytecode::OperandType t
bool D3D12DebugAPIWrapper::CalculateSampleGather(
DXBCBytecode::OpcodeType opcode, DXBCDebug::SampleGatherResourceData resourceData,
DXBCDebug::SampleGatherSamplerData samplerData, ShaderVariable uv, ShaderVariable ddxCalc,
ShaderVariable ddyCalc, const int texelOffsets[3], int multisampleIndex,
ShaderVariable ddyCalc, const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4], DXBCDebug::GatherChannel gatherChannel,
const char *opString, ShaderVariable &output)
{
+2 -2
View File
@@ -59,9 +59,8 @@ enum class NvShaderSpecial
FootprintSingleLOD = 5,
};
enum class NvShaderAtomic
enum class NvShaderAtomic : uint8_t
{
Unknown = -1,
And = 0,
Or = 1,
Xor = 2,
@@ -70,6 +69,7 @@ enum class NvShaderAtomic
Min = 7,
Swap = 8,
CompareAndSwap = 9,
Unknown = 255,
};
struct D3D12_GRAPHICS_PIPELINE_STATE_DESC;
+12 -11
View File
@@ -97,7 +97,7 @@ bool Program::UsesExtensionUAV(uint32_t slot, uint32_t space, const byte *bytes,
// nvidia is a structured buffer with counter
// AMD is a RW byte address buffer
if((op == OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED &&
Opcode::HasOrderPreservingCounter.Get(OpcodeToken0)) ||
Decl::HasOrderPreservingCounter.Get(OpcodeToken0)) ||
op == OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW)
{
uint32_t *tokenStream = cur;
@@ -235,9 +235,9 @@ DXBC::Reflection *Program::GuessReflection()
desc.space = dcl.space;
desc.reg = idx;
desc.bindCount = 1;
desc.retType = dcl.resType[0];
desc.retType = dcl.resource.resType[0];
switch(dcl.dim)
switch(dcl.resource.dim)
{
case RESOURCE_DIMENSION_BUFFER: desc.dimension = DXBC::ShaderInputBind::DIM_BUFFER; break;
case RESOURCE_DIMENSION_TEXTURE1D:
@@ -330,7 +330,7 @@ DXBC::Reflection *Program::GuessReflection()
desc.bindCount = 1;
desc.retType = DXBC::RETURN_TYPE_MIXED;
desc.dimension = DXBC::ShaderInputBind::DIM_BUFFER;
desc.numComps = dcl.stride;
desc.numComps = dcl.structured.stride;
HandleResourceArrayIndices(dcl.operand.indices, desc);
@@ -353,14 +353,14 @@ DXBC::Reflection *Program::GuessReflection()
DXBC::ShaderInputBind::TYPE_UAV_RWSTRUCTURED; // doesn't seem to be anything that
// determines append vs consume vs
// rwstructured
if(dcl.hasCounter)
if(dcl.structured.hasCounter)
desc.type = DXBC::ShaderInputBind::TYPE_UAV_RWSTRUCTURED_WITH_COUNTER;
desc.space = dcl.space;
desc.reg = idx;
desc.bindCount = 1;
desc.retType = DXBC::RETURN_TYPE_MIXED;
desc.dimension = DXBC::ShaderInputBind::DIM_BUFFER;
desc.numComps = dcl.stride;
desc.numComps = dcl.structured.stride;
HandleResourceArrayIndices(dcl.operand.indices, desc);
@@ -383,9 +383,9 @@ DXBC::Reflection *Program::GuessReflection()
desc.space = dcl.space;
desc.reg = idx;
desc.bindCount = 1;
desc.retType = dcl.resType[0];
desc.retType = dcl.uav_typed.resType[0];
switch(dcl.dim)
switch(dcl.uav_typed.dim)
{
case RESOURCE_DIMENSION_BUFFER: desc.dimension = DXBC::ShaderInputBind::DIM_BUFFER; break;
case RESOURCE_DIMENSION_TEXTURE1D:
@@ -440,7 +440,8 @@ DXBC::Reflection *Program::GuessReflection()
bool isShaderModel51 = IsShaderModel51();
uint32_t idx = (uint32_t)dcl.operand.indices[0].index;
uint32_t reg = isShaderModel51 ? (uint32_t)dcl.operand.indices[1].index : idx;
uint32_t numVecs = isShaderModel51 ? dcl.float4size : (uint32_t)dcl.operand.indices[1].index;
uint32_t numVecs =
isShaderModel51 ? dcl.cbufferVectorSize : (uint32_t)dcl.operand.indices[1].index;
desc.name = StringFormat::Fmt("cbuffer%u", idx);
desc.type = DXBC::ShaderInputBind::TYPE_CBUFFER;
@@ -560,10 +561,10 @@ D3D_PRIMITIVE_TOPOLOGY Program::GetOutputTopology()
for(const DXBCBytecode::Declaration &decl : m_Declarations)
{
if(decl.declaration == DXBCBytecode::OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY)
return decl.outTopology;
return decl.geomOutputTopology;
if(decl.declaration == DXBCBytecode::OPCODE_DCL_TESS_DOMAIN)
{
if(decl.domain == DXBCBytecode::DOMAIN_ISOLINE)
if(decl.tessDomain == DXBCBytecode::DOMAIN_ISOLINE)
return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
else
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+172 -157
View File
@@ -390,7 +390,7 @@ enum CustomDataClass
NUM_CUSTOMDATA_CLASSES,
};
enum ResinfoRetType
enum ResinfoRetType : uint8_t
{
RETTYPE_FLOAT = 0,
RETTYPE_RCPFLOAT,
@@ -409,7 +409,7 @@ enum ExtendedOpcodeType
NUM_EXTENDED_TYPES,
};
enum NumOperandComponents
enum NumOperandComponents : uint8_t
{
NUMCOMPS_0 = 0,
NUMCOMPS_1,
@@ -426,7 +426,7 @@ enum SelectionMode
SELECTION_SELECT_1,
};
enum OperandType
enum OperandType : uint8_t
{
TYPE_TEMP = 0,
TYPE_INPUT,
@@ -499,7 +499,7 @@ enum ExtendedOperandType
NUM_EXTENDED_OPERAND_TYPES,
};
enum OperandModifier
enum OperandModifier : uint8_t
{
OPERAND_MODIFIER_NONE = 0,
OPERAND_MODIFIER_NEG,
@@ -509,7 +509,7 @@ enum OperandModifier
NUM_MODIFIERS,
};
enum MinimumPrecision
enum MinimumPrecision : uint8_t
{
PRECISION_DEFAULT,
PRECISION_FLOAT16,
@@ -659,7 +659,7 @@ enum SemanticName
NUM_SEMANTICS,
};
enum ResourceDimension
enum ResourceDimension : uint8_t
{
RESOURCE_DIMENSION_UNKNOWN = 0,
RESOURCE_DIMENSION_BUFFER,
@@ -678,7 +678,7 @@ enum ResourceDimension
NUM_DIMENSIONS,
};
enum VendorAtomicOp
enum VendorAtomicOp : uint8_t
{
ATOMIC_OP_NONE = 0,
ATOMIC_OP_AND,
@@ -744,9 +744,8 @@ struct Operand
numComponents = MAX_COMPONENTS;
comps[0] = comps[1] = comps[2] = comps[3] = 0xff;
values[0] = values[1] = values[2] = values[3] = 0;
modifier = OPERAND_MODIFIER_NONE;
flags = FLAG_NONE;
precision = PRECISION_DEFAULT;
funcNum = 0;
declaration = NULL;
}
@@ -762,12 +761,22 @@ struct Operand
// operands can be given names to make the assembly easier to read.
// mostly used on vendor extensions where the syntax is non-standard/undocumented
rdcstr name;
rdcinflexiblestr name;
// temp register, constant buffer, input, output, other more specialised types
OperandType type;
// scalar, 4-vector or N-vector (currently unused)
NumOperandComponents numComponents;
enum Flags : uint8_t
{
FLAG_NONE = 0x00,
// these correspond to the bits in OperandModifier
FLAG_NEG = 0x01,
FLAG_ABS = 0x02,
} flags;
MinimumPrecision precision;
uint8_t comps[4]; // the components. each is 0,1,2,3 for x,y,z,w or 0xff if unused.
// e.g. .x = { 0, -1, -1, -1 }
// .zzw = { 2, 2, 3, -1 }
@@ -825,12 +834,6 @@ struct Operand
Declaration *declaration;
uint32_t values[4]; // if this operand is immediate, the values are here
OperandModifier modifier; // modifier, neg, abs(), -abs() etc. Could potentially be multiple
// modifiers in future
MinimumPrecision precision;
uint32_t funcNum; // interface this operand refers to
};
struct RegIndex
@@ -858,7 +861,7 @@ struct RegIndex
return false;
}
rdcstr str;
rdcstr toString(const DXBC::Reflection *reflection, ToString flags) const;
///////////////////////////////////////
@@ -874,163 +877,160 @@ struct RegIndex
struct Declaration
{
Declaration()
{
offset = 0;
length = 0;
instruction = 0;
declaration = NUM_REAL_OPCODES;
refactoringAllowed = doublePrecisionFloats = forceEarlyDepthStencil =
enableRawAndStructuredBuffers = skipOptimisation = enableMinPrecision =
enableD3D11_1DoubleExtensions = enableD3D11_1ShaderExtensions =
enableD3D12AllResourcesBound = false;
stride = 0;
hasCounter = false;
rov = false;
numTemps = 0;
tempReg = 0;
tempComponentCount = 0;
count = 0;
groupSize[0] = groupSize[1] = groupSize[2] = 0;
space = 0;
resType[0] = resType[1] = resType[2] = resType[3] = DXBC::NUM_RETURN_TYPES;
dim = RESOURCE_DIMENSION_UNKNOWN;
sampleCount = 0;
float4size = 0;
interpolation = INTERPOLATION_UNDEFINED;
systemValue = DXBC::SVNAME_UNDEFINED;
maxOut = 0;
samplerMode = NUM_SAMPLERS;
domain = DOMAIN_UNDEFINED;
controlPointCount = 0;
partition = PARTITIONING_UNDEFINED;
outPrim = OUTPUT_PRIMITIVE_UNDEFINED;
inPrim = PRIMITIVE_UNDEFINED;
outTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
instanceCount = 0;
indexRange = 0;
maxTessFactor = 0.0f;
globallyCoherant = false;
functionBody = 0;
functionTable = 0;
interfaceID = 0;
numInterfaces = 0;
numTypes = 0;
}
rdcstr str;
// many decls use an operand to declare things
Operand operand;
// function table for interface operations
rdcarray<uint32_t> functionTableContents;
///////////////////////////////////////
OpcodeType declaration = NUM_REAL_OPCODES;
// all the resource/cbuffer declarations can have a space in SM5.1, extract it here
uint32_t space = 0;
uint64_t offset;
uint32_t length;
// opcode specific data in anonymous union
union
{
// OPCODE_DCL_GLOBAL_FLAGS
struct
{
bool refactoringAllowed;
bool doublePrecisionFloats;
bool forceEarlyDepthStencil;
bool enableRawAndStructuredBuffers;
bool skipOptimisation;
bool enableMinPrecision;
bool enableD3D11_1DoubleExtensions;
bool enableD3D11_1ShaderExtensions;
bool enableD3D12AllResourcesBound;
} global_flags;
size_t instruction; // happens before this instruction. Usually 0 as all decls are up front,
// but can be non-zero for e.g. HS control point and join phase
OpcodeType declaration;
// OPCODE_DCL_RESOURCE
struct
{
DXBC::ResourceRetType resType[4];
ResourceDimension dim;
uint32_t sampleCount;
} resource;
Operand operand; // many decls use an operand to declare things
// OPCODE_DCL_RESOURCE_STRUCTURED
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED
struct
{
uint32_t stride;
bool hasCounter;
bool globallyCoherant;
bool rov;
} structured;
rdcarray<uint32_t> immediateData; // raw data (like default value of operand) for immediate
// constant buffer decl
// OPCODE_DCL_RESOURCE_RAW
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW
struct
{
ResourceDimension dim;
bool globallyCoherant;
bool rov;
DXBC::ResourceRetType resType[4];
} raw;
// opcode specific data
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED
struct
{
ResourceDimension dim;
bool globallyCoherant;
bool rov;
DXBC::ResourceRetType resType[4];
} uav_typed;
// OPCODE_DCL_GLOBAL_FLAGS
bool refactoringAllowed;
bool doublePrecisionFloats;
bool forceEarlyDepthStencil;
bool enableRawAndStructuredBuffers;
bool skipOptimisation;
bool enableMinPrecision;
bool enableD3D11_1DoubleExtensions;
bool enableD3D11_1ShaderExtensions;
bool enableD3D12AllResourcesBound;
// OPCODE_DCL_TEMPS
uint32_t numTemps;
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED
uint32_t stride;
bool hasCounter;
bool rov;
// OPCODE_DCL_INDEXABLE_TEMP
struct
{
uint32_t numTemps;
uint32_t tempReg;
uint32_t tempComponentCount;
} indexable_temp;
// OPCODE_DCL_TEMPS, OPCODE_DCL_INDEXABLE_TEMP
uint32_t numTemps;
// OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW
uint32_t tgsmCount;
// OPCODE_DCL_INDEXABLE_TEMP
uint32_t tempReg;
uint32_t tempComponentCount;
// OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED
struct
{
uint32_t count;
uint32_t stride;
} tsgm_structured;
// OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED
uint32_t count;
// OPCODE_DCL_THREAD_GROUP
uint32_t groupSize[3];
// OPCODE_DCL_THREAD_GROUP
uint32_t groupSize[3];
// OPCODE_DCL_CONSTANT_BUFFER
uint32_t cbufferVectorSize;
// OPCODE_DCL_RESOURCE
uint32_t space;
DXBC::ResourceRetType resType[4];
ResourceDimension dim;
uint32_t sampleCount;
// OPCODE_DCL_INPUT_PS
InterpolationMode inputInterpolation;
// OPCODE_DCL_CONSTANT_BUFFER
uint32_t float4size;
// OPCODE_DCL_INPUT_SIV
// OPCODE_DCL_INPUT_SGV
// OPCODE_DCL_INPUT_PS_SIV
// OPCODE_DCL_INPUT_PS_SGV
// OPCODE_DCL_OUTPUT_SIV
// OPCODE_DCL_OUTPUT_SGV
DXBC::SVSemantic systemValue;
// OPCODE_DCL_INPUT_PS
InterpolationMode interpolation;
// OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT
uint32_t maxVertexOutCount;
// OPCODE_DCL_INPUT_SIV
DXBC::SVSemantic systemValue;
// OPCODE_DCL_SAMPLER
SamplerMode samplerMode;
// OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT
uint32_t maxOut;
// OPCODE_DCL_TESS_DOMAIN
TessellatorDomain tessDomain;
// OPCODE_DCL_SAMPLER
SamplerMode samplerMode;
// OPCODE_DCL_INPUT_CONTROL_POINT_COUNT
uint32_t controlPointCount;
// OPCODE_DCL_TESS_DOMAIN
TessellatorDomain domain;
// OPCODE_DCL_TESS_PARTITIONING
TessellatorPartitioning tessPartition;
// OPCODE_DCL_INPUT_CONTROL_POINT_COUNT
uint32_t controlPointCount;
// OPCODE_DCL_TESS_OUTPUT_PRIMITIVE
TessellatorOutputPrimitive tessOutputPrimitive;
// OPCODE_DCL_TESS_PARTITIONING
TessellatorPartitioning partition;
// OPCODE_DCL_GS_INPUT_PRIMITIVE
PrimitiveType geomInputPrimitive;
// OPCODE_DCL_TESS_OUTPUT_PRIMITIVE
TessellatorOutputPrimitive outPrim;
// OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY
D3D_PRIMITIVE_TOPOLOGY geomOutputTopology;
// OPCODE_DCL_GS_INPUT_PRIMITIVE
PrimitiveType inPrim;
// OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT
// OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT
// OPCODE_DCL_GS_INSTANCE_COUNT
uint32_t instanceCount;
// OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY
D3D_PRIMITIVE_TOPOLOGY outTopology;
// OPCODE_DCL_INDEX_RANGE
uint32_t indexRange;
// OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT
// OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT
// OPCODE_DCL_GS_INSTANCE_COUNT
uint32_t instanceCount;
// OPCODE_DCL_HS_MAX_TESSFACTOR
float maxTessFactor;
// OPCODE_DCL_INDEX_RANGE
uint32_t indexRange;
// OPCODE_DCL_FUNCTION_BODY
uint32_t functionBody;
// OPCODE_DCL_HS_MAX_TESSFACTOR
float maxTessFactor;
// OPCODE_DCL_FUNCTION_TABLE
uint32_t functionTable;
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED
bool globallyCoherant;
// OPCODE_CUSTOMDATA
uint32_t customDataIndex;
// OPCODE_DCL_FUNCTION_BODY
uint32_t functionBody;
// OPCODE_DCL_FUNCTION_TABLE
uint32_t functionTable;
// OPCODE_CUSTOMDATA
uint32_t customDataIndex;
// OPCODE_DCL_INTERFACE
uint32_t interfaceID;
uint32_t numInterfaces;
uint32_t numTypes;
// OPCODE_DCL_INTERFACE
struct
{
uint32_t interfaceID;
uint32_t numInterfaces;
uint32_t numTypes;
} iface;
};
};
struct Operation
@@ -1039,11 +1039,9 @@ struct Operation
{
offset = 0;
line = 0;
length = 0;
stride = 0;
operation = NUM_REAL_OPCODES;
nonzero = false;
saturate = false;
flags = FLAG_NONE;
preciseValues = 0;
resinfoRetType = NUM_RETTYPES;
syncFlags = 0;
@@ -1054,22 +1052,16 @@ struct Operation
rdcstr str;
// for if, etc. If it checks for zero or nonzero
bool nonzero() const { return (flags & FLAG_NONZERO) != 0; }
// should the result be saturated.
bool saturate() const { return (flags & FLAG_SATURATE) != 0; }
///////////////////////////////////////
uintptr_t offset;
uint32_t line;
uint32_t length;
OpcodeType operation;
bool nonzero; // for if, etc. If it checks for zero or nonzero
bool saturate; // should the result be saturated.
uint32_t preciseValues; // for multiple output operand operations
ResinfoRetType resinfoRetType; // return type of resinfo
uint32_t syncFlags; // sync flags (for compute shader sync operations)
int texelOffset[3]; // U,V,W texel offset
ResourceDimension resDim; // resource dimension (tex2d etc)
DXBC::ResourceRetType resType[4]; // return type (e.g. for a sample operation)
union
{
@@ -1077,6 +1069,25 @@ struct Operation
uint32_t customDataIndex;
};
uint8_t preciseValues; // for multiple output operand operations
union
{
ResinfoRetType resinfoRetType; // return type of resinfo
uint8_t syncFlags; // sync flags (for compute shader sync operations)
};
int8_t texelOffset[3] = {0}; // U,V,W texel offset
ResourceDimension resDim; // resource dimension (tex2d etc)
DXBC::ResourceRetType resType[4]; // return type (e.g. for a sample operation)
enum Flags : uint8_t
{
FLAG_NONE = 0x0,
FLAG_NONZERO = 0x01,
FLAG_SATURATE = 0x02,
} flags;
rdcarray<Operand> operands;
};
@@ -1162,6 +1173,10 @@ protected:
rdcarray<Declaration> m_Declarations;
rdcarray<Operation> m_Instructions;
// declarations later in shaders - only used for different phases in hull shaders where
// declarations can happen after some instructions
rdcarray<rdcarray<Declaration>> m_LateDeclarations;
// these functions modify tokenStream pointer to point after the item
// ExtractOperation/ExtractDecl returns false if not an operation (ie. it's a declaration)
bool DecodeOperation(uint32_t *&tokenStream, Operation &op, bool friendlyName);
File diff suppressed because it is too large. Load diff
@@ -116,7 +116,7 @@ static MaskedElement<bool, 0x80000000> Extended;
static MaskedElement<CustomDataClass, 0xFFFFF800> CustomClass;
// opcode specific
static MaskedElement<uint32_t, 0x00780000> PreciseValues;
static MaskedElement<uint8_t, 0x00780000> PreciseValues;
// several
static MaskedElement<bool, 0x00002000> Saturate;
@@ -126,16 +126,12 @@ static MaskedElement<bool, 0x00040000> TestNonZero;
static MaskedElement<ResinfoRetType, 0x00001800> ResinfoReturn;
// OPCODE_SYNC
static MaskedElement<uint32_t, 0x00007800> SyncFlags;
static MaskedElement<uint8_t, 0x00007800> SyncFlags;
// relative to above uint32! ie. post shift.
static MaskedElement<bool, 0x00000001> Sync_Threads;
static MaskedElement<bool, 0x00000002> Sync_TGSM;
static MaskedElement<bool, 0x00000004> Sync_UAV_Group;
static MaskedElement<bool, 0x00000008> Sync_UAV_Global;
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED
// OPCODE_DCL_RESOURCE_STRUCTURED
static MaskedElement<bool, 0x00800000> HasOrderPreservingCounter;
}; // Opcode
// Declarations are Opcode tokens, but with their own particular definitions
@@ -194,6 +190,10 @@ static MaskedElement<TessellatorOutputPrimitive, 0x00003800> OutputPrimitive;
static MaskedElement<bool, 0x00010000> GloballyCoherent;
static MaskedElement<bool, 0x00020000> RasterizerOrderedAccess;
// OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED
// OPCODE_DCL_RESOURCE_STRUCTURED
static MaskedElement<bool, 0x00800000> HasOrderPreservingCounter;
// OPCODE_DCL_INTERFACE
static MaskedElement<uint32_t, 0x0000FFFF> TableLength;
static MaskedElement<uint32_t, 0xFFFF0000> NumInterfaces;
@@ -205,9 +205,9 @@ static MaskedElement<bool, 0x80000000> Extended;
static MaskedElement<ExtendedOpcodeType, 0x0000003F> Type;
// OPCODE_EX_SAMPLE_CONTROLS
static MaskedElement<int, 0x00001E00> TexelOffsetU;
static MaskedElement<int, 0x0001E000> TexelOffsetV;
static MaskedElement<int, 0x001E0000> TexelOffsetW;
static MaskedElement<int8_t, 0x00001E00> TexelOffsetU;
static MaskedElement<int8_t, 0x0001E000> TexelOffsetV;
static MaskedElement<int8_t, 0x001E0000> TexelOffsetW;
// OPCODE_EX_RESOURCE_DIM
static MaskedElement<ResourceDimension, 0x000007C0> ResourceDim;
@@ -178,7 +178,7 @@ static MaskedElement<uint8_t, 0x00018000> VtxParamComponent;
static MaskedElement<uint32_t, 0x00001F00> VtxParamParameter;
static MaskedElement<uint32_t, 0x00006000> VtxParamVertex;
static MaskedElement<uint32_t, 0x0000FF00> WaveOp;
static MaskedElement<uint8_t, 0x0000FF00> WaveOp;
static MaskedElement<uint32_t, 0x00FF0000> WaveOpFlags;
static MaskedElement<AMDAtomic, 0x0000FF00> AtomicOp;
@@ -428,7 +428,7 @@ void Program::PostprocessVendorExtensions()
op.operation = OPCODE_AMD_READFIRSTLANE;
op.operands.resize(2);
op.operands[0] = dstOperand;
op.operands[1].name = "src";
op.operands[1].name = "src"_lit;
op.operands[1] = srcParam[0];
break;
}
@@ -437,10 +437,10 @@ void Program::PostprocessVendorExtensions()
op.operation = OPCODE_AMD_READLANE;
op.operands.resize(3);
op.operands[0] = dstOperand;
op.operands[1].name = "src";
op.operands[1].name = "src"_lit;
op.operands[1] = srcParam[0];
// lane is encoded in instruction data
op.operands[2].name = "lane";
op.operands[2].name = "lane"_lit;
op.operands[2].type = TYPE_IMMEDIATE32;
op.operands[2].numComponents = NUMCOMPS_1;
op.operands[2].values[0] = AMDInstruction::Data.Get(instruction);
@@ -457,7 +457,7 @@ void Program::PostprocessVendorExtensions()
op.operation = OPCODE_AMD_SWIZZLE;
op.operands.resize(2);
op.operands[0] = dstOperand;
op.operands[1].name = "src";
op.operands[1].name = "src"_lit;
op.operands[1] = srcParam[0];
break;
}
@@ -475,7 +475,7 @@ void Program::PostprocessVendorExtensions()
op.operands[0] = dstParam[0];
op.operands[1] = dstOperand;
op.operands[2] = srcParam[0];
op.operands[2].name = "predicate";
op.operands[2].name = "predicate"_lit;
}
break;
}
@@ -533,9 +533,9 @@ void Program::PostprocessVendorExtensions()
// all modes except pull model have two outputs
op.operation = OPCODE_AMD_BARYCOORD;
op.operands.resize(2);
op.operands[0].name = "i";
op.operands[0].name = "i"_lit;
op.operands[0] = dstParam[0];
op.operands[0].name = "j";
op.operands[0].name = "j"_lit;
op.operands[1] = dstOperand;
}
else
@@ -548,11 +548,11 @@ void Program::PostprocessVendorExtensions()
// all modes except pull model have two outputs
op.operation = OPCODE_AMD_BARYCOORD;
op.operands.resize(3);
op.operands[0].name = "invW";
op.operands[0].name = "invW"_lit;
op.operands[0] = dstParam[0];
op.operands[1].name = "invI";
op.operands[1].name = "invI"_lit;
op.operands[1] = dstParam[1];
op.operands[2].name = "invJ";
op.operands[2].name = "invJ"_lit;
op.operands[2] = dstOperand;
}
break;
@@ -563,13 +563,13 @@ void Program::PostprocessVendorExtensions()
op.operands.resize(3);
op.operands[0] = dstOperand;
// vertexIndex is encoded in instruction data
op.operands[1].name = "vertexIndex";
op.operands[1].name = "vertexIndex"_lit;
op.operands[1].type = TYPE_IMMEDIATE32;
op.operands[1].numComponents = NUMCOMPS_1;
op.operands[1].values[0] = AMDInstruction::VtxParamVertex.Get(instruction);
// decode and pretty-ify the parameter index and component
op.operands[2].name = "parameter";
op.operands[2].name = "parameter"_lit;
op.operands[2].type = TYPE_INPUT;
op.operands[2].numComponents = NUMCOMPS_1;
op.operands[2].indices.resize(1);
@@ -615,11 +615,11 @@ void Program::PostprocessVendorExtensions()
op.operands.resize(4);
op.operands[0] = dstOperand;
op.operands[1] = srcParam[0];
op.operands[1].name = "gpuVaLoBits";
op.operands[1].name = "gpuVaLoBits"_lit;
op.operands[2] = srcParam[1];
op.operands[2].name = "gpuVaHiBits";
op.operands[2].name = "gpuVaHiBits"_lit;
op.operands[3] = srcParam[2];
op.operands[3].name = "offset";
op.operands[3].name = "offset"_lit;
}
break;
}
@@ -681,7 +681,7 @@ void Program::PostprocessVendorExtensions()
op.operands.push_back(srcParam[0]);
op.operands.back().setComps(srcParam[0].comps[0], srcParam[1].comps[0],
srcParam[2].comps[0], 0xff);
op.operands.back().name = "address";
op.operands.back().name = "address"_lit;
// store in texelOffset whether the parameter is combined (1) or split (2)
op.texelOffset[0] = 1;
@@ -689,13 +689,13 @@ void Program::PostprocessVendorExtensions()
else
{
op.operands.push_back(srcParam[0]);
op.operands.back().name = "address.x";
op.operands.back().name = "address.x"_lit;
op.operands.back().setComps(srcParam[0].comps[0], 0xff, 0xff, 0xff);
op.operands.push_back(srcParam[1]);
op.operands.back().name = "address.y";
op.operands.back().name = "address.y"_lit;
op.operands.back().setComps(srcParam[1].comps[0], 0xff, 0xff, 0xff);
op.operands.push_back(srcParam[2]);
op.operands.back().name = "address.z";
op.operands.back().name = "address.z"_lit;
op.operands.back().setComps(srcParam[2].comps[0], 0xff, 0xff, 0xff);
// store in texelOffset whether the parameter is combined (1) or split (2)
@@ -710,7 +710,7 @@ void Program::PostprocessVendorExtensions()
op.operands.push_back(srcParam[5]);
op.operands.back().setComps(srcParam[5].comps[0], srcParam[6].comps[0], 0xff, 0xff);
op.operands.back().values[1] = srcParam[6].values[0];
op.operands.back().name = "compare_value";
op.operands.back().name = "compare_value"_lit;
// store in texelOffset whether the parameter is combined (1) or split (2)
op.texelOffset[1] = 1;
@@ -718,10 +718,10 @@ void Program::PostprocessVendorExtensions()
else
{
op.operands.push_back(srcParam[5].swizzle(0));
op.operands.back().name = "compare_value.x";
op.operands.back().name = "compare_value.x"_lit;
op.operands.back().setComps(srcParam[5].comps[0], 0xff, 0xff, 0xff);
op.operands.push_back(srcParam[6].swizzle(0));
op.operands.back().name = "compare_value.y";
op.operands.back().name = "compare_value.y"_lit;
op.operands.back().setComps(srcParam[6].comps[0], 0xff, 0xff, 0xff);
// store in texelOffset whether the parameter is combined (1) or split (2)
@@ -735,7 +735,7 @@ void Program::PostprocessVendorExtensions()
op.operands.push_back(srcParam[3]);
op.operands.back().setComps(srcParam[3].comps[0], srcParam[4].comps[0], 0xff, 0xff);
op.operands.back().values[1] = srcParam[4].values[0];
op.operands.back().name = "value";
op.operands.back().name = "value"_lit;
// store in texelOffset whether the parameter is combined (1) or split (2)
op.texelOffset[2] = 1;
@@ -743,10 +743,10 @@ void Program::PostprocessVendorExtensions()
else
{
op.operands.push_back(srcParam[3].swizzle(0));
op.operands.back().name = "value.x";
op.operands.back().name = "value.x"_lit;
op.operands.back().setComps(srcParam[3].comps[0], 0xff, 0xff, 0xff);
op.operands.push_back(srcParam[4].swizzle(0));
op.operands.back().name = "value.y";
op.operands.back().name = "value.y"_lit;
op.operands.back().setComps(srcParam[4].comps[0], 0xff, 0xff, 0xff);
// store in texelOffset whether the parameter is combined (1) or split (2)
@@ -858,8 +858,10 @@ void Program::PostprocessVendorExtensions()
// remove this operation, but keep the old operation so we can undo this if things go
// wrong
curOp.syncFlags = curOp.operation;
curOp.stride = curOp.operation;
curOp.operation = OPCODE_VENDOR_REMOVED;
RDCCOMPILE_ASSERT(sizeof(curOp.stride) >= sizeof(curOp.operation),
"Hackily assuming stride is big enough to hold an operation");
}
else if(curOp.operation == OPCODE_IMM_ATOMIC_ALLOC &&
curOp.operands[1].indices[0].index == magicID)
@@ -916,16 +918,16 @@ void Program::PostprocessVendorExtensions()
op.operands.resize(4);
op.operands[0] = curOp.operands[0];
op.operands[1].name = "value";
op.operands[1].name = "value"_lit;
op.operands[1] = srcParam[0].swizzle(0);
if(nvopcode == NvShaderOpcode::Shuffle)
op.operands[2].name = "srcLane";
op.operands[2].name = "srcLane"_lit;
else if(nvopcode == NvShaderOpcode::ShuffleXor)
op.operands[2].name = "laneMask";
op.operands[2].name = "laneMask"_lit;
else
op.operands[2].name = "delta";
op.operands[2].name = "delta"_lit;
op.operands[2] = srcParam[0].swizzle(1);
op.operands[3].name = "width";
op.operands[3].name = "width"_lit;
op.operands[3] = srcParam[0].swizzle(3);
break;
}
@@ -943,7 +945,7 @@ void Program::PostprocessVendorExtensions()
op.operands.resize(2);
op.operands[0] = curOp.operands[0];
op.operands[1] = srcParam[0];
op.operands[1].name = "predicate";
op.operands[1].name = "predicate"_lit;
break;
}
case NvShaderOpcode::GetLaneId:
@@ -998,7 +1000,7 @@ void Program::PostprocessVendorExtensions()
dstParam[1].indices == curOp.operands[0].indices)
{
op.operands.push_back(curOp.operands[0]);
op.operands.back().name = "result";
op.operands.back().name = "result"_lit;
// fixup the comps according to the shuffle
op.operands.back().setComps(
@@ -1013,12 +1015,12 @@ void Program::PostprocessVendorExtensions()
{
// these are in reverse order because we read them as numOutputs was decrementing
op.operands.push_back(dstParam[1]);
op.operands.back().name = "result.x";
op.operands.back().name = "result.x"_lit;
op.operands.push_back(dstParam[0]);
op.operands.back().name = "result.y";
op.operands.back().name = "result.y"_lit;
// z is last
op.operands.push_back(curOp.operands[0]);
op.operands.back().name = "result.z";
op.operands.back().name = "result.z"_lit;
}
break;
@@ -1047,7 +1049,7 @@ void Program::PostprocessVendorExtensions()
dstParam[2].indices == curOp.operands[0].indices)
{
op.operands.push_back(curOp.operands[0]);
op.operands.back().name = "result";
op.operands.back().name = "result"_lit;
// fixup the comps according to the shuffle
op.operands.back().setComps(
@@ -1064,56 +1066,56 @@ void Program::PostprocessVendorExtensions()
{
// these are in reverse order because we read them as numOutputs was decrementing
op.operands.push_back(dstParam[2]);
op.operands.back().name = "result.x";
op.operands.back().name = "result.x"_lit;
op.operands.push_back(dstParam[1]);
op.operands.back().name = "result.y";
op.operands.back().name = "result.y"_lit;
op.operands.push_back(dstParam[0]);
op.operands.back().name = "result.z";
op.operands.back().name = "result.z"_lit;
// w is last
op.operands.push_back(curOp.operands[0]);
op.operands.back().name = "result.w";
op.operands.back().name = "result.w"_lit;
}
// peel out the source parameters
op.operands.push_back(srcParam[3].swizzle(0));
op.operands.back().name = "texSpace";
op.operands.back().name = "texSpace"_lit;
op.operands.push_back(srcParam[0].swizzle(0));
op.operands.back().name = "texIndex";
op.operands.back().name = "texIndex"_lit;
op.operands.push_back(srcParam[3].swizzle(1));
op.operands.back().name = "smpSpace";
op.operands.back().name = "smpSpace"_lit;
op.operands.push_back(srcParam[0].swizzle(1));
op.operands.back().name = "smpIndex";
op.operands.back().name = "smpIndex"_lit;
op.operands.push_back(srcParam[3].swizzle(2));
op.operands.back().name = "texType";
op.operands.back().name = "texType"_lit;
op.operands.push_back(srcParam[1]);
op.operands.back().comps[3] = 0xff; // location is a float3
op.operands.back().values[3] = 0;
op.operands.back().name = "location";
op.operands.back().name = "location"_lit;
op.operands.push_back(srcParam[3].swizzle(3));
op.operands.back().name = "coarse";
op.operands.back().name = "coarse"_lit;
op.operands.push_back(srcParam[1].swizzle(3));
op.operands.back().name = "gran";
op.operands.back().name = "gran"_lit;
if(nvopcode == NvShaderOpcode::FootprintBias)
{
op.operands.push_back(srcParam[2].swizzle(0));
op.operands.back().name = "bias";
op.operands.back().name = "bias"_lit;
}
else if(nvopcode == NvShaderOpcode::FootprintLevel)
{
op.operands.push_back(srcParam[2].swizzle(0));
op.operands.back().name = "lodLevel";
op.operands.back().name = "lodLevel"_lit;
}
else if(nvopcode == NvShaderOpcode::FootprintGrad)
{
op.operands.push_back(srcParam[2]);
op.operands.back().name = "ddx";
op.operands.back().name = "ddx"_lit;
op.operands.push_back(srcParam[5]);
op.operands.back().name = "ddy";
op.operands.back().name = "ddy"_lit;
}
op.operands.push_back(srcParam[4]);
op.operands.back().name = "offset";
op.operands.back().name = "offset"_lit;
break;
}
@@ -1125,16 +1127,16 @@ void Program::PostprocessVendorExtensions()
op.operands[0] = curOp.operands[0];
// second output is the laneValid we stored previously
op.operands[1] = dstParam[0];
op.operands[1].name = "out laneValid";
op.operands[1].name = "out laneValid"_lit;
// we expect the params are packed into srcParam[0]
op.operands[2] = srcParam[0].swizzle(0);
op.operands[2].name = "value";
op.operands[2].name = "value"_lit;
op.operands[3] = srcParam[0].swizzle(1);
op.operands[3].name = "srcLane";
op.operands[3].name = "srcLane"_lit;
op.operands[4] = srcParam[0].swizzle(2);
op.operands[4].name = "width";
op.operands[4].name = "width"_lit;
break;
}
case NvShaderOpcode::VPRSEvalAttribAtSample:
@@ -1164,7 +1166,7 @@ void Program::PostprocessVendorExtensions()
if(allSameReg)
{
op.operands.push_back(curOp.operands[0]);
op.operands.back().name = "result";
op.operands.back().name = "result"_lit;
for(int o = 0; o < 4; o++)
{
@@ -1184,28 +1186,26 @@ void Program::PostprocessVendorExtensions()
// these are in reverse order because we read them as numOutputs was
// decrementing
op.operands.push_back(dstParam[numOutputs - 2 - o]);
op.operands.back().name = "result.";
op.operands.back().name += swz[o];
op.operands.back().name = rdcstr("result.") + swz[o];
}
op.operands.push_back(curOp.operands[0]);
op.operands.back().name = "result.";
op.operands.back().name += swz[numOutputs - 1];
op.operands.back().name = rdcstr("result.") + swz[numOutputs - 1];
}
op.operands.push_back(srcParam[0]);
op.operands.back().name = "attrib";
op.operands.back().name = "attrib"_lit;
if(nvopcode == NvShaderOpcode::VPRSEvalAttribAtSample)
{
op.operands.push_back(srcParam[1]);
op.operands.back().name = "sampleIndex";
op.operands.back().name = "sampleIndex"_lit;
op.operands.push_back(srcParam[2]);
op.operands.back().name = "pixelOffset";
op.operands.back().name = "pixelOffset"_lit;
}
else if(nvopcode == NvShaderOpcode::VPRSEvalAttribSnapped)
{
op.operands.push_back(srcParam[1]);
op.operands.back().name = "offset";
op.operands.back().name = "offset"_lit;
}
break;
@@ -1266,7 +1266,7 @@ void Program::PostprocessVendorExtensions()
// remove this operation, but keep the old operation so we can undo this if things go
// wrong
curOp.syncFlags = curOp.operation;
curOp.stride = curOp.operation;
curOp.operation = OPCODE_VENDOR_REMOVED;
}
else if(curOp.operation == OPCODE_STORE_STRUCTURED &&
@@ -1346,9 +1346,9 @@ void Program::PostprocessVendorExtensions()
atomicop = (NvShaderAtomic)srcParam[2].values[0];
op.operands.push_back(srcParam[0]);
op.operands.back().name = "address";
op.operands.back().name = "address"_lit;
op.operands.push_back(srcParam[1]);
op.operands.back().name = "value";
op.operands.back().name = "value"_lit;
break;
}
@@ -1368,9 +1368,9 @@ void Program::PostprocessVendorExtensions()
atomicop = (NvShaderAtomic)srcParam[2].values[0];
op.operands.push_back(srcParam[0].swizzle(0));
op.operands.back().name = "byteAddress";
op.operands.back().name = "byteAddress"_lit;
op.operands.push_back(srcParam[1].swizzle(0));
op.operands.back().name = "value";
op.operands.back().name = "value"_lit;
break;
}
@@ -1400,7 +1400,7 @@ void Program::PostprocessVendorExtensions()
op.operands.push_back(srcParam[0]);
op.operands.back().numComponents = NUMCOMPS_1;
op.operands.back().name = "address";
op.operands.back().name = "address"_lit;
// store in texelOffset whether the parameter is combined (1) or split (2).
// on nv we assume the parameters are always combined
@@ -1414,12 +1414,12 @@ void Program::PostprocessVendorExtensions()
op.operands.back().numComponents = NUMCOMPS_4;
op.operands.back().setComps(srcParam[1].comps[0], srcParam[1].comps[1], 0xff, 0xff);
op.operands.back().values[1] = srcParam[1].values[1];
op.operands.back().name = "compareValue";
op.operands.back().name = "compareValue"_lit;
op.operands.push_back(srcParam[1]);
op.operands.back().numComponents = NUMCOMPS_4;
op.operands.back().setComps(srcParam[1].comps[2], srcParam[1].comps[3], 0xff, 0xff);
op.operands.back().values[1] = srcParam[1].values[3];
op.operands.back().name = "value";
op.operands.back().name = "value"_lit;
}
else
{
@@ -1427,7 +1427,7 @@ void Program::PostprocessVendorExtensions()
op.operands.back().numComponents = NUMCOMPS_4;
op.operands.back().setComps(srcParam[1].comps[0], srcParam[1].comps[1], 0xff, 0xff);
op.operands.back().values[1] = srcParam[1].values[1];
op.operands.back().name = "value";
op.operands.back().name = "value"_lit;
}
break;
@@ -1449,7 +1449,7 @@ void Program::PostprocessVendorExtensions()
}
op.offset = curOp.offset;
op.preciseValues = (uint32_t)atomicop;
op.preciseValues = (uint8_t)atomicop;
op.str = ToStr(op.operation);
switch(atomicop)
@@ -1612,7 +1612,7 @@ void Program::PostprocessVendorExtensions()
// remove this operation, but keep the old operation so we can undo this if things go
// wrong
curOp.syncFlags = curOp.operation;
curOp.stride = curOp.operation;
curOp.operation = OPCODE_VENDOR_REMOVED;
}
else if(curOp.operation == OPCODE_LD_STRUCTURED && curOp.operands[3].indices[0].index == magicID)
@@ -1676,11 +1676,11 @@ void Program::PostprocessVendorExtensions()
// remove the old one, we've replaced it
m_Instructions[j].operation = OPCODE_VENDOR_REMOVED;
// if we break and try to revert this one, keep it removed
m_Instructions[j].syncFlags = OPCODE_VENDOR_REMOVED;
m_Instructions[j].stride = OPCODE_VENDOR_REMOVED;
// also remove the current one! but back up the original in case something
// goes
// wrong
curOp.syncFlags = curOp.operation;
curOp.stride = curOp.operation;
curOp.operation = OPCODE_VENDOR_REMOVED;
break;
}
@@ -1714,7 +1714,7 @@ void Program::PostprocessVendorExtensions()
// remove this operation, but keep the old operation so we can undo this if things go
// wrong
curOp.syncFlags = curOp.operation;
curOp.stride = curOp.operation;
curOp.operation = OPCODE_VENDOR_REMOVED;
}
}
@@ -1729,7 +1729,7 @@ void Program::PostprocessVendorExtensions()
// remove this operation, but keep the old operation so we can undo this if things go
// wrong
curOp.syncFlags = curOp.operation;
curOp.stride = curOp.operation;
curOp.operation = OPCODE_VENDOR_REMOVED;
}
}
@@ -1743,7 +1743,7 @@ void Program::PostprocessVendorExtensions()
for(size_t i = 0; i < m_Instructions.size(); i++)
{
if(m_Instructions[i].operation == OPCODE_VENDOR_REMOVED)
m_Instructions[i].operation = (OpcodeType)m_Instructions[i].syncFlags;
m_Instructions[i].operation = (OpcodeType)m_Instructions[i].stride;
else if(m_Instructions[i].operation >= OPCODE_VENDOR_FIRST)
m_Instructions[i].operation = OPCODE_VENDOR_REMOVED;
}
+2 -1
View File
@@ -26,6 +26,7 @@
#include <map>
#include "api/replay/rdcarray.h"
#include "api/replay/rdcpair.h"
#include "api/replay/rdcstr.h"
#include "api/replay/shader_types.h"
@@ -80,7 +81,7 @@ enum class ShaderType
//
// essentially all information comes from the wine project.
/////////////////////////////////////////////////////////////////////////
enum ResourceRetType
enum ResourceRetType : uint8_t
{
RETURN_TYPE_UNKNOWN = 0,
RETURN_TYPE_UNORM = 1,
+34 -26
View File
@@ -1270,7 +1270,7 @@ void ThreadState::SetDst(ShaderDebugState *state, const Operand &dstoper, const
// in a vector operation like r0.zw = r4.xxxy + r6.yyyz
// then we must write from matching component to matching component
if(op.saturate)
if(op.saturate())
right = sat(right, OperationType(op.operation));
ShaderVariableChange change = {*changeVar};
@@ -1688,12 +1688,12 @@ ShaderVariable ThreadState::GetSrc(const Operand &oper, const Operation &op, boo
v.columns = 4;
}
if(oper.modifier == OPERAND_MODIFIER_ABS || oper.modifier == OPERAND_MODIFIER_ABSNEG)
if(oper.flags & Operand::FLAG_ABS)
{
v = abs(v, OperationType(op.operation));
}
if(oper.modifier == OPERAND_MODIFIER_NEG || oper.modifier == OPERAND_MODIFIER_ABSNEG)
if(oper.flags & Operand::FLAG_NEG)
{
v = neg(v, OperationType(op.operation));
}
@@ -3065,7 +3065,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
}
else if(pDecl->declaration == OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED)
{
stride = pDecl->stride;
stride = pDecl->structured.stride;
structured = true;
}
}
@@ -3203,7 +3203,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
srv ? OPCODE_DCL_RESOURCE_STRUCTURED : OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED;
const DXBCBytecode::Declaration *pDecl = program->FindDeclaration(declType, resIndex);
if(pDecl && pDecl->declaration == declOpcode)
stride = pDecl->stride;
stride = pDecl->structured.stride;
}
}
@@ -3751,7 +3751,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
program->FindDeclaration(TYPE_RESOURCE, (uint32_t)op.operands[2].indices[0].index);
if(pDecl && pDecl->declaration == OPCODE_DCL_RESOURCE)
{
switch(pDecl->dim)
switch(pDecl->resource.dim)
{
default:
case RESOURCE_DIMENSION_UNKNOWN:
@@ -3873,10 +3873,11 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
samplerMode = decl.samplerMode;
samplerBinding = GetBindingSlotForDeclaration(*program, decl);
}
if(op.operation == OPCODE_LD && decl.dim == RESOURCE_DIMENSION_BUFFER &&
decl.declaration == OPCODE_DCL_RESOURCE && decl.operand.sameResource(op.operands[2]))
if(op.operation == OPCODE_LD && decl.declaration == OPCODE_DCL_RESOURCE &&
decl.resource.dim == RESOURCE_DIMENSION_BUFFER &&
decl.operand.sameResource(op.operands[2]))
{
resourceDim = decl.dim;
resourceDim = decl.resource.dim;
resourceBinding = GetBindingSlotForDeclaration(*program, decl);
GlobalState::SRVIterator srv = global.srvs.find(resourceBinding);
@@ -3930,9 +3931,9 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
}
if(decl.declaration == OPCODE_DCL_RESOURCE && decl.operand.sameResource(op.operands[2]))
{
resourceDim = decl.dim;
resourceRetType = decl.resType[0];
sampleCount = decl.sampleCount;
resourceDim = decl.resource.dim;
resourceRetType = decl.resource.resType[0];
sampleCount = decl.resource.sampleCount;
resourceBinding = GetBindingSlotForDeclaration(*program, decl);
@@ -3943,12 +3944,14 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
// doesn't seem like these are ever less than four components, even if the texture is
// declared <float3> for example.
// shouldn't matter though is it just comes out in the wash.
RDCASSERT(decl.resType[0] == decl.resType[1] && decl.resType[1] == decl.resType[2] &&
decl.resType[2] == decl.resType[3]);
RDCASSERT(decl.resType[0] != DXBC::RETURN_TYPE_CONTINUED &&
decl.resType[0] != DXBC::RETURN_TYPE_UNUSED &&
decl.resType[0] != DXBC::RETURN_TYPE_MIXED && decl.resType[0] >= 0 &&
decl.resType[0] < DXBC::NUM_RETURN_TYPES);
RDCASSERT(decl.resource.resType[0] == decl.resource.resType[1] &&
decl.resource.resType[1] == decl.resource.resType[2] &&
decl.resource.resType[2] == decl.resource.resType[3]);
RDCASSERT(decl.resource.resType[0] != DXBC::RETURN_TYPE_CONTINUED &&
decl.resource.resType[0] != DXBC::RETURN_TYPE_UNUSED &&
decl.resource.resType[0] != DXBC::RETURN_TYPE_MIXED &&
decl.resource.resType[0] >= 0 &&
decl.resource.resType[0] < DXBC::NUM_RETURN_TYPES);
}
}
@@ -4150,7 +4153,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
if(op.operation == OPCODE_CONTINUE || op.operation == OPCODE_CONTINUEC)
depth = 1;
if((test == 0 && !op.nonzero) || (test != 0 && op.nonzero) ||
if((test == 0 && !op.nonzero()) || (test != 0 && op.nonzero()) ||
op.operation == OPCODE_CONTINUE || op.operation == OPCODE_ENDLOOP)
{
// skip back one to the endloop that we're processing
@@ -4179,7 +4182,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
{
int32_t test = op.operation == OPCODE_BREAKC ? GetSrc(op.operands[0], op).value.s32v[0] : 0;
if((test == 0 && !op.nonzero) || (test != 0 && op.nonzero) || op.operation == OPCODE_BREAK)
if((test == 0 && !op.nonzero()) || (test != 0 && op.nonzero()) || op.operation == OPCODE_BREAK)
{
// break out (jump to next endloop/endswitch)
int depth = 1;
@@ -4212,7 +4215,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
{
int32_t test = GetSrc(op.operands[0], op).value.s32v[0];
if((test == 0 && !op.nonzero) || (test != 0 && op.nonzero))
if((test == 0 && !op.nonzero()) || (test != 0 && op.nonzero()))
{
// nothing, we go into the if.
}
@@ -4280,7 +4283,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
{
int32_t test = GetSrc(op.operands[0], op).value.s32v[0];
if((test != 0 && !op.nonzero) || (test == 0 && op.nonzero))
if((test != 0 && !op.nonzero()) || (test == 0 && op.nonzero()))
{
// don't discard
break;
@@ -4295,7 +4298,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
{
int32_t test = op.operation == OPCODE_RETC ? GetSrc(op.operands[0], op).value.s32v[0] : 0;
if((test == 0 && !op.nonzero) || (test != 0 && op.nonzero) || op.operation == OPCODE_RET)
if((test == 0 && !op.nonzero()) || (test != 0 && op.nonzero()) || op.operation == OPCODE_RET)
{
// assumes not in a function call
done = true;
@@ -4502,11 +4505,16 @@ void GlobalState::PopulateGroupshared(const DXBCBytecode::Program *pBytecode)
mem.structured =
(decl.declaration == DXBCBytecode::OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED);
mem.count = decl.count;
if(mem.structured)
mem.bytestride = decl.stride;
{
mem.count = decl.tsgm_structured.count;
mem.bytestride = decl.tsgm_structured.stride;
}
else
{
mem.count = decl.tgsmCount;
mem.bytestride = 4; // raw groupshared is implicitly uint32s
}
mem.data.resize(mem.bytestride * mem.count);
}
@@ -4848,7 +4856,7 @@ DXBCBytecode::InterpolationMode GetInterpolationModeForInputParam(const SigParam
if(decl.declaration == DXBCBytecode::OPCODE_DCL_INPUT_PS &&
decl.operand.indices[0].absolute && decl.operand.indices[0].index == sig.regIndex)
{
interpolation = decl.interpolation;
interpolation = decl.inputInterpolation;
break;
}
}
+2 -2
View File
@@ -39,7 +39,7 @@ namespace DXBCBytecode
{
struct Declaration;
class Program;
enum OperandType;
enum OperandType : uint8_t;
}
class WrappedID3D11Device;
@@ -263,7 +263,7 @@ public:
SampleGatherResourceData resourceData,
SampleGatherSamplerData samplerData, ShaderVariable uv,
ShaderVariable ddxCalc, ShaderVariable ddyCalc,
const int texelOffsets[3], int multisampleIndex,
const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4],
GatherChannel gatherChannel, const char *opString,
ShaderVariable &output) = 0;