From 0cea5cf37821dd2f07afd9985437e4fa8d23a23b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 1 Aug 2024 17:57:02 +0300 Subject: [PATCH] Mark storage buffers in compute shaders as outputs --- source/glsl/optimize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 51377594..d544e343 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -1485,9 +1485,10 @@ void UnusedVariableRemover::visit(VariableDeclaration &var) VariableInfo &var_info = variables[&var]; /* Mark variables as output if they're used by the next stage or the - graphics API. */ + graphics API. Also mark storage buffers as output in compute stage. */ bool builtin = (!var.name.compare(0, 3, "gl_") || (var.block_declaration && !var.block_declaration->block_name.compare(0, 3, "gl_"))); - var_info.output = (var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || builtin)); + var_info.output = ((var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || builtin)) || + (var.interface=="buffer" && stage->type==Stage::COMPUTE)); // Linked outputs are automatically referenced. if(var_info.output && var.linked_declaration) -- 2.45.2