Module: wine Branch: stable Commit: cd55047c5eec29ffdcf4cfda1195176e00157572 URL: http://source.winehq.org/git/wine.git/?a=commit;h=cd55047c5eec29ffdcf4cfda11...
Author: Józef Kucia jkucia@codeweavers.com Date: Thu Jan 26 13:07:30 2017 +0100
wined3d: Create dummy buffer textures.
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit e800093706e7b56ae1df73182ec52f906295a975) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
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 6112b40..4243152 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"); } } @@ -2444,6 +2447,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 3a24e29..6aca567 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 2fb410b..a94aa64 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2592,6 +2592,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 */