16cbfb41df
This CL removes the bulk of the existing C++ code generator, especially all the complex format-string assembly code. It has been replaced with actual DSL code generation. Simple IR can now be successfully translated to a working DSL fragment processor. This CL also adds a simple test harness which is patterned after the existing SkSLTest; it renders a pixel, reads it back, and fails the test if the result isn't solid green (RGBA=0101). This CL doesn't implement every feature. Some obvious gaps include: - Sampling from children - Uniforms/inputs of any kind - Function calls of any kind Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709 Bug: skia:11854 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
24 lines
632 B
GLSL
24 lines
632 B
GLSL
// (This test code was largely borrowed from shared/DoWhileControlFlow.sksl.)
|
|
half4 main() {
|
|
half4 color = half4(1, 1, 1, 1);
|
|
|
|
// Simple do-while loop, with no Block.
|
|
do color.r -= 0.25; while (color.r > 0.5);
|
|
|
|
// Do-while loop with a Block and Break in the middle.
|
|
do {
|
|
color.r -= 0.25;
|
|
if (color.r <= 0) break;
|
|
} while (color.a == 1);
|
|
|
|
// Do-while loop with a Block and Continue in the middle.
|
|
do {
|
|
color.b -= 0.25;
|
|
if (color.a == 1) continue; // should always happen
|
|
color.g = 0;
|
|
} while (color.b > 0);
|
|
|
|
// color contains green.
|
|
return color;
|
|
}
|