diff options
Diffstat (limited to 'src/sksl')
-rw-r--r-- | src/sksl/README | 4 | ||||
-rw-r--r-- | src/sksl/SkSLCompiler.h | 1 | ||||
-rw-r--r-- | src/sksl/SkSLGLSLCodeGenerator.cpp | 3 | ||||
-rw-r--r-- | src/sksl/sksl_frag.inc | 2 |
4 files changed, 9 insertions, 1 deletions
diff --git a/src/sksl/README b/src/sksl/README index bb2dd05396..dd0af9825f 100644 --- a/src/sksl/README +++ b/src/sksl/README @@ -45,6 +45,8 @@ Differences from GLSL * use sk_InstanceID instead of gl_InstanceID * the fragment coordinate is sk_FragCoord, and is always relative to the upper left. +* use sk_Clockwise instead of gl_FrontFacing. This is always relative to an + upper left origin. * you do not need to include ".0" to make a number a float (meaning that "float2(x, y) * 4" is perfectly legal in SkSL, unlike GLSL where it would often have to be expressed "float2(x, y) * 4.0". There is no performance @@ -149,4 +151,4 @@ Creating a new .fp file 7. At this point you can reference the new fragment processor from within Skia. Once you have done this initial setup, simply re-build Skia to pick up any -changes to the .fp file.
\ No newline at end of file +changes to the .fp file. diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h index b55bf405bd..c840bd800f 100644 --- a/src/sksl/SkSLCompiler.h +++ b/src/sksl/SkSLCompiler.h @@ -27,6 +27,7 @@ #define SK_OUT_BUILTIN 10007 #define SK_LASTFRAGCOLOR_BUILTIN 10008 #define SK_FRAGCOORD_BUILTIN 15 +#define SK_CLOCKWISE_BUILTIN 17 #define SK_VERTEXID_BUILTIN 42 #define SK_INSTANCEID_BUILTIN 43 #define SK_CLIPDISTANCE_BUILTIN 3 diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp index 3c697d8e4b..d08c9135e1 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.cpp +++ b/src/sksl/SkSLGLSLCodeGenerator.cpp @@ -689,6 +689,9 @@ void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) { case SK_FRAGCOORD_BUILTIN: this->writeFragCoord(); break; + case SK_CLOCKWISE_BUILTIN: + this->write("gl_FrontFacing"); + break; case SK_VERTEXID_BUILTIN: this->write("gl_VertexID"); break; diff --git a/src/sksl/sksl_frag.inc b/src/sksl/sksl_frag.inc index 429d05a73e..202747a815 100644 --- a/src/sksl/sksl_frag.inc +++ b/src/sksl/sksl_frag.inc @@ -2,7 +2,9 @@ STRINGIFY( // defines built-in interfaces supported by SkiaSL fragment shaders +// See "enum SpvBuiltIn_" in ./spirv.h layout(builtin=15) in float4 sk_FragCoord; +layout(builtin=17) in bool sk_Clockwise; // Similar to gl_FrontFacing, but defined in device space. layout(builtin=3) float sk_ClipDistance[1]; // 9999 is a temporary value that causes us to ignore these declarations beyond |