https://git.reactos.org/?p=reactos.git;a=commitdiff;h=777269ea64113ed7c11e4…
commit 777269ea64113ed7c11e4edda39031ea79b67c68
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Sep 21 23:07:32 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Thu Feb 4 16:37:06 2021 +0100
[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(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id cfc533b40d2d1426a8f05501152b28aa1ec78f07 by Matteo Bruni
<mbruni(a)codeweavers.com>
---
dll/directx/wine/d3dx9_36/effect.c | 6 +-----
sdk/tools/winesync/d3dx9.cfg | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c
index c38ca0f0bdf..8670daa81b2 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -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)
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 8db3c5290ea..7ebb6f89bd1 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -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}