Commit f68de78d authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

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: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent bf7a97e5
......@@ -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 = &param->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, &param_value, &param)))
/* 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)
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment