[Mesa-dev] [PATCH 08/12] r600g: remove duplicated set_xx_resource functions

Marek Olšák maraeo at gmail.com
Tue Feb 21 16:55:59 PST 2012


---
 src/gallium/drivers/r600/evergreen_hw_context.c |   21 ---------------------
 src/gallium/drivers/r600/evergreen_state.c      |   16 ++++++++--------
 src/gallium/drivers/r600/r600.h                 |    3 ---
 src/gallium/drivers/r600/r600_state_common.c    |   21 +++++----------------
 4 files changed, 13 insertions(+), 48 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c
index bf6f422..a547475 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -774,27 +774,6 @@ out_err:
 	return r;
 }
 
-void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid)
-{
-	struct r600_block *block = ctx->ps_resources.blocks[rid];
-
-	r600_context_pipe_state_set_resource(ctx, state, block);
-}
-
-void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid)
-{
-	struct r600_block *block = ctx->vs_resources.blocks[rid];
-
-	r600_context_pipe_state_set_resource(ctx, state, block);
-}
-
-void evergreen_context_pipe_state_set_fs_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid)
-{
-	struct r600_block *block = ctx->fs_resources.blocks[rid];
-
-	r600_context_pipe_state_set_resource(ctx, state, block);
-}
-
 static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
 {
 	struct r600_range *range;
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index c4da360..4eca42c 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1061,8 +1061,8 @@ static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned cou
 
 	for (int i = 0; i < count; i++) {
 		if (resource[i]) {
-			evergreen_context_pipe_state_set_vs_resource(rctx, &resource[i]->state,
-								     i + R600_MAX_CONST_BUFFERS);
+			r600_context_pipe_state_set_vs_resource(rctx, &resource[i]->state,
+								i + R600_MAX_CONST_BUFFERS);
 		}
 	}
 }
@@ -1080,11 +1080,11 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou
 			if (resource[i]) {
 				if (((struct r600_resource_texture *)resource[i]->base.texture)->depth)
 					has_depth = 1;
-				evergreen_context_pipe_state_set_ps_resource(rctx, &resource[i]->state,
-									     i + R600_MAX_CONST_BUFFERS);
+				r600_context_pipe_state_set_ps_resource(rctx, &resource[i]->state,
+									i + R600_MAX_CONST_BUFFERS);
 			} else
-				evergreen_context_pipe_state_set_ps_resource(rctx, NULL,
-									     i + R600_MAX_CONST_BUFFERS);
+				r600_context_pipe_state_set_ps_resource(rctx, NULL,
+									i + R600_MAX_CONST_BUFFERS);
 
 			pipe_sampler_view_reference(
 				(struct pipe_sampler_view **)&rctx->ps_samplers.views[i],
@@ -1098,8 +1098,8 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou
 	}
 	for (i = count; i < NUM_TEX_UNITS; i++) {
 		if (rctx->ps_samplers.views[i]) {
-			evergreen_context_pipe_state_set_ps_resource(rctx, NULL,
-								     i + R600_MAX_CONST_BUFFERS);
+			r600_context_pipe_state_set_ps_resource(rctx, NULL,
+								i + R600_MAX_CONST_BUFFERS);
 			pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
 		}
 	}
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index a792e94..deba53f 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -235,9 +235,6 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
 void r600_context_block_resource_emit_dirty(struct r600_context *ctx, struct r600_block *block);
 
 int evergreen_context_init(struct r600_context *ctx);
-void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
-void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
-void evergreen_context_pipe_state_set_fs_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
 void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id);
 void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id);
 
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index cadb079..ec030de 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -381,19 +381,11 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
 	/* Zero states. */
 	for (i = 0; i < count; i++) {
 		if (!buffers[i].buffer) {
-			if (rctx->chip_class >= EVERGREEN) {
-				evergreen_context_pipe_state_set_fs_resource(rctx, NULL, i);
-			} else {
-				r600_context_pipe_state_set_fs_resource(rctx, NULL, i);
-			}
+			r600_context_pipe_state_set_fs_resource(rctx, NULL, i);
 		}
 	}
 	for (; i < rctx->vbuf_mgr->nr_real_vertex_buffers; i++) {
-		if (rctx->chip_class >= EVERGREEN) {
-			evergreen_context_pipe_state_set_fs_resource(rctx, NULL, i);
-		} else {
-			r600_context_pipe_state_set_fs_resource(rctx, NULL, i);
-		}
+		r600_context_pipe_state_set_fs_resource(rctx, NULL, i);
 	}
 
 	u_vbuf_set_vertex_buffers(rctx->vbuf_mgr, count, buffers);
@@ -561,11 +553,10 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
 
 		if (rctx->chip_class >= EVERGREEN) {
 			evergreen_pipe_mod_buffer_resource(ctx, rstate, rbuffer, offset, 16, RADEON_USAGE_READ);
-			evergreen_context_pipe_state_set_vs_resource(rctx, rstate, index);
 		} else {
 			r600_pipe_mod_buffer_resource(rstate, rbuffer, offset, 16, RADEON_USAGE_READ);
-			r600_context_pipe_state_set_vs_resource(rctx, rstate, index);
 		}
+		r600_context_pipe_state_set_vs_resource(rctx, rstate, index);
 		break;
 	case PIPE_SHADER_FRAGMENT:
 		rctx->ps_const_buffer.nregs = 0;
@@ -588,11 +579,10 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
 		}
 		if (rctx->chip_class >= EVERGREEN) {
 			evergreen_pipe_mod_buffer_resource(ctx, rstate, rbuffer, offset, 16, RADEON_USAGE_READ);
-			evergreen_context_pipe_state_set_ps_resource(rctx, rstate, index);
 		} else {
 			r600_pipe_mod_buffer_resource(rstate, rbuffer, offset, 16, RADEON_USAGE_READ);
-			r600_context_pipe_state_set_ps_resource(rctx, rstate, index);
 		}
+		r600_context_pipe_state_set_ps_resource(rctx, rstate, index);
 		break;
 	default:
 		R600_ERR("unsupported %d\n", shader);
@@ -715,11 +705,10 @@ static void r600_vertex_buffer_update(struct r600_context *rctx)
 
 		if (rctx->chip_class >= EVERGREEN) {
 			evergreen_pipe_mod_buffer_resource(&rctx->context, rstate, rbuffer, offset, vertex_buffer->stride, RADEON_USAGE_READ);
-			evergreen_context_pipe_state_set_fs_resource(rctx, rstate, i);
 		} else {
 			r600_pipe_mod_buffer_resource(rstate, rbuffer, offset, vertex_buffer->stride, RADEON_USAGE_READ);
-			r600_context_pipe_state_set_fs_resource(rctx, rstate, i);
 		}
+		r600_context_pipe_state_set_fs_resource(rctx, rstate, i);
 	}
 }
 
-- 
1.7.5.4



More information about the mesa-dev mailing list