Supersedes !601.
From: Andrey Gusev andrey.goosev@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53427 --- dlls/d3dx10_43/async.c | 12 ------------ dlls/d3dx10_43/compiler.c | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index 667219b3500..62627886804 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -600,18 +600,6 @@ HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *device, return S_OK; }
-HRESULT WINAPI D3DX10PreprocessShaderFromMemory(const char *data, SIZE_T data_size, const char *filename, - const D3D10_SHADER_MACRO *defines, ID3DInclude *include, ID3DX10ThreadPump *pump, ID3D10Blob **shader_text, - ID3D10Blob **errors, HRESULT *hresult) -{ - FIXME("data %s, data_size %Iu, filename %s, defines %p, include %p, pump %p, shader_text %p, " - "errors %p, hresult %p stub!\n", - debugstr_an(data, data_size), data_size, debugstr_a(filename), defines, include, pump, - shader_text, errors, hresult); - - return E_NOTIMPL; -} - struct work_item { struct list entry; diff --git a/dlls/d3dx10_43/compiler.c b/dlls/d3dx10_43/compiler.c index c66eb679a8f..ad27783eabb 100644 --- a/dlls/d3dx10_43/compiler.c +++ b/dlls/d3dx10_43/compiler.c @@ -183,3 +183,26 @@ HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE module, const WCHAR *reso free(filename); return hr; } + +HRESULT WINAPI D3DX10PreprocessShaderFromMemory(const char *data, SIZE_T data_size, const char *filename, + const D3D10_SHADER_MACRO *defines, ID3DInclude *include, ID3DX10ThreadPump *pump, ID3D10Blob **shader_text, + ID3D10Blob **errors, HRESULT *hresult) +{ + HRESULT hr; + + TRACE("data %s, data_size %Iu, filename %s, defines %p, include %p, pump %p, shader_text %p, " + "errors %p, hresult %p.\n", + debugstr_an(data, data_size), data_size, debugstr_a(filename), defines, include, pump, + shader_text, errors, hresult); + + if (!data) + return E_FAIL; + + if (pump) + FIXME("Unimplemented ID3DX10ThreadPump handling.\n"); + + hr = D3DPreprocess(data, data_size, filename, defines, include, shader_text, errors); + if (hresult) + *hresult = hr; + return hr; +}
From: Matteo Bruni mbruni@codeweavers.com
--- dlls/d3dx10_43/tests/d3dx10.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index ee969608d2b..d961f3d38da 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -3953,6 +3953,40 @@ static void test_create_effect_from_resource(void) ok(!refcount, "Unexpected refcount.\n"); }
+static void test_preprocess_shader(void) +{ + static const char shader_source[] = + "float4 main()\n" + "{\n" + " return float4(1.0);\n" + "}\n"; + ID3D10Blob *preprocessed, *errors; + HRESULT hr, hr2; + + hr2 = 0xdeadbeef; + hr = D3DX10PreprocessShaderFromMemory(NULL, 0, NULL, NULL, NULL, + NULL, &preprocessed, &errors, &hr2); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Unexpected hr2 %#lx.\n", hr2); + + hr2 = 0xdeadbeef; + hr = D3DX10PreprocessShaderFromMemory(shader_source, strlen(shader_source), NULL, NULL, NULL, + NULL, &preprocessed, &errors, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!preprocessed, "Unexpected preprocessed %p.\n", preprocessed); + ok(!errors, "Unexpected errors %p.\n", errors); + ID3D10Blob_Release(preprocessed); + + hr2 = 0xdeadbeef; + hr = D3DX10PreprocessShaderFromMemory(shader_source, strlen(shader_source), NULL, NULL, NULL, + NULL, &preprocessed, &errors, &hr2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Unexpected hr2 %#lx.\n", hr2); + ok(!!preprocessed, "Unexpected preprocessed %p.\n", preprocessed); + ok(!errors, "Unexpected errors %p.\n", errors); + ID3D10Blob_Release(preprocessed); +} + START_TEST(d3dx10) { test_D3DX10UnsetAllDeviceObjects(); @@ -3967,4 +4001,5 @@ START_TEST(d3dx10) test_font(); test_sprite(); test_create_effect_from_resource(); + test_preprocess_shader(); }
This merge request was approved by Matteo Bruni.