summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-10-19 23:06:05 +0200
committerAxel Davy <[email protected]>2016-12-20 23:44:22 +0100
commitc5af96aebd2be165e29124c1e5d5bb3b7021bb30 (patch)
tree7c4778700863624468e82ad92cc5c7c3611c679c /src
parent4a6d83ebc29546e8a70b4187bf1b66f6d745ef2e (diff)
st/nine: Put ff data in a separate structure
And make nine_state_access_transform take this new structure as input. 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')
-rw-r--r--src/gallium/state_trackers/nine/device9.c6
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c4
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c14
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h46
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c4
5 files changed, 38 insertions, 36 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index d8ff4cb56ca..2587ad1d7ae 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1975,7 +1975,7 @@ NineDevice9_SetTransform( struct NineDevice9 *This,
const D3DMATRIX *pMatrix )
{
struct nine_state *state = This->update;
- D3DMATRIX *M = nine_state_access_transform(state, State, TRUE);
+ D3DMATRIX *M = nine_state_access_transform(&state->ff, State, TRUE);
DBG("This=%p State=%d pMatrix=%p\n", This, State, pMatrix);
@@ -1993,7 +1993,7 @@ NineDevice9_GetTransform( struct NineDevice9 *This,
D3DTRANSFORMSTATETYPE State,
D3DMATRIX *pMatrix )
{
- D3DMATRIX *M = nine_state_access_transform(&This->state, State, FALSE);
+ D3DMATRIX *M = nine_state_access_transform(&This->state.ff, State, FALSE);
user_assert(M, D3DERR_INVALIDCALL);
*pMatrix = *M;
return D3D_OK;
@@ -2006,7 +2006,7 @@ NineDevice9_MultiplyTransform( struct NineDevice9 *This,
{
struct nine_state *state = This->update;
D3DMATRIX T;
- D3DMATRIX *M = nine_state_access_transform(state, State, TRUE);
+ D3DMATRIX *M = nine_state_access_transform(&state->ff, State, TRUE);
DBG("This=%p State=%d pMatrix=%p\n", This, State, pMatrix);
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index bfabf183a17..0c92bd13e8b 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -1708,7 +1708,7 @@ nine_ff_get_vs(struct NineDevice9 *device)
return vs;
}
-#define GET_D3DTS(n) nine_state_access_transform(state, D3DTS_##n, FALSE)
+#define GET_D3DTS(n) nine_state_access_transform(&state->ff, D3DTS_##n, FALSE)
#define IS_D3DTS_DIRTY(s,n) ((s)->ff.changed.transform[(D3DTS_##n) / 32] & (1 << ((D3DTS_##n) % 32)))
static struct NinePixelShader9 *
@@ -1977,7 +1977,7 @@ nine_ff_load_tex_matrices(struct NineDevice9 *device)
return;
for (s = 0; s < 8; ++s) {
if (IS_D3DTS_DIRTY(state, TEXTURE0 + s))
- nine_d3d_matrix_transpose(&M[32 + s], nine_state_access_transform(state, D3DTS_TEXTURE0 + s, FALSE));
+ nine_d3d_matrix_transpose(&M[32 + s], nine_state_access_transform(&state->ff, D3DTS_TEXTURE0 + s, FALSE));
}
}
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index c99c3734750..47fe31d391c 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -2783,7 +2783,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
/* Misc */
D3DMATRIX *
-nine_state_access_transform(struct nine_state *state, D3DTRANSFORMSTATETYPE t,
+nine_state_access_transform(struct nine_ff_state *ff_state, D3DTRANSFORMSTATETYPE t,
boolean alloc)
{
static D3DMATRIX Identity = { .m[0] = { 1, 0, 0, 0 },
@@ -2810,20 +2810,20 @@ nine_state_access_transform(struct nine_state *state, D3DTRANSFORMSTATETYPE t,
break;
}
- if (index >= state->ff.num_transforms) {
+ if (index >= ff_state->num_transforms) {
unsigned N = index + 1;
- unsigned n = state->ff.num_transforms;
+ unsigned n = ff_state->num_transforms;
if (!alloc)
return &Identity;
- state->ff.transform = REALLOC(state->ff.transform,
+ ff_state->transform = REALLOC(ff_state->transform,
n * sizeof(D3DMATRIX),
N * sizeof(D3DMATRIX));
for (; n < N; ++n)
- state->ff.transform[n] = Identity;
- state->ff.num_transforms = N;
+ ff_state->transform[n] = Identity;
+ ff_state->num_transforms = N;
}
- return &state->ff.transform[index];
+ return &ff_state->transform[index];
}
#define D3DRS_TO_STRING_CASE(n) case D3DRS_##n: return "D3DRS_"#n
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index a6f20ab5dd3..d73c40681f8 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -137,6 +137,28 @@
#define NINE_PS_SAMPLERS_MASK 0x00ffff
#define NINE_VS_SAMPLERS_MASK 0x1e0000
+struct nine_ff_state {
+ struct {
+ uint32_t tex_stage[NINE_MAX_TEXTURE_STAGES][(NINED3DTSS_COUNT + 31) / 32];
+ uint32_t transform[(NINED3DTS_COUNT + 31) / 32];
+ } changed;
+
+ D3DMATRIX *transform; /* access only via nine_state_access_transform */
+ unsigned num_transforms;
+
+ /* XXX: Do state blocks just change the set of active lights or do we
+ * have to store which lights have been disabled, too ?
+ */
+ D3DLIGHT9 *light;
+ uint16_t active_light[NINE_MAX_LIGHTS_ACTIVE]; /* 8 */
+ unsigned num_lights;
+ unsigned num_lights_active;
+
+ D3DMATERIAL9 material;
+
+ DWORD tex_stage[NINE_MAX_TEXTURE_STAGES][NINED3DTSS_COUNT];
+};
+
struct nine_state
{
struct {
@@ -192,27 +214,7 @@ struct nine_state
DWORD samp_advertised[NINE_MAX_SAMPLERS][D3DSAMP_COUNT];
- struct {
- struct {
- uint32_t tex_stage[NINE_MAX_TEXTURE_STAGES][(NINED3DTSS_COUNT + 31) / 32];
- uint32_t transform[(NINED3DTS_COUNT + 31) / 32];
- } changed;
-
- D3DMATRIX *transform; /* access only via nine_state_access_transform */
- unsigned num_transforms;
-
- /* XXX: Do state blocks just change the set of active lights or do we
- * have to store which lights have been disabled, too ?
- */
- D3DLIGHT9 *light;
- uint16_t active_light[NINE_MAX_LIGHTS_ACTIVE]; /* 8 */
- unsigned num_lights;
- unsigned num_lights_active;
-
- D3DMATERIAL9 material;
-
- DWORD tex_stage[NINE_MAX_TEXTURE_STAGES][NINED3DTSS_COUNT];
- } ff;
+ struct nine_ff_state ff;
};
struct nine_context {
@@ -457,7 +459,7 @@ void nine_state_destroy_sw(struct NineDevice9 *device);
* Therefore, do not modify if you set alloc to FALSE !
*/
D3DMATRIX *
-nine_state_access_transform(struct nine_state *, D3DTRANSFORMSTATETYPE,
+nine_state_access_transform(struct nine_ff_state *, D3DTRANSFORMSTATETYPE,
boolean alloc);
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 0aa69be16b9..cc802d4af28 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -316,9 +316,9 @@ nine_state_copy_common(struct NineDevice9 *device,
for (s = i * 32; s < (i * 32 + 32); ++s) {
if (!(mask->ff.changed.transform[i] & (1 << (s % 32))))
continue;
- *nine_state_access_transform(dst, s, TRUE) =
+ *nine_state_access_transform(&dst->ff, s, TRUE) =
*nine_state_access_transform( /* const because !alloc */
- (struct nine_state *)src, s, FALSE);
+ (struct nine_ff_state *)&src->ff, s, FALSE);
}
if (apply)
dst->ff.changed.transform[i] |= mask->ff.changed.transform[i];