summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/multisample.c
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2013-03-03 21:46:12 +1300
committerChris Forbes <[email protected]>2013-03-24 16:38:18 +1300
commit2405da174ed52cd1b164a6f16cb32964879348a3 (patch)
tree0dff631510216f1e2f001e1819ecbe9ecef95729 /src/mesa/main/multisample.c
parent90b5a2425a5f362ef51ae7bb4d296fc682b92f46 (diff)
mesa: use _mesa_check_sample_count() for multisample textures
Extends _mesa_check_sample_count() to properly support the TEXTURE_2D_MULTISAMPLE and TEXTURE_2D_MULTISAMPLE_ARRAY targets, which have subtly different limits than renderbuffers. This resolves the remaining TODO in the implementation of TexImage*DMultisample. V2: - Don't introduce spurious block. - Do this in multisample.c instead. - Fix typo in error message. - Inline spec quotes Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/multisample.c')
-rw-r--r--src/mesa/main/multisample.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 8e5a969e3a8..b0f45d9332a 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -142,19 +142,42 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target,
return samples > limit ? GL_INVALID_OPERATION : GL_NO_ERROR;
}
- /* If ARB_texture_multisample is supported, we have separate limits for
- * integer formats.
+ /* If ARB_texture_multisample is supported, we have separate limits,
+ * which may be lower than MAX_SAMPLES:
*
- * From the ARB_texture_multisample spec:
+ * From the ARB_texture_multisample spec, when describing the operation
+ * of RenderbufferStorageMultisample:
*
* "If <internalformat> is a signed or unsigned integer format and
* <samples> is greater than the value of MAX_INTEGER_SAMPLES, then the
* error INVALID_OPERATION is generated"
+ *
+ * And when describing the operation of TexImage*Multisample:
+ *
+ * "The error INVALID_OPERATION may be generated if any of the following are true:
+ *
+ * * <internalformat> is a depth/stencil-renderable format and <samples>
+ * is greater than the value of MAX_DEPTH_TEXTURE_SAMPLES
+ * * <internalformat> is a color-renderable format and <samples> is
+ * grater than the value of MAX_COLOR_TEXTURE_SAMPLES
+ * * <internalformat> is a signed or unsigned integer format and
+ * <samples> is greater than the value of MAX_INTEGER_SAMPLES
*/
if (ctx->Extensions.ARB_texture_multisample) {
if (_mesa_is_enum_format_integer(internalFormat))
return samples > ctx->Const.MaxIntegerSamples ? GL_INVALID_OPERATION : GL_NO_ERROR;
+
+ if (target == GL_TEXTURE_2D_MULTISAMPLE ||
+ target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
+
+ if (_mesa_is_depth_or_stencil_format(internalFormat))
+ return samples > ctx->Const.MaxDepthTextureSamples
+ ? GL_INVALID_OPERATION : GL_NO_ERROR;
+ else
+ return samples > ctx->Const.MaxColorTextureSamples
+ ? GL_INVALID_OPERATION : GL_NO_ERROR;
+ }
}
/* No more specific limit is available, so just use MAX_SAMPLES: