Commit f4b68744 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Match blitter and fragment processing color keying capabilities.

This is necessary if e.g. the nvts or ffp fragment processing pipeline is selected for debugging purposes on a GPU that otherwise supports the ARB program blitter.
parent 5d51c97d
......@@ -7716,7 +7716,8 @@ static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info)
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
}
static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format)
{
......@@ -7727,8 +7728,14 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum win
switch (blit_op)
{
case WINED3D_BLIT_OP_COLOR_BLIT:
case WINED3D_BLIT_OP_COLOR_BLIT_CKEY:
if (!d3d_info->shader_color_key)
{
/* The conversion modifies the alpha channel so the color key might no longer match. */
TRACE("Color keying not supported with converted textures.\n");
return FALSE;
}
case WINED3D_BLIT_OP_COLOR_BLIT:
break;
default:
......
......@@ -4378,7 +4378,8 @@ static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter,
if (CheckDepthStencilCapability(adapter, adapter_format, check_format)) return TRUE;
/* If opengl can't process the format natively, the blitter may be able to convert it */
if (adapter->blitter->blit_supported(&adapter->gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
if (adapter->blitter->blit_supported(&adapter->gl_info, &adapter->d3d_info,
WINED3D_BLIT_OP_COLOR_BLIT,
NULL, WINED3D_POOL_DEFAULT, 0, check_format,
NULL, WINED3D_POOL_DEFAULT, 0, adapter_format))
{
......
......@@ -1050,7 +1050,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const
struct wined3d_device *device = resource->device;
const struct blit_shader *blitter;
blitter = wined3d_select_blitter(&device->adapter->gl_info, WINED3D_BLIT_OP_DEPTH_FILL,
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, WINED3D_BLIT_OP_DEPTH_FILL,
NULL, 0, 0, NULL, rect, resource->usage, resource->pool, resource->format);
if (!blitter)
{
......@@ -3445,7 +3445,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st
struct wined3d_device *device = s->resource.device;
const struct blit_shader *blitter;
blitter = wined3d_select_blitter(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_FILL,
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, WINED3D_BLIT_OP_COLOR_FILL,
NULL, 0, 0, NULL, rect, s->resource.usage, s->resource.pool, s->resource.format);
if (!blitter)
{
......@@ -3463,6 +3463,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
struct wined3d_device *device = dst_surface->resource.device;
const struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(device->fb.render_targets[0]);
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n",
......@@ -3591,7 +3592,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface);
if (!device->blitter->blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
if (!device->blitter->blit_supported(gl_info, d3d_info, WINED3D_BLIT_OP_COLOR_BLIT,
src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
{
......@@ -4318,14 +4319,20 @@ static void ffp_blit_unset(const struct wined3d_gl_info *gl_info)
}
}
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format)
{
switch (blit_op)
{
case WINED3D_BLIT_OP_COLOR_BLIT:
case WINED3D_BLIT_OP_COLOR_BLIT_CKEY:
if (d3d_info->shader_color_key)
{
TRACE("Color keying requires converted textures.\n");
return FALSE;
}
case WINED3D_BLIT_OP_COLOR_BLIT:
if (src_pool == WINED3D_POOL_SYSTEM_MEM || dst_pool == WINED3D_POOL_SYSTEM_MEM)
return FALSE;
......@@ -4447,7 +4454,8 @@ static void cpu_blit_unset(const struct wined3d_gl_info *gl_info)
{
}
static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format)
{
......@@ -5367,7 +5375,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
return WINED3D_OK;
}
if (arbfp_blit.blit_supported(&device->adapter->gl_info, blit_op,
if (arbfp_blit.blit_supported(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
&src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
{
......
......@@ -4194,7 +4194,8 @@ const struct wine_rb_functions wined3d_ffp_vertex_program_rb_functions =
wined3d_ffp_vertex_program_key_compare,
};
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format)
{
......@@ -4208,7 +4209,7 @@ const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *g
for (i = 0; i < sizeof(blitters) / sizeof(*blitters); ++i)
{
if (blitters[i]->blit_supported(gl_info, blit_op,
if (blitters[i]->blit_supported(gl_info, d3d_info, blit_op,
src_rect, src_usage, src_pool, src_format,
dst_rect, dst_usage, dst_pool, dst_format))
return blitters[i];
......
......@@ -1340,7 +1340,8 @@ struct blit_shader
HRESULT (*set_shader)(void *blit_priv, struct wined3d_context *context, const struct wined3d_surface *surface,
const struct wined3d_color_key *color_key);
void (*unset_shader)(const struct wined3d_gl_info *gl_info);
BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format);
HRESULT (*color_fill)(struct wined3d_device *device, struct wined3d_surface *dst_surface,
......@@ -1353,7 +1354,8 @@ extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN;
extern const struct blit_shader arbfp_blit DECLSPEC_HIDDEN;
extern const struct blit_shader cpu_blit DECLSPEC_HIDDEN;
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format)
DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment