GLenum intFormat = GL_NONE; /* color buffers' internal format */
GLuint minWidth = ~0, minHeight = ~0, maxWidth = 0, maxHeight = 0;
GLint numSamples = -1;
+ GLint fixedSampleLocations = -1;
GLint i;
GLuint j;
f = texImg->_BaseFormat;
attFormat = texImg->TexFormat;
numImages++;
+
if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&
!is_legal_depth_format(ctx, f)) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
fbo_incomplete("texture attachment incomplete", -1);
return;
}
+
+ if (numSamples < 0)
+ numSamples = texImg->NumSamples;
+ else if (numSamples != texImg->NumSamples) {
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ fbo_incomplete("inconsistent sample count", -1);
+ return;
+ }
+
+ if (fixedSampleLocations < 0)
+ fixedSampleLocations = texImg->FixedSampleLocations;
+ else if (fixedSampleLocations != texImg->FixedSampleLocations) {
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ fbo_incomplete("inconsistent fixed sample locations", -1);
+ return;
+ }
}
else if (att->Type == GL_RENDERBUFFER_EXT) {
minWidth = MIN2(minWidth, att->Renderbuffer->Width);
f = att->Renderbuffer->InternalFormat;
attFormat = att->Renderbuffer->Format;
numImages++;
+
+ if (numSamples < 0)
+ numSamples = att->Renderbuffer->NumSamples;
+ else if (numSamples != att->Renderbuffer->NumSamples) {
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ fbo_incomplete("inconsistent sample count", -1);
+ return;
+ }
+
+ /* RENDERBUFFER has fixedSampleLocations implicitly true */
+ if (fixedSampleLocations < 0)
+ fixedSampleLocations = GL_TRUE;
+ else if (fixedSampleLocations != GL_TRUE) {
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ fbo_incomplete("inconsistent fixed sample locations", -1);
+ return;
+ }
}
else {
assert(att->Type == GL_NONE);
continue;
}
- if (att->Renderbuffer && numSamples < 0) {
- /* first buffer */
- numSamples = att->Renderbuffer->NumSamples;
- }
-
/* check if integer color */
fb->_IntegerColor = _mesa_is_format_integer_color(attFormat);
- /* Error-check width, height, format, samples
- */
+ /* Error-check width, height, format */
if (numImages == 1) {
- /* save format, num samples */
+ /* save format */
if (i >= 0) {
intFormat = f;
}
return;
}
}
- if (att->Renderbuffer &&
- att->Renderbuffer->NumSamples != numSamples) {
- fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
- fbo_incomplete("inconsistant number of samples", i);
- return;
- }
}
/* Check that the format is valid. (MESA_FORMAT_NONE means unsupported)