Mesa (master): mesa/main: Fix multisample texture initialize
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 5 00:30:19 UTC 2019
Module: Mesa
Branch: master
Commit: a113a42e7369a4e43a1db1c9a7a35a3f7175615e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a113a42e7369a4e43a1db1c9a7a35a3f7175615e
Author: Illia Iorin <illia.iorin at globallogic.com>
Date: Thu Feb 28 12:33:50 2019 +0200
mesa/main: Fix multisample texture initialize
Sampler of Multisample textures wasn't initialized correct. So when
texture object created as multisample its sampler is initialized in a
individual case. We change the initial state of TEXTURE_MIN_FILTER and
TEXTURE_MAG_FILTER to NEAREST.
These changes are approved by KhronosGroup.
https://github.com/KhronosGroup/OpenGL-API/issues/45
Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
Signed-off-by: Illia Iorin <illia.iorin at globallogic.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109057
---
src/mesa/main/texobj.c | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 5dc5cb8e1a9..38860fed4f0 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -272,6 +272,8 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
target == GL_TEXTURE_2D_MULTISAMPLE ||
target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
+ GLenum filter = GL_LINEAR;
+
memset(obj, 0, sizeof(*obj));
/* init the non-zero fields */
simple_mtx_init(&obj->Mutex, mtx_plain);
@@ -292,20 +294,30 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
obj->RequiredTextureImageUnits = 1;
/* sampler state */
- if (target == GL_TEXTURE_RECTANGLE_NV ||
- target == GL_TEXTURE_EXTERNAL_OES) {
- obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
- obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
- obj->Sampler.WrapR = GL_CLAMP_TO_EDGE;
- obj->Sampler.MinFilter = GL_LINEAR;
- }
- else {
- obj->Sampler.WrapS = GL_REPEAT;
- obj->Sampler.WrapT = GL_REPEAT;
- obj->Sampler.WrapR = GL_REPEAT;
- obj->Sampler.MinFilter = GL_NEAREST_MIPMAP_LINEAR;
+ switch (target) {
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ filter = GL_NEAREST;
+ /* fallthrough */
+
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_TEXTURE_EXTERNAL_OES:
+ obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
+ obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
+ obj->Sampler.WrapR = GL_CLAMP_TO_EDGE;
+ obj->Sampler.MinFilter = filter;
+ obj->Sampler.MagFilter = filter;
+ break;
+
+ default:
+ obj->Sampler.WrapS = GL_REPEAT;
+ obj->Sampler.WrapT = GL_REPEAT;
+ obj->Sampler.WrapR = GL_REPEAT;
+ obj->Sampler.MinFilter = GL_NEAREST_MIPMAP_LINEAR;
+ obj->Sampler.MagFilter = GL_LINEAR;
+ break;
}
- obj->Sampler.MagFilter = GL_LINEAR;
+
obj->Sampler.MinLod = -1000.0;
obj->Sampler.MaxLod = 1000.0;
obj->Sampler.LodBias = 0.0;
More information about the mesa-commit
mailing list