IWineD3DDeviceImpl_SetRenderState

H. Verbeet hverbeet at gmail.com
Sun Jul 27 03:44:54 CDT 2008


> --- device_old.c    2008-07-25 11:42:25.000000000 -0400
> +++ device.c    2008-07-26 21:07:45.000000000 -0400
Unrelated to the patch, but if you intend to work on Wine, I'd
strongly recommend you setup git first.

> +#define D3DBLEND_INVSRCCOLOR 4
You shouldn't use d3d8 or d3d9 definitions in wined3d.
WINED3DBLEND_INVSRCCOLOR is already defined in
include/wine/wined3d_types.h

> +#define WINED3DDMT_ENABLE 0
> +#define WINED3DDMT_DISABLE 1
> +#define WINED3DBLEND_INVSRCCOLOR2 17
> +#define WINED3DBLEND_SRCCOLOR2 16
These should be enums, and they should be declared in
include/wine/wined3d_types.h. You should also make sure the
corresponding definitions exist in ddraw/d3d8/d3d9.

> +          if ((Value == TRUE) ||
> +              (Value == FALSE)) break;
Comparing booleans like that is questionable.

> +          if ((Value == WINED3DBLEND_ZERO) ||
> +              (Value == WINED3DBLEND_ONE)  ||
> +              (Value == WINED3DBLEND_SRCCOLOR) ||
> +              (Value == WINED3DBLEND_INVSRCCOLOR) ||
> +              (Value == WINED3DBLEND_SRCALPHA)    ||
> +              (Value == WINED3DBLEND_INVSRCALPHA) ||
> +              (Value == WINED3DBLEND_DESTALPHA)   ||
> +              (Value == WINED3DBLEND_INVDESTALPHA) ||
> +              (Value == WINED3DBLEND_DESTCOLOR) ||
> +              (Value == WINED3DBLEND_INVDESTCOLOR) ||
> +              (Value == WINED3DBLEND_SRCALPHASAT) ||
> +              (Value == WINED3DBLEND_BOTHSRCALPHA) ||
> +              (Value == WINED3DBLEND_BOTHINVSRCALPHA) ||
> +              (Value == WINED3DBLEND_BLENDFACTOR) ||
> +              (Value == WINED3DBLEND_INVBLENDFACTOR) ||
> +              (Value == WINED3DBLEND_SRCCOLOR2) ||
> +              (Value == WINED3DBLEND_INVSRCCOLOR2)) break;
> +          return WINED3DERR_INVALIDCALL;
Considering these are enum values, I think it makes more sense to test
the range, rather every individual value within it.

> +          if ((Value >= 0) ||
Since DWORDs are unsigned, this will always evaluate as true.

> +          if ((Value >= 0) ||
> +              (Value <=0xFFFFFFFF)) break;
This doesn't make sense.

> +     Default:
Did you try to compile your code?

As a general comment, you're not going to get a patch like this in
without appropriate test cases in ddraw, d3d8 and d3d9.



More information about the wine-devel mailing list