Create virtual distinction between Vulkan & GL SPIR-V. Closes #2798

* This distinction unfortunately does not exist in SPIR-V so we have to carry
  around this metadata ourselves. Rather than allowing free specification of
  tools based on API, instead pretend that Vulkan and GL SPIR-V are separate
  format, and duplicate all SPIR-V tools to handle "both" types. This allows
  appropriate tool selection based on the encoding.
This commit is contained in:
baldurk
2022-12-27 13:39:44 +00:00
parent b5545d52f8
commit 0acb955e19
13 changed files with 151 additions and 63 deletions
+11 -3
View File
@@ -446,7 +446,7 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
// add any custom decompiling tools we have after the first one
for(const ShaderProcessingTool &d : m_Ctx.Config().ShaderProcessors)
{
if(d.input == m_ShaderDetails->encoding)
if(d.input == m_ShaderDetails->encoding && IsTextRepresentation(d.output))
targetNames << targetName(d);
}
}
@@ -5391,7 +5391,7 @@ float2 RD_SelectedRange();
)");
}
else if(encoding == ShaderEncoding::SPIRVAsm)
else if(encoding == ShaderEncoding::SPIRVAsm || encoding == ShaderEncoding::OpenGLSPIRVAsm)
{
text = lit("; Can't insert snippets for SPIR-V ASM");
}
@@ -5417,7 +5417,7 @@ SamplerState linearSampler : register(RD_LINEAR_SAMPLER_BINDING);
)"));
}
else
else if(encoding == ShaderEncoding::GLSL)
{
insertSnippet(lit(R"(
@@ -5435,6 +5435,10 @@ layout(binding = RD_LINEAR_SAMPLER_BINDING) uniform sampler linearSampler;
/////////////////////////////////////
)"));
}
else if(encoding == ShaderEncoding::SPIRVAsm || encoding == ShaderEncoding::OpenGLSPIRVAsm)
{
insertSnippet(lit("; Can't insert snippets for SPIR-V ASM"));
}
}
void ShaderViewer::snippet_resources()
@@ -5538,6 +5542,10 @@ layout (binding = RD_UINT_2DMS_BINDING) uniform usampler2DMS texUInt2DMS;
/////////////////////////////////////
)"));
}
else if(encoding == ShaderEncoding::SPIRVAsm || encoding == ShaderEncoding::OpenGLSPIRVAsm)
{
insertSnippet(lit("; Can't insert snippets for SPIR-V ASM"));
}
}
bool ShaderViewer::eventFilter(QObject *watched, QEvent *event)