wined3d: Get rid of dst_fbo.

As a result we can get rid of a couple of other things as well.
This commit is contained in:
Henri Verbeet 2011-07-31 17:33:43 +02:00 committed by Alexandre Julliard
parent ccb3a51a44
commit dcc969c32c
4 changed files with 11 additions and 54 deletions

View File

@ -112,8 +112,8 @@ static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo)
}
/* GL locking is done by the caller */
void context_attach_depth_stencil_fbo(const struct wined3d_context *context,
GLenum fbo_target, struct wined3d_surface *depth_stencil, BOOL use_render_buffer)
static void context_attach_depth_stencil_fbo(const struct wined3d_context *context,
GLenum fbo_target, struct wined3d_surface *depth_stencil)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -123,7 +123,7 @@ void context_attach_depth_stencil_fbo(const struct wined3d_context *context,
{
DWORD format_flags = depth_stencil->resource.format->flags;
if (use_render_buffer && depth_stencil->current_renderbuffer)
if (depth_stencil->current_renderbuffer)
{
if (format_flags & WINED3DFMT_FLAG_DEPTH)
{
@ -381,7 +381,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ
/* Apply depth targets */
if (entry->depth_stencil)
surface_set_compatible_renderbuffer(entry->depth_stencil, entry->render_targets[0]);
context_attach_depth_stencil_fbo(context, target, entry->depth_stencil, TRUE);
context_attach_depth_stencil_fbo(context, target, entry->depth_stencil);
entry->attached = TRUE;
}
@ -863,11 +863,6 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
if (context->valid)
{
if (context->dst_fbo)
{
TRACE("Destroy dst FBO %d\n", context->dst_fbo);
context_destroy_fbo(context, &context->dst_fbo);
}
if (context->dummy_arbfp_prog)
{
GL_EXTCALL(glDeleteProgramsARB(1, &context->dummy_arbfp_prog));

View File

@ -1437,15 +1437,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
LEAVE_GL();
device->depth_blt_texture = 0;
}
if (device->depth_blt_rb)
{
ENTER_GL();
gl_info->fbo_ops.glDeleteRenderbuffers(1, &device->depth_blt_rb);
LEAVE_GL();
device->depth_blt_rb = 0;
device->depth_blt_rb_w = 0;
device->depth_blt_rb_h = 0;
}
/* Release the update stateblock */
if (wined3d_stateblock_decref(device->updateStateBlock))
@ -5526,13 +5517,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
glDeleteTextures(1, &device->depth_blt_texture);
device->depth_blt_texture = 0;
}
if (device->depth_blt_rb)
{
gl_info->fbo_ops.glDeleteRenderbuffers(1, &device->depth_blt_rb);
device->depth_blt_rb = 0;
device->depth_blt_rb_w = 0;
device->depth_blt_rb_h = 0;
}
if (device->cursorTexture)
{
glDeleteTextures(1, &device->cursorTexture);

View File

@ -5705,7 +5705,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
/* Note that we use depth_blt here as well, rather than glCopyTexImage2D
* directly on the FBO texture. That's because we need to flip. */
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER,
context->swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
if (surface->texture_target == GL_TEXTURE_RECTANGLE_ARB)
{
glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &old_binding);
@ -5733,27 +5734,9 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
glTexParameteri(bind_target, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
glBindTexture(bind_target, old_binding);
/* Setup the destination */
if (!device->depth_blt_rb)
{
gl_info->fbo_ops.glGenRenderbuffers(1, &device->depth_blt_rb);
checkGLcall("glGenRenderbuffersEXT");
}
if (device->depth_blt_rb_w != w || device->depth_blt_rb_h != h)
{
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, device->depth_blt_rb);
checkGLcall("glBindRenderbufferEXT");
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, w, h);
checkGLcall("glRenderbufferStorageEXT");
device->depth_blt_rb_w = w;
device->depth_blt_rb_h = h;
}
context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo);
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, surface, FALSE);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER,
NULL, surface, SFLAG_INTEXTURE);
context_set_draw_buffer(context, GL_NONE);
/* Do the actual blit */
surface_depth_blt(surface, gl_info, device->depth_blt_texture, 0, 0, w, h, bind_target);
@ -5771,7 +5754,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER,
context->swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
surface_depth_blt(surface, gl_info, surface->texture_name,
0, surface->pow2Height - h, w, h, surface->texture_target);
checkGLcall("depth_blt");

View File

@ -1105,7 +1105,6 @@ struct wined3d_context
struct list fbo_list;
struct list fbo_destroy_list;
struct fbo_entry *current_fbo;
GLuint dst_fbo;
GLuint fbo_read_binding;
GLuint fbo_draw_binding;
BOOL rebind_fbo;
@ -1234,8 +1233,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN;
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
void context_attach_depth_stencil_fbo(const struct wined3d_context *context,
GLenum fbo_target, struct wined3d_surface *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(const struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN;
struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, struct wined3d_surface *target,
@ -1705,9 +1702,6 @@ struct wined3d_device
/* For rendering to a texture using glCopyTexImage */
GLuint depth_blt_texture;
GLuint depth_blt_rb;
UINT depth_blt_rb_w;
UINT depth_blt_rb_h;
/* Cursor management */
UINT xHotSpot;