[PATCH 1/2] wined3d: Avoid calculating 1 / (fog_end - fog_start) in the shader
Stefan Dösinger
stefan at codeweavers.com
Thu Aug 1 05:25:55 CDT 2013
Unmodified resend after the code freeze.
This is a minor GPU-side performance improvement. It also works for
fog_start == fog_end on drivers that don't handle this situation
correctly with fixed function fog. Tested on nvidia, r300g, r600g.
The performance gain is about 3% in a specific test program. It is not
noticable in any real-world application I tested.
---
dlls/wined3d/glsl_shader.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index e1fe0ee..cbf2c60 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4502,8 +4502,7 @@ static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer,
return;
case WINED3D_FFP_PS_FOG_LINEAR:
- /* Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start) */
- shader_addline(buffer, "float Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start);\n");
+ shader_addline(buffer, "float Fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale;\n");
break;
case WINED3D_FFP_PS_FOG_EXP:
--
1.8.1.5
More information about the wine-patches
mailing list