diff options
author | Axel Davy <[email protected]> | 2016-10-20 22:10:34 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:44:22 +0100 |
commit | b748b8fd8619ab412517f859dbf9a42b62ef6309 (patch) | |
tree | c2f892a75ad5e7126641051f191a091842842774 /src/gallium/state_trackers/nine/nine_ff.c | |
parent | a0a18920c7cdba1ffc6d642aff039476755c1cae (diff) |
st/nine: Track dirty state groups in nine_context
Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/nine_ff.c')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index 306b2aea722..748a9fa0f1e 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -1898,12 +1898,11 @@ nine_ff_load_vs_transforms(struct NineDevice9 *device) static void nine_ff_load_lights(struct NineDevice9 *device) { - struct nine_state *state = &device->state; struct nine_context *context = &device->context; struct fvec4 *dst = (struct fvec4 *)device->ff.vs_const; unsigned l; - if (state->changed.group & NINE_STATE_FF_MATERIAL) { + if (context->changed.group & NINE_STATE_FF_MATERIAL) { const D3DMATERIAL9 *mtl = &context->ff.material; memcpy(&dst[20], &mtl->Diffuse, 4 * sizeof(float)); @@ -1917,7 +1916,7 @@ nine_ff_load_lights(struct NineDevice9 *device) dst[19].z = dst[25].z * mtl->Ambient.b + mtl->Emissive.b; } - if (!(state->changed.group & NINE_STATE_FF_LIGHTING)) + if (!(context->changed.group & NINE_STATE_FF_LIGHTING)) return; for (l = 0; l < context->ff.num_lights_active; ++l) { @@ -1944,11 +1943,10 @@ nine_ff_load_lights(struct NineDevice9 *device) static void nine_ff_load_point_and_fog_params(struct NineDevice9 *device) { - const struct nine_state *state = &device->state; struct nine_context *context = &device->context; struct fvec4 *dst = (struct fvec4 *)device->ff.vs_const; - if (!(state->changed.group & NINE_STATE_FF_OTHER)) + if (!(context->changed.group & NINE_STATE_FF_OTHER)) return; dst[26].x = asfloat(context->rs[D3DRS_POINTSIZE_MIN]); dst[26].y = asfloat(context->rs[D3DRS_POINTSIZE_MAX]); @@ -1981,12 +1979,11 @@ nine_ff_load_tex_matrices(struct NineDevice9 *device) static void nine_ff_load_ps_params(struct NineDevice9 *device) { - const struct nine_state *state = &device->state; struct nine_context *context = &device->context; struct fvec4 *dst = (struct fvec4 *)device->ff.ps_const; unsigned s; - if (!(state->changed.group & (NINE_STATE_FF_PSSTAGES | NINE_STATE_FF_OTHER))) + if (!(context->changed.group & (NINE_STATE_FF_PSSTAGES | NINE_STATE_FF_OTHER))) return; for (s = 0; s < 8; ++s) @@ -2043,11 +2040,11 @@ nine_ff_update(struct NineDevice9 *device) /* NOTE: the only reference belongs to the hash table */ if (!context->programmable_vs) { device->ff.vs = nine_ff_get_vs(device); - device->state.changed.group |= NINE_STATE_VS; + context->changed.group |= NINE_STATE_VS; } if (!context->ps) { device->ff.ps = nine_ff_get_ps(device); - device->state.changed.group |= NINE_STATE_PS; + context->changed.group |= NINE_STATE_PS; } if (!context->programmable_vs) { @@ -2104,7 +2101,7 @@ nine_ff_update(struct NineDevice9 *device) context->commit |= NINE_STATE_COMMIT_CONST_PS; } - device->state.changed.group &= ~NINE_STATE_FF; + context->changed.group &= ~NINE_STATE_FF; } @@ -2158,25 +2155,29 @@ nine_ff_fini(struct NineDevice9 *device) static void nine_ff_prune_vs(struct NineDevice9 *device) { + struct nine_context *context = &device->context; + if (device->ff.num_vs > 100) { /* could destroy the bound one here, so unbind */ device->pipe->bind_vs_state(device->pipe, NULL); util_hash_table_foreach(device->ff.ht_vs, nine_ff_ht_delete_cb, NULL); util_hash_table_clear(device->ff.ht_vs); device->ff.num_vs = 0; - device->state.changed.group |= NINE_STATE_VS; + context->changed.group |= NINE_STATE_VS; } } static void nine_ff_prune_ps(struct NineDevice9 *device) { + struct nine_context *context = &device->context; + if (device->ff.num_ps > 100) { /* could destroy the bound one here, so unbind */ device->pipe->bind_fs_state(device->pipe, NULL); util_hash_table_foreach(device->ff.ht_ps, nine_ff_ht_delete_cb, NULL); util_hash_table_clear(device->ff.ht_ps); device->ff.num_ps = 0; - device->state.changed.group |= NINE_STATE_PS; + context->changed.group |= NINE_STATE_PS; } } |