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 -6
View File
@@ -694,13 +694,17 @@ rdcstr ShaderProcessingTool::DefaultArguments() const
{
if(tool == KnownShaderTool::SPIRV_Cross)
return "--vulkan-semantics --entry {entry_point} --stage {glsl_stage4}";
else if(tool == KnownShaderTool::spirv_dis)
else if(tool == KnownShaderTool::SPIRV_Cross_OpenGL)
return "--entry {entry_point} --stage {glsl_stage4}";
else if(tool == KnownShaderTool::spirv_dis || tool == KnownShaderTool::spirv_dis_OpenGL)
return "--no-color";
else if(tool == KnownShaderTool::glslangValidatorGLSL)
return "-g -V -S {glsl_stage4}";
else if(tool == KnownShaderTool::glslangValidatorGLSL_OpenGL)
return "-g -G -S {glsl_stage4}";
else if(tool == KnownShaderTool::glslangValidatorHLSL)
return "-D -g -V -S {glsl_stage4} -e {entry_point}";
else if(tool == KnownShaderTool::spirv_as)
else if(tool == KnownShaderTool::spirv_as || tool == KnownShaderTool::spirv_as_OpenGL)
return "";
else if(tool == KnownShaderTool::dxcSPIRV)
return "-T {hlsl_stage2}_6_0 -E {entry_point} -spirv";
@@ -714,15 +718,16 @@ rdcstr ShaderProcessingTool::DefaultArguments() const
rdcstr ShaderProcessingTool::IOArguments() const
{
if(tool == KnownShaderTool::SPIRV_Cross)
if(tool == KnownShaderTool::SPIRV_Cross || tool == KnownShaderTool::SPIRV_Cross_OpenGL)
return "--output {output_file} {input_file}";
else if(tool == KnownShaderTool::spirv_dis)
else if(tool == KnownShaderTool::spirv_dis || tool == KnownShaderTool::spirv_dis_OpenGL)
return "-o {output_file} {input_file}";
else if(tool == KnownShaderTool::glslangValidatorGLSL)
else if(tool == KnownShaderTool::glslangValidatorGLSL ||
tool == KnownShaderTool::glslangValidatorGLSL_OpenGL)
return "-o {output_file} {input_file}";
else if(tool == KnownShaderTool::glslangValidatorHLSL)
return "-o {output_file} {input_file}";
else if(tool == KnownShaderTool::spirv_as)
else if(tool == KnownShaderTool::spirv_as || tool == KnownShaderTool::spirv_as_OpenGL)
return "-o {output_file} {input_file}";
else if(tool == KnownShaderTool::dxcSPIRV)
return "-Fo {output_file} {input_file}";