[Mesa-dev] [PATCH 06/19] radeonsi: drop support for NULL sampler views

Marek Olšák maraeo at gmail.com
Sun Oct 2 21:09:21 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

not used anymore. It was used when the polygon stipple texture was constant.
---
 src/gallium/drivers/radeonsi/si_descriptors.c |  5 +++--
 src/gallium/drivers/radeonsi/si_state.c       | 11 +----------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 21dad3c..693233d 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -403,38 +403,39 @@ static void si_set_sampler_view(struct si_context *sctx,
 	struct si_sampler_view *rview = (struct si_sampler_view*)view;
 	struct si_descriptors *descs = si_sampler_descriptors(sctx, shader);
 
 	if (views->views[slot] == view && !disallow_early_out)
 		return;
 
 	if (view) {
 		struct r600_texture *rtex = (struct r600_texture *)view->texture;
 		uint32_t *desc = descs->list + slot * 16;
 
+		assert(rtex); /* NULL views aren't supported */
 		pipe_sampler_view_reference(&views->views[slot], view);
 		memcpy(desc, rview->state, 8*4);
 
-		if (view->texture && view->texture->target != PIPE_BUFFER) {
+		if (rtex->resource.b.b.target != PIPE_BUFFER) {
 			bool is_separate_stencil =
 				rtex->db_compatible &&
 				rview->is_stencil_sampler;
 
 			si_set_mutable_tex_desc_fields(rtex,
 						       rview->base_level_info,
 						       rview->base_level,
 						       rview->base.u.tex.first_level,
 						       rview->block_width,
 						       is_separate_stencil,
 						       desc);
 		}
 
-		if (view->texture && view->texture->target != PIPE_BUFFER &&
+		if (rtex->resource.b.b.target != PIPE_BUFFER &&
 		    rtex->fmask.size) {
 			memcpy(desc + 8,
 			       rview->fmask_state, 8*4);
 		} else {
 			/* Disable FMASK and bind sampler state in [12:15]. */
 			memcpy(desc + 8,
 			       null_texture_descriptor, 4*4);
 
 			if (views->sampler_states[slot])
 				memcpy(desc + 12,
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 04b57dc..0376693 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2943,30 +2943,21 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
 
 	if (!view)
 		return NULL;
 
 	/* initialize base object */
 	view->base = *state;
 	view->base.texture = NULL;
 	view->base.reference.count = 1;
 	view->base.context = ctx;
 
-	/* NULL resource, obey swizzle (only ZERO and ONE make sense). */
-	if (!texture) {
-		view->state[3] = S_008F1C_DST_SEL_X(si_map_swizzle(state->swizzle_r)) |
-				 S_008F1C_DST_SEL_Y(si_map_swizzle(state->swizzle_g)) |
-				 S_008F1C_DST_SEL_Z(si_map_swizzle(state->swizzle_b)) |
-				 S_008F1C_DST_SEL_W(si_map_swizzle(state->swizzle_a)) |
-				 S_008F1C_TYPE(V_008F1C_SQ_RSRC_IMG_1D);
-		return &view->base;
-	}
-
+	assert(texture);
 	pipe_resource_reference(&view->base.texture, texture);
 
 	if (state->format == PIPE_FORMAT_X24S8_UINT ||
 	    state->format == PIPE_FORMAT_S8X24_UINT ||
 	    state->format == PIPE_FORMAT_X32_S8X24_UINT ||
 	    state->format == PIPE_FORMAT_S8_UINT)
 		view->is_stencil_sampler = true;
 
 	/* Buffer resource. */
 	if (texture->target == PIPE_BUFFER) {
-- 
2.7.4



More information about the mesa-dev mailing list