Add input fetcher generation for GL shader debugging

This commit is contained in:
baldurk
2025-11-17 14:36:25 +00:00
parent 55e8c42f50
commit 02096dd75e
10 changed files with 915 additions and 44 deletions
+1
View File
@@ -479,6 +479,7 @@ set(data
data/glsl/vk_depthbuf2ms.frag
data/glsl/debug_math.comp
data/glsl/debug_sample.frag
data/hlsl/quadswizzle.hlsl
data/sourcecodepro.ttf
driver/vulkan/renderdoc.json)
+1
View File
@@ -77,5 +77,6 @@ DECLARE_EMBED(glsl_depth_copy_frag);
DECLARE_EMBED(glsl_depth_copyms_frag);
DECLARE_EMBED(glsl_debug_math_comp);
DECLARE_EMBED(glsl_debug_sample_frag);
DECLARE_EMBED(hlsl_quadswizzle_hlsl);
#undef DECLARE_EMBED
+9
View File
@@ -38,12 +38,16 @@
HEADER(gl_texsample) \
HEADER(gles_texsample)
#define HLSL_HEADERS(HEADER) HEADER(quadswizzle)
class EmbeddedIncluder : public glslang::TShader::Includer
{
#define DECL(header) rdcstr header = GetEmbeddedResource(CONCAT(glsl_, CONCAT(header, _h)));
GLSL_HEADERS(DECL)
#undef DECL
rdcstr quadswizzle = GetEmbeddedResource(hlsl_quadswizzle_hlsl);
public:
// For the "system" or <>-style includes; search the "system" paths.
virtual IncludeResult *includeSystem(const char *headerName, const char *includerName,
@@ -55,6 +59,11 @@ public:
GLSL_HEADERS(GET)
#undef GET
if(!strcmp(headerName, "quadswizzle.hlsl"))
{
return new IncludeResult("quadswizzle.hlsl", quadswizzle.data(), quadswizzle.length(), NULL);
}
return NULL;
}
+6 -6
View File
@@ -30,13 +30,13 @@ float4 quadSwizzleHelper(float4 c0, uint quadLaneIndex, uint readIndex)
bool readX = ((readIndex & 1u) != 0u);
bool readY = ((readIndex & 2u) != 0u);
float4 sign_x = 1.0f;
float4 sign_x = float4(0, 0, 0, 0);
sign_x.x = quadX ? -1.0f : 1.0f;
sign_x.y = quadX ? -1.0f : 1.0f;
sign_x.z = quadX ? -1.0f : 1.0f;
sign_x.w = quadX ? -1.0f : 1.0f;
float4 sign_y = 1.0f;
float4 sign_y = float4(0, 0, 0, 0);
sign_y.x = quadY ? -1.0f : 1.0f;
sign_y.y = quadY ? -1.0f : 1.0f;
sign_y.z = quadY ? -1.0f : 1.0f;
@@ -96,20 +96,20 @@ uint quadSwizzleHelper(uint c0, uint quadLaneIndex, uint readIndex)
int4 quadSwizzleHelper(int4 c0, uint quadLaneIndex, uint readIndex)
{
return uint4(quadSwizzleHelper(float4(c0), quadLaneIndex, readIndex));
return int4(quadSwizzleHelper(float4(c0), quadLaneIndex, readIndex));
}
int3 quadSwizzleHelper(int3 c0, uint quadLaneIndex, uint readIndex)
{
return uint3(quadSwizzleHelper(float3(c0), quadLaneIndex, readIndex));
return int3(quadSwizzleHelper(float3(c0), quadLaneIndex, readIndex));
}
int2 quadSwizzleHelper(int2 c0, uint quadLaneIndex, uint readIndex)
{
return uint2(quadSwizzleHelper(float2(c0), quadLaneIndex, readIndex));
return int2(quadSwizzleHelper(float2(c0), quadLaneIndex, readIndex));
}
int quadSwizzleHelper(int c0, uint quadLaneIndex, uint readIndex)
{
return uint(quadSwizzleHelper(float(c0), quadLaneIndex, readIndex));
return int(quadSwizzleHelper(float(c0), quadLaneIndex, readIndex));
}
+1 -1
View File
@@ -118,7 +118,7 @@ RESOURCE_shaderdebug_hlsl TYPE_EMBED "hlsl/shaderdebug.hlsl"
RESOURCE_d3d12_pixelhistory_hlsl TYPE_EMBED "hlsl/d3d12_pixelhistory.hlsl"
RESOURCE_depth_copy_hlsl TYPE_EMBED "hlsl/depth_copy.hlsl"
RESOURCE_raytracing_hlsl TYPE_EMBED "hlsl/raytracing.hlsl"
RESOURCE_quadswizzle_hlsl TYPE_EMBED "hlsl/quadswizzle.hlsl"
RESOURCE_hlsl_quadswizzle_hlsl TYPE_EMBED "hlsl/quadswizzle.hlsl"
#ifdef RENDERDOC_BAKED_DXC_SHADERS
+1 -1
View File
@@ -21,7 +21,7 @@
#define RESOURCE_d3d12_pixelhistory_hlsl 119
#define RESOURCE_depth_copy_hlsl 120
#define RESOURCE_raytracing_hlsl 121
#define RESOURCE_quadswizzle_hlsl 131
#define RESOURCE_hlsl_quadswizzle_hlsl 131
#define RESOURCE_fixedcol_0_dxbc 113
#define RESOURCE_fixedcol_1_dxbc 114
+1
View File
@@ -760,6 +760,7 @@ extern bool IsGLES;
EXT_TO_CHECK(43, 31, ARB_compute_shader) \
EXT_TO_CHECK(43, 32, ARB_copy_image) \
EXT_TO_CHECK(43, 30, ARB_ES3_compatibility) \
EXT_TO_CHECK(45, 31, ARB_ES3_1_compatibility) \
EXT_TO_CHECK(43, 30, ARB_invalidate_subdata) \
EXT_TO_CHECK(43, 99, ARB_internalformat_query2) \
EXT_TO_CHECK(43, 31, ARB_program_interface_query) \
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -390,7 +390,7 @@ void CreateLegacyInputFetcher(const DXBC::DXBCContainer *dxbc, const InputFetche
// work around NV driver bug - it miscompiles the quad swizzle helper sometimes, so use the wave op instead
if(!dxil || !cfg.waveOps)
fetcher.hlsl += GetEmbeddedResource(quadswizzle_hlsl);
fetcher.hlsl += GetEmbeddedResource(hlsl_quadswizzle_hlsl);
else
fetcher.hlsl +=
"#define quadSwizzleHelper(value, quadLaneIndex, readIndex) "
@@ -574,6 +574,14 @@ public:
return empty;
return it->second;
}
const DataType &GetDataType(Id id) const
{
static DataType empty;
auto it = dataTypes.find(id);
if(it == dataTypes.end())
return empty;
return it->second;
}
const Decorations &GetDecorations(Id id) const { return decorations[id]; };
const rdcarray<uint32_t> &GetSPIRV() const { return m_SPIRV; }
protected: