diff options
author | Eric Anholt <eric@anholt.net> | 2010-02-17 10:54:39 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-02-17 10:54:39 -0800 |
commit | 8da843e996bda7152abb217b3f461a8091dbc880 (patch) | |
tree | e68f9d6fb923f9735d715d1ccc7057670f02e326 /src/cairo-gl-shaders.c | |
parent | 89bdc2f8d55d951e15b77e6737c57b208d984b0a (diff) |
gl: Reduce complexity of radial fragment shaders.
This shaves 1 Mesa IR instruction, and 6 Gen4 ISA instructions.
Diffstat (limited to 'src/cairo-gl-shaders.c')
-rw-r--r-- | src/cairo-gl-shaders.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c index 70a8c757..741e2355 100644 --- a/src/cairo-gl-shaders.c +++ b/src/cairo-gl-shaders.c @@ -776,10 +776,7 @@ static const char *fs_source_radial_gradient = " det = max (det, 0.0);\n" " \n" " float sqrt_det = sqrt (det);\n" - " /* This complicated bit of logic acts as\n" - " * \"if (A < 0.0) sqrt_det = -sqrt_det\", without the branch.\n" - " */\n" - " sqrt_det *= 1.0 + 2.0 * sign (min (A, 0.0));\n" + " sqrt_det *= sign(A);\n" " \n" " float t = (-B + sqrt_det) / (2.0 * A);\n" " t = (t - source_first_offset) / (source_last_offset - source_first_offset);\n" @@ -857,10 +854,7 @@ static const char *fs_mask_radial_gradient = " det = max (det, 0.0);\n" " \n" " float sqrt_det = sqrt (det);\n" - " /* This complicated bit of logic acts as\n" - " * \"if (A < 0.0) sqrt_det = -sqrt_det\", without the branch.\n" - " */\n" - " sqrt_det *= 1.0 + 2.0 * sign (min (A, 0.0));\n" + " sqrt_det *= sign(A);\n" " \n" " float t = (-B + sqrt_det) / (2.0 * A);\n" " t = (t - mask_first_offset) / (mask_last_offset - mask_first_offset);\n" |