diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h index 5a28f2eff76..07a059fcceb 100644 --- a/dlls/d3dx9_36/d3dx9_private.h +++ b/dlls/d3dx9_36/d3dx9_private.h @@ -342,7 +342,7 @@ struct d3dx_shared_data ULONG64 update_version; }; -struct d3dx9_base_effect; +struct d3dx_effect; static inline BOOL is_top_level_parameter(struct d3dx_parameter *param) { @@ -375,14 +375,14 @@ static inline BOOL is_param_dirty(struct d3dx_parameter *param, ULONG64 update_v return is_top_level_param_dirty(param->top_level_param, update_version); } -struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *base, +struct d3dx_parameter *get_parameter_by_name(struct d3dx_effect *effect, struct d3dx_parameter *parameter, const char *name) DECLSPEC_HIDDEN; #define SET_D3D_STATE_(manager, device, method, args...) (manager ? manager->lpVtbl->method(manager, args) \ : device->lpVtbl->method(device, args)) #define SET_D3D_STATE(base_effect, args...) SET_D3D_STATE_(base_effect->manager, base_effect->device, args) -HRESULT d3dx_create_param_eval(struct d3dx9_base_effect *base_effect, void *byte_code, +HRESULT d3dx_create_param_eval(struct d3dx_effect *effect, void *byte_code, unsigned int byte_code_size, D3DXPARAMETER_TYPE type, struct d3dx_param_eval **peval, ULONG64 *version_counter, const char **skip_constants, unsigned int skip_constants_count) DECLSPEC_HIDDEN; diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 8242b70b77e..1379c26206a 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -510,7 +510,7 @@ static struct d3dx_parameter *get_valid_parameter(struct d3dx_effect *effect, D3 return handle_param; return effect->base_effect.flags & D3DXFX_LARGEADDRESSAWARE - ? NULL : get_parameter_by_name(&effect->base_effect, NULL, parameter); + ? NULL : get_parameter_by_name(effect, NULL, parameter); } static void free_state(struct d3dx_state *state) @@ -838,7 +838,7 @@ static struct d3dx_parameter *get_parameter_element_by_name(struct d3dx_effect * switch (*part++) { case '.': - return get_parameter_by_name(&effect->base_effect, temp_parameter, part); + return get_parameter_by_name(effect, temp_parameter, part); case '\0': TRACE("Returning parameter %p\n", temp_parameter); @@ -857,7 +857,6 @@ static struct d3dx_parameter *get_parameter_element_by_name(struct d3dx_effect * static struct d3dx_parameter *get_annotation_by_name(struct d3dx_effect *effect, unsigned int count, struct d3dx_parameter *annotations, const char *name) { - struct d3dx9_base_effect *base = &effect->base_effect; UINT i, length; struct d3dx_parameter *temp_parameter; const char *part; @@ -883,7 +882,7 @@ static struct d3dx_parameter *get_annotation_by_name(struct d3dx_effect *effect, switch (*part++) { case '.': - return get_parameter_by_name(base, temp_parameter, part); + return get_parameter_by_name(effect, temp_parameter, part); case '[': return get_parameter_element_by_name(effect, temp_parameter, part); @@ -899,10 +898,9 @@ static struct d3dx_parameter *get_annotation_by_name(struct d3dx_effect *effect, return NULL; } -struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *base, +struct d3dx_parameter *get_parameter_by_name(struct d3dx_effect* effect, struct d3dx_parameter *parameter, const char *name) { - struct d3dx_effect *effect = base->effect; struct d3dx_parameter *temp_parameter; unsigned int name_len, param_name_len; unsigned int i, count, length; @@ -911,7 +909,7 @@ struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *base, const char *part; char *full_name; - TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name)); + TRACE("effect %p, parameter %p, name %s.\n", effect, parameter, debugstr_a(name)); if (!name || !*name) return NULL; @@ -972,7 +970,7 @@ struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *base, switch (*part++) { case '.': - return get_parameter_by_name(base, temp_parameter, part); + return get_parameter_by_name(effect, temp_parameter, part); case '[': return get_parameter_element_by_name(effect, temp_parameter, part); @@ -2021,7 +2019,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterByName(ID3DXEffect *iface, D3DX return handle; } - handle = get_parameter_handle(get_parameter_by_name(&effect->base_effect, param, name)); + handle = get_parameter_handle(get_parameter_by_name(effect, param, name)); TRACE("Returning parameter %p.\n", handle); return handle; @@ -5721,7 +5719,6 @@ static HRESULT d3dx9_create_object(struct d3dx9_base_effect *base, struct d3dx_o static HRESULT d3dx_parse_array_selector(struct d3dx_effect *effect, struct d3dx_state *state, const char **skip_constants, unsigned int skip_constants_count) { - struct d3dx9_base_effect *base = &effect->base_effect; DWORD string_size; struct d3dx_parameter *param = &state->parameter; struct d3dx_object *object = &effect->objects[param->object_id]; @@ -5731,7 +5728,7 @@ static HRESULT d3dx_parse_array_selector(struct d3dx_effect *effect, struct d3dx TRACE("Parsing array entry selection state for parameter %p.\n", param); string_size = *(DWORD *)ptr; - state->referenced_param = get_parameter_by_name(base, NULL, ptr + 4); + state->referenced_param = get_parameter_by_name(effect, NULL, ptr + 4); if (state->referenced_param) { TRACE("Mapping to parameter %s.\n", debugstr_a(state->referenced_param->name)); @@ -5745,7 +5742,7 @@ static HRESULT d3dx_parse_array_selector(struct d3dx_effect *effect, struct d3dx if (string_size % sizeof(DWORD)) FIXME("Unaligned string_size %u.\n", string_size); - if (FAILED(ret = d3dx_create_param_eval(base, (DWORD *)(ptr + string_size) + 1, + if (FAILED(ret = d3dx_create_param_eval(effect, (DWORD *)(ptr + string_size) + 1, object->size - (string_size + sizeof(DWORD)), D3DXPT_INT, ¶m->param_eval, get_version_counter_ptr(effect), NULL, 0))) return ret; @@ -5766,7 +5763,7 @@ static HRESULT d3dx_parse_array_selector(struct d3dx_effect *effect, struct d3dx { TRACE("Creating preshader for object %u.\n", param->members[i].object_id); object = &effect->objects[param->members[i].object_id]; - if (FAILED(ret = d3dx_create_param_eval(base, object->data, object->size, param->type, + if (FAILED(ret = d3dx_create_param_eval(effect, object->data, object->size, param->type, ¶m->members[i].param_eval, get_version_counter_ptr(effect), skip_constants, skip_constants_count))) break; @@ -5885,7 +5882,7 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, { if (FAILED(hr = d3dx9_create_object(base, object))) return hr; - if (FAILED(hr = d3dx_create_param_eval(base, object->data, object->size, param->type, + if (FAILED(hr = d3dx_create_param_eval(effect, object->data, object->size, param->type, ¶m->param_eval, get_version_counter_ptr(effect), skip_constants, skip_constants_count))) return hr; @@ -5899,7 +5896,7 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, state->type = ST_FXLC; if (FAILED(hr = d3dx9_copy_data(effect, param->object_id, ptr))) return hr; - if (FAILED(hr = d3dx_create_param_eval(base, object->data, object->size, param->type, + if (FAILED(hr = d3dx_create_param_eval(effect, object->data, object->size, param->type, ¶m->param_eval, get_version_counter_ptr(effect), NULL, 0))) return hr; break; @@ -5916,7 +5913,7 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, return hr; TRACE("Looking for parameter %s.\n", debugstr_a(object->data)); - state->referenced_param = get_parameter_by_name(base, NULL, object->data); + state->referenced_param = get_parameter_by_name(effect, NULL, object->data); if (state->referenced_param) { struct d3dx_parameter *refpar = state->referenced_param; @@ -5928,7 +5925,7 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, if (!refpar->param_eval) { - if (FAILED(hr = d3dx_create_param_eval(base, refobj->data, refobj->size, + if (FAILED(hr = d3dx_create_param_eval(effect, refobj->data, refobj->size, refpar->type, &refpar->param_eval, get_version_counter_ptr(effect), skip_constants, skip_constants_count))) return hr; @@ -6292,7 +6289,7 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, for (i = 0; i < skip_constants_count; ++i) { struct d3dx_parameter *param; - param = get_parameter_by_name(base, NULL, skip_constants[i]); + param = get_parameter_by_name(effect, NULL, skip_constants[i]); if (param) { for (j = 0; j < base->technique_count; ++j) diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c index 8551d2fe631..be2bba8348f 100644 --- a/dlls/d3dx9_36/preshader.c +++ b/dlls/d3dx9_36/preshader.c @@ -855,7 +855,7 @@ static HRESULT init_set_constants_param(struct d3dx_const_tab *const_tab, ID3DXC } static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab *out, - struct d3dx9_base_effect *base, const char **skip_constants, + struct d3dx_effect *effect, const char **skip_constants, unsigned int skip_constants_count, struct d3dx_preshader *pres) { ID3DXConstantTable *ctab; @@ -900,7 +900,7 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab } if (FAILED(hr = get_ctab_constant_desc(ctab, hc, &cdesc[index], &constantinfo_reserved))) goto cleanup; - inputs_param[index] = get_parameter_by_name(base, NULL, cdesc[index].Name); + inputs_param[index] = get_parameter_by_name(effect, NULL, cdesc[index].Name); if (!inputs_param[index]) { WARN("Could not find parameter %s in effect.\n", cdesc[index].Name); @@ -1105,7 +1105,7 @@ static void dump_preshader(struct d3dx_preshader *pres) dump_ins(&pres->regs, &pres->ins[i]); } -static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, unsigned int count, struct d3dx9_base_effect *base) +static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, unsigned int count, struct d3dx_effect *effect) { unsigned int *p; unsigned int i, j, const_count; @@ -1172,7 +1172,7 @@ static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, u saved_word = *ptr; *ptr = 0xfffe0000; - hr = get_constants_desc(ptr, &pres->inputs, base, NULL, 0, NULL); + hr = get_constants_desc(ptr, &pres->inputs, effect, NULL, 0, NULL); *ptr = saved_word; if (FAILED(hr)) return hr; @@ -1225,7 +1225,7 @@ static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, u return D3D_OK; } -HRESULT d3dx_create_param_eval(struct d3dx9_base_effect *base_effect, void *byte_code, unsigned int byte_code_size, +HRESULT d3dx_create_param_eval(struct d3dx_effect *effect, void *byte_code, unsigned int byte_code_size, D3DXPARAMETER_TYPE type, struct d3dx_param_eval **peval_out, ULONG64 *version_counter, const char **skip_constants, unsigned int skip_constants_count) { @@ -1236,8 +1236,8 @@ HRESULT d3dx_create_param_eval(struct d3dx9_base_effect *base_effect, void *byte unsigned int count, pres_size; HRESULT ret; - TRACE("base_effect %p, byte_code %p, byte_code_size %u, type %u, peval_out %p.\n", - base_effect, byte_code, byte_code_size, type, peval_out); + TRACE("effect %p, byte_code %p, byte_code_size %u, type %u, peval_out %p.\n", + effect, byte_code, byte_code_size, type, peval_out); count = byte_code_size / sizeof(unsigned int); if (!byte_code || !count) @@ -1287,7 +1287,7 @@ HRESULT d3dx_create_param_eval(struct d3dx9_base_effect *base_effect, void *byte pres_size = count; } - if (ptr && FAILED(ret = parse_preshader(&peval->pres, ptr, pres_size, base_effect))) + if (ptr && FAILED(ret = parse_preshader(&peval->pres, ptr, pres_size, effect))) { FIXME("Failed parsing preshader, byte code for analysis follows.\n"); dump_bytecode(byte_code, byte_code_size); @@ -1296,7 +1296,7 @@ HRESULT d3dx_create_param_eval(struct d3dx9_base_effect *base_effect, void *byte if (shader) { - if (FAILED(ret = get_constants_desc(shader_ptr, &peval->shader_inputs, base_effect, + if (FAILED(ret = get_constants_desc(shader_ptr, &peval->shader_inputs, effect, skip_constants, skip_constants_count, &peval->pres))) { TRACE("Could not get shader constant table, hr %#x.\n", ret);