summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-02-09 16:41:30 -0800
committerKenneth Graunke <[email protected]>2014-02-10 08:18:29 -0800
commita21552a96b8cfafa933cab2fd49a389317a1b44e (patch)
tree5b78773684bfb99a71fd9f79b33da1a5a24588d2 /src/mesa/drivers
parentf4bc0ac83eee968b7a0f18fa8e1ecdc1ba2ddf9e (diff)
i965: Program 2x MSAA sample positions.
There are only two sensible placements for 2x MSAA samples - and one is the mirror image of the other. I chose (0.25, 0.25) and (0.75, 0.75). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_multisample_state.h11
-rw-r--r--src/mesa/drivers/dri/i965/gen6_multisample_state.c3
-rw-r--r--src/mesa/drivers/dri/i965/gen8_multisample_state.c6
3 files changed, 16 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_multisample_state.h b/src/mesa/drivers/dri/i965/brw_multisample_state.h
index 2e0250004da..26633e72983 100644
--- a/src/mesa/drivers/dri/i965/brw_multisample_state.h
+++ b/src/mesa/drivers/dri/i965/brw_multisample_state.h
@@ -24,6 +24,17 @@
#include <stdint.h>
/**
+ * 1x MSAA has a single sample at the center: (0.5, 0.5) -> (0x8, 0x8).
+ *
+ * 2x MSAA sample positions are (0.25, 0.25) and (0.75, 0.75):
+ * 4 c
+ * 4 0
+ * c 1
+ */
+static const uint32_t
+brw_multisample_positions_1x_2x = 0x0088cc44;
+
+/**
* Sample positions:
* 2 6 a e
* 2 0
diff --git a/src/mesa/drivers/dri/i965/gen6_multisample_state.c b/src/mesa/drivers/dri/i965/gen6_multisample_state.c
index cdc9ef8f075..5d65453a675 100644
--- a/src/mesa/drivers/dri/i965/gen6_multisample_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_multisample_state.c
@@ -38,6 +38,9 @@ gen6_get_sample_position(struct gl_context *ctx,
case 1:
result[0] = result[1] = 0.5f;
return;
+ case 2:
+ bits = brw_multisample_positions_1x_2x >> (8 * index);
+ break;
case 4:
bits = brw_multisample_positions_4x >> (8 * index);
break;
diff --git a/src/mesa/drivers/dri/i965/gen8_multisample_state.c b/src/mesa/drivers/dri/i965/gen8_multisample_state.c
index e137efe0d30..64c720807d2 100644
--- a/src/mesa/drivers/dri/i965/gen8_multisample_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_multisample_state.c
@@ -87,10 +87,8 @@ gen8_emit_3dstate_sample_pattern(struct brw_context *brw)
/* 4x MSAA */
OUT_BATCH(brw_multisample_positions_4x);
- /* 2x and 1x MSAA patterns
- * XXX: need to program 2x.
- */
- OUT_BATCH(0x00880000);
+ /* 1x and 2x MSAA */
+ OUT_BATCH(brw_multisample_positions_1x_2x);
ADVANCE_BATCH();
}