Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/context.c | 2 +- dlls/wined3d/device.c | 10 +++---- dlls/wined3d/state.c | 49 +++++++++++++++++++--------------- dlls/wined3d/wined3d_private.h | 4 +-- 4 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 122ed709610c..37264a08ef06 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -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. */ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 61896a254f85..79a5b68c6f77 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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);
@@ -5414,7 +5412,7 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) for (i = 0; i < device->context_count; ++i) { context = device->contexts[i]; - if(isStateDirty(context, rep)) continue; + if (isStateDirty(context, rep)) continue;
context->dirtyArray[context->numDirtyEntries++] = rep; idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 969dfc2e12a4..9dc98047cfde 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -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_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; default: cur = NULL; /* Stupid compiler */ } - if(!cur) continue; + if (!cur) continue;
/* GL extension filtering should not prevent multiple handlers being applied from different * pipeline parts */ 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. @@ -5561,7 +5565,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_ * * 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 */ if (!supported_extensions[cur[i].extension]) continue; set[cur[i].state] = TRUE; @@ -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", - cur[i].state, handlers + 1); + 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;
@@ -5623,7 +5628,7 @@ out_of_mem: 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; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 51b86a7646b0..8fe331065768 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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;