wined3d: Reuse the FBO for check_fbo_compat().

This commit is contained in:
Henri Verbeet 2009-06-18 09:04:03 +02:00 committed by Alexandre Julliard
parent 41d93e1dd1
commit 550a3bbf96
1 changed files with 13 additions and 4 deletions

View File

@ -559,8 +559,8 @@ static BOOL init_format_compression_info(WineD3D_GL_Info *gl_info)
static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_format, GLenum format, GLenum type) static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_format, GLenum format, GLenum type)
{ {
GLuint tex, fb;
GLenum status; GLenum status;
GLuint tex;
ENTER_GL(); ENTER_GL();
@ -571,12 +571,9 @@ static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_form
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GL_EXTCALL(glGenFramebuffersEXT(1, &fb));
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb));
GL_EXTCALL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0)); GL_EXTCALL(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0));
status = GL_EXTCALL(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); status = GL_EXTCALL(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
GL_EXTCALL(glDeleteFramebuffersEXT(1, &fb));
glDeleteTextures(1, &tex); glDeleteTextures(1, &tex);
checkGLcall("Framebuffer format check"); checkGLcall("Framebuffer format check");
@ -589,6 +586,13 @@ static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_form
static void init_format_fbo_compat_info(WineD3D_GL_Info *gl_info) static void init_format_fbo_compat_info(WineD3D_GL_Info *gl_info)
{ {
unsigned int i; unsigned int i;
GLuint fbo;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
GL_EXTCALL(glGenFramebuffersEXT(1, &fbo));
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo));
}
for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i) for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i)
{ {
@ -652,6 +656,11 @@ static void init_format_fbo_compat_info(WineD3D_GL_Info *gl_info)
desc->rtInternal = desc->glInternal; desc->rtInternal = desc->glInternal;
} }
} }
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
GL_EXTCALL(glDeleteFramebuffersEXT(1, &fbo));
}
} }
static BOOL init_format_texture_info(WineD3D_GL_Info *gl_info) static BOOL init_format_texture_info(WineD3D_GL_Info *gl_info)