wined3d: Store transforms in the wined3d_stateblock_state structure.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-02-05 23:01:04 -06:00 committed by Alexandre Julliard
parent d70d6b8486
commit b041cecfa1
3 changed files with 19 additions and 4 deletions

View File

@ -1495,11 +1495,11 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device,
TRACE("%.8e %.8e %.8e %.8e\n", matrix->_41, matrix->_42, matrix->_43, matrix->_44);
/* Handle recording of state blocks. */
device->update_stateblock_state->transforms[d3dts] = *matrix;
if (device->recording)
{
TRACE("Recording... not performing anything.\n");
device->recording->changed.transform[d3dts >> 5] |= 1u << (d3dts & 0x1f);
device->update_state->transforms[d3dts] = *matrix;
return;
}

View File

@ -787,7 +787,7 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
TRACE("Updating transform %#x.\n", transform);
stateblock->state.transforms[transform] = src_state->transforms[transform];
stateblock->stateblock_state.transforms[transform] = state->transforms[transform];
}
if (stateblock->changed.indices
@ -1110,8 +1110,10 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
/* Transform states. */
for (i = 0; i < stateblock->num_contained_transform_states; ++i)
{
wined3d_device_set_transform(device, stateblock->contained_transform_states[i],
&stateblock->state.transforms[stateblock->contained_transform_states[i]]);
enum wined3d_transform_state transform = stateblock->contained_transform_states[i];
state->transforms[transform] = stateblock->stateblock_state.transforms[transform];
wined3d_device_set_transform(device, transform, &stateblock->stateblock_state.transforms[transform]);
}
if (stateblock->changed.indices)
@ -1424,12 +1426,23 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
static void stateblock_state_init_default(struct wined3d_stateblock_state *state,
const struct wined3d_d3d_info *d3d_info)
{
struct wined3d_matrix identity;
unsigned int i;
get_identity_matrix(&identity);
state->transforms[WINED3D_TS_PROJECTION] = identity;
state->transforms[WINED3D_TS_VIEW] = identity;
for (i = 0; i < 256; ++i)
{
state->transforms[WINED3D_TS_WORLD_MATRIX(i)] = identity;
}
init_default_render_states(state->rs, d3d_info);
for (i = 0; i < MAX_TEXTURES; ++i)
{
state->transforms[WINED3D_TS_TEXTURE0 + i] = identity;
init_default_texture_state(i, state->texture_states[i]);
}

View File

@ -2985,6 +2985,8 @@ struct wined3d_stateblock_state
struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS];
DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1];
};
struct wined3d_device