[PATCH 02/10] wined3d: Create dummy 2D array textures.

Józef Kucia jkucia at codeweavers.com
Mon Apr 18 17:01:26 CDT 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/context.c         | 12 +++++++++++-
 dlls/wined3d/device.c          | 22 ++++++++++++++++++++++
 dlls/wined3d/wined3d_private.h |  9 +++++----
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index e33d37e..21340cb 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1507,6 +1507,12 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
             gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP, device->dummy_texture_cube[i]);
             checkGLcall("glBindTexture");
         }
+
+        if (gl_info->supported[EXT_TEXTURE_ARRAY])
+        {
+            gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[i]);
+            checkGLcall("glBindTexture");
+        }
     }
 }
 
@@ -2343,6 +2349,10 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
                 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[unit]);
                 checkGLcall("glBindTexture");
                 break;
+            case GL_TEXTURE_2D_ARRAY:
+                gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[unit]);
+                checkGLcall("glBindTexture");
+                break;
             case GL_TEXTURE_RECTANGLE_ARB:
                 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_RECTANGLE_ARB, device->dummy_texture_rect[unit]);
                 checkGLcall("glBindTexture");
@@ -2356,7 +2366,7 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
                 checkGLcall("glBindTexture");
                 break;
             default:
-                ERR("Unexpected texture target %#x\n", old_texture_type);
+                ERR("Unexpected texture target %#x.\n", old_texture_type);
         }
 
         context->texture_type[unit] = target;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 149234b..ddd47ca 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -690,6 +690,7 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
     count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers);
     for (i = 0; i < count; ++i)
     {
+        static const DWORD d3d10_color = 0x00000000;
         static const DWORD color = 0x000000ff;
 
         /* Make appropriate texture active */
@@ -749,6 +750,20 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
                 checkGLcall("glTexImage2D");
             }
         }
+
+        if (gl_info->supported[EXT_TEXTURE_ARRAY])
+        {
+            gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_2d_array[i]);
+            checkGLcall("glGenTextures");
+            TRACE("Dummy 2D array texture %u given name %u.\n", i, device->dummy_texture_2d_array[i]);
+
+            gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[i]);
+            checkGLcall("glBindTexture");
+
+            GL_EXTCALL(glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 1, 1, 1, 0,
+                    GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &d3d10_color));
+            checkGLcall("glTexImage3D");
+        }
     }
 }
 
@@ -757,6 +772,12 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
 {
     unsigned int count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers);
 
+    if (gl_info->supported[EXT_TEXTURE_ARRAY])
+    {
+        gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d_array);
+        checkGLcall("glDeleteTextures(count, device->dummy_texture_2d_array)");
+    }
+
     if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
     {
         gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_cube);
@@ -778,6 +799,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
     gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d);
     checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)");
 
+    memset(device->dummy_texture_2d_array, 0, count * sizeof(*device->dummy_texture_2d_array));
     memset(device->dummy_texture_cube, 0, count * sizeof(*device->dummy_texture_cube));
     memset(device->dummy_texture_3d, 0, count * sizeof(*device->dummy_texture_3d));
     memset(device->dummy_texture_rect, 0, count * sizeof(*device->dummy_texture_rect));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f51d7e2..b1ce55c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2304,10 +2304,11 @@ struct wined3d_device
     struct wined3d_texture *logo_texture;
 
     /* Textures for when no other textures are mapped */
-    UINT dummy_texture_2d[MAX_COMBINED_SAMPLERS];
-    UINT dummy_texture_rect[MAX_COMBINED_SAMPLERS];
-    UINT dummy_texture_3d[MAX_COMBINED_SAMPLERS];
-    UINT dummy_texture_cube[MAX_COMBINED_SAMPLERS];
+    GLuint dummy_texture_2d[MAX_COMBINED_SAMPLERS];
+    GLuint dummy_texture_rect[MAX_COMBINED_SAMPLERS];
+    GLuint dummy_texture_3d[MAX_COMBINED_SAMPLERS];
+    GLuint dummy_texture_cube[MAX_COMBINED_SAMPLERS];
+    GLuint dummy_texture_2d_array[MAX_COMBINED_SAMPLERS];
 
     /* Default sampler used to emulate the direct resource access without using wined3d_sampler */
     GLuint default_sampler;
-- 
2.4.10




More information about the wine-patches mailing list