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>
This commit is contained in:
Brian Osman 2020-10-20 14:24:25 -04:00 committed by Skia Commit-Bot
parent 838d71d93f
commit 2d2f82c00a
2 changed files with 2 additions and 2 deletions

View File

@ -1495,8 +1495,7 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) {
this->writeVarDeclaration(decl, true);
this->writeLine();
} else if (builtin == SK_FRAGCOLOR_BUILTIN &&
fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput() &&
decl.var().writeCount()) {
fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput()) {
if (fProgram.fSettings.fFragColorIsInOut) {
this->write("inout ");
} else {

View File

@ -1,4 +1,5 @@
out vec4 sk_FragColor;
void main() {
{
discard;