[PATCH 4/5] wined3d: Don't use depth textures without ARB_depth_texture.

Stefan Dösinger stefan at codeweavers.com
Tue Jun 9 02:28:09 CDT 2015


This is a fairly academic change because the FBO attachability test
already prevents us from using textures as depth attachments. It
prevents applications from using hypothetic depth textures that are
uploaded like normal textures instead of rendered to. It applies only to
D24S8 textures because other formats have the ARB_DEPTH_TEXTURE check in
the format table.
---
 dlls/wined3d/utils.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 687d3d7..62158a0 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2121,6 +2121,16 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
 
             if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_SRGB_WRITE) && !srgb_write)
                 format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
+
+            if (!gl_info->supported[ARB_DEPTH_TEXTURE]
+                    && format_texture_info[i].flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
+            {
+                format->flags[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3DFMT_FLAG_TEXTURE;
+                format->flags[WINED3D_GL_RES_TYPE_TEX_2D] &= ~WINED3DFMT_FLAG_TEXTURE;
+                format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+                format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] &= ~WINED3DFMT_FLAG_TEXTURE;
+                format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] &= ~WINED3DFMT_FLAG_TEXTURE;
+            }
         }
 
         /* Texture conversion stuff */
-- 
2.3.6




More information about the wine-patches mailing list