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

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Henri Verbeet 2018-03-12 12:36:49 +03:30 committed by Alexandre Julliard
parent 72de747c6a
commit 9a00e032b7
4 changed files with 23 additions and 20 deletions

View File

@ -7865,7 +7865,8 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
TRACE("Destination surface %p is offscreen.\n", dst_surface);
buffer = GL_COLOR_ATTACHMENT0;
}
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location);
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER,
&dst_texture->resource, surface_get_sub_resource_idx(dst_surface), NULL, 0, dst_location);
context_set_draw_buffer(context, buffer);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER);

View File

@ -774,22 +774,23 @@ static void context_apply_fbo_state(struct wined3d_context *context, GLenum targ
/* Context activation is done by the caller. */
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location)
struct wined3d_resource *rt, unsigned int rt_sub_resource_idx,
struct wined3d_resource *ds, unsigned int ds_sub_resource_idx, DWORD location)
{
struct wined3d_rendertarget_info ds_info = {{0}};
memset(context->blit_targets, 0, sizeof(context->blit_targets));
if (render_target)
if (rt)
{
context->blit_targets[0].resource = &render_target->container->resource;
context->blit_targets[0].sub_resource_idx = surface_get_sub_resource_idx(render_target);
context->blit_targets[0].resource = rt;
context->blit_targets[0].sub_resource_idx = rt_sub_resource_idx;
context->blit_targets[0].layer_count = 1;
}
if (depth_stencil)
if (ds)
{
ds_info.resource = &depth_stencil->container->resource;
ds_info.sub_resource_idx = surface_get_sub_resource_idx(depth_stencil);
ds_info.resource = ds;
ds_info.sub_resource_idx = ds_sub_resource_idx;
ds_info.layer_count = 1;
}
@ -2954,7 +2955,6 @@ static DWORD context_generate_rt_mask_no_fbo(const struct wined3d_context *conte
void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device)
{
struct wined3d_texture *rt = context->current_rt.texture;
struct wined3d_surface *surface;
DWORD rt_mask, *cur_mask;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
@ -2963,8 +2963,8 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
{
wined3d_texture_load(rt, context, FALSE);
surface = rt->sub_resources[context->current_rt.sub_resource_idx].u.surface;
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, surface, NULL, rt->resource.draw_binding);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, &rt->resource,
context->current_rt.sub_resource_idx, NULL, 0, rt->resource.draw_binding);
if (rt->resource.format->id != WINED3DFMT_NULL)
rt_mask = 1;
else

View File

@ -316,12 +316,12 @@ static void texture2d_depth_blt_fbo(const struct wined3d_device *device,
gl_info = context->gl_info;
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL,
src_texture->sub_resources[src_sub_resource_idx].u.surface, src_location);
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL, 0,
&src_texture->resource, src_sub_resource_idx, src_location);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, NULL,
dst_texture->sub_resources[dst_sub_resource_idx].u.surface, dst_location);
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, NULL, 0,
&dst_texture->resource, dst_sub_resource_idx, dst_location);
context_set_draw_buffer(context, GL_NONE);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER);
@ -464,7 +464,7 @@ static void texture2d_blt_fbo(const struct wined3d_device *device, struct wined3
}
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER,
src_texture->sub_resources[src_sub_resource_idx].u.surface, NULL, src_location);
&src_texture->resource, src_sub_resource_idx, NULL, 0, src_location);
gl_info->gl_ops.gl.p_glReadBuffer(buffer);
checkGLcall("glReadBuffer()");
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
@ -484,7 +484,7 @@ static void texture2d_blt_fbo(const struct wined3d_device *device, struct wined3
}
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER,
dst_texture->sub_resources[dst_sub_resource_idx].u.surface, NULL, dst_location);
&dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
context_set_draw_buffer(context, buffer);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER);
@ -1376,7 +1376,7 @@ static void texture2d_read_from_framebuffer(struct wined3d_texture *texture, uns
if (src_location != texture->resource.draw_binding)
{
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER,
texture->sub_resources[sub_resource_idx].u.surface, NULL, src_location);
&texture->resource, sub_resource_idx, NULL, 0, src_location);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER);
}
@ -2807,7 +2807,8 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
TRACE("Destination surface %p is offscreen.\n", dst_surface);
buffer = GL_COLOR_ATTACHMENT0;
}
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location);
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER,
dst_resource, surface_get_sub_resource_idx(dst_surface), NULL, 0, dst_location);
context_set_draw_buffer(context, buffer);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER);

View File

@ -2135,7 +2135,8 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_state *state,
UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN;
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
struct wined3d_resource *rt, unsigned int rt_sub_resource_idx,
struct wined3d_resource *ds, unsigned int ds_sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info,
unsigned int unit) DECLSPEC_HIDDEN;
void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name) DECLSPEC_HIDDEN;