Stefan Dösinger : winedd: Move shader_*_add_instruction_modifiers into the shader backend.

Alexandre Julliard julliard at winehq.org
Fri May 8 08:06:26 CDT 2009


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun May  3 18:17:07 2009 +0200

winedd: Move shader_*_add_instruction_modifiers into the shader backend.

---

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

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index f3ec739..fd9af76 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -2247,6 +2247,10 @@ static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup)
     return FALSE;
 }
 
+static void shader_arb_add_instruction_modifiers(const struct wined3d_shader_instruction *ins) {
+    /* Nothing to do for now */
+}
+
 static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABLE_SIZE] =
 {
     /* WINED3DSIH_ABS           */ shader_hw_map2gl,
@@ -2351,6 +2355,7 @@ const shader_backend_t arb_program_shader_backend = {
     shader_arb_generate_vshader,
     shader_arb_get_caps,
     shader_arb_color_fixup_supported,
+    shader_arb_add_instruction_modifiers,
 };
 
 /* ARB_fragment_program fixed function pipeline replacement definitions */
diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c
index 957ec61..303460f 100644
--- a/dlls/wined3d/baseshader.c
+++ b/dlls/wined3d/baseshader.c
@@ -1028,9 +1028,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
         hw_fct(&ins);
 
         /* Process instruction modifiers for GLSL apps ( _sat, etc. ) */
-        /* FIXME: This should be internal to the shader backend.
-         * Also, right now this is the only reason "shader_mode" exists. */
-        if (This->baseShader.shader_mode == SHADER_GLSL) shader_glsl_add_instruction_modifiers(&ins);
+        device->shader_backend->shader_add_instruction_modifiers(&ins);
     }
 }
 
@@ -1252,6 +1250,7 @@ static GLuint shader_none_generate_vshader(IWineD3DVertexShader *iface,
     FIXME("NONE shader backend asked to generate a vertex shader\n");
     return 0;
 }
+static void shader_none_add_instruction_modifiers(const struct wined3d_shader_instruction *ins) {}
 
 #define GLINFO_LOCATION      (*gl_info)
 static void shader_none_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
@@ -1298,4 +1297,5 @@ const shader_backend_t none_shader_backend = {
     shader_none_generate_vshader,
     shader_none_get_caps,
     shader_none_color_fixup_supported,
+    shader_none_add_instruction_modifiers,
 };
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 0370fde..ca50305 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1363,7 +1363,7 @@ static DWORD shader_glsl_append_dst(SHADER_BUFFER *buffer, const struct wined3d_
 }
 
 /** Process GLSL instruction modifiers */
-void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins)
+static void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins)
 {
     glsl_dst_param_t dst_param;
     DWORD modifiers;
@@ -4401,4 +4401,5 @@ const shader_backend_t glsl_shader_backend = {
     shader_glsl_generate_vshader,
     shader_glsl_get_caps,
     shader_glsl_color_fixup_supported,
+    shader_glsl_add_instruction_modifiers,
 };
diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c
index a2e182d..9b001db 100644
--- a/dlls/wined3d/pixelshader.c
+++ b/dlls/wined3d/pixelshader.c
@@ -207,7 +207,6 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
 static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, CONST DWORD *pFunction) {
 
     IWineD3DPixelShaderImpl *This =(IWineD3DPixelShaderImpl *)iface;
-    IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *) This->baseShader.device;
     unsigned int i, highest_reg_used = 0, num_regs_used = 0;
     shader_reg_maps *reg_maps = &This->baseShader.reg_maps;
     const struct wined3d_shader_frontend *fe;
@@ -285,8 +284,6 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
 
     This->baseShader.load_local_constsF = FALSE;
 
-    This->baseShader.shader_mode = deviceImpl->ps_selected_mode;
-
     TRACE("(%p) : Copying the function\n", This);
 
     This->baseShader.function = HeapAlloc(GetProcessHeap(), 0, This->baseShader.functionLength);
diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c
index e5fb20f..1491b0c 100644
--- a/dlls/wined3d/vertexshader.c
+++ b/dlls/wined3d/vertexshader.c
@@ -285,8 +285,6 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
 
     vshader_set_limits(This);
 
-    This->baseShader.shader_mode = deviceImpl->vs_selected_mode;
-
     if(deviceImpl->vs_selected_mode == SHADER_ARB &&
        (GLINFO_LOCATION).arb_vs_offset_limit      &&
        This->min_rel_offset <= This->max_rel_offset) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d40d0ab..641ca8c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -807,6 +807,7 @@ typedef struct {
             SHADER_BUFFER *buffer, const struct vs_compile_args *args);
     void (*shader_get_caps)(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *caps);
     BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup);
+    void (*shader_add_instruction_modifiers)(const struct wined3d_shader_instruction *ins);
 } shader_backend_t;
 
 extern const shader_backend_t glsl_shader_backend;
@@ -2525,9 +2526,6 @@ extern BOOL vshader_get_input(
 
 extern HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object);
 
-/* GLSL helper functions */
-extern void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins);
-
 /*****************************************************************************
  * IDirect3DBaseShader implementation structure
  */
@@ -2543,9 +2541,6 @@ typedef struct IWineD3DBaseShaderClass
     const struct wined3d_shader_frontend *frontend;
     void *frontend_data;
 
-    /* Type of shader backend */
-    int shader_mode;
-
     /* Programs this shader is linked with */
     struct list linked_programs;
 




More information about the wine-cvs mailing list