mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[WINESYNC] d3dx9: Use an assert() to validate access to const_tbl[].
This check is essentially validating that the hardcoded state_table[] has reasonable values for the shader constant states. Use ARRAY_SIZE() to avoid warnings if the compiler chooses an unsigned integer to back enum SHADER_CONSTANT_TYPE. Based on an idea by Henri Verbeet. Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id cfc533b40d2d1426a8f05501152b28aa1ec78f07 by Matteo Bruni <mbruni@codeweavers.com>
This commit is contained in:
parent
e6e305520c
commit
777269ea64
2 changed files with 2 additions and 6 deletions
|
@ -1473,11 +1473,7 @@ static HRESULT d3dx_set_shader_const_state(struct d3dx_effect *effect, enum SHAD
|
|||
D3DXVECTOR4 value;
|
||||
HRESULT ret;
|
||||
|
||||
if (op < 0 || op > SCT_PSINT)
|
||||
{
|
||||
FIXME("Unknown op %u.\n", op);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
assert(op < ARRAY_SIZE(const_tbl));
|
||||
element_count = param->bytes / const_tbl[op].elem_size;
|
||||
TRACE("%s, index %u, element_count %u.\n", const_tbl[op].name, index, element_count);
|
||||
if (param->type != const_tbl[op].type)
|
||||
|
|
|
@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
|
|||
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
|
||||
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
|
||||
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
|
||||
tags: {wine: 9796bdc966a89cd31829f3a094bb37ec71e21871}
|
||||
tags: {wine: cfc533b40d2d1426a8f05501152b28aa1ec78f07}
|
||||
|
|
Loading…
Reference in a new issue