wine-staging/patches/wined3d-1DTextures/0001-wined3d-Create-dummy-1d-textures.patch
2017-01-27 00:45:45 +01:00

129 lines
5.8 KiB
Diff

From 6a1701127f6f8f1c885cb787249496179a69b06b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 23 Aug 2016 22:54:14 +0200
Subject: wined3d: Create dummy 1d textures.
---
dlls/wined3d/context.c | 12 ++++++++++++
dlls/wined3d/device.c | 26 ++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 40 insertions(+)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index cd0057e1591..a4820d337c0 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1531,6 +1531,7 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru
GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + i));
checkGLcall("glActiveTexture");
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_textures.tex_1d);
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_textures.tex_2d);
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
@@ -1543,7 +1544,10 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP, device->dummy_textures.tex_cube);
if (gl_info->supported[EXT_TEXTURE_ARRAY])
+ {
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_textures.tex_1d_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);
@@ -2426,6 +2430,14 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
case GL_NONE:
/* nothing to do */
break;
+ case GL_TEXTURE_1D:
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_textures.tex_1d);
+ checkGLcall("glBindTexture");
+ break;
+ case GL_TEXTURE_1D_ARRAY:
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_textures.tex_1d_array);
+ checkGLcall("glBindTexture");
+ break;
case GL_TEXTURE_2D:
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_textures.tex_2d);
checkGLcall("glBindTexture");
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7898527f6c0..b5a42905d33 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -624,6 +624,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
* to each texture stage when the currently set D3D texture is NULL. */
context_active_texture(context, gl_info, 0);
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_1d);
+ checkGLcall("glGenTextures");
+ TRACE("Dummy 1D texture given name %u.\n", device->dummy_textures.tex_1d);
+
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_textures.tex_1d);
+ checkGLcall("glBindTexture");
+
+ gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 1, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color);
+ checkGLcall("glTexImage1D");
+
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d);
checkGLcall("glGenTextures");
TRACE("Dummy 2D texture given name %u.\n", device->dummy_textures.tex_2d);
@@ -682,6 +693,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
if (gl_info->supported[EXT_TEXTURE_ARRAY])
{
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_1d_array);
+ checkGLcall("glGenTextures");
+ TRACE("Dummy 1D array texture given name %u.\n", device->dummy_textures.tex_1d_array);
+
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_textures.tex_1d_array);
+ checkGLcall("glBindTexture");
+
+ gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, 1, 1, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color);
+ checkGLcall("glTexImage2D");
+
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d_array);
checkGLcall("glGenTextures");
TRACE("Dummy 2D array texture given name %u.\n", device->dummy_textures.tex_2d_array);
@@ -729,7 +751,10 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d
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);
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_1d_array);
+ }
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_cube);
@@ -741,6 +766,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_rect);
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d);
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_1d);
checkGLcall("Delete dummy textures");
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 051836c7414..a71ea9e73ef 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2582,10 +2582,12 @@ struct wined3d_device
/* Textures for when no other textures are mapped */
struct
{
+ GLuint tex_1d;
GLuint tex_2d;
GLuint tex_rect;
GLuint tex_3d;
GLuint tex_cube;
+ GLuint tex_1d_array;
GLuint tex_2d_array;
GLuint tex_buffer;
} dummy_textures;
--
2.11.0