Add query for per-thread properties when shader debugging

* This is distinct from input values or builtins because they're entirely
  internal for configuring the workgroup
This commit is contained in:
baldurk
2025-02-10 17:52:29 +00:00
parent 983cf91ef0
commit 7fcf64a562
2 changed files with 26 additions and 0 deletions
@@ -44,6 +44,18 @@ enum class GatherChannel : uint8_t
Alpha = 3,
};
enum class ThreadProperty : uint32_t
{
Helper,
QuadId,
QuadLane,
Active,
Elected,
Count,
};
ITERABLE_OPERATORS(ThreadProperty);
struct ThreadState;
class DebugAPIWrapper
@@ -72,6 +84,8 @@ public:
virtual void FillInputValue(ShaderVariable &var, ShaderBuiltin builtin, uint32_t threadIndex,
uint32_t location, uint32_t component) = 0;
virtual uint32_t GetThreadProperty(uint32_t threadIndex, ThreadProperty prop) = 0;
enum TextureType
{
Float_Texture = 0x00,
@@ -544,6 +544,16 @@ public:
threadIndex, location, component);
}
uint32_t GetThreadProperty(uint32_t threadIndex, rdcspv::ThreadProperty prop) override
{
if(prop >= rdcspv::ThreadProperty::Count)
return 0;
if(threadIndex >= thread_props.size())
return 0;
return thread_props[threadIndex][(size_t)prop];
}
bool CalculateSampleGather(rdcspv::ThreadState &lane, rdcspv::Op opcode,
DebugAPIWrapper::TextureType texType, ShaderBindIndex imageBind,
ShaderBindIndex samplerBind, const ShaderVariable &uv,
@@ -1456,6 +1466,8 @@ public:
// per-thread custom inputs by location [thread][location]
rdcarray<rdcarray<ShaderVariable>> location_inputs;
rdcarray<rdcfixedarray<uint32_t, arraydim<rdcspv::ThreadProperty>()>> thread_props;
private:
WrappedVulkan *m_pDriver = NULL;
ShaderDebugData &m_DebugData;