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

wined3d: Create dummy 2D array textures.

parent 8d8e374e
......@@ -1507,6 +1507,12 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP, device->dummy_texture_cube[i]);
checkGLcall("glBindTexture");
}
if (gl_info->supported[EXT_TEXTURE_ARRAY])
{
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[i]);
checkGLcall("glBindTexture");
}
}
}
......@@ -2343,6 +2349,10 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[unit]);
checkGLcall("glBindTexture");
break;
case GL_TEXTURE_2D_ARRAY:
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[unit]);
checkGLcall("glBindTexture");
break;
case GL_TEXTURE_RECTANGLE_ARB:
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_RECTANGLE_ARB, device->dummy_texture_rect[unit]);
checkGLcall("glBindTexture");
......@@ -2356,7 +2366,7 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
checkGLcall("glBindTexture");
break;
default:
ERR("Unexpected texture target %#x\n", old_texture_type);
ERR("Unexpected texture target %#x.\n", old_texture_type);
}
context->texture_type[unit] = target;
......
......@@ -690,6 +690,7 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers);
for (i = 0; i < count; ++i)
{
static const DWORD d3d10_color = 0x00000000;
static const DWORD color = 0x000000ff;
/* Make appropriate texture active */
......@@ -749,6 +750,20 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
checkGLcall("glTexImage2D");
}
}
if (gl_info->supported[EXT_TEXTURE_ARRAY])
{
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_2d_array[i]);
checkGLcall("glGenTextures");
TRACE("Dummy 2D array texture %u given name %u.\n", i, device->dummy_texture_2d_array[i]);
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[i]);
checkGLcall("glBindTexture");
GL_EXTCALL(glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 1, 1, 1, 0,
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &d3d10_color));
checkGLcall("glTexImage3D");
}
}
}
......@@ -757,6 +772,12 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
{
unsigned int count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers);
if (gl_info->supported[EXT_TEXTURE_ARRAY])
{
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d_array);
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d_array)");
}
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_cube);
......@@ -778,6 +799,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d);
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)");
memset(device->dummy_texture_2d_array, 0, count * sizeof(*device->dummy_texture_2d_array));
memset(device->dummy_texture_cube, 0, count * sizeof(*device->dummy_texture_cube));
memset(device->dummy_texture_3d, 0, count * sizeof(*device->dummy_texture_3d));
memset(device->dummy_texture_rect, 0, count * sizeof(*device->dummy_texture_rect));
......
......@@ -2305,10 +2305,11 @@ struct wined3d_device
struct wined3d_texture *logo_texture;
/* Textures for when no other textures are mapped */
UINT dummy_texture_2d[MAX_COMBINED_SAMPLERS];
UINT dummy_texture_rect[MAX_COMBINED_SAMPLERS];
UINT dummy_texture_3d[MAX_COMBINED_SAMPLERS];
UINT dummy_texture_cube[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_2d[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_rect[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_3d[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_cube[MAX_COMBINED_SAMPLERS];
GLuint dummy_texture_2d_array[MAX_COMBINED_SAMPLERS];
/* Default sampler used to emulate the direct resource access without using wined3d_sampler */
GLuint default_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