Commit 24c93d48 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 95130a7d
......@@ -182,51 +182,50 @@ static void context_apply_attachment_filter_states(IWineD3DSurfaceImpl *surface)
/* GL locking is done by the caller */
void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer)
GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer)
{
IWineD3DSurfaceImpl *depth_stencil_impl = (IWineD3DSurfaceImpl *)depth_stencil;
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Attach depth stencil %p\n", depth_stencil);
if (depth_stencil)
{
DWORD format_flags = depth_stencil_impl->resource.format_desc->Flags;
DWORD format_flags = depth_stencil->resource.format_desc->Flags;
if (use_render_buffer && depth_stencil_impl->current_renderbuffer)
if (use_render_buffer && depth_stencil->current_renderbuffer)
{
if (format_flags & WINED3DFMT_FLAG_DEPTH)
{
gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, depth_stencil_impl->current_renderbuffer->id);
GL_RENDERBUFFER, depth_stencil->current_renderbuffer->id);
checkGLcall("glFramebufferRenderbuffer()");
}
if (format_flags & WINED3DFMT_FLAG_STENCIL)
{
gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, depth_stencil_impl->current_renderbuffer->id);
GL_RENDERBUFFER, depth_stencil->current_renderbuffer->id);
checkGLcall("glFramebufferRenderbuffer()");
}
}
else
{
surface_prepare_texture(depth_stencil_impl, gl_info, FALSE);
context_apply_attachment_filter_states(depth_stencil_impl);
surface_prepare_texture(depth_stencil, gl_info, FALSE);
context_apply_attachment_filter_states(depth_stencil);
if (format_flags & WINED3DFMT_FLAG_DEPTH)
{
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_DEPTH_ATTACHMENT,
depth_stencil_impl->texture_target, depth_stencil_impl->texture_name,
depth_stencil_impl->texture_level);
depth_stencil->texture_target, depth_stencil->texture_name,
depth_stencil->texture_level);
checkGLcall("glFramebufferTexture2D()");
}
if (format_flags & WINED3DFMT_FLAG_STENCIL)
{
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_STENCIL_ATTACHMENT,
depth_stencil_impl->texture_target, depth_stencil_impl->texture_name,
depth_stencil_impl->texture_level);
depth_stencil->texture_target, depth_stencil->texture_name,
depth_stencil->texture_level);
checkGLcall("glFramebufferTexture2D()");
}
}
......@@ -426,7 +425,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
surface_set_compatible_renderbuffer(device->stencilBufferTarget, w, h);
}
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, device->stencilBufferTarget, TRUE);
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, (IWineD3DSurfaceImpl *)device->stencilBufferTarget, TRUE);
entry->attached = TRUE;
}
......
......@@ -4140,7 +4140,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *co
gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, device->depth_blt_rb);
checkGLcall("glFramebufferRenderbufferEXT");
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, iface, FALSE);
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, This, FALSE);
/* Do the actual blit */
surface_depth_blt(This, gl_info, device->depth_blt_texture,
......
......@@ -1214,7 +1214,7 @@ void context_resource_released(IWineD3DDevice *iface,
IWineD3DResource *resource, WINED3DRESOURCETYPE type) DECLSPEC_HIDDEN;
void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN;
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, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
void context_attach_surface_fbo(const struct wined3d_context *context,
GLenum fbo_target, DWORD idx, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
......
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