Switched SkSL from using raw strings back to STRINGIFY

Stringify was stripping the comments from the strings, whereas raw
strings preserve them, which led to an increase in executable
size. The only effect of this change is to strip the comments back
out.

Bug: 784880
Change-Id: Icf2f9cf522cb890179f2e481a3504e8171732705
Reviewed-on: https://skia-review.googlesource.com/72524
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2017-11-16 11:20:11 -05:00 committed by Skia Commit-Bot
parent b5fb7cf016
commit 7970765f7d
7 changed files with 16 additions and 14 deletions

View File

@ -11,10 +11,10 @@ import sys
src = open(sys.argv[1], 'r')
dst = open(sys.argv[2], 'w')
dst.write('R"(')
dst.write('STRINGIFY(')
for line in src.readlines():
if not line.startswith("#"):
dst.write(line)
dst.write(')"\n')
dst.write(')\n')
src.close()
dst.close()

View File

@ -31,6 +31,8 @@
// include the built-in shader symbols as static strings
#define STRINGIFY(x) #x
static const char* SKSL_INCLUDE =
#include "sksl.include"
;

View File

@ -1,4 +1,4 @@
R"(
STRINGIFY(
// defines built-in functions supported by SkiaSL
@ -330,11 +330,11 @@ float4 subpassLoad(subpassInputMS subpass, int sample);
$gfloat4subpassLoad(gsubpassInput subpass);
$gfloat4subpassLoad(gsubpassInputMS subpass, int sample);
*/
)"
)
// split into multiple chunks, as MSVC++ complains if a single string is too long
R"(
STRINGIFY(
half4 texture($gsampler1D sampler, float2 P);
half4 texture($gsampler1D sampler, float2 P, float bias);
@ -560,4 +560,4 @@ void memoryBarrierImage();
void groupMemoryBarrier();
*/
)"
)

View File

@ -1,4 +1,4 @@
R"(
STRINGIFY(
// defines built-in interfaces supported by SkiaSL fragment shaders
@ -22,4 +22,4 @@ layout(builtin=10005) float2[] sk_TransformedCoords2D;
layout(builtin=10006) sampler2D[] sk_TextureSamplers;
half4 process(fragmentProcessor fp);
)"
)

View File

@ -1,4 +1,4 @@
R"(
STRINGIFY(
// defines built-in interfaces supported by SkiaSL fragment shaders
@ -18,4 +18,4 @@ layout(builtin=9999) out half4 gl_SecondaryFragColorEXT;
layout(location=0,index=0,builtin=10001) out half4 sk_FragColor;
)"
)

View File

@ -1,4 +1,4 @@
R"(
STRINGIFY(
// defines built-in interfaces supported by SkiaSL geometry shaders
@ -21,4 +21,4 @@ sk_has_side_effects void EndStreamPrimitive(int stream);
sk_has_side_effects void EmitVertex();
sk_has_side_effects void EndPrimitive();
)"
)

View File

@ -1,4 +1,4 @@
R"(
STRINGIFY(
// defines built-in interfaces supported by SkiaSL vertex shaders
@ -11,4 +11,4 @@ out sk_PerVertex {
layout(builtin=5) in int sk_VertexID;
layout(builtin=6) in int sk_InstanceID;
)"
)