[PATCH 3/7] wined3d: Create dummy cube array textures.

Józef Kucia jkucia at codeweavers.com
Wed Mar 8 05:07:20 CST 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/context.c         |  5 ++++-
 dlls/wined3d/device.c          | 21 +++++++++++++++++++++
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index ef11c5c..8fac19e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1525,6 +1525,9 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru
         if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
             gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP, device->dummy_textures.tex_cube);
 
+        if (gl_info->supported[ARB_TEXTURE_CUBE_MAP_ARRAY])
+            gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, device->dummy_textures.tex_cube_array);
+
         if (gl_info->supported[EXT_TEXTURE_ARRAY])
             gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_textures.tex_2d_array);
 
@@ -2419,7 +2422,7 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
                 checkGLcall("glBindTexture");
                 break;
             case GL_TEXTURE_CUBE_MAP_ARRAY:
-                gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, 0);
+                gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, device->dummy_textures.tex_cube_array);
                 checkGLcall("glBindTexture");
                 break;
             case GL_TEXTURE_3D:
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index cb68f3c..5f66beb 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -684,6 +684,24 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
         }
     }
 
+    if (gl_info->supported[ARB_TEXTURE_CUBE_MAP_ARRAY])
+    {
+        DWORD cube_array_data[6];
+
+        gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_cube_array);
+        checkGLcall("glGenTextures");
+        TRACE("Dummy cube array texture given name %u.\n", device->dummy_textures.tex_cube_array);
+
+        gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, device->dummy_textures.tex_cube_array);
+        checkGLcall("glBindTexture");
+
+        for (i = 0; i < ARRAY_SIZE(cube_array_data); ++i)
+            cube_array_data[i] = color;
+        GL_EXTCALL(glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA8, 1, 1, 6, 0,
+                    GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, cube_array_data));
+        checkGLcall("glTexImage3D");
+    }
+
     if (gl_info->supported[EXT_TEXTURE_ARRAY])
     {
         gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d_array);
@@ -735,6 +753,9 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d
     if (gl_info->supported[EXT_TEXTURE_ARRAY])
         gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d_array);
 
+    if (gl_info->supported[ARB_TEXTURE_CUBE_MAP_ARRAY])
+        gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_cube_array);
+
     if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
         gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_cube);
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4404f78..80cc7da 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2670,6 +2670,7 @@ struct wined3d_device
         GLuint tex_rect;
         GLuint tex_3d;
         GLuint tex_cube;
+        GLuint tex_cube_array;
         GLuint tex_2d_array;
         GLuint tex_buffer;
     } dummy_textures;
-- 
2.10.2




More information about the wine-patches mailing list