wined3d: Simply pass an IWineD3DSurfaceImpl pointer to context_attach_surface_fbo().

This commit is contained in:
Henri Verbeet 2010-04-15 19:21:25 +02:00 committed by Alexandre Julliard
parent 870b3cb40b
commit 95130a7d5e
4 changed files with 13 additions and 14 deletions

View File

@ -255,20 +255,19 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
/* GL locking is done by the caller */
void context_attach_surface_fbo(const struct wined3d_context *context,
GLenum fbo_target, DWORD idx, IWineD3DSurface *surface)
GLenum fbo_target, DWORD idx, IWineD3DSurfaceImpl *surface)
{
IWineD3DSurfaceImpl *surface_impl = (IWineD3DSurfaceImpl *)surface;
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Attach surface %p to %u\n", surface, idx);
if (surface)
{
surface_prepare_texture(surface_impl, gl_info, FALSE);
context_apply_attachment_filter_states(surface_impl);
surface_prepare_texture(surface, gl_info, FALSE);
context_apply_attachment_filter_states(surface);
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, surface_impl->texture_target,
surface_impl->texture_name, surface_impl->texture_level);
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, surface->texture_target,
surface->texture_name, surface->texture_level);
checkGLcall("glFramebufferTexture2D()");
}
else
@ -415,7 +414,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
/* Apply render targets */
for (i = 0; i < gl_info->limits.buffers; ++i)
{
IWineD3DSurface *render_target = device->render_targets[i];
IWineD3DSurfaceImpl *render_target = (IWineD3DSurfaceImpl *)device->render_targets[i];
context_attach_surface_fbo(context, GL_FRAMEBUFFER, i, render_target);
}
@ -2011,7 +2010,7 @@ static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceI
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo);
context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, context->current_rt);
context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, (IWineD3DSurfaceImpl *)context->current_rt);
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
LEAVE_GL();
} else {

View File

@ -4394,7 +4394,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo);
context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, (IWineD3DSurface *)target);
context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, target);
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
LEAVE_GL();
}
@ -5458,7 +5458,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo);
context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, surface);
context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, (IWineD3DSurfaceImpl *)surface);
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
}
@ -5784,7 +5784,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
TRACE("Source surface %p is offscreen\n", src_surface);
ENTER_GL();
context_bind_fbo(context, GL_READ_FRAMEBUFFER, &context->src_fbo);
context_attach_surface_fbo(context, GL_READ_FRAMEBUFFER, 0, src_surface);
context_attach_surface_fbo(context, GL_READ_FRAMEBUFFER, 0, (IWineD3DSurfaceImpl *)src_surface);
glReadBuffer(GL_COLOR_ATTACHMENT0);
checkGLcall("glReadBuffer()");
context_attach_depth_stencil_fbo(context, GL_READ_FRAMEBUFFER, NULL, FALSE);
@ -5823,7 +5823,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
ENTER_GL();
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, &context->dst_fbo);
context_attach_surface_fbo(context, GL_DRAW_FRAMEBUFFER, 0, dst_surface);
context_attach_surface_fbo(context, GL_DRAW_FRAMEBUFFER, 0, (IWineD3DSurfaceImpl *)dst_surface);
context_set_draw_buffer(context, GL_COLOR_ATTACHMENT0);
context_attach_depth_stencil_fbo(context, GL_DRAW_FRAMEBUFFER, NULL, FALSE);
}

View File

@ -118,7 +118,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
{
ENTER_GL();
context_bind_fbo(context, GL_READ_FRAMEBUFFER, &context->src_fbo);
context_attach_surface_fbo(context, GL_READ_FRAMEBUFFER, 0, This->backBuffer[0]);
context_attach_surface_fbo(context, GL_READ_FRAMEBUFFER, 0, backbuffer);
context_attach_depth_stencil_fbo(context, GL_READ_FRAMEBUFFER, NULL, FALSE);
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);

View File

@ -1216,7 +1216,7 @@ void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fb
void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
void context_attach_surface_fbo(const struct wined3d_context *context,
GLenum fbo_target, DWORD idx, IWineD3DSurface *surface) DECLSPEC_HIDDEN;
GLenum fbo_target, DWORD idx, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN;
void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;