Commit d9fa6bb6 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Create dummy textures for multisample texture targets.

parent a9e30882
......@@ -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);
}
......
......@@ -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);
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment