mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 23:46:41 +00:00
Add helpers for accessing 'special' properties in pointer/image vars
This commit is contained in:
@@ -660,7 +660,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState>
|
||||
|
||||
// get the pointer base offset (should be zero for any binding but could be non-zero for a
|
||||
// buffer_device_address pointer)
|
||||
uint64_t offset = structPointer.value.u64v[BufferPointerByteOffsetVariableSlot];
|
||||
uint64_t offset = debugger.GetPointerByteOffset(structPointer);
|
||||
|
||||
// add the offset of the member
|
||||
const DataType &pointerType = debugger.GetTypeForId(len.structure);
|
||||
@@ -2299,8 +2299,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState>
|
||||
sampler.type == VarType::Sampler);
|
||||
|
||||
// at setup time we stored the texture type for easy access here
|
||||
DebugAPIWrapper::TextureType texType =
|
||||
(DebugAPIWrapper::TextureType)img.value.u64v[TextureTypeVariableSlot];
|
||||
DebugAPIWrapper::TextureType texType = debugger.GetTextureType(img);
|
||||
|
||||
// should not be sampling or fetching from subpass textures
|
||||
RDCASSERT((texType & DebugAPIWrapper::Subpass_Texture) == 0);
|
||||
@@ -2352,8 +2351,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState>
|
||||
ShaderVariable result;
|
||||
result.type = resultType.scalar().Type();
|
||||
|
||||
DebugAPIWrapper::TextureType texType =
|
||||
(DebugAPIWrapper::TextureType)img.value.u64v[TextureTypeVariableSlot];
|
||||
DebugAPIWrapper::TextureType texType = debugger.GetTextureType(img);
|
||||
|
||||
if(texType & DebugAPIWrapper::Subpass_Texture)
|
||||
{
|
||||
|
||||
@@ -102,19 +102,6 @@ public:
|
||||
uint32_t component) = 0;
|
||||
};
|
||||
|
||||
// this could be cleaner if ShaderVariable wasn't a very public struct, but it's not worth it so
|
||||
// we just reserve value slots that we know won't be used in opaque variables
|
||||
static const uint32_t PointerVariableSlot = 0;
|
||||
static const uint32_t Scalar0VariableSlot = 1;
|
||||
static const uint32_t Scalar1VariableSlot = 2;
|
||||
static const uint32_t BaseIdVariableSlot = 3;
|
||||
static const uint32_t MajorStrideVariableSlot = 4;
|
||||
static const uint32_t ArrayVariableSlot = 8;
|
||||
static const uint32_t TextureTypeVariableSlot = 9;
|
||||
static const uint32_t BufferPointerByteOffsetVariableSlot = 9;
|
||||
static const uint32_t BufferPointerTypeIdVariableSlot = 10;
|
||||
static const uint32_t SSBOVariableSlot = 11;
|
||||
|
||||
typedef ShaderVariable (*ExtInstImpl)(ThreadState &, uint32_t, const rdcarray<Id> &);
|
||||
|
||||
struct ExtInstDispatcher
|
||||
@@ -280,6 +267,8 @@ public:
|
||||
|
||||
ShaderVariable ReadFromPointer(const ShaderVariable &v) const;
|
||||
ShaderVariable GetPointerValue(const ShaderVariable &v) const;
|
||||
uint64_t GetPointerByteOffset(const ShaderVariable &ptr) const;
|
||||
DebugAPIWrapper::TextureType GetTextureType(const ShaderVariable &img) const;
|
||||
ShaderVariable MakePointerVariable(Id id, const ShaderVariable *v, uint32_t scalar0 = ~0U,
|
||||
uint32_t scalar1 = ~0U) const;
|
||||
Id GetPointerBaseId(const ShaderVariable &v) const;
|
||||
|
||||
@@ -27,6 +27,19 @@
|
||||
#include "spirv_op_helpers.h"
|
||||
#include "spirv_reflect.h"
|
||||
|
||||
// this could be cleaner if ShaderVariable wasn't a very public struct, but it's not worth it so
|
||||
// we just reserve value slots that we know won't be used in opaque variables
|
||||
static const uint32_t PointerVariableSlot = 0;
|
||||
static const uint32_t Scalar0VariableSlot = 1;
|
||||
static const uint32_t Scalar1VariableSlot = 2;
|
||||
static const uint32_t BaseIdVariableSlot = 3;
|
||||
static const uint32_t MajorStrideVariableSlot = 4;
|
||||
static const uint32_t ArrayVariableSlot = 8;
|
||||
static const uint32_t TextureTypeVariableSlot = 9;
|
||||
static const uint32_t BufferPointerByteOffsetVariableSlot = 9;
|
||||
static const uint32_t BufferPointerTypeIdVariableSlot = 10;
|
||||
static const uint32_t SSBOVariableSlot = 11;
|
||||
|
||||
static ShaderVariable *pointerIfMutable(const ShaderVariable &var)
|
||||
{
|
||||
return NULL;
|
||||
@@ -1402,6 +1415,16 @@ ShaderVariable Debugger::MakeCompositePointer(const ShaderVariable &base, Id id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t Debugger::GetPointerByteOffset(const ShaderVariable &ptr) const
|
||||
{
|
||||
return ptr.value.u64v[BufferPointerByteOffsetVariableSlot];
|
||||
}
|
||||
|
||||
DebugAPIWrapper::TextureType Debugger::GetTextureType(const ShaderVariable &img) const
|
||||
{
|
||||
return (DebugAPIWrapper::TextureType)img.value.u64v[TextureTypeVariableSlot];
|
||||
}
|
||||
|
||||
ShaderVariable Debugger::GetPointerValue(const ShaderVariable &ptr) const
|
||||
{
|
||||
// opaque pointers display as their inner value
|
||||
|
||||
Reference in New Issue
Block a user