wined3d: Check FBO completeness after the read / draw buffers are specified.

Unless the driver implements ARB_ES2_compatibility / GL4.1, FBO completeness
depends on what read / draw buffers are set.
This commit is contained in:
Henri Verbeet 2011-04-08 20:22:52 +02:00 committed by Alexandre Julliard
parent 8e12b2e61e
commit 84103460bd
4 changed files with 28 additions and 3 deletions

View File

@ -299,7 +299,7 @@ static void context_attach_surface_fbo(const struct wined3d_context *context,
}
/* GL locking is done by the caller */
static void context_check_fbo_status(struct wined3d_context *context, GLenum target)
void context_check_fbo_status(struct wined3d_context *context, GLenum target)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
GLenum status;
@ -499,8 +499,6 @@ static void context_apply_fbo_state(struct wined3d_context *context, GLenum targ
context->current_fbo = NULL;
context_bind_fbo(context, target, NULL);
}
context_check_fbo_status(context, target);
}
/* GL locking is done by the caller */
@ -2056,6 +2054,13 @@ void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImp
context->draw_buffer_dirty = FALSE;
}
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
ENTER_GL();
context_check_fbo_status(context, GL_FRAMEBUFFER);
LEAVE_GL();
}
SetupForBlit(device, context);
}
@ -2119,6 +2124,13 @@ BOOL context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceIm
context_apply_draw_buffers(context, rt_count, rts);
context->draw_buffer_dirty = TRUE;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
ENTER_GL();
context_check_fbo_status(context, GL_FRAMEBUFFER);
LEAVE_GL();
}
if (context->last_was_blit)
{
device->frag_pipe->enable_extension(TRUE);
@ -2186,6 +2198,13 @@ BOOL context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImp
context->draw_buffer_dirty = FALSE;
}
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
ENTER_GL();
context_check_fbo_status(context, GL_FRAMEBUFFER);
LEAVE_GL();
}
if (context->last_was_blit)
{
device->frag_pipe->enable_extension(TRUE);

View File

@ -3416,6 +3416,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
glReadBuffer(GL_COLOR_ATTACHMENT0);
checkGLcall("glReadBuffer()");
}
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
LEAVE_GL();
if (dst_location == SFLAG_INDRAWABLE)
@ -3438,6 +3439,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location);
context_set_draw_buffer(context, GL_COLOR_ATTACHMENT0);
}
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE));
@ -3516,9 +3518,11 @@ static void wined3d_surface_depth_blt_fbo(IWineD3DDeviceImpl *device, IWineD3DSu
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL, src_surface, SFLAG_INTEXTURE);
glReadBuffer(GL_NONE);
checkGLcall("glReadBuffer()");
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, NULL, dst_surface, SFLAG_INTEXTURE);
context_set_draw_buffer(context, GL_NONE);
context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
if (gl_mask & GL_DEPTH_BUFFER_BIT)
{

View File

@ -302,6 +302,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
ENTER_GL();
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, SFLAG_INTEXTURE);
glReadBuffer(GL_COLOR_ATTACHMENT0);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);
context_set_draw_buffer(context, GL_BACK);

View File

@ -1218,6 +1218,7 @@ void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target
void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN;
void context_check_fbo_status(struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN;
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;