[Mesa-dev] [RFC PATCH 22/26] i965: gen6: set multisample mode in surface_state

Chris Forbes chrisf at ijw.co.nz
Sat Dec 29 04:35:35 PST 2012


- Set the multisample mode
- Set the surface dimensions correctly, in pixels.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 1c54d59..160bd3f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -814,6 +814,14 @@ brw_update_texture_surface(struct gl_context *ctx,
 
    intel_miptree_get_dimensions_for_image(firstImage, &width, &height, &depth);
 
+   if (tObj->Target == GL_TEXTURE_2D_MULTISAMPLE ||
+         tObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
+      /* surface_state wants pixel dimensions, not the 2x2 or 4x2 size
+       * of the surface as stored in the miptree's levels array. */
+      width = intelObj->mt->singlesample_width0;
+      height = intelObj->mt->singlesample_height0;
+   }
+
    surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
 			  6 * 4, 32, &binding_table[surf_index]);
 
@@ -837,7 +845,7 @@ brw_update_texture_surface(struct gl_context *ctx,
 	      ((intelObj->mt->region->pitch * intelObj->mt->cpp) - 1) <<
 	      BRW_SURFACE_PITCH_SHIFT);
 
-   surf[4] = 0;
+   surf[4] = brw_get_surface_num_multisamples(intelObj->mt->num_samples);
 
    surf[5] = (mt->align_h == 4) ? BRW_SURFACE_VERTICAL_ALIGN_ENABLE : 0;
 
-- 
1.8.0.3



More information about the mesa-dev mailing list