wined3d: Check FBO compatibility on all formats with a GL format.

Instead of just the ones that have a fallback specified.
This commit is contained in:
Henri Verbeet 2009-06-05 10:10:47 +02:00 committed by Alexandre Julliard
parent b93c3b3253
commit 786408fb95
1 changed files with 19 additions and 6 deletions

View File

@ -501,7 +501,7 @@ static BOOL init_format_base_info(WineD3D_GL_Info *gl_info)
#define GLINFO_LOCATION (*gl_info)
static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_format)
static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_format, GLenum format, GLenum type)
{
GLuint tex, fb;
GLenum status;
@ -511,7 +511,7 @@ static BOOL check_fbo_compat(const WineD3D_GL_Info *gl_info, GLint internal_form
while(glGetError());
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, 16, 16, 0, format, type, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -540,21 +540,34 @@ static void init_format_fbo_compat_info(WineD3D_GL_Info *gl_info)
if (!desc->glInternal) continue;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && desc->rtInternal)
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
/* Check if the default internal format is supported as a frame buffer target, otherwise
* fall back to the render target internal.
*
* Try to stick to the standard format if possible, this limits precision differences. */
if (check_fbo_compat(gl_info, desc->glInternal))
if (check_fbo_compat(gl_info, desc->glInternal, desc->glFormat, desc->glType))
{
TRACE("Format %s is supported as fbo target\n", debug_d3dformat(desc->format));
desc->rtInternal = desc->glInternal;
}
else
{
TRACE("Internal format of %s not supported as FBO target, using render target internal instead\n",
debug_d3dformat(desc->format));
if (!desc->rtInternal)
{
if (desc->Flags & WINED3DFMT_FLAG_RENDERTARGET)
{
FIXME("Internal format of %s not supported as FBO target, and no fallback specified.\n",
debug_d3dformat(desc->format));
desc->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
desc->rtInternal = desc->glInternal;
}
else
{
TRACE("Internal format of %s not supported as FBO target, using render target internal instead.\n",
debug_d3dformat(desc->format));
}
}
}
else