Skip to content

Commit 17c2f99

Browse files
committed
fshack: Always allocate a depth buffer
Some applications use depth testing but leave the image format depth component set to 0. OpenGL drivers always provide a depth buffer for framebuffers regardless of whether the image format specifies one, so the FS hack texture should too, otherwise such applications will render incorrectly. Signed-off-by: John Brooks <john@fastquake.com>
1 parent 4de2c10 commit 17c2f99

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

dlls/winex11.drv/opengl.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,19 +2157,15 @@ static void fs_hack_get_attachments_config( struct gl_drawable *gl, struct fs_ha
21572157
config->color_internalformat = attribs->alpha_size ? GL_RGBA8 : GL_RGB8;
21582158
config->color_format = GL_BGRA;
21592159
config->color_type = GL_UNSIGNED_INT_8_8_8_8_REV;
2160-
if (attribs->depth_size || attribs->stencil_size)
2161-
{
2162-
if (attribs->depth_size != 24) FIXME( "Unsupported depth buffer size %u.\n", attribs->depth_size );
2163-
if (attribs->stencil_size && attribs->stencil_size != 8)
2164-
FIXME( "Unsupported stencil buffer size %u.\n", attribs->stencil_size );
2165-
config->ds_internalformat = attribs->stencil_size ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT24;
2166-
config->ds_format = attribs->stencil_size ? GL_DEPTH_STENCIL : GL_DEPTH_COMPONENT;
2167-
config->ds_type = attribs->stencil_size ? GL_UNSIGNED_INT_24_8 : GL_UNSIGNED_INT;
2168-
}
2169-
else
2170-
{
2171-
config->ds_internalformat = config->ds_format = config->ds_type = 0;
2172-
}
2160+
2161+
if (attribs->depth_size && attribs->depth_size != 24)
2162+
FIXME( "Unsupported depth buffer size %u.\n", attribs->depth_size );
2163+
if (attribs->stencil_size && attribs->stencil_size != 8)
2164+
FIXME( "Unsupported stencil buffer size %u.\n", attribs->stencil_size );
2165+
config->ds_internalformat = attribs->stencil_size ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT24;
2166+
config->ds_format = attribs->stencil_size ? GL_DEPTH_STENCIL : GL_DEPTH_COMPONENT;
2167+
config->ds_type = attribs->stencil_size ? GL_UNSIGNED_INT_24_8 : GL_UNSIGNED_INT;
2168+
21732169
config->samples = attribs->samples;
21742170
}
21752171

@@ -2523,12 +2519,13 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable *
25232519
height, 0, config.ds_format, config.ds_type, NULL );
25242520
opengl_funcs.gl.p_glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 );
25252521
opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, prev_texture );
2526-
if (attribs.depth_size)
2527-
pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
2528-
GL_TEXTURE_2D, ctx->fs_hack_ds_texture, 0 );
25292522
if (attribs.stencil_size)
25302523
pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
25312524
GL_TEXTURE_2D, ctx->fs_hack_ds_texture, 0 );
2525+
else
2526+
pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
2527+
GL_TEXTURE_2D, ctx->fs_hack_ds_texture, 0 );
2528+
25322529
TRACE( "Created DS texture %u for fullscreen hack.\n", ctx->fs_hack_ds_texture );
25332530
}
25342531
}

0 commit comments

Comments
 (0)