diff options
author | Paul Berry <stereotype441@gmail.com> | 2012-07-26 18:01:28 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2012-08-01 12:45:15 -0700 |
commit | 97fc89c6cbaa3b5ef7f678d2dc2c7d5bbba05315 (patch) | |
tree | 357d9e09d8b56536aad4bdc80e0779e4f3df41a3 /src/mesa/drivers/dri/i965/gen6_multisample_state.c | |
parent | d5c918f6adb2f7f72a759607c8f76e7616656c13 (diff) | |
download | external_mesa3d-97fc89c6cbaa3b5ef7f678d2dc2c7d5bbba05315.zip external_mesa3d-97fc89c6cbaa3b5ef7f678d2dc2c7d5bbba05315.tar.gz external_mesa3d-97fc89c6cbaa3b5ef7f678d2dc2c7d5bbba05315.tar.bz2 |
i965/msaa: Treat GL_SAMPLES=1 as equivalent to GL_SAMPLES=0.
EXT_framebuffer_multisample is a required subpart of
ARB_framebuffer_object, which means that we must support it even on
platforms that don't support MSAA. Fortunately
EXT_framebuffer_multisample allows for this by allowing GL_MAX_SAMPLES
to be set to 1.
This leads to a tricky quirk in the GL spec: since
GlRenderbufferStorageMultisamples() accepts any value for its
"samples" parameter up to and including GL_MAX_SAMPLES, that means
that on platforms that don't support MSAA, GL_SAMPLES is allowed to be
set to either 0 or 1. On platforms that do support MSAA, GL_SAMPLES=1
is not used; 0 means no MSAA, and 2 or higher means MSAA.
In other words, GL_SAMPLES needs to be interpreted as follows:
=0 no MSAA (possible on all platforms)
=1 no MSAA (only possible on platforms where MSAA unsupported)
>1 MSAA (only possible on platforms where MSAA supported)
This patch modifies all MSAA-related code to choose between
multisampling and single-sampling based on the condition (GL_SAMPLES >
1) instead of (GL_SAMPLES > 0) so that GL_SAMPLES=1 will be treated as
"no MSAA".
Note that since GL_SAMPLES=1 implies GL_SAMPLE_BUFFERS=1, we can no
longer use GL_SAMPLE_BUFFERS to distinguish between MSAA and non-MSAA
rendering.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_multisample_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_multisample_state.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_multisample_state.c b/src/mesa/drivers/dri/i965/gen6_multisample_state.c index 68d28dd..64ac292 100644 --- a/src/mesa/drivers/dri/i965/gen6_multisample_state.c +++ b/src/mesa/drivers/dri/i965/gen6_multisample_state.c @@ -42,6 +42,7 @@ gen6_emit_3dstate_multisample(struct brw_context *brw, switch (num_samples) { case 0: + case 1: number_of_multisamples = MS_NUMSAMPLES_1; break; case 4: @@ -121,7 +122,7 @@ gen6_emit_3dstate_sample_mask(struct brw_context *brw, BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_SAMPLE_MASK << 16 | (2 - 2)); - if (num_samples > 0) { + if (num_samples > 1) { int coverage_int = (int) (num_samples * coverage + 0.5); uint32_t coverage_bits = (1 << coverage_int) - 1; if (coverage_invert) |