wined3d: Introduce a global stateblock flag for transforms.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2020-03-02 14:02:46 +01:00 committed by Alexandre Julliard
parent 0d2a1ecced
commit a8c44bd94c
3 changed files with 27 additions and 17 deletions

View File

@ -3977,14 +3977,17 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
}
}
for (i = 0; i < ARRAY_SIZE(changed->transform); ++i)
if (changed->transforms)
{
map = changed->transform[i];
while (map)
for (i = 0; i < ARRAY_SIZE(changed->transform); ++i)
{
j = wined3d_bit_scan(&map);
idx = i * word_bit_count + j;
wined3d_device_set_transform(device, idx, &state->transforms[idx]);
map = changed->transform[i];
while (map)
{
j = wined3d_bit_scan(&map);
idx = i * word_bit_count + j;
wined3d_device_set_transform(device, idx, &state->transforms[idx]);
}
}
}

View File

@ -210,6 +210,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
states->scissorRect = 1;
states->blend_state = 1;
states->lights = 1;
states->transforms = 1;
states->streamSource = 0xffff;
states->streamFreq = 0xffff;
@ -807,14 +808,16 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
stateblock->stateblock_state.ps_consts_b[idx] = state->ps_consts_b[idx];
}
/* Others + Render & Texture */
for (i = 0; i < stateblock->num_contained_transform_states; ++i)
if (stateblock->changed.transforms)
{
enum wined3d_transform_state transform = stateblock->contained_transform_states[i];
for (i = 0; i < stateblock->num_contained_transform_states; ++i)
{
enum wined3d_transform_state transform = stateblock->contained_transform_states[i];
TRACE("Updating transform %#x.\n", transform);
TRACE("Updating transform %#x.\n", transform);
stateblock->stateblock_state.transforms[transform] = state->transforms[transform];
stateblock->stateblock_state.transforms[transform] = state->transforms[transform];
}
}
if (stateblock->changed.indices
@ -1177,13 +1180,15 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
wined3d_device_set_sampler_state(device, stage, sampler_state, value);
}
/* Transform states. */
for (i = 0; i < stateblock->num_contained_transform_states; ++i)
if (stateblock->changed.transforms)
{
enum wined3d_transform_state transform = stateblock->contained_transform_states[i];
for (i = 0; i < stateblock->num_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]);
state->transforms[transform] = stateblock->stateblock_state.transforms[transform];
wined3d_device_set_transform(device, transform, &stateblock->stateblock_state.transforms[transform]);
}
}
if (stateblock->changed.indices)
@ -1579,6 +1584,7 @@ void CDECL wined3d_stateblock_set_transform(struct wined3d_stateblock *statebloc
stateblock->stateblock_state.transforms[d3dts] = *matrix;
stateblock->changed.transform[d3dts >> 5] |= 1u << (d3dts & 0x1f);
stateblock->changed.transforms = 1;
}
void CDECL wined3d_stateblock_multiply_transform(struct wined3d_stateblock *stateblock,

View File

@ -3938,7 +3938,8 @@ struct wined3d_saved_states
DWORD store_stream_offset : 1;
DWORD blend_state : 1;
DWORD lights : 1;
DWORD padding : 2;
DWORD transforms : 1;
DWORD padding : 1;
};
struct StageState {