Commit 1d1511f6 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Rename StateTable.

parent a2954a71
...@@ -1953,7 +1953,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, ...@@ -1953,7 +1953,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
context->win_handle = swapchain->win_handle; context->win_handle = swapchain->win_handle;
context->gl_info = &device->adapter->gl_info; context->gl_info = &device->adapter->gl_info;
context->d3d_info = &device->adapter->d3d_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 /* 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. */ * the first use of the context. Compute states do not need initialization. */
......
...@@ -5357,7 +5357,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, ...@@ -5357,7 +5357,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
wine_rb_init(&device->samplers, wined3d_sampler_compare); wine_rb_init(&device->samplers, wined3d_sampler_compare);
if (vertex_pipeline->vp_states && fragment_pipeline->states 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, &adapter->d3d_info, adapter->gl_info.supported, vertex_pipeline,
fragment_pipeline, misc_state_template))) fragment_pipeline, misc_state_template)))
{ {
...@@ -5396,11 +5396,9 @@ err: ...@@ -5396,11 +5396,9 @@ err:
void device_invalidate_state(const struct wined3d_device *device, DWORD state) 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; struct wined3d_context *context;
DWORD idx; unsigned int i, idx, shift;
BYTE shift;
UINT i;
wined3d_from_cs(device->cs); wined3d_from_cs(device->cs);
...@@ -5414,7 +5412,7 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) ...@@ -5414,7 +5412,7 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state)
for (i = 0; i < device->context_count; ++i) for (i = 0; i < device->context_count; ++i)
{ {
context = device->contexts[i]; context = device->contexts[i];
if(isStateDirty(context, rep)) continue; if (isStateDirty(context, rep)) continue;
context->dirtyArray[context->numDirtyEntries++] = rep; context->dirtyArray[context->numDirtyEntries++] = rep;
idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT); idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT);
......
...@@ -5519,39 +5519,43 @@ static void validate_state_table(struct StateEntry *state_table) ...@@ -5519,39 +5519,43 @@ 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_d3d_info *d3d_info, const BOOL *supported_extensions,
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment, const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
const struct StateEntryTemplate *misc) const struct StateEntryTemplate *misc)
{ {
unsigned int i, type, handlers;
APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3]; APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
const struct StateEntryTemplate *cur; const struct StateEntryTemplate *cur;
unsigned int i, type, handlers;
BOOL set[STATE_HIGHEST + 1]; BOOL set[STATE_HIGHEST + 1];
memset(multistate_funcs, 0, sizeof(multistate_funcs)); memset(multistate_funcs, 0, sizeof(multistate_funcs));
for(i = 0; i < STATE_HIGHEST + 1; i++) { for (i = 0; i < STATE_HIGHEST + 1; ++i)
StateTable[i].representative = 0; {
StateTable[i].apply = state_undefined; 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 */ /* This switch decides the order in which the states are applied */
switch(type) { switch (type)
{
case 0: cur = misc; break; case 0: cur = misc; break;
case 1: cur = fragment->states; break; case 1: cur = fragment->states; break;
case 2: cur = vertex->vp_states; break; case 2: cur = vertex->vp_states; break;
default: cur = NULL; /* Stupid compiler */ default: cur = NULL; /* Stupid compiler */
} }
if(!cur) continue; if (!cur) continue;
/* GL extension filtering should not prevent multiple handlers being applied from different /* GL extension filtering should not prevent multiple handlers being applied from different
* pipeline parts * pipeline parts
*/ */
memset(set, 0, sizeof(set)); memset(set, 0, sizeof(set));
for(i = 0; cur[i].state; i++) { for (i = 0; cur[i].state; ++i)
{
APPLYSTATEFUNC *funcs_array; APPLYSTATEFUNC *funcs_array;
/* Only use the first matching state with the available extension from one template. /* Only use the first matching state with the available extension from one template.
...@@ -5561,7 +5565,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_ ...@@ -5561,7 +5565,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
* *
* if GL_XYZ_fancy is supported, ignore the 2nd line * if GL_XYZ_fancy is supported, ignore the 2nd line
*/ */
if(set[cur[i].state]) continue; if (set[cur[i].state]) continue;
/* Skip state lines depending on unsupported extensions */ /* Skip state lines depending on unsupported extensions */
if (!supported_extensions[cur[i].extension]) continue; if (!supported_extensions[cur[i].extension]) continue;
set[cur[i].state] = TRUE; set[cur[i].state] = TRUE;
...@@ -5576,12 +5580,13 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_ ...@@ -5576,12 +5580,13 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
handlers = num_handlers(multistate_funcs[cur[i].state]); handlers = num_handlers(multistate_funcs[cur[i].state]);
multistate_funcs[cur[i].state][handlers] = cur[i].content.apply; multistate_funcs[cur[i].state][handlers] = cur[i].content.apply;
switch(handlers) { switch (handlers)
{
case 0: case 0:
StateTable[cur[i].state].apply = cur[i].content.apply; state_table[cur[i].state].apply = cur[i].content.apply;
break; break;
case 1: 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)))) if (!(dev_multistate_funcs[cur[i].state] = heap_calloc(2, sizeof(**dev_multistate_funcs))))
goto out_of_mem; goto out_of_mem;
...@@ -5589,7 +5594,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_ ...@@ -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]; dev_multistate_funcs[cur[i].state][1] = multistate_funcs[cur[i].state][1];
break; break;
case 2: 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], if (!(funcs_array = heap_realloc(dev_multistate_funcs[cur[i].state],
sizeof(**dev_multistate_funcs) * 3))) sizeof(**dev_multistate_funcs) * 3)))
goto out_of_mem; goto out_of_mem;
...@@ -5598,22 +5603,22 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_ ...@@ -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]; dev_multistate_funcs[cur[i].state][2] = multistate_funcs[cur[i].state][2];
break; break;
default: 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); cur[i].state, handlers + 1);
} }
if (StateTable[cur[i].state].representative if (state_table[cur[i].state].representative
&& StateTable[cur[i].state].representative != cur[i].content.representative) && state_table[cur[i].state].representative != cur[i].content.representative)
{ {
FIXME("State %s (%#x) has different representatives in different pipeline parts.\n", FIXME("State %s (%#x) has different representatives in different pipeline parts.\n",
debug_d3dstate(cur[i].state), cur[i].state); 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); prune_invalid_states(state_table, d3d_info);
validate_state_table(StateTable); validate_state_table(state_table);
return WINED3D_OK; return WINED3D_OK;
...@@ -5623,7 +5628,7 @@ out_of_mem: ...@@ -5623,7 +5628,7 @@ out_of_mem:
heap_free(dev_multistate_funcs[i]); heap_free(dev_multistate_funcs[i]);
} }
memset(dev_multistate_funcs, 0, (STATE_HIGHEST + 1)*sizeof(*dev_multistate_funcs)); memset(dev_multistate_funcs, 0, (STATE_HIGHEST + 1) * sizeof(*dev_multistate_funcs));
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -2107,7 +2107,7 @@ extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN; ...@@ -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; extern const struct wined3d_vertex_pipe_ops glsl_vertex_pipe DECLSPEC_HIDDEN;
/* "Base" state table */ /* "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_d3d_info *d3d_info, const BOOL *supported_extensions,
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment, const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN; const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN;
...@@ -3038,7 +3038,7 @@ struct wined3d_device ...@@ -3038,7 +3038,7 @@ struct wined3d_device
void *shader_priv; void *shader_priv;
void *fragment_priv; void *fragment_priv;
void *vertex_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 */ /* Array of functions for states which are handled by more than one pipeline part */
APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1]; APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1];
struct wined3d_blitter *blitter; struct wined3d_blitter *blitter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment