Move D3D11 API usage out of dxbc_debug.cpp

The following instructions used D3D11 calls to compute results, and have been
moved to an API wrapper class that is defined in d3d11_shaderdebug.cpp:
transcendentals (rcp, rsqrt, exp2, log2, and sincos), sample info/pos, bufinfo,
resinfo, and sample/load/gather/lod.
This commit is contained in:
Steve Karolewics
2019-07-29 11:48:00 +01:00
committed by Baldur Karlsson
parent 94648f8fe2
commit 665ad6c05c
3 changed files with 1524 additions and 1377 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+51 -5
View File
@@ -147,6 +147,55 @@ public:
std::map<SampleEvalCacheKey, ShaderVariable> sampleEvalCache;
};
struct SampleGatherResourceData
{
DXBC::ResourceDimension dim;
DXBC::ResourceRetType retType;
int sampleCount;
UINT slot;
};
struct SampleGatherSamplerData
{
DXBC::SamplerMode mode;
UINT slot;
float bias;
};
enum class GatherChannel : uint8_t
{
Red = 0,
Green = 1,
Blue = 2,
Alpha = 3,
};
class DebugAPIWrapper
{
public:
virtual void SetCurrentInstruction(uint32_t instruction) = 0;
virtual void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src,
std::string d) = 0;
virtual bool CalculateMathIntrinsic(DXBC::OpcodeType opcode, const ShaderVariable &input,
ShaderVariable &output1, ShaderVariable &output2) = 0;
virtual ShaderVariable GetSampleInfo(DXBC::OperandType type, bool isAbsoluteResource, UINT slot,
const char *opString) = 0;
virtual ShaderVariable GetBufferInfo(DXBC::OperandType type, UINT slot, const char *opString) = 0;
virtual ShaderVariable GetResourceInfo(DXBC::OperandType type, UINT slot, uint32_t mipLevel,
int &dim) = 0;
virtual bool CalculateSampleGather(DXBC::OpcodeType opcode, SampleGatherResourceData resourceData,
SampleGatherSamplerData samplerData, ShaderVariable uv,
ShaderVariable ddxCalc, ShaderVariable ddyCalc,
const int texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4],
GatherChannel gatherChannel, const char *opString,
ShaderVariable &output) = 0;
};
class State : public ShaderDebugState
{
public:
@@ -158,10 +207,9 @@ public:
done = false;
trace = NULL;
dxbc = NULL;
device = NULL;
RDCEraseEl(semantics);
}
State(int quadIdx, const ShaderDebugTrace *t, DXBC::DXBCFile *f, WrappedID3D11Device *d)
State(int quadIdx, const ShaderDebugTrace *t, DXBC::DXBCFile *f)
{
quadIndex = quadIdx;
nextInstruction = 0;
@@ -169,7 +217,6 @@ public:
done = false;
trace = t;
dxbc = f;
device = d;
RDCEraseEl(semantics);
}
@@ -192,7 +239,7 @@ public:
void Init();
bool Finished() const;
State GetNext(GlobalState &global, State quad[4]) const;
State GetNext(GlobalState &global, DebugAPIWrapper *apiWrapper, State quad[4]) const;
private:
// index in the pixel quad
@@ -223,7 +270,6 @@ private:
DXBC::DXBCFile *dxbc;
const ShaderDebugTrace *trace;
WrappedID3D11Device *device;
};
}; // namespace ShaderDebug