----Message d'origine----
>Date: Tue, 06 Jun 2006 02:46:59 -0400
>De: Ivan Gyurdiev <ivg2(a)cornell.edu>
>A: wine patch <wine-patches(a)winehq.org>
>Sujet: [WINED3D 5/5] Remove constant type field in stateblock.
>
>It is wrong to maintain a mapping from a constant index to a
type field,
>because different constant types do not share an index -
boolean
>constant 0 is supposed to co-exist with floating point constant
0, not
>replace it. Drawprim and other code using the type array to
decide
>whether to look up a constant in bools, floats, or ints is wrong -
you
>can't make that decision based on the index.
>
>To do this:
>==========
>- split .set and .changed stateblock arrays for constants into
>individual arrays for F, B, and I constants
>- don't use shared SetConstant/GetConstant function in
device.c, unroll
>that into its callers, and make them use separate .set
and .changed
>arrays. Remove old SetConstant/GetConstant functions, not
enough is
>shared to justify them. Remove SetConstantN, it's not used
anymore.
>- change stateblock to not use the type array
>- change drawprim to use the .set array, instead of a type array
to
>check if constants need to be loaded
>
Hi Ivan,
just one comment:
+ int i, cnt = min(count, MAX_VSHADER_CONSTANTS - (start
+ 1));
should be:
if (start > MAX_VSHADER_CONSTANTS - 1) return
WINED3DERR_INVALIDCALL;
UINT i, cnt = min(count, MAX_VSHADER_CONSTANTS - (start
+ 1));
as count and start are UINT (better to avoid ugliy
unsigned/signed bugs).
Anyway what windows do if (start + count >
MAX_VSHADER_CONSTANTS) ?
The code seems handle this case truncating the input
Best Regards,
Raphael