diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 7d029dbbeb5..8ffb30c6c16 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -455,10 +455,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]->pow2Width, entry->render_targets[0]->pow2Height); - } + surface_set_compatible_renderbuffer(entry->depth_stencil, entry->render_targets[0]); context_attach_depth_stencil_fbo(context, target, entry->depth_stencil, TRUE); entry->attached = TRUE; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 5d4dfa75c7c..59f5aa77f92 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1104,12 +1104,24 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win * render target dimensions. With FBOs, the dimensions have to be an exact match. */ /* TODO: We should synchronize the renderbuffer's content with the texture's content. */ /* GL locking is done by the caller */ -void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned int width, unsigned int height) +void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *rt) { const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info; renderbuffer_entry_t *entry; GLuint renderbuffer = 0; unsigned int src_width, src_height; + unsigned int width, height; + + if (rt->resource.format->id != WINED3DFMT_NULL) + { + width = rt->pow2Width; + height = rt->pow2Height; + } + else + { + width = surface->pow2Width; + height = surface->pow2Height; + } src_width = surface->pow2Width; src_height = surface->pow2Height; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c9853787b9c..117909afc04 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2121,8 +2121,7 @@ void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, DWORD location, UI void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent) DECLSPEC_HIDDEN; void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN; -void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, - unsigned int width, unsigned int height) DECLSPEC_HIDDEN; +void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *rt) DECLSPEC_HIDDEN; void surface_set_container(IWineD3DSurfaceImpl *surface, enum wined3d_container_type type, void *container) DECLSPEC_HIDDEN; void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;