Commit 95130a7d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 870b3cb4
...@@ -255,20 +255,19 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context, ...@@ -255,20 +255,19 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
/* GL locking is done by the caller */ /* GL locking is done by the caller */
void context_attach_surface_fbo(const struct wined3d_context *context, 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; const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Attach surface %p to %u\n", surface, idx); TRACE("Attach surface %p to %u\n", surface, idx);
if (surface) if (surface)
{ {
surface_prepare_texture(surface_impl, gl_info, FALSE); surface_prepare_texture(surface, gl_info, FALSE);
context_apply_attachment_filter_states(surface_impl); context_apply_attachment_filter_states(surface);
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, surface_impl->texture_target, gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, surface->texture_target,
surface_impl->texture_name, surface_impl->texture_level); surface->texture_name, surface->texture_level);
checkGLcall("glFramebufferTexture2D()"); checkGLcall("glFramebufferTexture2D()");
} }
else else
...@@ -415,7 +414,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_ ...@@ -415,7 +414,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
/* Apply render targets */ /* Apply render targets */
for (i = 0; i < gl_info->limits.buffers; ++i) 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); context_attach_surface_fbo(context, GL_FRAMEBUFFER, i, render_target);
} }
...@@ -2011,7 +2010,7 @@ static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceI ...@@ -2011,7 +2010,7 @@ static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceI
ENTER_GL(); ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo); 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); context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
LEAVE_GL(); LEAVE_GL();
} else { } else {
......
...@@ -4394,7 +4394,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac ...@@ -4394,7 +4394,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
ENTER_GL(); ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo); 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); context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
LEAVE_GL(); LEAVE_GL();
} }
...@@ -5458,7 +5458,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface, ...@@ -5458,7 +5458,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD); context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo); 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); context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
} }
...@@ -5784,7 +5784,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const ...@@ -5784,7 +5784,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
TRACE("Source surface %p is offscreen\n", src_surface); TRACE("Source surface %p is offscreen\n", src_surface);
ENTER_GL(); ENTER_GL();
context_bind_fbo(context, GL_READ_FRAMEBUFFER, &context->src_fbo); 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); glReadBuffer(GL_COLOR_ATTACHMENT0);
checkGLcall("glReadBuffer()"); checkGLcall("glReadBuffer()");
context_attach_depth_stencil_fbo(context, GL_READ_FRAMEBUFFER, NULL, FALSE); 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 ...@@ -5823,7 +5823,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
ENTER_GL(); ENTER_GL();
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, &context->dst_fbo); 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_set_draw_buffer(context, GL_COLOR_ATTACHMENT0);
context_attach_depth_stencil_fbo(context, GL_DRAW_FRAMEBUFFER, NULL, FALSE); context_attach_depth_stencil_fbo(context, GL_DRAW_FRAMEBUFFER, NULL, FALSE);
} }
......
...@@ -118,7 +118,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * ...@@ -118,7 +118,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
{ {
ENTER_GL(); ENTER_GL();
context_bind_fbo(context, GL_READ_FRAMEBUFFER, &context->src_fbo); 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_attach_depth_stencil_fbo(context, GL_READ_FRAMEBUFFER, NULL, FALSE);
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL); context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);
......
...@@ -1216,7 +1216,7 @@ void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fb ...@@ -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, void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN; GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
void context_attach_surface_fbo(const struct wined3d_context *context, 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, struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN; const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN;
void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN; void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) 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