[WINESYNC] d3dx9: Move technique_count out of struct d3dx9_base_effect.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 074e3232ee90c94f9a8e7c55988b29b40e1e3f0f by Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
winesync 2020-09-21 22:50:18 +02:00 committed by Jérôme Gardou
parent 515c280579
commit 9931b438e9
2 changed files with 20 additions and 21 deletions

View File

@ -156,8 +156,6 @@ struct d3dx9_base_effect
{
struct d3dx_effect *effect;
UINT technique_count;
struct d3dx_top_level_parameter *parameters;
struct d3dx_technique *techniques;
@ -174,6 +172,7 @@ struct d3dx_effect
struct d3dx9_base_effect base_effect;
unsigned int parameter_count;
unsigned int technique_count;
unsigned int object_count;
struct d3dx_object *objects;
struct wine_rb_tree param_tree;
@ -463,7 +462,7 @@ static struct d3dx_technique *get_technique_by_name(struct d3dx_effect *effect,
if (!name) return NULL;
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
{
if (!strcmp(base->techniques[i].name, name))
return &base->techniques[i];
@ -477,7 +476,7 @@ static struct d3dx_technique *get_valid_technique(struct d3dx_effect *effect, D3
struct d3dx9_base_effect *base = &effect->base_effect;
unsigned int i;
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
{
if (get_technique_handle(&base->techniques[i]) == technique)
return &base->techniques[i];
@ -491,7 +490,7 @@ static struct d3dx_pass *get_valid_pass(struct d3dx_effect *effect, D3DXHANDLE p
struct d3dx9_base_effect *base = &effect->base_effect;
unsigned int i, k;
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
{
struct d3dx_technique *technique = &base->techniques[i];
@ -705,7 +704,7 @@ static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect)
if (base->techniques)
{
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
free_technique(&base->techniques[i]);
HeapFree(GetProcessHeap(), 0, base->techniques);
base->techniques = NULL;
@ -1863,7 +1862,7 @@ static HRESULT WINAPI d3dx_effect_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *d
desc->Creator = NULL;
desc->Functions = 0;
desc->Parameters = effect->parameter_count;
desc->Techniques = effect->base_effect.technique_count;
desc->Techniques = effect->technique_count;
return D3D_OK;
}
@ -2126,7 +2125,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetTechnique(ID3DXEffect *iface, UINT index
TRACE("iface %p, index %u.\n", iface, index);
if (index >= effect->base_effect.technique_count)
if (index >= effect->technique_count)
{
WARN("Invalid argument specified.\n");
return NULL;
@ -3663,7 +3662,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
if (!(prev_tech = get_valid_technique(effect, technique)))
return D3DERR_INVALIDCALL;
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
{
tech = &base->techniques[i];
if (tech == prev_tech)
@ -3678,7 +3677,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
i = 0;
}
for (; i < base->technique_count; ++i)
for (; i < effect->technique_count; ++i)
{
tech = &base->techniques[i];
if (SUCCEEDED(d3dx_effect_ValidateTechnique(iface, get_technique_handle(tech))))
@ -5841,9 +5840,10 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data,
struct d3dx_technique *technique;
struct d3dx_pass *pass;
if (technique_index >= base->technique_count)
if (technique_index >= effect->technique_count)
{
FIXME("Index out of bounds: technique_index %u >= technique_count %u\n", technique_index, base->technique_count);
FIXME("Index out of bounds: technique_index %u >= technique_count %u.\n", technique_index,
effect->technique_count);
return E_FAIL;
}
@ -5976,8 +5976,8 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
read_dword(&ptr, &effect->parameter_count);
TRACE("Parameter count: %u.\n", effect->parameter_count);
read_dword(&ptr, &base->technique_count);
TRACE("Technique count: %u.\n", base->technique_count);
read_dword(&ptr, &effect->technique_count);
TRACE("Technique count: %u.\n", effect->technique_count);
skip_dword_unknown(&ptr, 1);
@ -6020,10 +6020,9 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
}
}
if (base->technique_count)
if (effect->technique_count)
{
base->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*base->techniques) * base->technique_count);
base->techniques = heap_alloc_zero(sizeof(*base->techniques) * effect->technique_count);
if (!base->techniques)
{
ERR("Out of memory.\n");
@ -6031,7 +6030,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
goto err_out;
}
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
{
TRACE("Parsing technique %u.\n", i);
hr = d3dx_parse_effect_technique(effect, &base->techniques[i], data, &ptr, effect->objects);
@ -6093,7 +6092,7 @@ err_out:
if (base->techniques)
{
for (i = 0; i < base->technique_count; ++i)
for (i = 0; i < effect->technique_count; ++i)
free_technique(&base->techniques[i]);
HeapFree(GetProcessHeap(), 0, base->techniques);
base->techniques = NULL;
@ -6296,7 +6295,7 @@ static HRESULT d3dx9_base_effect_init(struct d3dx_effect *effect, const char *da
param = get_parameter_by_name(effect, NULL, skip_constants[i]);
if (param)
{
for (j = 0; j < base->technique_count; ++j)
for (j = 0; j < effect->technique_count; ++j)
{
if (is_parameter_used(param, &base->techniques[j]))
{

View File

@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
tags: {wine: 92d2f6d99429df4b5f132eca2fa8a2c1eae4a6d0}
tags: {wine: 074e3232ee90c94f9a8e7c55988b29b40e1e3f0f}