Skip to content

Commit 2d2f82c

Browse files
brianosmanSkia Commit-Bot
authored andcommitted
Always declare sk_FragColor in GLSL, even if unused
PLS and discard-only shaders are the only time this has an impact, and it doesn't seem like a problem to have the declaration? Removes one use of variable reference counts, which are going to be refactored. Change-Id: Idb8d06087eed56070252ee02dcf907bf0d24c5a1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328796 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
1 parent 838d71d commit 2d2f82c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sksl/SkSLGLSLCodeGenerator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,8 +1495,7 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) {
14951495
this->writeVarDeclaration(decl, true);
14961496
this->writeLine();
14971497
} else if (builtin == SK_FRAGCOLOR_BUILTIN &&
1498-
fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput() &&
1499-
decl.var().writeCount()) {
1498+
fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput()) {
15001499
if (fProgram.fSettings.fFragColorIsInOut) {
15011500
this->write("inout ");
15021501
} else {

tests/sksl/shared/golden/Discard.glsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
out vec4 sk_FragColor;
23
void main() {
34
{
45
discard;

0 commit comments

Comments
 (0)