Stefan Dösinger : wined3d: Care for the inverted y coords in dsy.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 09:55:42 CDT 2007


Module: wine
Branch: master
Commit: 8f3accc718f7239707dbe5368a9c27c27a7d8c01
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8f3accc718f7239707dbe5368a9c27c27a7d8c01

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sat Oct 13 13:03:56 2007 +0200

wined3d: Care for the inverted y coords in dsy.

---

 dlls/wined3d/baseshader.c      |    2 ++
 dlls/wined3d/glsl_shader.c     |    4 ++--
 dlls/wined3d/pixelshader.c     |    6 ++++++
 dlls/wined3d/wined3d_private.h |    2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c
index cba756e..2d1c5d9 100644
--- a/dlls/wined3d/baseshader.c
+++ b/dlls/wined3d/baseshader.c
@@ -389,6 +389,8 @@ HRESULT shader_get_registers_used(
                 } else {
                     reg_maps->bumpmat = regnum;
                 }
+            } else if(WINED3DSIO_DSY  == curOpcode->opcode) {
+                reg_maps->usesdsy = 1;
             }
 
             /* This will loop over all the registers and try to
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 8a0603b..14ac4e3 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -559,7 +559,7 @@ void shader_generate_glsl_declarations(
             ps_impl->srgb_enabled = 0;
             ps_impl->srgb_mode_hardcoded = 1;
         }
-        if(reg_maps->vpos) {
+        if(reg_maps->vpos || reg_maps->usesdsy) {
             if(This->baseShader.limits.constant_float + extra_constants_needed + 1 < GL_LIMITS(pshader_constantsF)) {
                 shader_addline(buffer, "uniform vec4 ycorrection;\n");
                 ((IWineD3DPixelShaderImpl *) This)->vpos_uniform = 1;
@@ -1392,7 +1392,7 @@ void shader_glsl_map2gl(SHADER_OPCODE_ARG* arg) {
         case WINED3DSIO_EXP: instruction = "exp2"; break;
         case WINED3DSIO_SGN: instruction = "sign"; break;
         case WINED3DSIO_DSX: instruction = "dFdx"; break;
-        case WINED3DSIO_DSY: instruction = "dFdy"; break;
+        case WINED3DSIO_DSY: instruction = "ycorrection.y * dFdy"; break;
         default: instruction = "";
             FIXME("Opcode %s not yet handled in GLSL\n", curOpcode->name);
             break;
diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c
index a7de7e9..4c31d55 100644
--- a/dlls/wined3d/pixelshader.c
+++ b/dlls/wined3d/pixelshader.c
@@ -599,6 +599,12 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_CompileShader(IWineD3DPixelShader
                 goto recompile;
             }
         }
+        if(This->baseShader.reg_maps.usesdsy && !This->vpos_uniform) {
+            if(This->render_offscreen ? 0 : 1 != deviceImpl->render_offscreen ? 0 : 1) {
+                WARN("Recompiling shader because dsy is used, hard compiled and render_offscreen changed\n");
+                goto recompile;
+            }
+        }
 
         return WINED3D_OK;
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 446f2a9..2d73e7f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1653,7 +1653,7 @@ typedef struct shader_reg_maps {
      * Use 0 as default (bit 31 is always 1 on a valid token) */
     DWORD samplers[max(MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS)];
     char bumpmat, luminanceparams;
-    char usesnrm, vpos;
+    char usesnrm, vpos, usesdsy;
 
     /* Whether or not loops are used in this shader, and nesting depth */
     unsigned loop_depth;




More information about the wine-cvs mailing list