diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index e912154e341..d06ac9c5ee6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1831,12 +1831,15 @@ void CDECL wined3d_device_set_material(struct wined3d_device *device, const stru { TRACE("device %p, material %p.\n", device, material); - device->update_state->material = *material; - + device->update_stateblock_state->material = *material; if (device->recording) + { device->recording->changed.material = TRUE; - else - wined3d_cs_emit_set_material(device->cs, material); + return; + } + + device->state.material = *material; + wined3d_cs_emit_set_material(device->cs, material); } void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index d3308217fa4..cf4f7d1fc00 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -822,11 +822,12 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) } if (stateblock->changed.material - && memcmp(&src_state->material, &stateblock->state.material, sizeof(stateblock->state.material))) + && memcmp(&state->material, &stateblock->stateblock_state.material, + sizeof(stateblock->stateblock_state.material))) { TRACE("Updating material.\n"); - stateblock->state.material = src_state->material; + stateblock->stateblock_state.material = state->material; } assert(src_state->viewport_count <= 1); @@ -1127,7 +1128,10 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) wined3d_device_set_vertex_declaration(device, stateblock->state.vertex_declaration); if (stateblock->changed.material) - wined3d_device_set_material(device, &stateblock->state.material); + { + state->material = stateblock->stateblock_state.material; + wined3d_device_set_material(device, &stateblock->stateblock_state.material); + } if (stateblock->changed.viewport) wined3d_device_set_viewports(device, stateblock->state.viewport_count, stateblock->state.viewports); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d9237e6e873..6091d211c13 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2988,6 +2988,7 @@ struct wined3d_stateblock_state struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES]; + struct wined3d_material material; }; struct wined3d_device