d3dx10: Partially implement D3DX10CreateEffectFromMemory().
[wine.git] / dlls / d3dx10_43 / compiler.c
blob1ccb0e45a69d366375aed95ac55373a29657a455
1 /*
2 * Copyright 2021 Nikolay Sivov for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/debug.h"
22 #define COBJMACROS
24 #include "d3d10_1.h"
25 #include "d3dx10.h"
26 #include "d3dcompiler.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
31 HRESULT WINAPI D3DX10CreateEffectFromMemory(const void *data, SIZE_T datasize, const char *filename,
32 const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile,
33 UINT shader_flags, UINT effect_flags, ID3D10Device *device, ID3D10EffectPool *effect_pool,
34 ID3DX10ThreadPump *pump, ID3D10Effect **effect, ID3D10Blob **errors, HRESULT *hresult)
36 ID3D10Blob *code;
37 HRESULT hr;
39 TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, profile %s, shader_flags %#x,"
40 "effect_flags %#x, device %p, effect_pool %p, pump %p, effect %p, errors %p, hresult %p.\n",
41 data, datasize, debugstr_a(filename), defines, include, debugstr_a(profile),
42 shader_flags, effect_flags, device, effect_pool, pump, effect, errors, hresult);
44 if (pump)
45 FIXME("Asynchronous mode is not supported.\n");
47 if (!include)
48 include = D3D_COMPILE_STANDARD_FILE_INCLUDE;
50 if (FAILED(hr = D3DCompile(data, datasize, filename, defines, include, "main", profile,
51 shader_flags, effect_flags, &code, errors)))
53 WARN("Effect compilation failed, hr %#x.\n", hr);
54 return hr;
57 hr = D3D10CreateEffectFromMemory(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
58 effect_flags, device, effect_pool, effect);
59 ID3D10Blob_Release(code);
61 return hr;