[PATCH 1/2] d3dx10: Partially implement D3DX10CreateEffectFromMemory().

Nikolay Sivov nsivov at codeweavers.com
Fri Aug 6 05:00:57 CDT 2021


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/d3dx10_43/d3dx10_43_main.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c
index 06b00cb0393..650645362ea 100644
--- a/dlls/d3dx10_43/d3dx10_43_main.c
+++ b/dlls/d3dx10_43/d3dx10_43_main.c
@@ -32,6 +32,7 @@
 
 #include "d3d10_1.h"
 #include "d3dx10.h"
+#include "d3dcompiler.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
 
@@ -79,12 +80,29 @@ HRESULT WINAPI D3DX10CreateEffectFromMemory(const void *data, SIZE_T datasize, c
         UINT fxflags, ID3D10Device *device, ID3D10EffectPool *effectpool, ID3DX10ThreadPump *pump,
         ID3D10Effect **effect, ID3D10Blob **errors, HRESULT *hresult)
 {
-    FIXME("data %p, datasize %lu, filename %s, defines %p, include %p, profile %s, hlslflags %#x, fxflags %#x, "
+    ID3D10Blob *code;
+    HRESULT hr;
+
+    TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, profile %s, hlslflags %#x, fxflags %#x, "
             "device %p, effectpool %p, pump %p, effect %p, errors %p, hresult %p\n",
             data, datasize, debugstr_a(filename), defines, include, debugstr_a(profile), hlslflags, fxflags, device,
             effectpool, pump, effect, errors, hresult);
 
-    return E_NOTIMPL;
+    if (pump)
+        FIXME("Asynchronous mode is not supported.\n");
+
+    if (FAILED(hr = D3DCompile(data, datasize, filename, defines, include, NULL, profile,
+            hlslflags, fxflags, &code, errors)))
+    {
+        WARN("Effect compilation failed, hr %#x.\n", hr);
+        return hr;
+    }
+
+    hr = D3D10CreateEffectFromMemory(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
+            fxflags, device, effectpool, effect);
+    ID3D10Blob_Release(code);
+
+    return hr;
 }
 
 HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(const void *data, SIZE_T datasize, const char *filename,
-- 
2.30.2




More information about the wine-devel mailing list