Created attachment 142804 [details] example (needs GLFW and GLEW) Hi, I noticed that it seems impossible to read from multisampled textures using texelFetch() if the texture uses an integral format (like GL_R8UI). I attached a small test for this, where a GL_TEXTURE_2D_MULTISAMPLE is written to by a fragment shader, and then read from in another fragment shader. I'm using a "uint" output in the writing shader, and "usampler2DMS" in the reading shader - so in my opinion, everything is set up correctly. I haven't got a lot of experience in the OpenGL world, so there might be something I'm missing. The code works on NVidia drivers, though. Using Mesa (tested on i965 and nouveau), the test fails - we always obtain zeros from texelFetch(). Most interestingly, it works if I (incorrectly) use GL_R32F as the texture type, even though the shaders both expect integers. To compile the sample, use: g++ -std=c++11 -o intel_multisample intel_multisample.cpp -lglfw -lGL -lGLEW Then run it: ./intel_multisample GL_R8UI # fails ./intel_multisample GL_R32F # works My hardware: 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06) 02:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2) I'd be glad to help with further debugging if it turns out to be a real bug.
Some further information from glGetIntegerv(): GL_MAX_INTEGER_SAMPLES: 16 GL_MAX_SAMPLES: 16 And glGetInternalformativ(): Supported sample counts per internal format: - GL_R16UI: 16 8 4 2 - GL_R32F: 16 8 4 2 - GL_R32UI: 16 8 4 2 - GL_R8UI: 16 8 4 2 Both reported on the intel card.
Hello, Max. Here is potential fix on review: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/177 Don't you mind if we will convert your sample to piglit-test?
Hi Sergii, indeed, that PR fixes my issue. Thanks for cross-referencing! > Don't you mind if we will convert your sample to piglit-test? No, I don't mind. Go ahead :-)
> No, I don't mind. Go ahead :-) Thanks, will do soon
Piglit test that shows how texelfetch() works with all possible internal types: https://patchwork.freedesktop.org/patch/285599/
Should be fixed by: commit a113a42e7369a4e43a1db1c9a7a35a3f7175615e Author: Illia Iorin <illia.iorin@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@globallogic.com> Signed-off-by: Illia Iorin <illia.iorin@globallogic.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109057 Illia can you please update the piglit test as per the review comments. Thanks.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.