diff options
author | Gert Wollny <gert.wollny@collabora.com> | 2023-06-19 13:58:25 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-06-20 08:24:14 +0000 |
commit | 527e912b9831c6e2b5cc046a8e637f380051de4d (patch) | |
tree | 0b72237e34004a87ff04b3b60a7bc21b6107198b | |
parent | e5ad8e9ad3b9ce96f9b68725fe02dba63f91d894 (diff) |
vrend: Correctly apply texture levels for texture views
Either we limit the levels by using the parameters in the texture view
or we set the parameters GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL.
Since the latter would result in ugly if-else statements, we stick to the
texture view.
This fixes the CTS test KHR-GL43.texture_view.view_sampling
It fixes also most of the rendering of GravityMark.
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8339
Signed-off-by: Gert Wollny <gert.wollny@collabora.co.uk>
Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1166>
-rw-r--r-- | .gitlab-ci/expectations/host/virgl-gl-fails.txt | 1 | ||||
-rw-r--r-- | src/vrend_renderer.c | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/.gitlab-ci/expectations/host/virgl-gl-fails.txt b/.gitlab-ci/expectations/host/virgl-gl-fails.txt index 92fd210..f706654 100644 --- a/.gitlab-ci/expectations/host/virgl-gl-fails.txt +++ b/.gitlab-ci/expectations/host/virgl-gl-fails.txt @@ -71,7 +71,6 @@ KHR-GL43.shader_storage_buffer_object.advanced-usage-sync,Fail KHR-GL43.shader_storage_buffer_object.basic-atomic-case1,Fail KHR-GL43.shader_storage_buffer_object.basic-atomic-case2,Fail KHR-GL43.shading_language_420pack.binding_images,Fail -KHR-GL43.texture_view.view_sampling,Fail KHR-GL43.transform_feedback.capture_vertex_interleaved_test,Fail KHR-GL43.transform_feedback.capture_vertex_separate_test,Fail KHR-GL43.transform_feedback.discard_vertex_test,Fail diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 3180964..797742c 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2727,14 +2727,18 @@ int vrend_create_sampler_view(struct vrend_context *ctx, else if (view->format != view->texture->base.format) needs_view = true; + unsigned base_layer = view->val0 & 0xffff; + int base_level = view->val1 & 0xff; + + if (base_layer > 0 || base_level > 0) + needs_view = true; + if (needs_view && has_bit(view->texture->storage_bits, VREND_STORAGE_GL_IMMUTABLE) && has_feature(feat_texture_view)) { glGenTextures(1, &view->id); GLenum internalformat = tex_conv_table[format].internalformat; - unsigned base_layer = view->val0 & 0xffff; unsigned max_layer = (view->val0 >> 16) & 0xffff; - int base_level = view->val1 & 0xff; int max_level = (view->val1 >> 8) & 0xff; view->levels = (max_level - base_level) + 1; @@ -2777,8 +2781,6 @@ int vrend_create_sampler_view(struct vrend_context *ctx, } } - glTexParameteri(view->target, GL_TEXTURE_BASE_LEVEL, base_level); - glTexParameteri(view->target, GL_TEXTURE_MAX_LEVEL, max_level); if (vrend_state.use_gles) { for (unsigned int i = 0; i < 4; ++i) { glTexParameteri(view->target, GL_TEXTURE_SWIZZLE_R + i, view->gl_swizzle[i]); |