[PATCH 3/6] wined3d: Create dummy textures for multisample texture targets.
Józef Kucia
jkucia at codeweavers.com
Thu Feb 15 06:49:35 CST 2018
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/context.c | 17 ++++++++++++++++-
dlls/wined3d/device.c | 31 +++++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 8c2ea866113d..7eeb8c41938f 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1756,7 +1756,15 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru
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");
+ if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE,
+ device->dummy_textures.tex_2d_ms);
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+ device->dummy_textures.tex_2d_ms_array);
+ }
+
+ checkGLcall("bind dummy textures");
}
}
@@ -2759,6 +2767,13 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, device->dummy_textures.tex_buffer);
checkGLcall("glBindTexture");
break;
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, device->dummy_textures.tex_2d_ms);
+ break;
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+ device->dummy_textures.tex_2d_ms_array);
+ break;
default:
ERR("Unexpected texture target %#x.\n", old_texture_type);
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e41227256de8..be77c0e5bb81 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -727,6 +727,31 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
checkGLcall("glDeleteBuffers");
}
+ if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d_ms);
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, device->dummy_textures.tex_2d_ms);
+ GL_EXTCALL(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 1, GL_RGBA8, 1, 1, GL_TRUE));
+
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d_ms_array);
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, device->dummy_textures.tex_2d_ms_array);
+ GL_EXTCALL(glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, GL_RGBA8, 1, 1, 1, GL_TRUE));
+
+ if (gl_info->supported[ARB_CLEAR_TEXTURE])
+ {
+ GL_EXTCALL(glClearTexImage(device->dummy_textures.tex_2d_ms,
+ 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
+ GL_EXTCALL(glClearTexImage(device->dummy_textures.tex_2d_ms_array,
+ 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
+ }
+ else
+ {
+ WARN("ARB_clear_texture is currently required to clear dummy multisample textures.\n");
+ }
+
+ checkGLcall("create dummy multisample textures");
+ }
+
context_bind_dummy_textures(device, context);
}
@@ -735,6 +760,12 @@ 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_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d_ms);
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d_ms_array);
+ }
+
if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_buffer);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 02f471b9c446..7cf5fc3fbfa5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2942,6 +2942,8 @@ struct wined3d_device
GLuint tex_cube_array;
GLuint tex_2d_array;
GLuint tex_buffer;
+ GLuint tex_2d_ms;
+ GLuint tex_2d_ms_array;
} dummy_textures;
/* Default sampler used to emulate the direct resource access without using wined3d_sampler */
--
2.13.6
More information about the wine-devel
mailing list