Please ignore this patch for now (along with the previous version). I have discovered that there is still the case when object_id can be nonzero, but the object is never created (not initialized array of shaders). So we should keep the creation_failed flag probably. I will send the test for null shaders and the new patch version in the next series. On 09/01/2017 01:56 PM, Paul Gofman wrote:
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> --- v3: - use object_id != 0 as the indication of non-null shader. --- dlls/d3dx9_36/effect.c | 45 +++++++++++++++++++++++++++++++++++++++++--- dlls/d3dx9_36/tests/effect.c | 3 --- 2 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 2cd0c22f64..ef772d99b5 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -3941,11 +3941,50 @@ static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect *iface)
static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique) { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); + struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface); + struct d3dx9_base_effect *base = &effect->base_effect; + struct d3dx_technique *tech = get_valid_technique(base, technique); + HRESULT ret = D3D_OK; + unsigned int i, j;
- FIXME("(%p)->(%p): stub\n", This, technique); + FIXME("iface %p, technique %p semi-stub.\n", iface, technique);
- return D3D_OK; + if (!tech) + { + ret = D3DERR_INVALIDCALL; + goto done; + } + for (i = 0; i < tech->pass_count; ++i) + { + struct d3dx_pass *pass = &tech->passes[i]; + + for (j = 0; j < pass->state_count; ++j) + { + struct d3dx_state *state = &pass->states[j]; + + if (state_table[state->operation].class == SC_VERTEXSHADER + || state_table[state->operation].class == SC_PIXELSHADER) + { + struct d3dx_parameter *param; + void *param_value; + BOOL param_dirty; + HRESULT hr; + + if (FAILED(hr = d3dx9_get_param_value_ptr(pass, &pass->states[j], ¶m_value, ¶m, + FALSE, ¶m_dirty))) + return hr; + + if (param->object_id && !*(void **)param->data) + { + ret = E_FAIL; + goto done; + } + } + } + } +done: + TRACE("Returning %#x.\n", ret); + return ret; }
static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique) diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index bb26fe4e51..7260411c39 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -7090,10 +7090,8 @@ static void test_effect_unsupported_shader(void) ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->ValidateTechnique(effect, "missing_technique"); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); hr = effect->lpVtbl->ValidateTechnique(effect, "tech0"); - todo_wine ok(hr == E_FAIL, "Got result %#x.\n", hr);
hr = effect->lpVtbl->ValidateTechnique(effect, "tech1"); @@ -7101,7 +7099,6 @@ static void test_effect_unsupported_shader(void) effect->lpVtbl->SetInt(effect, "i", 1); ok(hr == D3D_OK, "Got result %#x.\n", hr); hr = effect->lpVtbl->ValidateTechnique(effect, "tech1"); - todo_wine ok(hr == E_FAIL, "Got result %#x.\n", hr); effect->lpVtbl->SetInt(effect, "i", 0); hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");