Added patch for ID3DXEffect::FindNextValidTechnique.

This commit is contained in:
Michael Müller 2014-12-19 22:40:48 +01:00
parent 3d8a3c0e69
commit 9efe53b3f5
5 changed files with 160 additions and 1 deletions

View File

@ -37,11 +37,12 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [4]:**
**Bugfixes and features included in the next upcoming release [5]:**
* Add stub for RtlSetHeapInformation
* Ensure X11 input events are handled even without explicit message loop ([Wine Bug #8854](https://bugs.winehq.org/show_bug.cgi?id=8854))
* Fix handling of subdirectory in FtpFindFirstFile ([Wine Bug #16526](https://bugs.winehq.org/show_bug.cgi?id=16526))
* Implement ID3DXEffect::FindNextValidTechnique ([Wine Bug #34101](https://bugs.winehq.org/show_bug.cgi?id=34101))
* Implement IDXGIOutput::GetDesc

1
debian/changelog vendored
View File

@ -9,6 +9,7 @@ wine-staging (1.7.34) UNRELEASED; urgency=low
* Added test for server-Unexpected_Wakeup patch.
* Added patch for stub of ntdll.RtlSetHeapInformation.
* Added patch for IDXGIOutput::GetDesc.
* Added patch for ID3DXEffect::FindNextValidTechnique.
* Removed patch to implement combase HSTRING objects (accepted upstream).
* Removed patch to add fake ProductId to registry (accepted upstream).
* Removed patch to implement stubs for MFStartup and MFShutdown (accepted upstream).

View File

@ -30,6 +30,7 @@ PATCHLIST := \
d3d9-Surface_Refcount.ok \
d3dx9_36-DXTn.ok \
d3dx9_36-Filter_Warnings.ok \
d3dx9_36-FindNextValidTechnique.ok \
d3dx9_36-GetShaderSemantics.ok \
d3dx9_36-Optimize_Inplace.ok \
d3dx9_36-Texture_Align.ok \
@ -376,6 +377,21 @@ d3dx9_36-Filter_Warnings.ok:
echo '+ { "Christian Costa", "d3dx9_36: Filter out D3DCompile warning messages that are not present with D3DCompileShader.", 4 },'; \
) > d3dx9_36-Filter_Warnings.ok
# Patchset d3dx9_36-FindNextValidTechnique
# |
# | This patchset fixes the following Wine bugs:
# | * [#34101] Implement ID3DXEffect::FindNextValidTechnique
# |
# | Modified files:
# | * dlls/d3dx9_36/effect.c, dlls/d3dx9_36/tests/effect.c
# |
.INTERMEDIATE: d3dx9_36-FindNextValidTechnique.ok
d3dx9_36-FindNextValidTechnique.ok:
$(call APPLY_FILE,d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch)
@( \
echo '+ { "Christian Costa", "d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests.", 1 },'; \
) > d3dx9_36-FindNextValidTechnique.ok
# Patchset d3dx9_36-GetShaderSemantics
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,140 @@
From fcbc8716f358f29b4831c0eaea131ee9e5508435 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Fri, 19 Dec 2014 22:31:46 +0100
Subject: d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests.
---
dlls/d3dx9_36/effect.c | 34 ++++++++++++++++++++++---
dlls/d3dx9_36/tests/effect.c | 60 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 8e2f850..2e06437 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -3122,13 +3122,41 @@ static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DX
return D3D_OK;
}
-static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
+static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect *iface,
+ D3DXHANDLE technique, D3DXHANDLE *next_technique)
{
struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
+ struct d3dx9_base_effect *base_effect = &This->base_effect;
+ UINT i = 0;
- FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
+ TRACE("iface %p, technique %p, next_technique %p\n", iface, technique, next_technique);
- return E_NOTIMPL;
+ if (!next_technique)
+ return D3DERR_INVALIDCALL;
+
+ if (technique)
+ {
+ for (; i < base_effect->technique_count; i++)
+ {
+ if (technique == get_technique_handle(&base_effect->techniques[i]))
+ {
+ i++; /* Go to next technique */
+ break;
+ }
+ }
+ }
+
+ for (; i < base_effect->technique_count; i++)
+ {
+ if (SUCCEEDED(iface->lpVtbl->ValidateTechnique(iface, get_technique_handle(&base_effect->techniques[i]))))
+ {
+ *next_technique = get_technique_handle(&base_effect->techniques[i]);
+ return D3D_OK;
+ }
+ }
+
+ *next_technique = NULL;
+ return S_FALSE;
}
static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 482f064..1bac9f0 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -2692,6 +2692,65 @@ static void test_effect_compilation_errors(IDirect3DDevice9 *device)
effect->lpVtbl->Release(effect);
}
+/*
+ * fxc.exe /Tfx_2_0
+ */
+#if 0
+technique t1 { pass p { ZEnable = TRUE; } }
+technique t2 { pass p { ZEnable = FALSE; } }
+#endif
+static const DWORD test_effect_technique_validation_blob[] =
+{
+0xfeff0901, 0x00000064, 0x00000000, 0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
+0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x00000070, 0x00000003, 0x00003174, 0x00000000,
+0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
+0x00000070, 0x00000003, 0x00003274, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x0000002c,
+0x00000000, 0x00000001, 0x00000024, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000008,
+0x00000004, 0x0000005c, 0x00000000, 0x00000001, 0x00000054, 0x00000000, 0x00000001, 0x00000000,
+0x00000000, 0x00000038, 0x00000034, 0x00000000, 0x00000000
+};
+
+static void test_effect_technique_validation(IDirect3DDevice9 *device)
+{
+ ID3DXEffect *effect;
+ ULONG count;
+ D3DXHANDLE technique1, technique2, technique;
+ HRESULT hr;
+
+ hr = D3DXCreateEffect(device, test_effect_technique_validation_blob,
+ sizeof(test_effect_technique_validation_blob), NULL, NULL, 0, NULL, &effect, NULL);
+ ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
+
+ technique1 = effect->lpVtbl->GetTechniqueByName(effect, "t1");
+ ok(technique1 != NULL, "Failed to get technique\n");
+ technique2 = effect->lpVtbl->GetTechniqueByName(effect, "t2");
+ ok(technique2 != NULL, "Failed to get technique\n");
+
+#if 0 /* This crashes on Windows */
+ hr = effect->lpVtbl->FindNextValidTechnique(effect, (D3DXHANDLE)0xdeadbeef, &technique);
+#endif
+ hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "FindNextValidTechnique, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
+
+ technique = (D3DXHANDLE)0xdeadbeef;
+ hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &technique);
+ ok(hr == D3D_OK, "FindNextValidTechnique failed, got %#x, expected %#x\n", hr, D3D_OK);
+ ok(technique == technique1, "Technique returned %p, expected %p\n", technique, technique1);
+
+ technique = (D3DXHANDLE)0xdeadbeef;
+ hr = effect->lpVtbl->FindNextValidTechnique(effect, technique1, &technique);
+ ok(hr == D3D_OK, "FindNextValidTechnique failed, got %#x, expected %#x\n", hr, D3D_OK);
+ ok(technique == technique2, "Technique returned %p, expected %p\n", technique, technique2);
+
+ technique = (D3DXHANDLE)0xdeadbeef;
+ hr = effect->lpVtbl->FindNextValidTechnique(effect, technique2, &technique);
+ ok(hr == S_FALSE, "FindNextValidTechnique, got %#x, expected %#x\n", hr, S_FALSE);
+ ok(technique == NULL, "Technique returned %p, expected %p\n", technique, NULL);
+
+ count = effect->lpVtbl->Release(effect);
+ ok(!count, "Release failed %u\n", count);
+}
+
START_TEST(effect)
{
HWND wnd;
@@ -2730,6 +2789,7 @@ START_TEST(effect)
test_effect_parameter_value(device);
test_effect_variable_names(device);
test_effect_compilation_errors(device);
+ test_effect_technique_validation(device);
count = IDirect3DDevice9_Release(device);
ok(count == 0, "The device was not properly freed: refcount %u\n", count);
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [34101] Implement ID3DXEffect::FindNextValidTechnique