skia2/resources/sksl/runtime/Commutative.rts
John Stiles dfe33f49f5 Add a setting to disable SkVM variable traces.
This will allow the visualizer to see line-number information without
incurring the code bloat caused by trace_var.

For reference, Commutative.skvm with no debug traces:
https://osscs.corp.google.com/skia/skia/+/main:tests/sksl/runtime/Commutative.skvm;drc=c809e5ba9fc9bc67291d088c448ed0057371b760

Change-Id: If98b5e102571d7fe06a1653d199e3ae035b3cb78
Bug: skia:12692
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478417
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-01 17:25:59 +00:00

49 lines
1.1 KiB
Plaintext

/*#pragma settings SkVMDebugTrace NoES2Restrictions NoTraceVarInSkVMDebugTrace*/
// We use bitwise ops below, which SkVM supports but ES2 technically does not.
uniform half4 colorGreen, colorRed;
uniform int a, b;
uniform float c, d;
half4 main(float2 xy) {
bool ok = true;
int a_and_b = a & b;
int b_and_a = b & a;
ok = ok && (a_and_b == b_and_a);
int a_or_b = a | b;
int b_or_a = b | a;
ok = ok && (a_or_b == b_or_a);
int a_xor_b = a ^ b;
int b_xor_a = b ^ a;
ok = ok && (a_xor_b == b_xor_a);
bool a_eq_b = a == b;
bool b_eq_a = b == a;
ok = ok && (a_eq_b == b_eq_a);
bool a_neq_b = a != b;
bool b_neq_a = b != a;
ok = ok && (a_neq_b == b_neq_a);
int a_add_b = a + b;
int b_add_a = b + a;
ok = ok && (a_add_b == b_add_a);
float c_add_d = c + d;
float d_add_c = d + c;
ok = ok && (c_add_d == d_add_c);
int a_mul_b = a * b;
int b_mul_a = b * a;
ok = ok && (a_mul_b == b_mul_a);
float c_mul_d = c * d;
float d_mul_c = d * c;
ok = ok && (c_mul_d == d_mul_c);
return ok ? colorGreen : colorRed;
}