diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d0e9d59c457..2c2233175a6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2610,22 +2610,23 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, if (count > WINED3D_MAX_CONSTS_B - start_idx) count = WINED3D_MAX_CONSTS_B - start_idx; - memcpy(&device->update_state->ps_consts_b[start_idx], constants, count * sizeof(*constants)); + + memcpy(&device->update_stateblock_state->ps_consts_b[start_idx], constants, count * sizeof(*constants)); + if (device->recording) + { + for (i = start_idx; i < count + start_idx; ++i) + device->recording->changed.pixelShaderConstantsB |= (1u << i); + return WINED3D_OK; + } + + memcpy(&device->state.ps_consts_b[start_idx], constants, count * sizeof(*constants)); if (TRACE_ON(d3d)) { for (i = 0; i < count; ++i) TRACE("Set BOOL constant %u to %#x.\n", start_idx + i, constants[i]); } - if (device->recording) - { - for (i = start_idx; i < count + start_idx; ++i) - device->recording->changed.pixelShaderConstantsB |= (1u << i); - } - else - { - wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants); - } + wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants); return WINED3D_OK; } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 340578c3b6d..a87e3ebbbf3 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -762,10 +762,11 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i) { unsigned int idx = stateblock->contained_ps_consts_b[i]; - TRACE("Setting ps_consts_b[%u] to %s.\n", - idx, src_state->ps_consts_b[idx] ? "TRUE" : "FALSE"); - stateblock->state.ps_consts_b[idx] = src_state->ps_consts_b[idx]; + TRACE("Setting ps_consts_b[%u] to %s.\n", + idx, state->ps_consts_b[idx] ? "TRUE" : "FALSE"); + + stateblock->stateblock_state.ps_consts_b[idx] = state->ps_consts_b[idx]; } /* Others + Render & Texture */ @@ -1057,8 +1058,9 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) } for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i) { + state->ps_consts_b[i] = stateblock->stateblock_state.ps_consts_b[i]; wined3d_device_set_ps_consts_b(device, stateblock->contained_ps_consts_b[i], - 1, &stateblock->state.ps_consts_b[stateblock->contained_ps_consts_b[i]]); + 1, &stateblock->stateblock_state.ps_consts_b[stateblock->contained_ps_consts_b[i]]); } /* Render states. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 227b7fb7bb8..c3470187236 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2978,6 +2978,7 @@ struct wined3d_stateblock_state struct wined3d_shader *ps; struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I]; + BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; }; struct wined3d_device