wined3d: Take the layer index into account in wined3d_shader_resource_view_gl_generate_mipmap().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8c47318081
commit
6580892660
|
@ -1197,7 +1197,7 @@ static void shader_resource_view_gl_bind_and_dirtify(struct wined3d_shader_resou
|
||||||
void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resource_view_gl *view_gl,
|
void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resource_view_gl *view_gl,
|
||||||
struct wined3d_context_gl *context_gl)
|
struct wined3d_context_gl *context_gl)
|
||||||
{
|
{
|
||||||
unsigned int i, j, layer_count, level_count, base_level, max_level;
|
unsigned int i, j, layer_count, level_count, base_level, base_layer;
|
||||||
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||||
struct wined3d_texture_gl *texture_gl;
|
struct wined3d_texture_gl *texture_gl;
|
||||||
struct gl_texture *gl_tex;
|
struct gl_texture *gl_tex;
|
||||||
|
@ -1209,14 +1209,16 @@ void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resou
|
||||||
layer_count = view_gl->v.desc.u.texture.layer_count;
|
layer_count = view_gl->v.desc.u.texture.layer_count;
|
||||||
level_count = view_gl->v.desc.u.texture.level_count;
|
level_count = view_gl->v.desc.u.texture.level_count;
|
||||||
base_level = view_gl->v.desc.u.texture.level_idx;
|
base_level = view_gl->v.desc.u.texture.level_idx;
|
||||||
max_level = base_level + level_count - 1;
|
base_layer = view_gl->v.desc.u.texture.layer_idx;
|
||||||
|
|
||||||
texture_gl = wined3d_texture_gl(texture_from_resource(view_gl->v.resource));
|
texture_gl = wined3d_texture_gl(texture_from_resource(view_gl->v.resource));
|
||||||
srgb = !!(texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB);
|
srgb = !!(texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB);
|
||||||
location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
|
location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
|
||||||
for (i = 0; i < layer_count; ++i)
|
for (i = 0; i < layer_count; ++i)
|
||||||
{
|
{
|
||||||
wined3d_texture_load_location(&texture_gl->t, i * level_count + base_level, &context_gl->c, location);
|
if (!wined3d_texture_load_location(&texture_gl->t,
|
||||||
|
(base_layer + i) * level_count + base_level, &context_gl->c, location))
|
||||||
|
ERR("Failed to load source layer %u.\n", base_layer + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view_gl->gl_view.name)
|
if (view_gl->gl_view.name)
|
||||||
|
@ -1227,7 +1229,7 @@ void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resou
|
||||||
{
|
{
|
||||||
wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, srgb);
|
wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, srgb);
|
||||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, base_level);
|
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, base_level);
|
||||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_MAX_LEVEL, max_level);
|
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_MAX_LEVEL, base_level + level_count - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
|
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
|
||||||
|
@ -1245,10 +1247,12 @@ void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resou
|
||||||
|
|
||||||
for (i = 0; i < layer_count; ++i)
|
for (i = 0; i < layer_count; ++i)
|
||||||
{
|
{
|
||||||
for (j = base_level + 1; j <= max_level; ++j)
|
for (j = 1; j < level_count; ++j)
|
||||||
{
|
{
|
||||||
wined3d_texture_validate_location(&texture_gl->t, i * level_count + j, location);
|
wined3d_texture_validate_location(&texture_gl->t,
|
||||||
wined3d_texture_invalidate_location(&texture_gl->t, i * level_count + j, ~location);
|
(base_layer + i) * level_count + base_level + j, location);
|
||||||
|
wined3d_texture_invalidate_location(&texture_gl->t,
|
||||||
|
(base_layer + i) * level_count + base_level + j, ~location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue