wined3d: Simply pass an IWineD3DSurfaceImpl pointer to surface_set_compatible_renderbuffer().

This commit is contained in:
Henri Verbeet 2010-04-18 22:50:46 +02:00 committed by Alexandre Julliard
parent 03dc612c9c
commit 92a44884c7
3 changed files with 18 additions and 15 deletions

View File

@ -423,7 +423,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
unsigned int w = ((IWineD3DSurfaceImpl *)device->render_targets[0])->pow2Width;
unsigned int h = ((IWineD3DSurfaceImpl *)device->render_targets[0])->pow2Height;
surface_set_compatible_renderbuffer(device->stencilBufferTarget, w, h);
surface_set_compatible_renderbuffer((IWineD3DSurfaceImpl *)device->stencilBufferTarget, w, h);
}
context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, (IWineD3DSurfaceImpl *)device->stencilBufferTarget, TRUE);

View File

@ -873,15 +873,15 @@ 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(IWineD3DSurface *iface, unsigned int width, unsigned int height) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned int width, unsigned int height)
{
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;
src_width = This->pow2Width;
src_height = This->pow2Height;
src_width = surface->pow2Width;
src_height = surface->pow2Height;
/* A depth stencil smaller than the render target is not valid */
if (width > src_width || height > src_height) return;
@ -890,32 +890,35 @@ void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int wi
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
|| (width == src_width && height == src_height))
{
This->current_renderbuffer = NULL;
surface->current_renderbuffer = NULL;
return;
}
/* Look if we've already got a renderbuffer of the correct dimensions */
LIST_FOR_EACH_ENTRY(entry, &This->renderbuffers, renderbuffer_entry_t, entry) {
if (entry->width == width && entry->height == height) {
LIST_FOR_EACH_ENTRY(entry, &surface->renderbuffers, renderbuffer_entry_t, entry)
{
if (entry->width == width && entry->height == height)
{
renderbuffer = entry->id;
This->current_renderbuffer = entry;
surface->current_renderbuffer = entry;
break;
}
}
if (!renderbuffer) {
if (!renderbuffer)
{
gl_info->fbo_ops.glGenRenderbuffers(1, &renderbuffer);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER,
This->resource.format_desc->glInternal, width, height);
surface->resource.format_desc->glInternal, width, height);
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(renderbuffer_entry_t));
entry->width = width;
entry->height = height;
entry->id = renderbuffer;
list_add_head(&This->renderbuffers, &entry->entry);
list_add_head(&surface->renderbuffers, &entry->entry);
This->current_renderbuffer = entry;
surface->current_renderbuffer = entry;
}
checkGLcall("set_compatible_renderbuffer");

View File

@ -2680,7 +2680,7 @@ GLenum surface_get_gl_buffer(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
void surface_load_ds_location(IWineD3DSurfaceImpl *surface,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, DWORD location) DECLSPEC_HIDDEN;
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface,
void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface,
unsigned int width, unsigned int height) DECLSPEC_HIDDEN;
void surface_set_texture_name(IWineD3DSurface *iface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
void surface_set_texture_target(IWineD3DSurface *iface, GLenum target) DECLSPEC_HIDDEN;