Matteo Bruni : d3dx9: Override d3dx9_get_param_value_ptr() return value only on array overflow.
Alexandre Julliard
julliard at winehq.org
Tue Mar 21 16:05:53 CDT 2017
Module: wine
Branch: master
Commit: f68de78d9ecd8babbf166866400e751f401a5bb4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f68de78d9ecd8babbf166866400e751f401a5bb4
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Tue Mar 21 19:04:09 2017 +0100
d3dx9: Override d3dx9_get_param_value_ptr() return value only on array overflow.
Incidentally this exposes a few test failures (due to not supporting
relative addressing in preshaders) previously masked by the broad
override.
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/effect.c | 22 +++++++++++++++++-----
dlls/d3dx9_36/tests/effect.c | 4 ++--
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 202a9a3..75254c1 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -2572,8 +2572,9 @@ static HRESULT d3dx9_get_param_value_ptr(struct ID3DXEffectImpl *effect, struct
TRACE("Array index %u.\n", array_idx);
if (array_idx >= param->element_count)
{
- ERR("Computed array index %u is out of bound %u.\n", array_idx, param->element_count);
- return D3DERR_INVALIDCALL;
+ WARN("Computed array index %u is larger than array size %u.\n",
+ array_idx, param->element_count);
+ return E_FAIL;
}
param = ¶m->members[array_idx];
@@ -2816,10 +2817,21 @@ static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pas
HRESULT hr;
TRACE("operation %u, index %u, type %u.\n", state->operation, state->index, state->type);
+
if (FAILED(hr = d3dx9_get_param_value_ptr(effect, pass, state, ¶m_value, ¶m)))
- /* Native d3dx returns D3D_OK from BeginPass or Commit involving out of bounds array
- * access and does not touch affected state. */
- return D3D_OK;
+ {
+ if (hr == E_FAIL)
+ {
+ /* Native d3dx9 returns D3D_OK from BeginPass or Commit involving
+ * out of bounds array access and does not touch the affected
+ * state, except for BeginPass when the out of bounds array index
+ * depends on dirty parameters. The latter case is supposed to
+ * return E_FAIL but is currently TODO. */
+ WARN("Returning D3D_OK on out of bounds array access.\n");
+ return D3D_OK;
+ }
+ return hr;
+ }
switch (state_table[state->operation].class)
{
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 24817dc..6aa2aaf 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -4153,7 +4153,7 @@ static void test_effect_preshader(IDirect3DDevice9 *device)
ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
hr = effect->lpVtbl->BeginPass(effect, 0);
- ok(hr == D3D_OK, "Got result %#x.\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->BeginPass(effect, 0);
ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
@@ -4327,7 +4327,7 @@ static void test_preshader_op(IDirect3DDevice9 *device, const DWORD *sample_effe
}
hr = effect->lpVtbl->BeginPass(effect, 0);
- ok(hr == D3D_OK, "Got result %#x.\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = IDirect3DDevice9_GetLight(device, blob_position[test->args_count].result_index, &light);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
More information about the wine-cvs
mailing list