added sk_LastFragColor
Bug: skia:
Change-Id: If64d8281beb8b7687db629eef2e956974ee9a979
Reviewed-on: https://skia-review.googlesource.com/121343
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index 9afd470..895d344 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -106,7 +106,7 @@
shaderCaps->fbFetchExtensionString());
// Some versions of this extension string require declaring custom color output on ES 3.0+
- const char* fbFetchColorName = shaderCaps->fbFetchColorName();
+ const char* fbFetchColorName = "sk_LastFragColor";
if (shaderCaps->fbFetchNeedsCustomOutput()) {
this->enableCustomOutput();
fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOut_TypeModifier);
diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h
index 0ed6a3b..7a188e0 100644
--- a/src/sksl/SkSLCompiler.h
+++ b/src/sksl/SkSLCompiler.h
@@ -25,6 +25,7 @@
#define SK_TRANSFORMEDCOORDS2D_BUILTIN 10005
#define SK_TEXTURESAMPLERS_BUILTIN 10006
#define SK_OUT_BUILTIN 10007
+#define SK_LASTFRAGCOLOR_BUILTIN 10008
#define SK_FRAGCOORD_BUILTIN 15
#define SK_VERTEXID_BUILTIN 42
#define SK_INSTANCEID_BUILTIN 43
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 43c1c95..0ee0afa 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -694,6 +694,9 @@
case SK_INVOCATIONID_BUILTIN:
this->write("gl_InvocationID");
break;
+ case SK_LASTFRAGCOLOR_BUILTIN:
+ this->write(fProgram.fSettings.fCaps->fbFetchColorName());
+ break;
default:
this->write(ref.fVariable.fName);
}
diff --git a/src/sksl/sksl_frag.inc b/src/sksl/sksl_frag.inc
index e96165b..429d05a 100644
--- a/src/sksl/sksl_frag.inc
+++ b/src/sksl/sksl_frag.inc
@@ -9,13 +9,11 @@
// adding them to the symbol table. This works fine in GLSL (where they do not
// require any further handling) but will fail in SPIR-V. We'll have a better
// solution for this soon.
-layout(builtin=9999) float4 gl_LastFragData[1];
-layout(builtin=9999) half4 gl_LastFragColor;
-layout(builtin=9999) half4 gl_LastFragColorARM;
layout(builtin=9999) int gl_SampleMaskIn[1];
layout(builtin=9999) out int gl_SampleMask[1];
layout(builtin=9999) out half4 gl_SecondaryFragColorEXT;
layout(location=0,index=0,builtin=10001) out half4 sk_FragColor;
+layout(builtin=10008) half4 sk_LastFragColor;
)