diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 59d08480bb2..46de003e50c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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; } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 4c43beccc75..01b6dca3a8e 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -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]); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e0bc4d8bc0a..a3c9ef8ce96 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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