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);
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;
{
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);
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 *
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));
}
}
/* 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 },
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
#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 {
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 {
* 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);
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];