summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-10-04 19:29:59 +0200
committerAxel Davy <[email protected]>2016-10-10 23:43:49 +0200
commita83dce01284f220b1bf932774730e13fca6cdd20 (patch)
treea0d6a3abb7e17717b15897bdf00b27c4490eb5dd /src/gallium/state_trackers
parentf78089b962537364d52ba05aa14dacbe20de995c (diff)
st/nine: Change dirty tracking for vs int and bool constants
This change makes easier to introduce tracking for swvp constants. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/device9.c14
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c18
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h8
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c38
4 files changed, 56 insertions, 22 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index cc13399ec5e..591a021002a 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2487,8 +2487,10 @@ NineDevice9_CreateStateBlock( struct NineDevice9 *This,
nine_render_states_vertex, sizeof(dst->changed.rs));
nine_ranges_insert(&dst->changed.vs_const_f, 0, This->max_vs_const_f,
&This->range_pool);
- dst->changed.vs_const_i = 0xffff;
- dst->changed.vs_const_b = 0xffff;
+ nine_ranges_insert(&dst->changed.vs_const_i, 0, NINE_MAX_CONST_I,
+ &This->range_pool);
+ nine_ranges_insert(&dst->changed.vs_const_b, 0, NINE_MAX_CONST_B,
+ &This->range_pool);
for (s = 0; s < NINE_MAX_SAMPLERS; ++s)
dst->changed.sampler[s] |= 1 << D3DSAMP_DMAPOFFSET;
if (This->state.ff.num_lights) {
@@ -3452,7 +3454,9 @@ NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
}
}
- state->changed.vs_const_i |= ((1 << Vector4iCount) - 1) << StartRegister;
+ nine_ranges_insert(&state->changed.vs_const_i,
+ StartRegister, StartRegister + Vector4iCount,
+ &This->range_pool);
state->changed.group |= NINE_STATE_VS_CONST;
return D3D_OK;
@@ -3517,7 +3521,9 @@ NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
for (i = 0; i < BoolCount; i++)
state->vs_const_b[StartRegister + i] = pConstantData[i] ? bool_true : 0;
- state->changed.vs_const_b |= ((1 << BoolCount) - 1) << StartRegister;
+ nine_ranges_insert(&state->changed.vs_const_b,
+ StartRegister, StartRegister + BoolCount,
+ &This->range_pool);
state->changed.group |= NINE_STATE_VS_CONST;
return D3D_OK;
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index a18dd73f4f3..b7a211d21f7 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -143,6 +143,24 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
nine_range_pool_put_chain(&device->range_pool, r, p);
device->state.changed.vs_const_f = NULL;
}
+
+ if (device->state.changed.vs_const_i) {
+ struct nine_range *r = device->state.changed.vs_const_i;
+ struct nine_range *p = r;
+ while (p->next)
+ p = p->next;
+ nine_range_pool_put_chain(&device->range_pool, r, p);
+ device->state.changed.vs_const_i = NULL;
+ }
+
+ if (device->state.changed.vs_const_b) {
+ struct nine_range *r = device->state.changed.vs_const_b;
+ struct nine_range *p = r;
+ while (p->next)
+ p = p->next;
+ nine_range_pool_put_chain(&device->range_pool, r, p);
+ device->state.changed.vs_const_b = NULL;
+ }
state->changed.group &= ~NINE_STATE_VS_CONST;
state->commit |= NINE_STATE_COMMIT_CONST_VS;
}
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index d3c36f84eab..7c395b84a28 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -137,10 +137,10 @@ struct nine_state
uint16_t sampler[NINE_MAX_SAMPLERS];
struct nine_range *vs_const_f;
struct nine_range *ps_const_f;
- uint16_t vs_const_i; /* NINE_MAX_CONST_I == 16 */
- uint16_t ps_const_i;
- uint16_t vs_const_b; /* NINE_MAX_CONST_B == 16 */
- uint16_t ps_const_b;
+ struct nine_range *vs_const_i;
+ uint16_t ps_const_i; /* NINE_MAX_CONST_I == 16 */
+ struct nine_range *vs_const_b;
+ uint16_t ps_const_b; /* NINE_MAX_CONST_B == 16 */
uint8_t ucp;
} changed;
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index bcc00ab88d5..7ba19e76c19 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -76,6 +76,14 @@ NineStateBlock9_dtor( struct NineStateBlock9 *This )
for (r = This->state.changed.vs_const_f; r->next; r = r->next);
nine_range_pool_put_chain(pool, This->state.changed.vs_const_f, r);
}
+ if (This->state.changed.vs_const_i) {
+ for (r = This->state.changed.vs_const_i; r->next; r = r->next);
+ nine_range_pool_put_chain(pool, This->state.changed.vs_const_i, r);
+ }
+ if (This->state.changed.vs_const_b) {
+ for (r = This->state.changed.vs_const_b; r->next; r = r->next);
+ nine_range_pool_put_chain(pool, This->state.changed.vs_const_b, r);
+ }
NineUnknown_dtor(&This->base);
}
@@ -122,21 +130,21 @@ nine_state_copy_common(struct nine_state *dst,
nine_ranges_insert(&dst->changed.vs_const_f, r->bgn, r->end,
pool);
}
- if (mask->changed.vs_const_i) {
- uint16_t m = mask->changed.vs_const_i;
- for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
- if (m & 1)
- memcpy(dst->vs_const_i[i], src->vs_const_i[i], 4 * sizeof(int));
+ for (r = mask->changed.vs_const_i; r; r = r->next) {
+ memcpy(&dst->vs_const_i[r->bgn],
+ &src->vs_const_i[r->bgn],
+ (r->end - r->bgn) * 4 * sizeof(int));
if (apply)
- dst->changed.vs_const_i |= mask->changed.vs_const_i;
+ nine_ranges_insert(&dst->changed.vs_const_i, r->bgn, r->end,
+ pool);
}
- if (mask->changed.vs_const_b) {
- uint16_t m = mask->changed.vs_const_b;
- for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
- if (m & 1)
- dst->vs_const_b[i] = src->vs_const_b[i];
+ for (r = mask->changed.vs_const_b; r; r = r->next) {
+ memcpy(&dst->vs_const_b[r->bgn],
+ &src->vs_const_b[r->bgn],
+ (r->end - r->bgn) * sizeof(int));
if (apply)
- dst->changed.vs_const_b |= mask->changed.vs_const_b;
+ nine_ranges_insert(&dst->changed.vs_const_b, r->bgn, r->end,
+ pool);
}
}
@@ -360,8 +368,10 @@ nine_state_copy_common_all(struct nine_state *dst,
memcpy(dst->vs_const_i, src->vs_const_i, sizeof(dst->vs_const_i));
memcpy(dst->vs_const_b, src->vs_const_b, sizeof(dst->vs_const_b));
if (apply) {
- dst->changed.vs_const_i |= src->changed.vs_const_i;
- dst->changed.vs_const_b |= src->changed.vs_const_b;
+ r = help->changed.vs_const_i;
+ nine_ranges_insert(&dst->changed.vs_const_i, r->bgn, r->end, pool);
+ r = help->changed.vs_const_b;
+ nine_ranges_insert(&dst->changed.vs_const_b, r->bgn, r->end, pool);
}
}