Updated spirv-cross.

This commit is contained in:
Бранимир Караџић
2025-02-08 17:24:43 -08:00
parent 1687187482
commit c3bc3ada4d
6 changed files with 51 additions and 5 deletions

View File

@@ -9824,7 +9824,17 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
case BuiltInInvocationId:
return "gl_InvocationID";
case BuiltInLayer:
{
auto model = get_execution_model();
if (model == ExecutionModelVertex || model == ExecutionModelTessellationEvaluation)
{
if (options.es)
require_extension_internal("GL_NV_viewport_array2");
else
require_extension_internal("GL_ARB_shader_viewport_layer_array");
}
return "gl_Layer";
}
case BuiltInViewportIndex:
return "gl_ViewportIndex";
case BuiltInTessLevelOuter:
@@ -17869,6 +17879,14 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
case SPIRBlock::Unreachable:
{
// If the entry point ends with unreachable and has a return value, insert a return
// statement to avoid potential compiler errors from non-void functions without a return value.
if (block.return_value)
{
statement("return ", to_unpacked_expression(block.return_value), ";");
break;
}
// Avoid emitting false fallthrough, which can happen for
// if (cond) break; else discard; inside a case label.
// Discard is not always implementable as a terminator.