d3dcompiler: Implement D3DGetOutputSignatureBlob().
[wine.git] / dlls / d3dcompiler_43 / d3dcompiler_43_main.c
blobbc4cac089d30aa700ab9bd2040799ea6c0f8c93e
1 /*
2 * Direct3D shader compiler main file
4 * Copyright 2010 Matteo Bruni for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wine/debug.h"
30 #include "d3dcompiler_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
34 BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
36 switch (reason)
38 case DLL_WINE_PREATTACH:
39 return FALSE; /* prefer native version */
40 case DLL_PROCESS_ATTACH:
41 DisableThreadLibraryCalls(inst);
42 break;
43 case DLL_PROCESS_DETACH:
44 break;
46 return TRUE;
49 HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
51 struct d3dcompiler_blob *object;
52 HRESULT hr;
54 TRACE("data_size %lu, blob %p\n", data_size, blob);
56 if (!blob)
58 WARN("Invalid blob specified.\n");
59 return D3DERR_INVALIDCALL;
62 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
63 if (!object)
65 ERR("Failed to allocate D3D blob object memory\n");
66 return E_OUTOFMEMORY;
69 hr = d3dcompiler_blob_init(object, data_size);
70 if (FAILED(hr))
72 WARN("Failed to initialize blob, hr %#x.\n", hr);
73 HeapFree(GetProcessHeap(), 0, object);
74 return hr;
77 *blob = (ID3DBlob *)object;
79 TRACE("Created ID3DBlob %p\n", object);
81 return S_OK;
84 HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
86 TRACE("data %p, data_size %lu, part %s, flags %#x, blob %p\n", data,
87 data_size, debug_d3dcompiler_d3d_blob_part(part), flags, blob);
89 return d3dcompiler_get_blob_part(data, data_size, part, flags, blob);
92 HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
94 TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
96 return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, blob);
99 HRESULT WINAPI D3DGetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
101 TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
103 return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_OUTPUT_SIGNATURE_BLOB, 0, blob);