Module: wine Branch: master Commit: e800093706e7b56ae1df73182ec52f906295a975 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e800093706e7b56ae1df73182e...
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
---
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 75a939e..7898527 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -694,6 +694,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); }
@@ -702,6 +725,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 4ee9d5c..5c94803 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2587,6 +2587,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 */