[PATCH 05/11] wined3d: Fix shader_resource_view_generate_mipmaps() with texture views.
Matteo Bruni
mbruni at codeweavers.com
Thu Dec 7 15:56:17 CST 2017
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
Józef noticed that GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL are
specified to be relative to the view, not to the original
texture. That mostly means that we don't want to set them here if we
have a texture view.
dlls/wined3d/view.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index a8651ab8bbb..828845827f4 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -844,14 +844,20 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
for (i = 0; i < layer_count; ++i)
wined3d_texture_load_location(texture, i * level_count + base_level, context, location);
+
if (view->gl_view.name)
+ {
shader_resource_view_bind_and_dirtify(view, context);
+ }
else
+ {
wined3d_texture_bind_and_dirtify(texture, context, srgb);
+ gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level);
+ gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, max_level);
+ }
+
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
GL_EXTCALL(glBindSampler(context->active_texture, 0));
- gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level);
- gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, max_level);
gl_tex = wined3d_texture_get_gl_texture(texture, srgb);
if (context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
{
@@ -872,11 +878,11 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
}
}
- gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, level_count - 1);
- if (srgb)
- texture->texture_srgb.base_level = base_level;
- else
- texture->texture_rgb.base_level = base_level;
+ if (!view->gl_view.name)
+ {
+ gl_tex->base_level = base_level;
+ gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1);
+ }
context_release(context);
}
--
2.13.6
More information about the wine-devel
mailing list