[PATCH 04/11] wined3d: Create dummy buffer textures.

Józef Kucia jkucia at codeweavers.com
Thu Jan 26 06:07:30 CST 2017


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

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index b4e40fd..cd0057e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1545,6 +1545,9 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru
         if (gl_info->supported[EXT_TEXTURE_ARRAY])
             gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_textures.tex_2d_array);
 
+        if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
+            gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, device->dummy_textures.tex_buffer);
+
         checkGLcall("Bind dummy textures");
     }
 }
@@ -2443,6 +2446,10 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
                 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, device->dummy_textures.tex_3d);
                 checkGLcall("glBindTexture");
                 break;
+            case GL_TEXTURE_BUFFER:
+                gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, device->dummy_textures.tex_buffer);
+                checkGLcall("glBindTexture");
+                break;
             default:
                 ERR("Unexpected texture target %#x.\n", old_texture_type);
         }
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c6467f2..8eb8f65 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -769,6 +769,29 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
         checkGLcall("glTexImage3D");
     }
 
+    if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
+    {
+        GLuint buffer;
+
+        GL_EXTCALL(glGenBuffers(1, &buffer));
+        GL_EXTCALL(glBindBuffer(GL_TEXTURE_BUFFER, buffer));
+        GL_EXTCALL(glBufferData(GL_TEXTURE_BUFFER, sizeof(color), &color, GL_STATIC_DRAW));
+        GL_EXTCALL(glBindBuffer(GL_TEXTURE_BUFFER, 0));
+        checkGLcall("Create buffer object");
+
+        gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_buffer);
+        checkGLcall("glGenTextures");
+        TRACE("Dummy buffer texture given name %u.\n", device->dummy_textures.tex_buffer);
+
+        gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, device->dummy_textures.tex_buffer);
+        checkGLcall("glBindTexture");
+        GL_EXTCALL(glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, buffer));
+        checkGLcall("glTexBuffer");
+
+        GL_EXTCALL(glDeleteBuffers(1, &buffer));
+        checkGLcall("glDeleteBuffers");
+    }
+
     context_bind_dummy_textures(device, context);
 }
 
@@ -777,6 +800,9 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
 
+    if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
+        gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_buffer);
+
     if (gl_info->supported[EXT_TEXTURE_ARRAY])
         gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d_array);
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9c98b85..ee2eaad 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2586,6 +2586,7 @@ struct wined3d_device
         GLuint tex_3d;
         GLuint tex_cube;
         GLuint tex_2d_array;
+        GLuint tex_buffer;
     } dummy_textures;
 
     /* Default sampler used to emulate the direct resource access without using wined3d_sampler */
-- 
2.10.2




More information about the wine-patches mailing list