Hi, I’m using Texture2DMultisample to perform full screen anti aliaising. Everything works perfectly but i have one question. What happens when i fetch more samples than i actually have in the buffer? Here’s the shader code that i use to resolve the msaa buffer.
#version 330
in vec2 texCoordIn;
uniform sampler2DMS color;
uniform int samples;
out vec4 fragColor;
float div= 1.0/samples;
void main()
{
fragColor = vec4(0.0);
ivec2 texcoord = ivec2(textureSize(color) * texCoordIn);
for (int i=0;i<samples;i++)
{
fragColor += texelFetch(color, texcoord, i);
}
fragColor*= div;
}
Lets say i create a multi sampled buffer with only 4 samples but in my shader i set the number of samples to 16. It still works and i get 0 errors. Changing the number of samples in my shader from 4 to 16 even though my buffer only has 4 samples actually look somewhat smoother. What’s actually going on here? Where is it getting these extra samples from?