From: Mikko Rasa Date: Thu, 1 Aug 2024 14:57:02 +0000 (+0300) Subject: Mark storage buffers in compute shaders as outputs X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=0cea5cf37821dd2f07afd9985437e4fa8d23a23b;p=libs%2Fgl.git Mark storage buffers in compute shaders as outputs --- 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)