[Mesa-dev] [PATCH 0.2/2] i965: Initialize the sample_map_Xx variables

Anuj Phogat anuj.phogat at gmail.com
Tue Sep 23 17:41:21 PDT 2014


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_context.c | 36 +++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 619f2d5..cabc79f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -406,6 +406,42 @@ brw_initialize_context_constants(struct brw_context *brw)
    ctx->Const.MaxDepthTextureSamples = max_samples;
    ctx->Const.MaxIntegerSamples = max_samples;
 
+   /* Sample index layout shows the numbering of slots in a rectangular
+    * grid of samples with in a pixel. Sample number layout shows the
+    * rectangular grid of samples roughly corresponding to the real sample
+    * locations with in a pixel. Sample number layout matches the sample
+    * index layout in case of 2X and 4x MSAA, but they are different in
+    * case of 8X MSAA.
+    *
+    * 2X MSAA sample index / number layout
+    *           ---------
+    *           | 0 | 1 |
+    *           ---------
+    *
+    * 4X MSAA sample index / number layout
+    *           ---------
+    *           | 0 | 1 |
+    *           ---------
+    *           | 2 | 3 |
+    *           ---------
+    *
+    * 8X MSAA sample index layout    8x MSAA sample number layout
+    *           ---------                      ---------
+    *           | 0 | 1 |                      | 5 | 2 |
+    *           ---------                      ---------
+    *           | 2 | 3 |                      | 4 | 6 |
+    *           ---------                      ---------
+    *           | 4 | 5 |                      | 0 | 3 |
+    *           ---------                      ---------
+    *           | 6 | 7 |                      | 7 | 1 |
+    *           ---------                      ---------
+    *
+    * A sample map is used to map sample index to a sample number.
+    */
+   ctx->Const.sample_map_2x = "0, 1";
+   ctx->Const.sample_map_4x = "0, 1, 2, 3";
+   ctx->Const.sample_map_8x = "5, 2, 4, 6, 0, 3, 7, 1";
+
    if (brw->gen >= 7)
       ctx->Const.MaxProgramTextureGatherComponents = 4;
    else if (brw->gen == 6)
-- 
1.9.3



More information about the mesa-dev mailing list