Match SPIR-V debugger structs change in GL shader debugging

This commit is contained in:
baldurk
2026-08-11 16:50:13 +01:00
parent e807742444
commit 717d23e770
3 changed files with 34 additions and 28 deletions
+10 -5
View File
@@ -2463,10 +2463,12 @@ struct ResultData
uvec4 helperBallot;
uint numSubgroups;
// split out because we use std140 packing which won't pack {uint, uvec3}
uint shadRate; // unused, matches declaration & vulkan
uint pad1;
uint pad2;
uint pad3;
// padding so overall struct size is 8-byte aligned for if LaneData contains 8-byte data
uvec4 paddingForDoubles;
LaneData laneData[NUMLANES];
};
@@ -2479,6 +2481,9 @@ layout(std140) buffer Output
uint hit_count;
uint total_count;
uvec2 pad;
// extra padding so the offset of ResultData is 8-byte aligned in case we have user 8-byte inputs
uvec4 paddingForDoubles;
ResultData hits[];
} outbuffer;
@@ -3133,7 +3138,7 @@ ShaderDebugTrace *GLReplay::DebugVertex(uint32_t eventId, uint32_t vertid, uint3
(void)hit_count;
// RDCASSERTMSG("Should only get one hit for vertex shaders", hit_count == 1, hit_count);
base += sizeof(Vec4f);
base += offsetof(rdcspv::ResultBaseBuffer, hits);
rdcspv::ResultDataBase *winner = (rdcspv::ResultDataBase *)base;
@@ -3547,7 +3552,7 @@ ShaderDebugTrace *GLReplay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t y,
hit_count = maxHits;
}
base += sizeof(Vec4f);
base += offsetof(rdcspv::ResultBaseBuffer, hits);
rdcspv::ResultDataBase *winner = NULL;
@@ -4007,7 +4012,7 @@ ShaderDebugTrace *GLReplay::DebugThread(uint32_t eventId, const rdcfixedarray<ui
hit_count = maxHits;
}
base += sizeof(Vec4f);
base += offsetof(rdcspv::ResultBaseBuffer, hits);
rdcspv::ResultDataBase *winner = (rdcspv::ResultDataBase *)base;
@@ -193,6 +193,20 @@ struct ResultDataBase
// each LaneData is prefixed by the subgroup struct below if needed, and then the stage struct unconditionally
};
struct ResultBaseBuffer
{
uint32_t hit_count;
uint32_t total_count;
uint32_t dummy;
uint32_t padding;
// extra padding so the offset of ResultData is 8-byte aligned in case we have user 8-byte inputs
Vec4u paddingForDoubles;
// dummy entry, used only for offsets of ResultData hits[];
byte hits;
};
// things we need per-lane with subgroups active, before any per-stage data
struct SubgroupLaneData
{
+10 -23
View File
@@ -53,20 +53,6 @@ struct hash<ShaderBuiltin>
};
}
struct HitStorage
{
uint32_t hit_count;
uint32_t total_count;
uint32_t dummy;
uint32_t padding;
// extra padding so the offset of LaneData is 8-byte aligned in case we have user 8-byte inputs
Vec4u paddingForDoubles;
// dummy entry, used only for offsets of LaneData hits[];
byte hits;
};
// should match the descriptor set layout created in ShaderDebugData::Init()
enum class ShaderDebugBind
{
@@ -4408,12 +4394,13 @@ static void CreateInputFetcher(rdcarray<uint32_t> &spv, const rdcarray<SpecConst
RDCASSERT((resultStride % paramAlign) == 0);
rdcspv::Id bufBase = editor.DeclareStructType(
"__rd_HitStorage", {
{uint32Type, "hit_count", offsetof(HitStorage, hit_count)},
{uint32Type, "total_count", offsetof(HitStorage, total_count)},
{uint32Type, "dummy", offsetof(HitStorage, dummy)},
{ResultDataRTArray, "hits", offsetof(HitStorage, hits)},
});
"__rd_ResultBaseBuffer",
{
{uint32Type, "hit_count", offsetof(rdcspv::ResultBaseBuffer, hit_count)},
{uint32Type, "total_count", offsetof(rdcspv::ResultBaseBuffer, total_count)},
{uint32Type, "dummy", offsetof(rdcspv::ResultBaseBuffer, dummy)},
{ResultDataRTArray, "hits", offsetof(rdcspv::ResultBaseBuffer, hits)},
});
rdcspv::StorageClass bufferClass = editor.PrepareAddedBufferAccess();
@@ -5759,7 +5746,7 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
RDCASSERTMSG("Should only get one hit for vertex shaders", hit_count == 1, hit_count);
base += offsetof(HitStorage, hits);
base += offsetof(rdcspv::ResultBaseBuffer, hits);
rdcspv::ResultDataBase *winner = (rdcspv::ResultDataBase *)base;
@@ -6344,7 +6331,7 @@ ShaderDebugTrace *VulkanReplay::DebugPixel(uint32_t eventId, uint32_t x, uint32_
hit_count = overdrawLevels;
}
base += offsetof(HitStorage, hits);
base += offsetof(rdcspv::ResultBaseBuffer, hits);
rdcspv::ResultDataBase *winner = NULL;
@@ -6900,7 +6887,7 @@ ShaderDebugTrace *VulkanReplay::DebugComputeCommon(ShaderStage stage, uint32_t e
hit_count = maxHits;
}
base += offsetof(HitStorage, hits);
base += offsetof(rdcspv::ResultBaseBuffer, hits);
rdcspv::ResultDataBase *winner = (rdcspv::ResultDataBase *)base;