[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [PATCH 2/2] d3d10: Parse effect shaders as anonymous shaders.
From:       Henri Verbeet <hverbeet () gmail ! com>
Date:       2009-12-31 16:52:36
Message-ID: d658b69e0912310852i339c817ascc4485aacefc9730 () mail ! gmail ! com
[Download RAW message or body]

2009/12/31 Rico Schüller <kgbricola@web.de>:
> struct d3d10_effect_shader_variable *s;
...
> +    v->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct \
> d3d10_effect_shader_variable));
...
> +    s = v->data;

I think this would be nicer:
s = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*s));
...
v->data = s;

That's mostly my fault for writing it like that in the first place,
but we might as well fix that.

> +        default:
> +            ERR("This should not happen!\n");
> +            break;
You'll probably want to return E_FAIL here.

> +    struct d3d10_effect_variable *v = \
> &e->anonymous_shaders[e->anonymous_shader_current]; +    struct d3d10_effect_type \
> *t = &e->anonymous_shader_type[e->anonymous_shader_current];
...
> +            hr = parse_fx10_anonymous_shader(o->pass->technique->effect, o->type);
...
> +            o->data = \
> &o->pass->technique->effect->anonymous_shaders[o->pass->technique->effect->anonymous_shader_current-1];
> 
If you create a structure for anonymous shaders, you can store that in
a single array. You can then pass a pointer to that structure to
parse_fx10_anonymous_shader(), and handle "anonymous_shader_current"
in parse_fx10_object(). E.g.:

struct d3d10_effect *effect = o->pass->technique->effect;
struct d3d10_effect_anonymous_shader *shader =
&effect->anonymous_shaders[effect->anonymous_shader_current];

hr = parse_fx10_anonymous_shader(effect, o->type, shader);
if (FAILED(hr)) return hr;

++effect->anonymous_shader_current;
o->data = shader;

Note that you should also validate that "anonymous_shader_current" <
"anonymous_shader_count". The count is supposed to be correct, but the
.fx might lie about it, possibly on purpose.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic