[1/7] [wined3d] add ps_np2fixup_t struct to ps_compiled_shader

Henri Verbeet hverbeet at gmail.com
Wed Apr 22 12:27:40 CDT 2009

2009/4/22 Tobias Jakobi <liquid.acid at gmx.net>:
> Henri Verbeet wrote:
>> Sure, but it's still internal bookkeeping of the backends. Everything
>> the backend needs from the outside world is the np2_fixup field from
>> struct ps_compile_args.
>>> For ARB mode this is essential since something like the prog_link struct
>>> from GLSL doesn't exist there.
>> It's not terribly hard to introduce something like that. That could
>> mean adding a handle table to the ARB backend, or expanding prgId to
>> be a pointer, but that's ok.
> So, is that a suggestion? I don't think that's for me to decide.
> You should make clear if I should implement it this way or use another
> approach. From my point of view it makes sense to share the data, so
> putting this into ps_compiled_shader is my currently best option.
> But if you say, that the current approach is a no-go - I'll try the
> pointer-approach.
> So, how should I do it?
A handle table would probably make the most sense. A pointer would
work for ARB, but for GLSL that's just extra indirection that isn't
really needed.

>> The point is that writing "GLfloat* const_cache;" implies the * is
>> part of the type instead of the declarator. C doesn't work that way,
>> it's misleading at best.
> IMHO that's splitting hairs.
> You could apply the same this for pointer casting, forbidding something
> like
> var = (TYPE*)var2;
> and instead enforce
> var = (TYPE *)var2;
I think that's better, yes.

>> Not in the current code, no. But if you store the index of the fixup
>> parameter instead of the index of the packed uniform the parameter is
>> stored in, you can derive the index of the packed uniform as (idx >>
>> 1) and the position within that uniform as (idx & 1).
> I don't think I can follow you.
> I tried some similar approach in the beginning, but it I think it failed
> if tex1 and tex3 need fixup, but tex2 does not.
> The approach didn't like "holes" in the indices. However we can't assume
> that all texture samples that need fixup are consecutive.
Tex fixup parameter for tex1 would have idx 0, the one for tex3 would
have idx 1. These would then be packed as PsamplerNP2Fixup0.xy and

More information about the wine-devel mailing list