wined3d: Get rid of context_set_depth_stencil_fbo().

Integrate clearing the depth stencil attachment in context_attach_depth_stencil_fbo().
This commit is contained in:
Henri Verbeet 2008-09-18 14:57:53 +02:00 committed by Alexandre Julliard
parent 8f2ed870f1
commit 3a8ab00fe1

View File

@ -137,6 +137,10 @@ void context_attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_targe
{ {
IWineD3DSurfaceImpl *depth_stencil_impl = (IWineD3DSurfaceImpl *)depth_stencil; IWineD3DSurfaceImpl *depth_stencil_impl = (IWineD3DSurfaceImpl *)depth_stencil;
TRACE("Attach depth stencil %p\n", depth_stencil);
if (depth_stencil)
{
if (use_render_buffer && depth_stencil_impl->current_renderbuffer) if (use_render_buffer && depth_stencil_impl->current_renderbuffer)
{ {
GL_EXTCALL(glFramebufferRenderbufferEXT(fbo_target, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_stencil_impl->current_renderbuffer->id)); GL_EXTCALL(glFramebufferRenderbufferEXT(fbo_target, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_stencil_impl->current_renderbuffer->id));
@ -148,6 +152,10 @@ void context_attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_targe
depth_stencil_impl->glDescription.textureName, depth_stencil_impl->glDescription.level)); depth_stencil_impl->glDescription.textureName, depth_stencil_impl->glDescription.level));
checkGLcall("glFramebufferTexture2DEXT()"); checkGLcall("glFramebufferTexture2DEXT()");
} }
} else {
GL_EXTCALL(glFramebufferTexture2DEXT(fbo_target, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, 0, 0));
checkGLcall("glFramebufferTexture2DEXT()");
}
} }
void context_attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface) void context_attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface)
@ -169,22 +177,6 @@ void context_attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWO
} }
} }
/* TODO: Handle stencil attachments */
static void context_set_depth_stencil_fbo(IWineD3DDevice *iface, IWineD3DSurface *depth_stencil)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("Set depth stencil to %p\n", depth_stencil);
if (depth_stencil)
{
context_attach_depth_stencil_fbo(This, GL_FRAMEBUFFER_EXT, depth_stencil, TRUE);
} else {
GL_EXTCALL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, 0, 0));
checkGLcall("glFramebufferTexture2DEXT()");
}
}
static void context_check_fbo_status(IWineD3DDevice *iface) static void context_check_fbo_status(IWineD3DDevice *iface)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
@ -267,7 +259,7 @@ void context_apply_fbo_state(IWineD3DDevice *iface)
{ {
surface_set_compatible_renderbuffer(This->stencilBufferTarget, w, h); surface_set_compatible_renderbuffer(This->stencilBufferTarget, w, h);
} }
context_set_depth_stencil_fbo(iface, This->stencilBufferTarget); context_attach_depth_stencil_fbo(This, GL_FRAMEBUFFER_EXT, This->stencilBufferTarget, TRUE);
context->fbo_depth_attachment = This->stencilBufferTarget; context->fbo_depth_attachment = This->stencilBufferTarget;
} }