wined3d: Rename StateTable.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-03-03 19:55:26 +01:00 committed by Alexandre Julliard
parent a2954a7121
commit 1d1511f66d
4 changed files with 34 additions and 31 deletions

View File

@ -1953,7 +1953,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
context->win_handle = swapchain->win_handle;
context->gl_info = &device->adapter->gl_info;
context->d3d_info = &device->adapter->d3d_info;
context->state_table = device->StateTable;
context->state_table = device->state_table;
/* Mark all states dirty to force a proper initialization of the states on
* the first use of the context. Compute states do not need initialization. */

View File

@ -5357,7 +5357,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
wine_rb_init(&device->samplers, wined3d_sampler_compare);
if (vertex_pipeline->vp_states && fragment_pipeline->states
&& FAILED(hr = compile_state_table(device->StateTable, device->multistate_funcs,
&& FAILED(hr = compile_state_table(device->state_table, device->multistate_funcs,
&adapter->d3d_info, adapter->gl_info.supported, vertex_pipeline,
fragment_pipeline, misc_state_template)))
{
@ -5396,11 +5396,9 @@ err:
void device_invalidate_state(const struct wined3d_device *device, DWORD state)
{
DWORD rep = device->StateTable[state].representative;
DWORD rep = device->state_table[state].representative;
struct wined3d_context *context;
DWORD idx;
BYTE shift;
UINT i;
unsigned int i, idx, shift;
wined3d_from_cs(device->cs);

View File

@ -5519,26 +5519,29 @@ static void validate_state_table(struct StateEntry *state_table)
}
}
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
HRESULT compile_state_table(struct StateEntry *state_table, APPLYSTATEFUNC **dev_multistate_funcs,
const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
const struct StateEntryTemplate *misc)
{
unsigned int i, type, handlers;
APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
const struct StateEntryTemplate *cur;
unsigned int i, type, handlers;
BOOL set[STATE_HIGHEST + 1];
memset(multistate_funcs, 0, sizeof(multistate_funcs));
for(i = 0; i < STATE_HIGHEST + 1; i++) {
StateTable[i].representative = 0;
StateTable[i].apply = state_undefined;
for (i = 0; i < STATE_HIGHEST + 1; ++i)
{
state_table[i].representative = 0;
state_table[i].apply = state_undefined;
}
for(type = 0; type < 3; type++) {
for (type = 0; type < 3; ++type)
{
/* This switch decides the order in which the states are applied */
switch(type) {
switch (type)
{
case 0: cur = misc; break;
case 1: cur = fragment->states; break;
case 2: cur = vertex->vp_states; break;
@ -5551,7 +5554,8 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
*/
memset(set, 0, sizeof(set));
for(i = 0; cur[i].state; i++) {
for (i = 0; cur[i].state; ++i)
{
APPLYSTATEFUNC *funcs_array;
/* Only use the first matching state with the available extension from one template.
@ -5576,12 +5580,13 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
handlers = num_handlers(multistate_funcs[cur[i].state]);
multistate_funcs[cur[i].state][handlers] = cur[i].content.apply;
switch(handlers) {
switch (handlers)
{
case 0:
StateTable[cur[i].state].apply = cur[i].content.apply;
state_table[cur[i].state].apply = cur[i].content.apply;
break;
case 1:
StateTable[cur[i].state].apply = multistate_apply_2;
state_table[cur[i].state].apply = multistate_apply_2;
if (!(dev_multistate_funcs[cur[i].state] = heap_calloc(2, sizeof(**dev_multistate_funcs))))
goto out_of_mem;
@ -5589,7 +5594,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
dev_multistate_funcs[cur[i].state][1] = multistate_funcs[cur[i].state][1];
break;
case 2:
StateTable[cur[i].state].apply = multistate_apply_3;
state_table[cur[i].state].apply = multistate_apply_3;
if (!(funcs_array = heap_realloc(dev_multistate_funcs[cur[i].state],
sizeof(**dev_multistate_funcs) * 3)))
goto out_of_mem;
@ -5598,22 +5603,22 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
dev_multistate_funcs[cur[i].state][2] = multistate_funcs[cur[i].state][2];
break;
default:
ERR("Unexpected amount of state handlers for state %u: %u\n",
ERR("Unexpected amount of state handlers for state %u: %u.\n",
cur[i].state, handlers + 1);
}
if (StateTable[cur[i].state].representative
&& StateTable[cur[i].state].representative != cur[i].content.representative)
if (state_table[cur[i].state].representative
&& state_table[cur[i].state].representative != cur[i].content.representative)
{
FIXME("State %s (%#x) has different representatives in different pipeline parts.\n",
debug_d3dstate(cur[i].state), cur[i].state);
}
StateTable[cur[i].state].representative = cur[i].content.representative;
state_table[cur[i].state].representative = cur[i].content.representative;
}
}
prune_invalid_states(StateTable, d3d_info);
validate_state_table(StateTable);
prune_invalid_states(state_table, d3d_info);
validate_state_table(state_table);
return WINED3D_OK;

View File

@ -2107,7 +2107,7 @@ extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN;
extern const struct wined3d_vertex_pipe_ops glsl_vertex_pipe DECLSPEC_HIDDEN;
/* "Base" state table */
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
HRESULT compile_state_table(struct StateEntry *state_table, APPLYSTATEFUNC **dev_multistate_funcs,
const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN;
@ -3038,7 +3038,7 @@ struct wined3d_device
void *shader_priv;
void *fragment_priv;
void *vertex_priv;
struct StateEntry StateTable[STATE_HIGHEST + 1];
struct StateEntry state_table[STATE_HIGHEST + 1];
/* Array of functions for states which are handled by more than one pipeline part */
APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1];
struct wined3d_blitter *blitter;