Roderick Colenbrander : wined3d: Start moving paletted texture support to the blit_shader.
Alexandre Julliard
julliard at winehq.org
Fri Mar 19 11:16:39 CDT 2010
Module: wine
Branch: master
Commit: 27a96e477aa8dfa84c33e8e7988f3f8e822ed10b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=27a96e477aa8dfa84c33e8e7988f3f8e822ed10b
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Thu Mar 18 23:11:55 2010 +0100
wined3d: Start moving paletted texture support to the blit_shader.
---
dlls/wined3d/arb_program_shader.c | 2 +-
dlls/wined3d/directx.c | 2 +-
dlls/wined3d/surface.c | 25 +++++++++++++++++--------
dlls/wined3d/utils.c | 7 +++++--
dlls/wined3d/wined3d_private.h | 2 +-
5 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 28be889..b3d63b1 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -6808,7 +6808,7 @@ static void arbfp_blit_unset(IWineD3DDevice *iface) {
LEAVE_GL();
}
-static BOOL arbfp_blit_color_fixup_supported(struct color_fixup_desc fixup)
+static BOOL arbfp_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup)
{
enum complex_fixup complex_fixup;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index f2de807..9b70eb3 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3619,7 +3619,7 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, const struct
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(check_format_desc->color_fixup))
+ if (adapter->blitter->color_fixup_supported(&adapter->gl_info, check_format_desc->color_fixup))
{
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index acc24e5..de19c48 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2078,14 +2078,13 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
Paletted Texture
**************** */
- /* Use conversion when the paletted texture extension OR fragment shaders are available. When either
- * of the two is available make sure texturing is requested as neither of the two works in
- * conjunction with calls like glDraw-/glReadPixels. Further also use conversion in case of color keying.
+ /* 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.
* Paletted textures can be emulated using shaders but only do that for 2D purposes e.g. situations
* in which the main render target uses p8. Some games like GTA Vice City use P8 for texturing which
* conflicts with this.
*/
- if (!(gl_info->supported[EXT_PALETTED_TEXTURE] || (device->blitter->color_fixup_supported(This->resource.format_desc->color_fixup)
+ if (!((device->blitter->color_fixup_supported(gl_info, This->resource.format_desc->color_fixup)
&& device->render_targets && This == (IWineD3DSurfaceImpl*)device->render_targets[0]))
|| colorkey_active || !use_texturing)
{
@@ -2099,7 +2098,8 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
*convert = CONVERT_PALETTED;
}
}
- else if (!gl_info->supported[EXT_PALETTED_TEXTURE] && device->blitter->color_fixup_supported(This->resource.format_desc->color_fixup))
+ /* 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))
{
*format = GL_ALPHA;
*type = GL_UNSIGNED_BYTE;
@@ -4062,7 +4062,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
dump_color_fixup_desc(This->resource.format_desc->color_fixup);
}
- if (!myDevice->blitter->color_fixup_supported(Src->resource.format_desc->color_fixup))
+ if (!myDevice->blitter->color_fixup_supported(&myDevice->adapter->gl_info, Src->resource.format_desc->color_fixup))
{
FIXME("Source format %s has an unsupported fixup:\n",
debug_d3dformat(Src->resource.format_desc->format));
@@ -4993,7 +4993,7 @@ 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
- && (gl_info->supported[EXT_PALETTED_TEXTURE] || device->blitter->color_fixup_supported(This->resource.format_desc->color_fixup)))
+ && (device->blitter->color_fixup_supported(gl_info, This->resource.format_desc->color_fixup)))
{
d3dfmt_p8_upload_palette(iface, gl_info, convert);
mem = This->resource.allocatedMemory;
@@ -5206,8 +5206,10 @@ static void ffp_blit_unset(IWineD3DDevice *iface)
LEAVE_GL();
}
-static BOOL ffp_blit_color_fixup_supported(struct color_fixup_desc fixup)
+static BOOL ffp_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup)
{
+ enum complex_fixup complex_fixup;
+
if (TRACE_ON(d3d_surface) && TRACE_ON(d3d))
{
TRACE("Checking support for fixup:\n");
@@ -5221,6 +5223,13 @@ static BOOL ffp_blit_color_fixup_supported(struct color_fixup_desc fixup)
return TRUE;
}
+ complex_fixup = get_complex_fixup(fixup);
+ if(complex_fixup == COMPLEX_FIXUP_P8 && gl_info->supported[EXT_PALETTED_TEXTURE])
+ {
+ TRACE("P8 fixup supported\n");
+ return TRUE;
+ }
+
TRACE("[FAILED]\n");
return FALSE;
}
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 19d5949..83585d3 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -1098,8 +1098,11 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
gl_info->gl_formats[idx].heightscale = 1.5f;
gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
- idx = getFmtIdx(WINED3DFMT_P8_UINT);
- gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
+ if (gl_info->supported[EXT_PALETTED_TEXTURE] || gl_info->supported[ARB_FRAGMENT_PROGRAM])
+ {
+ idx = getFmtIdx(WINED3DFMT_P8_UINT);
+ gl_info->gl_formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
+ }
if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 091e85d..cc0aca0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1169,7 +1169,7 @@ struct blit_shader
HRESULT (*set_shader)(IWineD3DDevice *iface, const struct GlPixelFormatDesc *format_desc,
GLenum textype, UINT width, UINT height);
void (*unset_shader)(IWineD3DDevice *iface);
- BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
+ BOOL (*color_fixup_supported)(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup);
};
extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list