mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-07 15:20:58 +00:00
Pass the texture type to CalculateSampleGather
This commit is contained in:
@@ -1566,13 +1566,21 @@ void ThreadState::StepNext(ShaderDebugState *state,
|
||||
RDCASSERT(sampler.type == VarType::Unknown || sampler.type == VarType::ReadOnlyResource ||
|
||||
sampler.type == VarType::Sampler);
|
||||
|
||||
// at setup time we stored the texture type for easy access here
|
||||
DebugAPIWrapper::TextureType texType =
|
||||
(DebugAPIWrapper::TextureType)img.value.uv[TextureTypeVariableSlot];
|
||||
|
||||
ShaderVariable result;
|
||||
|
||||
result.type = resultType.scalar().Type();
|
||||
|
||||
if(!debugger.GetAPIWrapper()->CalculateSampleGather(*this, opdata.op, img.GetBinding(),
|
||||
sampler.GetBinding(), uv, ddxCalc, ddyCalc,
|
||||
compare, gather, operands, result))
|
||||
BindpointIndex samplerIndex = BindpointIndex(~0U, ~0U, ~0U);
|
||||
if(sampler.type == VarType::Sampler)
|
||||
samplerIndex = sampler.GetBinding();
|
||||
|
||||
if(!debugger.GetAPIWrapper()->CalculateSampleGather(
|
||||
*this, opdata.op, texType, img.GetBinding(), samplerIndex, uv, ddxCalc, ddyCalc,
|
||||
compare, gather, operands, result))
|
||||
{
|
||||
// sample failed. Pretend we got 0 columns back
|
||||
|
||||
|
||||
@@ -58,10 +58,21 @@ public:
|
||||
virtual void FillInputValue(ShaderVariable &var, ShaderBuiltin builtin, uint32_t location,
|
||||
uint32_t component) = 0;
|
||||
|
||||
virtual bool CalculateSampleGather(ThreadState &thread, rdcspv::Op opcode, BindpointIndex imageBind,
|
||||
BindpointIndex samplerBind, const ShaderVariable &uv,
|
||||
const ShaderVariable &ddxCalc, const ShaderVariable &ddyCalc,
|
||||
const ShaderVariable &compare, GatherChannel gatherChannel,
|
||||
enum TextureType
|
||||
{
|
||||
Float_Texture = 0x00,
|
||||
|
||||
UInt_Texture = 0x01,
|
||||
SInt_Texture = 0x02,
|
||||
|
||||
Buffer_Texture = 0x10,
|
||||
};
|
||||
|
||||
virtual bool CalculateSampleGather(ThreadState &lane, rdcspv::Op opcode, TextureType texType,
|
||||
BindpointIndex imageBind, BindpointIndex samplerBind,
|
||||
const ShaderVariable &uv, const ShaderVariable &ddxCalc,
|
||||
const ShaderVariable &ddyCalc, const ShaderVariable &compare,
|
||||
GatherChannel gatherChannel,
|
||||
const ImageOperandsAndParamDatas &operands,
|
||||
ShaderVariable &output) = 0;
|
||||
|
||||
@@ -77,6 +88,8 @@ public:
|
||||
uint32_t component) = 0;
|
||||
};
|
||||
|
||||
static const uint32_t TextureTypeVariableSlot = 8;
|
||||
|
||||
typedef ShaderVariable (*ExtInstImpl)(ThreadState &, const rdcarray<Id> &);
|
||||
|
||||
struct ExtInstDispatcher
|
||||
|
||||
@@ -406,6 +406,23 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, const Shader
|
||||
var.type = VarType::ReadOnlyResource;
|
||||
debugType = DebugVariableType::ReadOnlyResource;
|
||||
|
||||
// store the texture type here, since the image may be copied around and combined with a
|
||||
// sampler, so accessing the original type might be non-trivial at point of access
|
||||
uint32_t texType = DebugAPIWrapper::Float_Texture;
|
||||
|
||||
if(imageTypes[type.InnerType()].dim == Dim::Buffer)
|
||||
texType |= DebugAPIWrapper::Buffer_Texture;
|
||||
|
||||
if(imageTypes[type.InnerType()].retType.type == Op::TypeInt)
|
||||
{
|
||||
if(imageTypes[type.InnerType()].retType.signedness)
|
||||
texType |= DebugAPIWrapper::SInt_Texture;
|
||||
else
|
||||
texType |= DebugAPIWrapper::UInt_Texture;
|
||||
}
|
||||
|
||||
var.value.uv[TextureTypeVariableSlot] = texType;
|
||||
|
||||
global.readOnlyResources.push_back(var);
|
||||
readOnlyIDs.push_back(v.id);
|
||||
}
|
||||
|
||||
@@ -266,7 +266,8 @@ public:
|
||||
return DerivativeDeltas();
|
||||
}
|
||||
|
||||
bool CalculateSampleGather(rdcspv::ThreadState &thread, rdcspv::Op opcode, BindpointIndex imageBind,
|
||||
bool CalculateSampleGather(rdcspv::ThreadState &lane, rdcspv::Op opcode,
|
||||
DebugAPIWrapper::TextureType texType, BindpointIndex imageBind,
|
||||
BindpointIndex samplerBind, const ShaderVariable &uv,
|
||||
const ShaderVariable &ddxCalc, const ShaderVariable &ddyCalc,
|
||||
const ShaderVariable &compare, rdcspv::GatherChannel gatherChannel,
|
||||
|
||||
Reference in New Issue
Block a user