[PATCH 3/4] Rename blit_shader color_fixup_supported to blit_supported.

Roderick Colenbrander thunderbird2k at gmail.com
Thu Apr 1 05:50:31 CDT 2010


---
 dlls/wined3d/arb_program_shader.c |   20 +++++++++++-----
 dlls/wined3d/directx.c            |    2 +-
 dlls/wined3d/surface.c            |   46 +++++++++++++++++++++++++-----------
 dlls/wined3d/wined3d_private.h    |    9 ++++++-
 4 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 8e613c9..207df22 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -6808,30 +6808,38 @@ static void arbfp_blit_unset(IWineD3DDevice *iface) {
     LEAVE_GL();
 }
 
-static BOOL arbfp_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup)
+static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
+                                 DWORD src_usage, DWORD src_pool, const struct wined3d_format_desc *src_format_desc,
+                                 DWORD dst_usage, DWORD dst_pool, const struct wined3d_format_desc *dst_format_desc)
 {
     enum complex_fixup complex_fixup;
 
     if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
     {
         TRACE("Checking support for fixup:\n");
-        dump_color_fixup_desc(fixup);
+        dump_color_fixup_desc(src_format_desc->color_fixup);
+    }
+
+    if (blit_op != BLIT_OP_BLIT)
+    {
+        TRACE("Unsupported blit_op=%d\n", blit_op);
+        return FALSE;
     }
 
-    if (is_identity_fixup(fixup))
+    if (is_identity_fixup(src_format_desc->color_fixup))
     {
         TRACE("[OK]\n");
         return TRUE;
     }
 
     /* We only support YUV conversions. */
-    if (!is_complex_fixup(fixup))
+    if (!is_complex_fixup(src_format_desc->color_fixup))
     {
         TRACE("[FAILED]\n");
         return FALSE;
     }
 
-    complex_fixup = get_complex_fixup(fixup);
+    complex_fixup = get_complex_fixup(src_format_desc->color_fixup);
     switch(complex_fixup)
     {
         case COMPLEX_FIXUP_YUY2:
@@ -6859,7 +6867,7 @@ const struct blit_shader arbfp_blit = {
     arbfp_blit_free,
     arbfp_blit_set,
     arbfp_blit_unset,
-    arbfp_blit_color_fixup_supported,
+    arbfp_blit_supported,
     arbfp_blit_color_fill
 };
 
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 464e43e..2d16bac 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3636,7 +3636,7 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter,
     if (CheckDepthStencilCapability(adapter, adapter_format_desc, check_format_desc)) return TRUE;
 
     /* If opengl can't process the format natively, the blitter may be able to convert it */
-    if (adapter->blitter->color_fixup_supported(&adapter->gl_info, check_format_desc->color_fixup))
+    if (adapter->blitter->blit_supported(&adapter->gl_info, BLIT_OP_BLIT, 0, 0, check_format_desc, 0, 0, NULL))
     {
         TRACE_(d3d_caps)("[OK]\n");
         return TRUE;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 3bde8fd..936a490 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2120,6 +2120,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
     const struct wined3d_format_desc *glDesc = This->resource.format_desc;
     IWineD3DDeviceImpl *device = This->resource.device;
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+    BOOL blit_supported = FALSE;
 
     /* Default values: From the surface */
     *format = glDesc->glFormat;
@@ -2145,6 +2146,9 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
             /* ****************
                 Paletted Texture
                 **************** */
+            blit_supported = device->blitter->blit_supported(&device->adapter->gl_info, BLIT_OP_BLIT,
+                                                             This->resource.usage, This->resource.pool,
+                                                             This->resource.format_desc, 0, 0, NULL);
 
             /* Use conversion when the blit_shader backend supports it. It only supports this in case of
              * texturing. Further also use conversion in case of color keying.
@@ -2152,8 +2156,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
              * in which the main render target uses p8. Some games like GTA Vice City use P8 for texturing which
              * conflicts with this.
              */
-            if (!((device->blitter->color_fixup_supported(gl_info, This->resource.format_desc->color_fixup)
-                    && device->render_targets && This == (IWineD3DSurfaceImpl*)device->render_targets[0]))
+            if (!((blit_supported && device->render_targets && This == (IWineD3DSurfaceImpl*)device->render_targets[0]))
                     || colorkey_active || !use_texturing)
             {
                 *format = GL_RGBA;
@@ -2167,7 +2170,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
                 }
             }
             /* TODO: this check is evil and should die (it basically checks which blitter backend is used) */
-            else if (!gl_info->supported[EXT_PALETTED_TEXTURE] && device->blitter->color_fixup_supported(gl_info, This->resource.format_desc->color_fixup))
+            else if (!gl_info->supported[EXT_PALETTED_TEXTURE] && blit_supported)
             {
                 *format = GL_ALPHA;
                 *type = GL_UNSIGNED_BYTE;
@@ -4096,7 +4099,9 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
             dump_color_fixup_desc(This->resource.format_desc->color_fixup);
         }
 
-        if (!myDevice->blitter->color_fixup_supported(&myDevice->adapter->gl_info, Src->resource.format_desc->color_fixup))
+        if (!myDevice->blitter->blit_supported(&myDevice->adapter->gl_info, BLIT_OP_BLIT,
+                                               Src->resource.usage, Src->resource.pool, Src->resource.format_desc,
+                                               This->resource.usage, This->resource.pool, This->resource.format_desc))
         {
             FIXME("Source format %s has an unsupported fixup:\n",
                     debug_d3dformat(Src->resource.format_desc->format));
@@ -4342,7 +4347,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)
     {
         IWineD3DDeviceImpl *device = This->resource.device;
         if((This->resource.usage & WINED3DUSAGE_RENDERTARGET) &&
-            device->blitter->color_fixup_supported(&device->adapter->gl_info, This->resource.format_desc->color_fixup))
+            device->blitter->blit_supported(&device->adapter->gl_info, BLIT_OP_BLIT, This->resource.usage,
+                                            This->resource.pool, This->resource.format_desc, 0, 0, NULL))
         {
             struct wined3d_context *context;
 
@@ -4961,8 +4967,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
                 }
                 d3dfmt_convert_surface(This->resource.allocatedMemory, mem, pitch, width, height, outpitch, convert, This);
             }
-            else if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
-                    && (device->blitter->color_fixup_supported(gl_info, This->resource.format_desc->color_fixup)))
+            else if (This->resource.format_desc->format == WINED3DFMT_P8_UINT &&
+                     device->blitter->blit_supported(&device->adapter->gl_info, BLIT_OP_BLIT,
+                                                     This->resource.usage, This->resource.pool, This->resource.format_desc,
+                                                     0, 0, NULL))
             {
                 d3dfmt_p8_upload_palette(iface, gl_info, convert);
                 mem = This->resource.allocatedMemory;
@@ -5175,24 +5183,32 @@ static void ffp_blit_unset(IWineD3DDevice *iface)
     LEAVE_GL();
 }
 
-static BOOL ffp_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup)
+static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
+                           DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format_desc,
+                           DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format_desc)
 {
     enum complex_fixup complex_fixup;
 
     if (TRACE_ON(d3d_surface) && TRACE_ON(d3d))
     {
         TRACE("Checking support for fixup:\n");
-        dump_color_fixup_desc(fixup);
+        dump_color_fixup_desc(src_format_desc->color_fixup);
+    }
+
+    if (blit_op != BLIT_OP_BLIT)
+    {
+        TRACE("Unsupported blit_op=%d\n", blit_op);
+        return FALSE;
     }
 
     /* We only support identity conversions. */
-    if (is_identity_fixup(fixup))
+    if (is_identity_fixup(src_format_desc->color_fixup))
     {
         TRACE("[OK]\n");
         return TRUE;
     }
 
-    complex_fixup = get_complex_fixup(fixup);
+    complex_fixup = get_complex_fixup(src_format_desc->color_fixup);
     if(complex_fixup == COMPLEX_FIXUP_P8 && gl_info->supported[EXT_PALETTED_TEXTURE])
     {
         TRACE("P8 fixup supported\n");
@@ -5214,7 +5230,7 @@ const struct blit_shader ffp_blit =  {
     ffp_blit_free,
     ffp_blit_set,
     ffp_blit_unset,
-    ffp_blit_color_fixup_supported,
+    ffp_blit_supported,
     ffp_blit_color_fill
 };
 
@@ -5240,7 +5256,9 @@ static void cpu_blit_unset(IWineD3DDevice *iface)
 {
 }
 
-static BOOL cpu_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup)
+static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
+                           DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format_desc,
+                           DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format_desc)
 {
     return FALSE;
 }
@@ -5259,6 +5277,6 @@ const struct blit_shader cpu_blit =  {
     cpu_blit_free,
     cpu_blit_set,
     cpu_blit_unset,
-    cpu_blit_color_fixup_supported,
+    cpu_blit_supported,
     cpu_blit_color_fill
 };
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e168162..c22d1a3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1168,6 +1168,11 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
         const struct wined3d_gl_info *gl_info, const struct StateEntryTemplate *vertex,
         const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN;
 
+enum blit_operation
+{
+    BLIT_OP_BLIT
+};
+
 /* Shaders for color conversions in blits */
 struct blit_shader
 {
@@ -1176,7 +1181,9 @@ struct blit_shader
     HRESULT (*set_shader)(IWineD3DDevice *iface, const struct wined3d_format_desc *format_desc,
             GLenum textype, UINT width, UINT height);
     void (*unset_shader)(IWineD3DDevice *iface);
-    BOOL (*color_fixup_supported)(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup);
+    BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
+                           DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format_desc,
+                           DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format_desc);
     HRESULT (*color_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect, DWORD fill_color);
 };
 
-- 
1.6.3.3




More information about the wine-patches mailing list