From 0e0b613192bc431232ce9c657bd37674bb097472 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Mon, 17 Mar 2014 20:22:53 +0100 Subject: [PATCH] d3dx9: Store pointers to referenced parameters for "usage 1" resources. --- dlls/d3dx9_36/effect.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index b3a27195869..73eb5c8d1ab 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -118,6 +118,8 @@ struct d3dx_parameter struct d3dx_parameter *annotations; struct d3dx_parameter *members; + + struct d3dx_parameter *referenced_param; }; struct d3dx_object @@ -5070,11 +5072,11 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char * TRACE("Using object id %u.\n", param->object_id); object = &base->objects[param->object_id]; + TRACE("Usage %u: class %s, type %s.\n", usage, debug_d3dxparameter_class(param->class), + debug_d3dxparameter_type(param->type)); switch (usage) { case 0: - TRACE("usage 0: class %s type %s.\n", debug_d3dxparameter_class(param->class), - debug_d3dxparameter_type(param->type)); switch (param->type) { case D3DXPT_VERTEXSHADER: @@ -5103,7 +5105,20 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char * case 1: state->type = ST_PARAMETER; - hr = d3dx9_copy_data(&base->objects[param->object_id], ptr); + if (FAILED(hr = d3dx9_copy_data(&base->objects[param->object_id], ptr))) + return hr; + + TRACE("Looking for parameter %s.\n", debugstr_a(object->data)); + param->referenced_param = get_parameter_by_name(base, NULL, object->data); + if (param->referenced_param) + { + TRACE("Mapping to parameter %p.\n", param->referenced_param); + } + else + { + FIXME("Referenced parameter %s not found.\n", (char *)object->data); + return D3DXERR_INVALIDDATA; + } break; default: