wined3d: Add resolve_format parameter to blitter_blit.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jan Sikorski 2021-03-31 12:27:37 +02:00 committed by Alexandre Julliard
parent 2adae568a6
commit 99dc5b78a1
6 changed files with 57 additions and 38 deletions

View File

@ -7792,7 +7792,8 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
@ -7804,11 +7805,12 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
unsigned int src_level;
RECT s, d;
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
"dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, "
"src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, "
"colour_key %p, filter %s, resolve format %p.\n",
blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
wine_dbgstr_rect(dst_rect), color_key, debug_d3dtexturefiltertype(filter));
wine_dbgstr_rect(dst_rect), color_key, debug_d3dtexturefiltertype(filter), resolve_format);
if (!arbfp_blit_supported(op, context, &src_texture->resource, src_location,
&dst_texture->resource, dst_location))
@ -7821,7 +7823,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
TRACE("Forwarding to blitter %p.\n", next);
return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, color_key, filter);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, color_key, filter, resolve_format);
}
arbfp_blitter = CONTAINING_RECORD(blitter, struct wined3d_arbfp_blitter, blitter);

View File

@ -13067,7 +13067,8 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
struct wined3d_texture_gl *dst_texture_gl = wined3d_texture_gl(dst_texture);
@ -13083,11 +13084,12 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
GLint location;
RECT s, d;
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
"dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, "
"src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, "
"colour_key %p, filter %s, resolve format %p.\n",
blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter), resolve_format);
if (!glsl_blitter_supported(op, context, src_texture_gl, src_location, dst_texture_gl, dst_location))
{
@ -13099,7 +13101,8 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
TRACE("Forwarding to blitter %p.\n", next);
return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter,
resolve_format);
}
glsl_blitter = CONTAINING_RECORD(blitter, struct wined3d_glsl_blitter, blitter);

View File

@ -1400,7 +1400,8 @@ static DWORD cpu_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
@ -1481,6 +1482,7 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
struct wined3d_texture_sub_resource *src_sub_resource, *dst_sub_resource;
struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
const struct wined3d_format *resolve_format = NULL;
const struct wined3d_color_key *colour_key = NULL;
DWORD src_location, dst_location, valid_locations;
struct wined3d_context *context;
@ -1510,6 +1512,9 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
fx->src_color_key.color_space_low_value,
fx->src_color_key.color_space_high_value);
TRACE("resolve_format_id %s.\n", debug_d3dformat(fx->resolve_format_id));
if (fx->resolve_format_id != WINED3DFMT_UNKNOWN)
resolve_format = wined3d_get_format(device->adapter, fx->resolve_format_id, 0);
}
dst_sub_resource = &dst_texture->sub_resources[dst_sub_resource_idx];
@ -1582,7 +1587,7 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
src_texture, src_sub_resource_idx, src_texture->resource.draw_binding, &src_rect,
dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, NULL, filter);
dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, NULL, filter, resolve_format);
context_release(context);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, valid_locations);
@ -1716,7 +1721,7 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
src_texture, src_sub_resource_idx, src_location, &src_rect,
dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, colour_key, filter);
dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, colour_key, filter, resolve_format);
context_release(context);

View File

@ -496,7 +496,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
wined3d_texture_validate_location(texture, 0, WINED3D_LOCATION_DRAWABLE);
device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context, texture, 0,
location, src_rect, texture, 0, WINED3D_LOCATION_DRAWABLE, dst_rect, NULL, filter);
location, src_rect, texture, 0, WINED3D_LOCATION_DRAWABLE, dst_rect, NULL, filter, NULL);
wined3d_texture_invalidate_location(texture, 0, WINED3D_LOCATION_DRAWABLE);
}

View File

@ -320,7 +320,7 @@ static void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_cont
enum wined3d_texture_filter_type filter, struct wined3d_texture *src_texture,
unsigned int src_sub_resource_idx, DWORD src_location, const RECT *src_rect,
struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location,
const RECT *dst_rect)
const RECT *dst_rect, const struct wined3d_format *resolve_format)
{
struct wined3d_texture *required_texture, *restore_texture;
const struct wined3d_gl_info *gl_info;
@ -332,10 +332,10 @@ static void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_cont
RECT s, d;
TRACE("device %p, context %p, filter %s, src_texture %p, src_sub_resource_idx %u, src_location %s, "
"src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s.\n",
"src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, resolve format %p.\n",
device, context, debug_d3dtexturefiltertype(filter), src_texture, src_sub_resource_idx,
wined3d_debug_location(src_location), wine_dbgstr_rect(src_rect), dst_texture,
dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect), resolve_format);
scaled_resolve = wined3d_texture_gl_is_multisample_location(wined3d_texture_gl(src_texture), src_location)
&& (abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top)
@ -2958,7 +2958,7 @@ static BOOL wined3d_texture_load_drawable(struct wined3d_texture *texture,
device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context,
texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r,
texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r,
NULL, WINED3D_TEXF_POINT);
NULL, WINED3D_TEXF_POINT, NULL);
return TRUE;
}
@ -2996,7 +2996,7 @@ static BOOL wined3d_texture_load_renderbuffer(struct wined3d_texture *texture,
src_location = WINED3D_LOCATION_TEXTURE_RGB;
texture2d_blt_fbo(texture->resource.device, context, WINED3D_TEXF_POINT, texture,
sub_resource_idx, src_location, &rect, texture, sub_resource_idx, dst_location, &rect);
sub_resource_idx, src_location, &rect, texture, sub_resource_idx, dst_location, &rect, NULL);
return TRUE;
}
@ -3043,11 +3043,11 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
if (srgb)
texture2d_blt_fbo(device, &context_gl->c, WINED3D_TEXF_POINT,
&texture_gl->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &src_rect,
&texture_gl->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_SRGB, &src_rect);
&texture_gl->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_SRGB, &src_rect, NULL);
else
texture2d_blt_fbo(device, &context_gl->c, WINED3D_TEXF_POINT,
&texture_gl->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_SRGB, &src_rect,
&texture_gl->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &src_rect);
&texture_gl->t, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &src_rect, NULL);
return TRUE;
}
@ -3064,7 +3064,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
if (fbo_blitter_supported(WINED3D_BLIT_OP_COLOR_BLIT, gl_info,
&texture_gl->t.resource, src_location, &texture_gl->t.resource, dst_location))
texture2d_blt_fbo(device, &context_gl->c, WINED3D_TEXF_POINT, &texture_gl->t, sub_resource_idx,
src_location, &src_rect, &texture_gl->t, sub_resource_idx, dst_location, &src_rect);
src_location, &src_rect, &texture_gl->t, sub_resource_idx, dst_location, &src_rect, NULL);
return TRUE;
}
@ -5634,7 +5634,8 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
@ -5655,7 +5656,8 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
{
if ((next = blitter->next))
return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter,
resolve_format);
}
TRACE("Blt from texture %p, %u to rendertarget %p, %u.\n",
@ -5843,7 +5845,8 @@ static DWORD fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
struct wined3d_resource *src_resource, *dst_resource;
@ -5851,11 +5854,12 @@ static DWORD fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
struct wined3d_device *device;
struct wined3d_blitter *next;
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
"dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, "
"src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, "
"colour_key %p, filter %s, resolve_format %p.\n",
blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter), resolve_format);
src_resource = &src_texture->resource;
dst_resource = &dst_texture->resource;
@ -5881,14 +5885,15 @@ static DWORD fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
TRACE("Forwarding to blitter %p.\n", next);
return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter,
resolve_format);
}
if (blit_op == WINED3D_BLIT_OP_COLOR_BLIT)
{
TRACE("Colour blit.\n");
texture2d_blt_fbo(device, context, filter, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, resolve_format);
return dst_location;
}
@ -5959,7 +5964,8 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
struct wined3d_texture_gl *dst_texture_gl = wined3d_texture_gl(dst_texture);
@ -5986,7 +5992,8 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
TRACE("Forwarding to blitter %p.\n", next);
return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter,
resolve_format);
}
TRACE("Blit using ARB_copy_image.\n");
@ -6428,7 +6435,8 @@ static DWORD vk_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_
struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter,
const struct wined3d_format *resolve_format)
{
struct wined3d_texture_vk *src_texture_vk = wined3d_texture_vk(src_texture);
struct wined3d_texture_vk *dst_texture_vk = wined3d_texture_vk(dst_texture);
@ -6439,11 +6447,12 @@ static DWORD vk_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_
struct wined3d_blitter *next;
bool resolve = false;
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
"dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, "
"src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, "
"colour_key %p, filter %s, resolve format %p.\n",
blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter), resolve_format);
if (!vk_blitter_blit_supported(op, context, &src_texture->resource, src_rect, &dst_texture->resource, dst_rect))
goto next;
@ -6587,7 +6596,7 @@ next:
TRACE("Forwarding to blitter %p.\n", next);
return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter, resolve_format);
}
static const struct wined3d_blitter_ops vk_blitter_ops =

View File

@ -2764,7 +2764,7 @@ struct wined3d_blitter_ops
struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, DWORD src_location,
const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
DWORD dst_location, const RECT *dst_rect, const struct wined3d_color_key *colour_key,
enum wined3d_texture_filter_type filter);
enum wined3d_texture_filter_type filter, const struct wined3d_format *resolve_format);
};
void wined3d_arbfp_blitter_create(struct wined3d_blitter **next,