gl: Reduce complexity of radial fragment shaders.

This shaves 1 Mesa IR instruction, and 6 Gen4 ISA instructions.
This commit is contained in:
Eric Anholt 2010-02-17 10:54:39 -08:00
parent 89bdc2f8d5
commit 8da843e996

View file

@ -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"