summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/multisample.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-06-11 18:30:34 -0400
committerMarek Olšák <[email protected]>2018-08-04 02:46:55 -0400
commit459f05c7ec4b885450acd7e4b64eb4ad8c955c03 (patch)
treea9d473b33bda93cf48fcef5b32f2c60fe4500cbb /src/mesa/main/multisample.c
parent328c1c8d99073df55b4b82615cfc3a0993784a53 (diff)
mesa: add functional FBO changes for AMD_framebuffer_multisample_advanced
- relax FBO completeness rules - validate sample counts Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/multisample.c')
-rw-r--r--src/mesa/main/multisample.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 4341a5918e4..8beb1d839ec 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -226,6 +226,58 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target,
return GL_INVALID_OPERATION;
}
+ if (ctx->Extensions.AMD_framebuffer_multisample_advanced &&
+ target == GL_RENDERBUFFER) {
+ if (!_mesa_is_depth_or_stencil_format(internalFormat)) {
+ /* From the AMD_framebuffer_multisample_advanced spec:
+ *
+ * "An INVALID_OPERATION error is generated if <internalformat>
+ * is a color format and <storageSamples> is greater than
+ * the implementation-dependent limit MAX_COLOR_FRAMEBUFFER_-
+ * STORAGE_SAMPLES_AMD."
+ */
+ if (samples > ctx->Const.MaxColorFramebufferSamples)
+ return GL_INVALID_OPERATION;
+
+ /* From the AMD_framebuffer_multisample_advanced spec:
+ *
+ * "An INVALID_OPERATION error is generated if <internalformat>
+ * is a color format and <storageSamples> is greater than
+ * the implementation-dependent limit MAX_COLOR_FRAMEBUFFER_-
+ * STORAGE_SAMPLES_AMD."
+ */
+ if (storageSamples > ctx->Const.MaxColorFramebufferStorageSamples)
+ return GL_INVALID_OPERATION;
+
+ /* From the AMD_framebuffer_multisample_advanced spec:
+ *
+ * "An INVALID_OPERATION error is generated if <storageSamples> is
+ * greater than <samples>."
+ */
+ if (storageSamples > samples)
+ return GL_INVALID_OPERATION;
+
+ /* Color renderbuffer sample counts are now fully validated
+ * according to AMD_framebuffer_multisample_advanced.
+ */
+ return GL_NO_ERROR;
+ } else {
+ /* From the AMD_framebuffer_multisample_advanced spec:
+ *
+ * "An INVALID_OPERATION error is generated if <internalformat> is
+ * a depth or stencil format and <storageSamples> is not equal to
+ * <samples>."
+ */
+ if (storageSamples != samples)
+ return GL_INVALID_OPERATION;
+ }
+ } else {
+ /* If the extension is unsupported, it's not possible to set
+ * storageSamples differently.
+ */
+ assert(samples == storageSamples);
+ }
+
/* If ARB_internalformat_query is supported, then treat its highest
* returned sample count as the absolute maximum for this format; it is
* allowed to exceed MAX_SAMPLES.