Commit 70a68144 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a texture and sub-resource index to wined3d_blitter_ops.blitter_blit().

parent f09c498e
...@@ -7795,13 +7795,11 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine ...@@ -7795,13 +7795,11 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine
} }
static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op, static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
struct wined3d_context *context, struct wined3d_surface *src_surface, DWORD src_location, struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
const RECT *src_rect, struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect, 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)
{ {
unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device; struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_arbfp_blitter *arbfp_blitter; struct wined3d_arbfp_blitter *arbfp_blitter;
struct wined3d_color_key alpha_test_key; struct wined3d_color_key alpha_test_key;
...@@ -7812,15 +7810,15 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl ...@@ -7812,15 +7810,15 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
&dst_texture->resource, dst_location)) &dst_texture->resource, dst_location))
{ {
if ((next = blitter->next)) if ((next = blitter->next))
return next->ops->blitter_blit(next, op, context, src_surface, src_location, return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
src_rect, dst_surface, dst_location, dst_rect, color_key, filter); src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, color_key, filter);
} }
arbfp_blitter = CONTAINING_RECORD(blitter, struct wined3d_arbfp_blitter, blitter); arbfp_blitter = CONTAINING_RECORD(blitter, struct wined3d_arbfp_blitter, blitter);
/* Now load the surface */ /* Now load the surface */
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& (surface_get_sub_resource(src_surface)->locations && (src_texture->sub_resources[src_sub_resource_idx].locations
& (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE)) & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE))
== WINED3D_LOCATION_DRAWABLE == WINED3D_LOCATION_DRAWABLE
&& !wined3d_resource_is_offscreen(&src_texture->resource)) && !wined3d_resource_is_offscreen(&src_texture->resource))
...@@ -7857,16 +7855,16 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl ...@@ -7857,16 +7855,16 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
if (dst_location == WINED3D_LOCATION_DRAWABLE) if (dst_location == WINED3D_LOCATION_DRAWABLE)
{ {
TRACE("Destination surface %p is onscreen.\n", dst_surface); TRACE("Destination texture %p is onscreen.\n", dst_texture);
buffer = wined3d_texture_get_gl_buffer(dst_texture); buffer = wined3d_texture_get_gl_buffer(dst_texture);
} }
else else
{ {
TRACE("Destination surface %p is offscreen.\n", dst_surface); TRACE("Destination texture %p is offscreen.\n", dst_texture);
buffer = GL_COLOR_ATTACHMENT0; buffer = GL_COLOR_ATTACHMENT0;
} }
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER,
&dst_texture->resource, surface_get_sub_resource_idx(dst_surface), NULL, 0, dst_location); &dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
context_set_draw_buffer(context, buffer); context_set_draw_buffer(context, buffer);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER); context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER); context_invalidate_state(context, STATE_FRAMEBUFFER);
......
...@@ -309,7 +309,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, ...@@ -309,7 +309,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect) struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect)
{ {
struct wined3d_texture *texture = swapchain->back_buffers[0]; struct wined3d_texture *texture = swapchain->back_buffers[0];
struct wined3d_surface *back_buffer = texture->sub_resources[0].u.surface;
struct wined3d_device *device = swapchain->device; struct wined3d_device *device = swapchain->device;
enum wined3d_texture_filter_type filter; enum wined3d_texture_filter_type filter;
DWORD location; DWORD location;
...@@ -329,8 +328,8 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, ...@@ -329,8 +328,8 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
location = WINED3D_LOCATION_RB_RESOLVED; location = WINED3D_LOCATION_RB_RESOLVED;
wined3d_texture_validate_location(texture, 0, WINED3D_LOCATION_DRAWABLE); wined3d_texture_validate_location(texture, 0, WINED3D_LOCATION_DRAWABLE);
device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context, back_buffer, device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context, texture, 0,
location, src_rect, back_buffer, WINED3D_LOCATION_DRAWABLE, dst_rect, NULL, filter); location, src_rect, texture, 0, WINED3D_LOCATION_DRAWABLE, dst_rect, NULL, filter);
wined3d_texture_invalidate_location(texture, 0, WINED3D_LOCATION_DRAWABLE); wined3d_texture_invalidate_location(texture, 0, WINED3D_LOCATION_DRAWABLE);
} }
......
...@@ -2109,9 +2109,10 @@ struct wined3d_blitter_ops ...@@ -2109,9 +2109,10 @@ struct wined3d_blitter_ops
unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil); const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil);
DWORD (*blitter_blit)(struct wined3d_blitter *blitter, enum wined3d_blit_op op, struct wined3d_context *context, DWORD (*blitter_blit)(struct wined3d_blitter *blitter, enum wined3d_blit_op op, struct wined3d_context *context,
struct wined3d_surface *src_surface, DWORD src_location, const RECT *src_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, DWORD src_location,
struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect, const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter); DWORD dst_location, const RECT *dst_rect, const struct wined3d_color_key *colour_key,
enum wined3d_texture_filter_type filter);
}; };
void wined3d_arbfp_blitter_create(struct wined3d_blitter **next, void wined3d_arbfp_blitter_create(struct wined3d_blitter **next,
...@@ -3343,11 +3344,6 @@ static inline unsigned int surface_get_sub_resource_idx(const struct wined3d_sur ...@@ -3343,11 +3344,6 @@ static inline unsigned int surface_get_sub_resource_idx(const struct wined3d_sur
return surface->texture_layer * surface->container->level_count + surface->texture_level; return surface->texture_layer * surface->container->level_count + surface->texture_level;
} }
static inline struct wined3d_texture_sub_resource *surface_get_sub_resource(struct wined3d_surface *surface)
{
return &surface->container->sub_resources[surface_get_sub_resource_idx(surface)];
}
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const struct wined3d_box *dst_box, HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const struct wined3d_box *dst_box,
struct wined3d_surface *src_surface, const struct wined3d_box *src_box, DWORD flags, struct wined3d_surface *src_surface, const struct wined3d_box *src_box, DWORD flags,
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) 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