[Mesa-dev] [PATCH 4/4] r600g: add support for remaining bits for multisample texture

Dave Airlie airlied at gmail.com
Sun Mar 3 12:27:54 PST 2013


From: Dave Airlie <airlied at redhat.com>

get sample position is most definitely wrong, need to find out what
sample positions the hardware uses.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/drivers/r600/r600_shader.c       |  1 +
 src/gallium/drivers/r600/r600_state_common.c | 35 ++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 8642463..5fd3f83 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -4705,6 +4705,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 			tex.src_sel_z = tex.src_sel_y;
 		}
 	} else if (inst->Texture.Texture == TGSI_TEXTURE_2D_ARRAY ||
+		   inst->Texture.Texture == TGSI_TEXTURE_2D_ARRAY_MSAA ||
 		   inst->Texture.Texture == TGSI_TEXTURE_SHADOW2D_ARRAY ||
 		   ((inst->Texture.Texture == TGSI_TEXTURE_CUBE_ARRAY ||
 		    inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE_ARRAY) &&
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 22ac846..8c8b665 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1748,6 +1748,39 @@ bool sampler_state_needs_border_color(const struct pipe_sampler_state *state)
 		wrap_mode_uses_border_color(state->wrap_r, linear_filter));
 }
 
+static void r600_get_sample_position(struct pipe_context *ctx,
+				     int max_sample,
+				     unsigned sample_index,
+				     float *out_value)
+{
+	switch (max_sample) {
+	case 1:
+	default:
+		out_value[0] = out_value[1] = 0.5;
+		break;
+	case 4:
+		switch (sample_index) {
+		case 0:
+			out_value[0] = 0.25;
+			out_value[1] = 0.25;
+			break;
+		case 1:
+			out_value[0] = 0.25;
+			out_value[1] = 0.75;
+			break;
+		case 2:
+			out_value[0] = 0.75;
+			out_value[1] = 0.25;
+			break;
+		case 3:
+			out_value[0] = 0.75;
+			out_value[1] = 0.75;
+			break;
+		}
+		break;
+	}
+}
+
 /* keep this at the end of this file, please */
 void r600_init_common_state_functions(struct r600_context *rctx)
 {
@@ -1785,6 +1818,8 @@ void r600_init_common_state_functions(struct r600_context *rctx)
 	rctx->context.stream_output_target_destroy = r600_so_target_destroy;
 	rctx->context.set_stream_output_targets = r600_set_streamout_targets;
 	rctx->context.draw_vbo = r600_draw_vbo;
+
+	rctx->context.get_sample_position = r600_get_sample_position;
 }
 
 #if R600_TRACE_CS
-- 
1.8.1.2



More information about the mesa-dev mailing list