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

Henri Verbeet hverbeet at codeweavers.com
Fri Jun 5 03:10:47 CDT 2009


Instead of just the ones that have a fallback specified.
---
 dlls/wined3d/utils.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index d4eed06..ef55419 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -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
-- 
1.6.0.6



--------------000702050902050805070204--



More information about the wine-patches mailing list