mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
wined3d: Always use context_bind_fbo() to change the framebuffer binding.
This commit is contained in:
parent
7485173849
commit
710f6f8456
3 changed files with 29 additions and 31 deletions
|
@ -47,15 +47,24 @@ void context_set_last_device(IWineD3DDeviceImpl *device)
|
|||
void context_bind_fbo(struct WineD3DContext *context, GLenum target, GLuint *fbo)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
GLuint f;
|
||||
|
||||
if (!*fbo)
|
||||
if (!fbo)
|
||||
{
|
||||
GL_EXTCALL(glGenFramebuffersEXT(1, fbo));
|
||||
checkGLcall("glGenFramebuffersEXT()");
|
||||
TRACE("Created FBO %d\n", *fbo);
|
||||
f = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!*fbo)
|
||||
{
|
||||
GL_EXTCALL(glGenFramebuffersEXT(1, fbo));
|
||||
checkGLcall("glGenFramebuffersEXT()");
|
||||
TRACE("Created FBO %u.\n", *fbo);
|
||||
}
|
||||
f = *fbo;
|
||||
}
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(target, *fbo));
|
||||
GL_EXTCALL(glBindFramebufferEXT(target, f));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
}
|
||||
|
||||
|
@ -77,17 +86,14 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info)
|
|||
}
|
||||
|
||||
/* GL locking is done by the caller */
|
||||
static void context_destroy_fbo(struct WineD3DContext *context, const GLuint *fbo)
|
||||
static void context_destroy_fbo(struct WineD3DContext *context, GLuint *fbo)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, *fbo));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
|
||||
context_bind_fbo(context, GL_FRAMEBUFFER_EXT, fbo);
|
||||
context_clean_fbo_attachments(gl_info);
|
||||
context_bind_fbo(context, GL_FRAMEBUFFER_EXT, NULL);
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
GL_EXTCALL(glDeleteFramebuffersEXT(1, fbo));
|
||||
checkGLcall("glDeleteFramebuffers()");
|
||||
}
|
||||
|
@ -308,8 +314,7 @@ static void context_reuse_fbo_entry(struct WineD3DContext *context, struct fbo_e
|
|||
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, entry->id));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
context_bind_fbo(context, GL_FRAMEBUFFER_EXT, &entry->id);
|
||||
context_clean_fbo_attachments(gl_info);
|
||||
|
||||
memcpy(entry->render_targets, device->render_targets, GL_LIMITS(buffers) * sizeof(*entry->render_targets));
|
||||
|
@ -419,7 +424,6 @@ static void context_apply_fbo_entry(struct WineD3DContext *context, struct fbo_e
|
|||
static void context_apply_fbo_state(struct WineD3DContext *context)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
if (device->render_offscreen)
|
||||
{
|
||||
|
@ -427,7 +431,7 @@ static void context_apply_fbo_state(struct WineD3DContext *context)
|
|||
context_apply_fbo_entry(context, context->current_fbo);
|
||||
} else {
|
||||
context->current_fbo = NULL;
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
context_bind_fbo(context, GL_FRAMEBUFFER_EXT, NULL);
|
||||
}
|
||||
|
||||
context_check_fbo_status(context);
|
||||
|
@ -1800,8 +1804,7 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
|
|||
LEAVE_GL();
|
||||
} else {
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glFramebufferRenderbufferEXT");
|
||||
context_bind_fbo(context, GL_FRAMEBUFFER_EXT, NULL);
|
||||
LEAVE_GL();
|
||||
}
|
||||
context->draw_buffer_dirty = TRUE;
|
||||
|
|
|
@ -6041,7 +6041,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
|
|||
|
||||
ActivateContext(This, surface, CTXUSAGE_RESOURCELOAD);
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, NULL);
|
||||
buffer = surface_get_gl_buffer(surface, swapchain);
|
||||
glDrawBuffer(buffer);
|
||||
checkGLcall("glDrawBuffer()");
|
||||
|
@ -6083,8 +6083,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
|
|||
if (This->activeContext->current_fbo) {
|
||||
context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, &This->activeContext->current_fbo->id);
|
||||
} else {
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, NULL);
|
||||
}
|
||||
|
||||
if (swapchain && surface == ((IWineD3DSwapChainImpl *)swapchain)->frontBuffer
|
||||
|
@ -6468,7 +6467,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
|||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0));
|
||||
context_bind_fbo(This->activeContext, GL_READ_FRAMEBUFFER_EXT, NULL);
|
||||
glReadBuffer(buffer);
|
||||
checkGLcall("glReadBuffer()");
|
||||
} else {
|
||||
|
@ -6507,7 +6506,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
|||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0));
|
||||
context_bind_fbo(This->activeContext, GL_DRAW_FRAMEBUFFER_EXT, NULL);
|
||||
glDrawBuffer(buffer);
|
||||
checkGLcall("glDrawBuffer()");
|
||||
} else {
|
||||
|
@ -6538,8 +6537,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
|||
if (This->activeContext->current_fbo) {
|
||||
context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, &This->activeContext->current_fbo->id);
|
||||
} else {
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, NULL);
|
||||
}
|
||||
|
||||
/* If we switched from GL_BACK to GL_FRONT above, we need to switch back here */
|
||||
|
|
|
@ -4404,7 +4404,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) {
|
|||
|
||||
/* Note that we use depth_blt here as well, rather than glCopyTexImage2D
|
||||
* directly on the FBO texture. That's because we need to flip. */
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
context_bind_fbo(device->activeContext, GL_FRAMEBUFFER_EXT, NULL);
|
||||
if (This->texture_target == GL_TEXTURE_RECTANGLE_ARB)
|
||||
{
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &old_binding);
|
||||
|
@ -4451,8 +4451,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) {
|
|||
if (device->activeContext->current_fbo) {
|
||||
context_bind_fbo(device->activeContext, GL_FRAMEBUFFER_EXT, &device->activeContext->current_fbo->id);
|
||||
} else {
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
context_bind_fbo(device->activeContext, GL_FRAMEBUFFER_EXT, NULL);
|
||||
}
|
||||
|
||||
LEAVE_GL();
|
||||
|
@ -4465,15 +4464,13 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) {
|
|||
|
||||
ENTER_GL();
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
context_bind_fbo(device->activeContext, GL_FRAMEBUFFER_EXT, NULL);
|
||||
surface_depth_blt(This, This->texture_name, This->currentDesc.Width,
|
||||
This->currentDesc.Height, This->texture_target);
|
||||
checkGLcall("depth_blt");
|
||||
|
||||
if (device->activeContext->current_fbo) {
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, device->activeContext->current_fbo->id));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
context_bind_fbo(device->activeContext, GL_FRAMEBUFFER_EXT, &device->activeContext->current_fbo->id);
|
||||
}
|
||||
|
||||
LEAVE_GL();
|
||||
|
|
Loading…
Reference in a new issue