summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/evergreen_state.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-10-18 12:04:57 +1000
committerDave Airlie <[email protected]>2010-10-18 13:39:54 +1000
commita1b7333c07797faea29f50fd49b6c5e877beca0a (patch)
tree277ac7e9cd8cf43717d2574858a7a5b8e8d1aee2 /src/gallium/drivers/r600/evergreen_state.c
parent9da17fed2e7645a401a378ae690eb23513948e18 (diff)
r600g: do proper tracking of views/samplers.
we need to do pretty much what r300g does in for this, this fixes some issues seen while working on tiling.
Diffstat (limited to 'src/gallium/drivers/r600/evergreen_state.c')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 935496c04af..ce34ed4ad3c 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -500,15 +500,27 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
-
- rctx->ps_samplers.views = resource;
- rctx->ps_samplers.n_views = count;
-
- for (int i = 0; i < count; i++) {
- if (resource[i]) {
- evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i);
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (&rctx->ps_samplers.views[i]->base != views[i]) {
+ if (resource[i])
+ evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i);
+ else
+ evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, i);
+
+ pipe_sampler_view_reference(
+ (struct pipe_sampler_view **)&rctx->ps_samplers.views[i],
+ views[i]);
}
}
+ for (i = count; i < NUM_TEX_UNITS; i++) {
+ if (rctx->ps_samplers.views[i]) {
+ evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, i);
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
+ }
+ }
+ rctx->ps_samplers.n_views = count;
}
static void evergreen_bind_state(struct pipe_context *ctx, void *state)
@@ -527,7 +539,8 @@ static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count,
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
- rctx->ps_samplers.samplers = states;
+
+ memcpy(rctx->ps_samplers.samplers, states, sizeof(void*) * count);
rctx->ps_samplers.n_samplers = count;
for (int i = 0; i < count; i++) {