Remove SkSL shade/blend/filter intrinsics

Bug: skia:12302
Change-Id: I4ff394f1f9d93d2def19a9f9d49cb208651aff10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445639
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2021-09-03 10:47:37 -04:00 committed by SkCQ
parent 3e4ccf17c3
commit 33e0f9aa49
6 changed files with 64 additions and 173 deletions

View File

@ -1,4 +1,4 @@
// Expect 36 errors
// Expect 24 errors
uniform shader s;
uniform colorFilter f;
@ -22,41 +22,6 @@ half4 sample_blender_color() { return sample(b, color); }
half4 sample_blender_xy() { return sample(b, xy); }
half4 sample_blender_xy_color() { return sample(b, xy, color); }
// Same as above, but using the type-specific functions (shade, filter, blend):
half4 shade_shader_xy_color() { return shade(s, xy, color); }
half4 shade_shader_color() { return shade(s, color); }
half4 shade_shader_color_xy() { return shade(s, color, xy); }
half4 shade_shader_empty() { return shade(s); }
half4 shade_shader_matrix() { return shade(s, float3x3(1)); }
half4 filter_colorFilter_empty() { return filter(f); }
half4 filter_colorFilter_xy() { return filter(f, xy); }
half4 filter_colorFilter_xy_color() { return filter(f, xy, color); }
half4 blend_blender_empty() { return blend(b); }
half4 blend_blender_color() { return blend(b, color); }
half4 blend_blender_xy() { return blend(b, xy); }
half4 blend_blender_xy_color() { return blend(b, xy, color); }
// Try to invoke a child with the wrong type-specific function, with either
// argument list (aligned to function, or child type):
half4 blend_shader_b() { return blend(s, color, color); }
half4 blend_shader_s() { return blend(s, xy); }
half4 filter_shader_f() { return filter(s, color); }
half4 filter_shader_s() { return filter(s, xy); }
half4 blend_colorFilter_b() { return blend(f, color, color); }
half4 blend_colorFilter_f() { return blend(f, color); }
half4 shade_colorFilter_s() { return shade(f, xy); }
half4 shade_colorFilter_f() { return shade(f, color); }
half4 filter_blender_f() { return filter(b, color); }
half4 filter_blender_b() { return filter(b, color, color); }
half4 shade_blender_s() { return shade(b, xy); }
half4 shade_blender_b() { return shade(b, color, color); }
// Using .eval()
half4 eval_shader_xy_color() { return s.eval(xy, color); }
@ -76,10 +41,6 @@ half4 eval_blender_xy_color() { return b.eval(xy, color); }
// Correct usage (EXPECT NO ERRORS)
half4 blend_blender() { return blend(b, color, color); }
half4 filter_colorFilter() { return filter(f, color); }
half4 shade_shader() { return shade(s, xy); }
half4 eval_blender() { return b.eval(color, color); }
half4 eval_colorFilter() { return f.eval(color); }
half4 eval_shader() { return s.eval(xy); }

View File

@ -21,7 +21,6 @@
SKSL_INTRINSIC(atanh) \
SKSL_INTRINSIC(atan) \
SKSL_INTRINSIC(bitCount) \
SKSL_INTRINSIC(blend) \
SKSL_INTRINSIC(ceil) \
SKSL_INTRINSIC(clamp) \
SKSL_INTRINSIC(cosh) \
@ -38,7 +37,6 @@
SKSL_INTRINSIC(exp2) \
SKSL_INTRINSIC(exp) \
SKSL_INTRINSIC(faceforward) \
SKSL_INTRINSIC(filter) \
SKSL_INTRINSIC(findLSB) \
SKSL_INTRINSIC(findMSB) \
SKSL_INTRINSIC(floatBitsToInt) \
@ -87,7 +85,6 @@
SKSL_INTRINSIC(round) \
SKSL_INTRINSIC(sample) \
SKSL_INTRINSIC(saturate) \
SKSL_INTRINSIC(shade) \
SKSL_INTRINSIC(sign) \
SKSL_INTRINSIC(sinh) \
SKSL_INTRINSIC(sin) \

View File

@ -1,4 +1,4 @@
static uint8_t SKSL_INCLUDE_sksl_public[] = {140,3,
static uint8_t SKSL_INCLUDE_sksl_public[] = {121,3,
7,100,101,103,114,101,101,115,
8,36,103,101,110,84,121,112,101,
7,114,97,100,105,97,110,115,
@ -121,18 +121,15 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {140,3,
6,115,104,97,100,101,114,
6,99,111,111,114,100,115,
6,102,108,111,97,116,50,
5,115,104,97,100,101,
6,115,97,109,112,108,101,
1,102,
11,99,111,108,111,114,70,105,108,116,101,114,
6,102,105,108,116,101,114,
1,98,
7,98,108,101,110,100,101,114,
3,115,114,99,
3,100,115,116,
5,98,108,101,110,100,
6,115,97,109,112,108,101,
5,36,101,118,97,108,
48,62,2,
48,52,2,
52,1,0,
17,2,0,
49,2,0,10,0,3,
@ -1957,101 +1954,71 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {140,3,
17,78,3,2,60,2,62,2,
46,44,2,
52,65,2,
17,84,3,
49,66,2,86,3,3,
17,85,3,
49,66,2,87,3,3,
52,67,2,
17,15,3,
46,44,2,3,
29,68,2,
17,98,3,2,65,2,67,2,
51,68,2,2,
46,64,2,
29,69,2,
17,78,3,2,65,2,67,2,
46,44,2,
52,69,2,
17,105,3,
49,70,2,107,3,3,
52,71,2,
17,115,3,
46,44,2,3,
46,69,2,
52,70,2,
17,99,3,
49,71,2,101,3,3,
52,72,2,
17,119,3,
17,109,3,
46,44,2,3,
29,73,2,
17,123,3,3,69,2,71,2,72,2,
52,73,2,
17,113,3,
46,44,2,3,
51,74,2,3,
46,64,2,
46,69,2,
29,75,2,
17,78,3,3,70,2,72,2,73,2,
46,44,2,
52,74,2,
17,55,3,
46,61,2,3,
52,75,2,
46,75,2,
52,76,2,
17,64,3,
46,63,2,3,
29,76,2,
17,129,3,2,74,2,75,2,
46,44,2,
52,77,2,
17,84,3,
46,66,2,3,
52,78,2,
17,15,3,
46,44,2,3,
51,79,2,2,
46,76,2,
29,80,2,
17,129,3,2,77,2,78,2,
46,44,2,
46,80,2,
52,81,2,
17,105,3,
46,70,2,3,
52,82,2,
17,115,3,
46,44,2,3,
52,83,2,
17,119,3,
46,44,2,3,
51,84,2,3,
46,76,2,
46,80,2,
29,85,2,
17,129,3,3,81,2,82,2,83,2,
46,44,2,
46,85,2,
52,86,2,
17,64,3,
46,63,2,3,
52,87,2,
17,55,3,
46,61,2,3,
29,88,2,
17,136,3,2,86,2,87,2,
29,78,2,
17,117,3,2,76,2,77,2,
46,44,2,
52,89,2,
52,79,2,
17,15,3,
46,44,2,3,
52,90,2,
17,84,3,
52,80,2,
17,85,3,
46,66,2,3,
51,91,2,2,
46,88,2,
29,92,2,
17,136,3,2,89,2,90,2,
51,81,2,2,
46,78,2,
29,82,2,
17,117,3,2,79,2,80,2,
46,44,2,
46,92,2,
52,93,2,
17,115,3,
46,82,2,
52,83,2,
17,109,3,
46,44,2,3,
52,94,2,
17,119,3,
52,84,2,
17,113,3,
46,44,2,3,
52,95,2,
17,105,3,
46,70,2,3,
51,96,2,3,
46,88,2,
46,92,2,
29,97,2,
17,136,3,3,93,2,94,2,95,2,
52,85,2,
17,99,3,
46,71,2,3,
51,86,2,3,
46,78,2,
46,82,2,
29,87,2,
17,117,3,3,83,2,84,2,85,2,
46,44,2,
46,97,2,72,0,
60,2,
46,87,2,69,0,
50,2,
118,0,
33,0,
71,0,
@ -2061,7 +2028,6 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {140,3,
66,0,
46,0,
76,0,
37,2,
133,0,
53,1,
18,0,
@ -2077,7 +2043,6 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {140,3,
88,0,
98,0,
113,1,
33,2,
7,1,
9,1,
128,0,
@ -2108,9 +2073,8 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {140,3,
129,1,
22,1,
27,1,
48,2,
38,2,
207,0,
30,2,
123,0,
13,0,
51,0,

View File

@ -876,10 +876,7 @@ std::unique_ptr<Expression> FunctionCall::Convert(const Context& context,
}
switch (function.intrinsicKind()) {
case k_blend_IntrinsicKind:
case k_sample_IntrinsicKind:
case k_shade_IntrinsicKind:
case k_filter_IntrinsicKind: {
case k_sample_IntrinsicKind: {
if (arguments.size() >= 1 && arguments[0]->type().isEffectChild()) {
// Translate these intrinsic calls into a ChildCall, which simplifies handling in
// the generators and analysis code

View File

@ -207,10 +207,6 @@ $es3 $genHType dFdx($genHType p);
$es3 $genHType dFdy($genHType p);
// SkSL intrinsics that reflect Skia's C++ object model:
half4 shade(shader s, float2 coords);
half4 filter(colorFilter f, half4 color);
half4 blend(blender b, half4 src, half4 dst);
half4 sample(shader s, float2 coords);
half4 sample(colorFilter f, half4 color);
half4 sample(blender b, half4 src, half4 dst);

View File

@ -12,40 +12,16 @@ error: 20: no match for sample(blender)
error: 21: no match for sample(blender, half4)
error: 22: no match for sample(blender, float2)
error: 23: no match for sample(blender, float2, half4)
error: 27: call to 'shade' expected 2 arguments, but found 3
error: 28: expected 'float2', but found 'half4'
error: 29: call to 'shade' expected 2 arguments, but found 3
error: 30: call to 'shade' expected 2 arguments, but found 1
error: 31: expected 'float2', but found 'float3x3'
error: 33: call to 'filter' expected 2 arguments, but found 1
error: 34: expected 'half4', but found 'float2'
error: 35: call to 'filter' expected 2 arguments, but found 3
error: 37: call to 'blend' expected 3 arguments, but found 1
error: 38: call to 'blend' expected 3 arguments, but found 2
error: 39: call to 'blend' expected 3 arguments, but found 2
error: 40: expected 'half4', but found 'float2'
error: 45: expected 'blender', but found 'shader'
error: 46: call to 'blend' expected 3 arguments, but found 2
error: 47: expected 'colorFilter', but found 'shader'
error: 48: expected 'colorFilter', but found 'shader'
error: 50: expected 'blender', but found 'colorFilter'
error: 51: call to 'blend' expected 3 arguments, but found 2
error: 52: expected 'shader', but found 'colorFilter'
error: 53: expected 'shader', but found 'colorFilter'
error: 55: expected 'colorFilter', but found 'blender'
error: 56: call to 'filter' expected 2 arguments, but found 3
error: 57: expected 'shader', but found 'blender'
error: 58: call to 'shade' expected 2 arguments, but found 3
error: 62: no match for shader::eval(float2, half4)
error: 63: no match for shader::eval(half4)
error: 64: no match for shader::eval(half4, float2)
error: 65: no match for shader::eval()
error: 66: no match for shader::eval(float3x3)
error: 68: no match for colorFilter::eval()
error: 69: no match for colorFilter::eval(float2)
error: 70: no match for colorFilter::eval(float2, half4)
error: 72: no match for blender::eval()
error: 73: no match for blender::eval(half4)
error: 74: no match for blender::eval(float2)
error: 75: no match for blender::eval(float2, half4)
48 errors
error: 27: no match for shader::eval(float2, half4)
error: 28: no match for shader::eval(half4)
error: 29: no match for shader::eval(half4, float2)
error: 30: no match for shader::eval()
error: 31: no match for shader::eval(float3x3)
error: 33: no match for colorFilter::eval()
error: 34: no match for colorFilter::eval(float2)
error: 35: no match for colorFilter::eval(float2, half4)
error: 37: no match for blender::eval()
error: 38: no match for blender::eval(half4)
error: 39: no match for blender::eval(float2)
error: 40: no match for blender::eval(float2, half4)
24 errors