aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2018-10-13 22:45:16 +0200
committerAxel Davy <[email protected]>2018-10-26 22:16:16 +0200
commit454201b4529a9f934c5663df3e13af2ca7b9d0e0 (patch)
tree59fd85ca4e8edcf798f3ba0714084b5ccdcc932d /src/gallium/state_trackers
parent2594b2efdc3f250f0e8b6bc5412d509eb693541e (diff)
st/nine: Never update device changed.* fields
The device state changed.* field are never used. These fields are used only for stateblocks. Avoid setting them at all for clarity. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/device9.c4
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c7
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h2
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c94
4 files changed, 59 insertions, 48 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 25a8172b3fd..461b212995b 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2178,9 +2178,11 @@ NineDevice9_LightEnable( struct NineDevice9 *This,
NineDevice9_SetLight(This, Index, &light);
}
- nine_state_light_enable(&state->ff, &state->changed.group, Index, Enable);
+ nine_state_light_enable(&state->ff, Index, Enable);
if (likely(!This->is_recording))
nine_context_light_enable(This, Index, Enable);
+ else
+ state->changed.group |= NINE_STATE_FF_LIGHTING;
return D3D_OK;
}
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 569a1b47292..74aaf57a549 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1827,7 +1827,8 @@ CSMT_ITEM_NO_WAIT(nine_context_light_enable,
{
struct nine_context *context = &device->context;
- nine_state_light_enable(&context->ff, &context->changed.group, Index, Enable);
+ nine_state_light_enable(&context->ff, Index, Enable);
+ context->changed.group |= NINE_STATE_FF_LIGHTING;
}
CSMT_ITEM_NO_WAIT(nine_context_set_texture_stage_state,
@@ -3480,7 +3481,7 @@ nine_state_set_light(struct nine_ff_state *ff_state, DWORD Index,
}
HRESULT
-nine_state_light_enable(struct nine_ff_state *ff_state, uint32_t *change_group,
+nine_state_light_enable(struct nine_ff_state *ff_state,
DWORD Index, BOOL Enable)
{
unsigned i;
@@ -3509,8 +3510,6 @@ nine_state_light_enable(struct nine_ff_state *ff_state, uint32_t *change_group,
ff_state->active_light[i] = ff_state->active_light[i + 1];
}
- *change_group |= NINE_STATE_FF_LIGHTING;
-
return D3D_OK;
}
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 55ccfd0f519..51e5e326527 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -623,7 +623,7 @@ HRESULT
nine_state_set_light(struct nine_ff_state *, DWORD, const D3DLIGHT9 *);
HRESULT
-nine_state_light_enable(struct nine_ff_state *, uint32_t *,
+nine_state_light_enable(struct nine_ff_state *,
DWORD, BOOL);
const char *nine_d3drs_to_string(DWORD State);
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index 7b2deae7f9b..50ed70aec3a 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -134,8 +134,15 @@ nine_state_copy_common(struct NineDevice9 *device,
unsigned i, s;
DBG("apply:%d changed.group: %x\n", (int)apply, (int)mask->changed.group );
- if (apply)
- dst->changed.group |= mask->changed.group;
+
+ /* device changed.* are unused.
+ * Instead nine_context_apply_stateblock is used and will
+ * internally set the right context->changed fields.
+ * Uncomment these only if we want to apply a stateblock onto a stateblock.
+ *
+ * if (apply)
+ * dst->changed.group |= mask->changed.group;
+ */
if (mask->changed.group & NINE_STATE_VIEWPORT)
dst->viewport = src->viewport;
@@ -202,10 +209,10 @@ nine_state_copy_common(struct NineDevice9 *device,
/* Render states.
* TODO: Maybe build a list ?
*/
- for (i = 0; i < ARRAY_SIZE(dst->changed.rs); ++i) {
+ for (i = 0; i < ARRAY_SIZE(mask->changed.rs); ++i) {
uint32_t m = mask->changed.rs[i];
- if (apply)
- dst->changed.rs[i] |= m;
+ /* if (apply)
+ * dst->changed.rs[i] |= m; */
while (m) {
const int r = ffs(m) - 1;
m &= ~(1 << r);
@@ -222,8 +229,8 @@ nine_state_copy_common(struct NineDevice9 *device,
if (mask->changed.ucp & (1 << i))
memcpy(dst->clip.ucp[i],
src->clip.ucp[i], sizeof(src->clip.ucp[0]));
- if (apply)
- dst->changed.ucp |= mask->changed.ucp;
+ /* if (apply)
+ * dst->changed.ucp |= mask->changed.ucp;*/
}
/* Sampler state. */
@@ -240,8 +247,8 @@ nine_state_copy_common(struct NineDevice9 *device,
dst->samp_advertised[s][i] = src->samp_advertised[s][i];
}
}
- if (apply)
- dst->changed.sampler[s] |= mask->changed.sampler[s];
+ /* if (apply)
+ * dst->changed.sampler[s] |= mask->changed.sampler[s];*/
}
}
@@ -270,10 +277,11 @@ nine_state_copy_common(struct NineDevice9 *device,
if (mask->changed.stream_freq & (1 << i))
dst->stream_freq[i] = src->stream_freq[i];
}
- if (apply) {
- dst->changed.vtxbuf |= mask->changed.vtxbuf;
- dst->changed.stream_freq |= mask->changed.stream_freq;
- }
+ /*
+ * if (apply) {
+ * dst->changed.vtxbuf |= mask->changed.vtxbuf;
+ * dst->changed.stream_freq |= mask->changed.stream_freq;
+ * }*/
}
/* Textures */
@@ -298,13 +306,14 @@ nine_state_copy_common(struct NineDevice9 *device,
for (i = 0; i < NINED3DTSS_COUNT; ++i)
if (mask->ff.changed.tex_stage[s][i / 32] & (1 << (i % 32)))
dst->ff.tex_stage[s][i] = src->ff.tex_stage[s][i];
- if (apply) {
- /* TODO: it's 32 exactly, just offset by 1 as 0 is unused */
- dst->ff.changed.tex_stage[s][0] |=
- mask->ff.changed.tex_stage[s][0];
- dst->ff.changed.tex_stage[s][1] |=
- mask->ff.changed.tex_stage[s][1];
- }
+ /*
+ * if (apply) {
+ * TODO: it's 32 exactly, just offset by 1 as 0 is unused
+ * dst->ff.changed.tex_stage[s][0] |=
+ * mask->ff.changed.tex_stage[s][0];
+ * dst->ff.changed.tex_stage[s][1] |=
+ * mask->ff.changed.tex_stage[s][1];
+ * }*/
}
}
if (mask->changed.group & NINE_STATE_FF_LIGHTING) {
@@ -359,8 +368,8 @@ nine_state_copy_common(struct NineDevice9 *device,
*nine_state_access_transform(&dst->ff, s, TRUE) =
*nine_state_access_transform(&src->ff, s, FALSE);
}
- if (apply)
- dst->ff.changed.transform[i] |= mask->ff.changed.transform[i];
+ /* if (apply)
+ * dst->ff.changed.transform[i] |= mask->ff.changed.transform[i];*/
}
}
}
@@ -376,8 +385,9 @@ nine_state_copy_common_all(struct NineDevice9 *device,
{
unsigned i;
- if (apply)
- dst->changed.group |= src->changed.group;
+ /* if (apply)
+ * dst->changed.group |= src->changed.group;
+ */
dst->viewport = src->viewport;
dst->scissor = src->scissor;
@@ -411,20 +421,20 @@ nine_state_copy_common_all(struct NineDevice9 *device,
/* Render states. */
memcpy(dst->rs_advertised, src->rs_advertised, sizeof(dst->rs_advertised));
- if (apply)
- memcpy(dst->changed.rs, src->changed.rs, sizeof(dst->changed.rs));
+ /* if (apply)
+ * memcpy(dst->changed.rs, src->changed.rs, sizeof(dst->changed.rs));*/
/* Clip planes. */
memcpy(&dst->clip, &src->clip, sizeof(dst->clip));
- if (apply)
- dst->changed.ucp = src->changed.ucp;
+ /* if (apply)
+ * dst->changed.ucp = src->changed.ucp;*/
/* Sampler state. */
memcpy(dst->samp_advertised, src->samp_advertised, sizeof(dst->samp_advertised));
- if (apply)
- memcpy(dst->changed.sampler,
- src->changed.sampler, sizeof(dst->changed.sampler));
+ /* if (apply)
+ * memcpy(dst->changed.sampler,
+ * src->changed.sampler, sizeof(dst->changed.sampler));*/
/* Index buffer. */
NineStateBlock9_BindBuffer(device,
@@ -445,10 +455,10 @@ nine_state_copy_common_all(struct NineDevice9 *device,
}
dst->stream_freq[i] = src->stream_freq[i];
}
- if (apply) {
- dst->changed.vtxbuf = (1ULL << MaxStreams) - 1;
- dst->changed.stream_freq = (1ULL << MaxStreams) - 1;
- }
+ /* if (apply) {
+ * dst->changed.vtxbuf = (1ULL << MaxStreams) - 1;
+ * dst->changed.stream_freq = (1ULL << MaxStreams) - 1;
+ * }*/
}
/* Textures */
@@ -466,9 +476,9 @@ nine_state_copy_common_all(struct NineDevice9 *device,
dst->ff.material = src->ff.material;
memcpy(dst->ff.tex_stage, src->ff.tex_stage, sizeof(dst->ff.tex_stage));
- if (apply) /* TODO: memset */
- memcpy(dst->ff.changed.tex_stage,
- src->ff.changed.tex_stage, sizeof(dst->ff.changed.tex_stage));
+ /* if (apply) TODO: memset
+ * memcpy(dst->ff.changed.tex_stage,
+ * src->ff.changed.tex_stage, sizeof(dst->ff.changed.tex_stage));*/
/* Lights. */
if (1) {
@@ -500,10 +510,10 @@ nine_state_copy_common_all(struct NineDevice9 *device,
/* Apply is always used on device state.
* src is then the D3DSBT_ALL stateblock which
* ff.changed.transform indicates all matrices are dirty.
- */
- if (apply)
- memcpy(dst->ff.changed.transform,
- src->ff.changed.transform, sizeof(dst->ff.changed.transform));
+ *
+ * if (apply)
+ * memcpy(dst->ff.changed.transform,
+ * src->ff.changed.transform, sizeof(dst->ff.changed.transform));*/
}
}