wined3d: Store render states 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:
parent
05149fa2d5
commit
9a1d079793
|
@ -2033,8 +2033,6 @@ struct wined3d_rasterizer_state * CDECL wined3d_device_get_rasterizer_state(stru
|
|||
void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
|
||||
enum wined3d_render_state state, DWORD value)
|
||||
{
|
||||
DWORD old_value;
|
||||
|
||||
TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
|
||||
|
||||
if (state > WINEHIGHEST_RENDER_STATE)
|
||||
|
@ -2043,8 +2041,7 @@ void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
|
|||
return;
|
||||
}
|
||||
|
||||
old_value = device->state.render_states[state];
|
||||
device->update_state->render_states[state] = value;
|
||||
device->update_stateblock_state->rs[state] = value;
|
||||
|
||||
/* Handle recording of state blocks. */
|
||||
if (device->recording)
|
||||
|
@ -2054,11 +2051,13 @@ void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Compared here and not before the assignment to allow proper stateblock recording. */
|
||||
if (value == old_value)
|
||||
if (value == device->state.render_states[state])
|
||||
TRACE("Application is setting the old value over, nothing to do.\n");
|
||||
else
|
||||
{
|
||||
device->state.render_states[state] = value;
|
||||
wined3d_cs_emit_set_render_state(device->cs, state, value);
|
||||
}
|
||||
|
||||
if (state == WINED3D_RS_POINTSIZE && value == WINED3D_RESZ_CODE)
|
||||
{
|
||||
|
@ -5038,6 +5037,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
|||
state_init(&device->state, &device->fb, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
|
||||
device->update_state = &device->state;
|
||||
memset(&device->stateblock_state, 0, sizeof(device->stateblock_state));
|
||||
wined3d_stateblock_state_init(&device->stateblock_state, device, WINED3D_STATE_INIT_DEFAULT);
|
||||
device->update_stateblock_state = &device->stateblock_state;
|
||||
|
||||
device_init_swapchain_state(device, swapchain);
|
||||
|
@ -5313,6 +5313,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
|
|||
|
||||
state_init(&device->state, &device->fb, &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
|
||||
device->update_state = &device->state;
|
||||
wined3d_stateblock_state_init(&device->stateblock_state, device, WINED3D_STATE_INIT_DEFAULT);
|
||||
device->update_stateblock_state = &device->stateblock_state;
|
||||
|
||||
device->max_frame_latency = 3;
|
||||
|
|
|
@ -916,9 +916,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
|
|||
{
|
||||
enum wined3d_render_state rs = stateblock->contained_render_states[i];
|
||||
|
||||
TRACE("Updating render state %#x to %u.\n", rs, src_state->render_states[rs]);
|
||||
TRACE("Updating render state %#x to %u.\n", rs, state->rs[rs]);
|
||||
|
||||
stateblock->state.render_states[rs] = src_state->render_states[rs];
|
||||
stateblock->stateblock_state.rs[rs] = state->rs[rs];
|
||||
}
|
||||
|
||||
/* Texture states */
|
||||
|
@ -1066,8 +1066,9 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
|
|||
/* Render states. */
|
||||
for (i = 0; i < stateblock->num_contained_render_states; ++i)
|
||||
{
|
||||
state->rs[i] = stateblock->stateblock_state.rs[i];
|
||||
wined3d_device_set_render_state(device, stateblock->contained_render_states[i],
|
||||
stateblock->state.render_states[stateblock->contained_render_states[i]]);
|
||||
stateblock->stateblock_state.rs[stateblock->contained_render_states[i]]);
|
||||
}
|
||||
|
||||
/* Texture states. */
|
||||
|
@ -1387,6 +1388,19 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
|
|||
state_init_default(state, d3d_info);
|
||||
}
|
||||
|
||||
static void stateblock_state_init_default(struct wined3d_stateblock_state *state,
|
||||
const struct wined3d_d3d_info *d3d_info)
|
||||
{
|
||||
init_default_render_states(state->rs, d3d_info);
|
||||
}
|
||||
|
||||
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
|
||||
const struct wined3d_device *device, DWORD flags)
|
||||
{
|
||||
if (flags & WINED3D_STATE_INIT_DEFAULT)
|
||||
stateblock_state_init_default(state, &device->adapter->d3d_info);
|
||||
}
|
||||
|
||||
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
|
||||
struct wined3d_device *device, enum wined3d_stateblock_type type)
|
||||
{
|
||||
|
@ -1395,6 +1409,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
|
|||
stateblock->ref = 1;
|
||||
stateblock->device = device;
|
||||
state_init(&stateblock->state, NULL, d3d_info, 0);
|
||||
wined3d_stateblock_state_init(&stateblock->stateblock_state, device, 0);
|
||||
|
||||
if (type == WINED3D_SBT_RECORDED)
|
||||
return WINED3D_OK;
|
||||
|
|
|
@ -2979,6 +2979,8 @@ struct wined3d_stateblock_state
|
|||
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];
|
||||
|
||||
DWORD rs[WINEHIGHEST_RENDER_STATE + 1];
|
||||
};
|
||||
|
||||
struct wined3d_device
|
||||
|
@ -3598,6 +3600,8 @@ struct wined3d_stateblock
|
|||
|
||||
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
|
||||
|
||||
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
|
||||
const struct wined3d_device *device, DWORD flags) DECLSPEC_HIDDEN;
|
||||
void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state) DECLSPEC_HIDDEN;
|
||||
|
||||
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue