summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_state_common.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-09-10 04:53:33 +0200
committerMarek Olšák <[email protected]>2012-09-13 20:18:44 +0200
commitf2eac1423a92ba47981ba50a4af22e6596059cf4 (patch)
treeeb7a76c7832f835284fb1122a85349dbcffb7c93 /src/gallium/drivers/r600/r600_state_common.c
parent3fe78594b1221358f4ba96072d952e33a7e54a76 (diff)
r600g: put sampler states and views into an array indexed by shader type
Reviewed-by: Jerome Glisse <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_state_common.c')
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 87183169a2a..7899e6cce8e 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -366,7 +366,7 @@ static void r600_bind_sampler_states(struct pipe_context *pipe,
unsigned count, void **states)
{
struct r600_context *rctx = (struct r600_context *)pipe;
- struct r600_textures_info *dst;
+ struct r600_textures_info *dst = &rctx->samplers[shader];
struct r600_pipe_sampler_state **rstates = (struct r600_pipe_sampler_state**)states;
int seamless_cube_map = -1;
unsigned i;
@@ -377,18 +377,6 @@ static void r600_bind_sampler_states(struct pipe_context *pipe,
assert(start == 0); /* XXX fix below */
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- dst = &rctx->vs_samplers;
- break;
- case PIPE_SHADER_FRAGMENT:
- dst = &rctx->ps_samplers;
- break;
- default:
- debug_error("bad shader in r600_bind_samplers()");
- return;
- }
-
for (i = 0; i < count; i++) {
struct r600_pipe_sampler_state *rstate = rstates[i];
@@ -571,7 +559,7 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
struct pipe_sampler_view **views)
{
struct r600_context *rctx = (struct r600_context *) pipe;
- struct r600_textures_info *dst;
+ struct r600_textures_info *dst = &rctx->samplers[shader];
struct r600_pipe_sampler_view **rviews = (struct r600_pipe_sampler_view **)views;
uint32_t dirty_sampler_states_mask = 0;
unsigned i;
@@ -585,18 +573,6 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
assert(start == 0); /* XXX fix below */
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- dst = &rctx->vs_samplers;
- break;
- case PIPE_SHADER_FRAGMENT:
- dst = &rctx->ps_samplers;
- break;
- default:
- debug_error("bad shader in r600_set_sampler_views()");
- return;
- }
-
remaining_mask = dst->views.enabled_mask & disable_mask;
while (remaining_mask) {
@@ -1069,18 +1045,17 @@ static void r600_update_derived_state(struct r600_context *rctx)
unsigned ps_dirty = 0, blend_override;
if (!rctx->blitter->running) {
+ unsigned i;
+
/* Decompress textures if needed. */
- if (rctx->vs_samplers.views.compressed_depthtex_mask) {
- r600_decompress_depth_textures(rctx, &rctx->vs_samplers.views);
- }
- if (rctx->ps_samplers.views.compressed_depthtex_mask) {
- r600_decompress_depth_textures(rctx, &rctx->ps_samplers.views);
- }
- if (rctx->vs_samplers.views.compressed_colortex_mask) {
- r600_decompress_color_textures(rctx, &rctx->vs_samplers.views);
- }
- if (rctx->ps_samplers.views.compressed_colortex_mask) {
- r600_decompress_color_textures(rctx, &rctx->ps_samplers.views);
+ for (i = 0; i < PIPE_SHADER_TYPES; i++) {
+ struct r600_samplerview_state *views = &rctx->samplers[i].views;
+ if (views->compressed_depthtex_mask) {
+ r600_decompress_depth_textures(rctx, views);
+ }
+ if (views->compressed_colortex_mask) {
+ r600_decompress_color_textures(rctx, views);
+ }
}
}