Henri Verbeet : wined3d: Validate required OpenGL extensions in wined3d_texture_gl_init() instead of wined3d_texture_init().

Alexandre Julliard julliard at winehq.org
Tue Oct 30 14:19:34 CDT 2018


Module: wine
Branch: master
Commit: f8ba91ac7553165fdded7ba3d3f8d6883dc047b2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f8ba91ac7553165fdded7ba3d3f8d6883dc047b2

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Oct 30 13:36:45 2018 +0330

wined3d: Validate required OpenGL extensions in wined3d_texture_gl_init() instead of wined3d_texture_init().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/texture.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 9b9e825..907ede7 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2881,26 +2881,10 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
     if (!desc->width || !desc->height || !desc->depth)
         return WINED3DERR_INVALIDCALL;
 
-    if (desc->resource_type == WINED3D_RTYPE_TEXTURE_3D)
+    if (desc->resource_type == WINED3D_RTYPE_TEXTURE_3D && layer_count != 1)
     {
-        if (layer_count != 1)
-        {
-            ERR("Invalid layer count for volume texture.\n");
-            return E_INVALIDARG;
-        }
-
-        if (!gl_info->supported[EXT_TEXTURE3D])
-        {
-            WARN("OpenGL implementation does not support 3D textures.\n");
-            return WINED3DERR_INVALIDCALL;
-        }
-    }
-
-    if (!(desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) && layer_count > 1
-            && !gl_info->supported[EXT_TEXTURE_ARRAY])
-    {
-        WARN("OpenGL implementation does not support array textures.\n");
-        return WINED3DERR_INVALIDCALL;
+        ERR("Invalid layer count for volume texture.\n");
+        return E_INVALIDARG;
     }
 
     texture->sub_resources = sub_resources;
@@ -3562,6 +3546,13 @@ static HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, st
             texture_gl, device, desc, layer_count, level_count,
             flags, parent, parent_ops, sub_resources);
 
+    if (!(desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) && layer_count > 1
+            && !gl_info->supported[EXT_TEXTURE_ARRAY])
+    {
+        WARN("OpenGL implementation does not support array textures.\n");
+        return WINED3DERR_INVALIDCALL;
+    }
+
     switch (desc->resource_type)
     {
         case WINED3D_RTYPE_TEXTURE_1D:
@@ -3595,6 +3586,11 @@ static HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, st
             break;
 
         case WINED3D_RTYPE_TEXTURE_3D:
+            if (!gl_info->supported[EXT_TEXTURE3D])
+            {
+                WARN("OpenGL implementation does not support 3D textures.\n");
+                return WINED3DERR_INVALIDCALL;
+            }
             texture_ops = &texture3d_ops;
             texture_gl->target = GL_TEXTURE_3D;
             break;




More information about the wine-cvs mailing list