ReactOS 0.4.15-dev-8231-g29a56f3
blob.c File Reference
#include "d3dcompiler.h"
#include "wine/test.h"
Include dependency graph for blob.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define D3DERR_INVALIDCALL   0x8876086c
 
#define MAKE_TAG(ch0, ch1, ch2, ch3)
 
#define TAG_Aon9   MAKE_TAG('A', 'o', 'n', '9')
 
#define TAG_DXBC   MAKE_TAG('D', 'X', 'B', 'C')
 
#define TAG_ISGN   MAKE_TAG('I', 'S', 'G', 'N')
 
#define TAG_OSGN   MAKE_TAG('O', 'S', 'G', 'N')
 
#define TAG_PCSG   MAKE_TAG('P', 'C', 'S', 'G')
 
#define TAG_RDEF   MAKE_TAG('R', 'D', 'E', 'F')
 
#define TAG_SDBG   MAKE_TAG('S', 'D', 'B', 'G')
 
#define TAG_SHDR   MAKE_TAG('S', 'H', 'D', 'R')
 
#define TAG_SHEX   MAKE_TAG('S', 'H', 'E', 'X')
 
#define TAG_STAT   MAKE_TAG('S', 'T', 'A', 'T')
 
#define TAG_XNAP   MAKE_TAG('X', 'N', 'A', 'P')
 
#define TAG_XNAS   MAKE_TAG('X', 'N', 'A', 'S')
 

Functions

static HRESULT (WINAPI *pD3DCreateBlob)(SIZE_T
 
static void test_create_blob (void)
 
static void test_get_blob_part (void)
 
static void test_get_blob_part2 (void)
 
static BOOL load_d3dcompiler_43 (void)
 
static BOOL load_d3dcompiler_47 (void)
 
static BOOL create_file (WCHAR *filename, const DWORD *data, DWORD data_size)
 
static void test_D3DReadFileToBlob (void)
 
 START_TEST (blob)
 

Variables

static ID3DBlob **static SIZE_T
 
static ID3DBlob **static D3D_BLOB_PART
 
static ID3DBlob **static UINT
 
static const D3D_BLOB_PART parts []
 
static DWORD test_blob_part []
 
static DWORD test_blob_part2 []
 
static const DWORD test_cso_data []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file blob.c.

◆ D3DERR_INVALIDCALL

#define D3DERR_INVALIDCALL   0x8876086c

Definition at line 34 of file blob.c.

◆ MAKE_TAG

#define MAKE_TAG (   ch0,
  ch1,
  ch2,
  ch3 
)
Value:
((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DWORD
Definition: nt_native.h:44

Definition at line 41 of file blob.c.

◆ TAG_Aon9

#define TAG_Aon9   MAKE_TAG('A', 'o', 'n', '9')

Definition at line 44 of file blob.c.

◆ TAG_DXBC

#define TAG_DXBC   MAKE_TAG('D', 'X', 'B', 'C')

Definition at line 45 of file blob.c.

◆ TAG_ISGN

#define TAG_ISGN   MAKE_TAG('I', 'S', 'G', 'N')

Definition at line 46 of file blob.c.

◆ TAG_OSGN

#define TAG_OSGN   MAKE_TAG('O', 'S', 'G', 'N')

Definition at line 47 of file blob.c.

◆ TAG_PCSG

#define TAG_PCSG   MAKE_TAG('P', 'C', 'S', 'G')

Definition at line 48 of file blob.c.

◆ TAG_RDEF

#define TAG_RDEF   MAKE_TAG('R', 'D', 'E', 'F')

Definition at line 49 of file blob.c.

◆ TAG_SDBG

#define TAG_SDBG   MAKE_TAG('S', 'D', 'B', 'G')

Definition at line 50 of file blob.c.

◆ TAG_SHDR

#define TAG_SHDR   MAKE_TAG('S', 'H', 'D', 'R')

Definition at line 51 of file blob.c.

◆ TAG_SHEX

#define TAG_SHEX   MAKE_TAG('S', 'H', 'E', 'X')

Definition at line 52 of file blob.c.

◆ TAG_STAT

#define TAG_STAT   MAKE_TAG('S', 'T', 'A', 'T')

Definition at line 53 of file blob.c.

◆ TAG_XNAP

#define TAG_XNAP   MAKE_TAG('X', 'N', 'A', 'P')

Definition at line 54 of file blob.c.

◆ TAG_XNAS

#define TAG_XNAS   MAKE_TAG('X', 'N', 'A', 'S')

Definition at line 55 of file blob.c.

Function Documentation

◆ create_file()

static BOOL create_file ( WCHAR filename,
const DWORD data,
DWORD  data_size 
)
static

Definition at line 767 of file blob.c.

768{
769 static WCHAR temp_dir[MAX_PATH];
770 DWORD written;
771 HANDLE file;
772
773 if (!temp_dir[0])
774 GetTempPathW(ARRAY_SIZE(temp_dir), temp_dir);
775 GetTempFileNameW(temp_dir, NULL, 0, filename);
778 return FALSE;
779
780 if (data)
781 {
782 WriteFile(file, data, data_size, &written, NULL);
783 if (written != data_size)
784 {
787 return FALSE;
788 }
789 }
791 return TRUE;
792}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const char * filename
Definition: ioapi.h:137
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ HRESULT()

static HRESULT ( WINAPI pD3DCreateBlob)
static

◆ load_d3dcompiler_43()

static BOOL load_d3dcompiler_43 ( void  )
static

Definition at line 744 of file blob.c.

745{
747
748 if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
749
750 pD3DCreateBlob = (void*)GetProcAddress(module, "D3DCreateBlob");
751 pD3DGetBlobPart = (void*)GetProcAddress(module, "D3DGetBlobPart");
752 pD3DStripShader = (void*)GetProcAddress(module, "D3DStripShader");
753 return TRUE;
754}
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111

Referenced by START_TEST().

◆ load_d3dcompiler_47()

static BOOL load_d3dcompiler_47 ( void  )
static

Definition at line 756 of file blob.c.

757{
759
760 if (!(module = LoadLibraryA("d3dcompiler_47.dll")))
761 return FALSE;
762
763 pD3DReadFileToBlob = (void *)GetProcAddress(module, "D3DReadFileToBlob");
764 return TRUE;
765}

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( blob  )

Definition at line 865 of file blob.c.

866{
868 {
872 }
873 else
874 {
875 win_skip("Could not load d3dcompiler_43.dll\n");
876 }
877
879 {
881 }
882 else
883 {
884 win_skip("Could not load d3dcompiler_47.dll.\n");
885 }
886}
static void test_get_blob_part2(void)
Definition: blob.c:594
static BOOL load_d3dcompiler_47(void)
Definition: blob.c:756
static BOOL load_d3dcompiler_43(void)
Definition: blob.c:744
static void test_create_blob(void)
Definition: blob.c:57
static void test_D3DReadFileToBlob(void)
Definition: blob.c:816
static void test_get_blob_part(void)
Definition: blob.c:119
#define win_skip
Definition: test.h:163

◆ test_create_blob()

static void test_create_blob ( void  )
static

Definition at line 57 of file blob.c.

58{
60 HRESULT hr;
61 ULONG refcount;
62
63 hr = pD3DCreateBlob(1, NULL);
64 ok(hr == D3DERR_INVALIDCALL, "D3DCreateBlob failed with %x\n", hr);
65
66 hr = pD3DCreateBlob(0, NULL);
67 ok(hr == D3DERR_INVALIDCALL, "D3DCreateBlob failed with %x\n", hr);
68
69 hr = pD3DCreateBlob(0, &blob);
70 ok(hr == S_OK, "D3DCreateBlob failed with %x\n", hr);
71
72 refcount = ID3D10Blob_Release(blob);
73 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
74}
#define ok(value,...)
Definition: atltest.h:57
#define D3DERR_INVALIDCALL
#define S_OK
Definition: intsafe.h:52
HRESULT hr
Definition: shlfolder.c:183
Definition: image.c:134
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_D3DReadFileToBlob()

static void test_D3DReadFileToBlob ( void  )
static

Definition at line 816 of file blob.c.

817{
818 WCHAR filename[MAX_PATH] = {'n','o','n','e','x','i','s','t','e','n','t',0};
819 ID3DBlob *blob = NULL;
820 SIZE_T data_size;
821 DWORD *data;
822 HRESULT hr;
823
824 hr = pD3DReadFileToBlob(filename, NULL);
825 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#x.\n", hr);
826
827 hr = pD3DReadFileToBlob(filename, &blob);
828 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#x.\n", hr);
829
830 if (0)
831 {
832 /* Crashes on Windows. */
834 pD3DReadFileToBlob(filename, NULL);
836 }
837
838 if (!create_file(filename, NULL, 0))
839 {
840 win_skip("File creation failed.\n");
841 return;
842 }
843 hr = pD3DReadFileToBlob(filename, &blob);
844 ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
845 data_size = ID3D10Blob_GetBufferSize(blob);
846 ok(!data_size, "Got unexpected data size.\n");
848 ID3D10Blob_Release(blob);
849
851 {
852 win_skip("File creation failed.\n");
853 return;
854 }
855 hr = pD3DReadFileToBlob(filename, &blob);
856 ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
857 data_size = ID3D10Blob_GetBufferSize(blob);
858 ok(data_size == ARRAY_SIZE(test_cso_data), "Got unexpected data size.\n");
859 data = ID3D10Blob_GetBufferPointer(blob);
860 ok(!memcmp(data, test_cso_data, ARRAY_SIZE(test_cso_data)), "Got unexpected data.\n");
862 ID3D10Blob_Release(blob);
863}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const DWORD test_cso_data[]
Definition: blob.c:795
#define create_file(name, size)
Definition: asmcache.c:813
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by START_TEST().

◆ test_get_blob_part()

static void test_get_blob_part ( void  )
static

Definition at line 119 of file blob.c.

120{
121 ID3DBlob *blob, *blob2;
122 HRESULT hr;
123 ULONG refcount;
124 DWORD *dword;
125 SIZE_T size;
126 UINT i;
127
128 hr = pD3DCreateBlob(1, &blob2);
129 ok(hr == S_OK, "D3DCreateBlob failed with %x\n", hr);
130 blob = blob2;
131
132 /* invalid cases */
133 hr = pD3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
134 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
135 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
136
137 hr = pD3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
138 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
139 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
140
141 hr = pD3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
142 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
143
144 hr = pD3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
145 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
146
147 hr = pD3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
148 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
149 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
150
152 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
153
154 hr = pD3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
155 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
156
158 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
159 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
160
161 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], 0xffffffff, 0, &blob);
162 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
163 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
164
165 refcount = ID3D10Blob_Release(blob2);
166 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
167
168 /* D3D_BLOB_INPUT_SIGNATURE_BLOB */
170 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
171
172 size = ID3D10Blob_GetBufferSize(blob);
173 ok(size == 124, "GetBufferSize failed, got %lu, expected %u\n", size, 124);
174
175 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
176 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
177 ok(TAG_ISGN == *(dword+9), "ISGN got %#x, expected %#x.\n", *(dword+9), TAG_ISGN);
178
179 for (i = 0; i < ARRAY_SIZE(parts); i++)
180 {
181 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
182
184 {
185 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
186
187 refcount = ID3D10Blob_Release(blob2);
188 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
189 }
190 else
191 {
192 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
193 }
194 }
195
196 refcount = ID3D10Blob_Release(blob);
197 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
198
199 /* D3D_BLOB_OUTPUT_SIGNATURE_BLOB */
201 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
202
203 size = ID3D10Blob_GetBufferSize(blob);
204 ok(size == 88, "GetBufferSize failed, got %lu, expected %u\n", size, 88);
205
206 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
207 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
208 ok(TAG_OSGN == *(dword+9), "OSGN got %#x, expected %#x.\n", *(dword+9), TAG_OSGN);
209
210 for (i = 0; i < ARRAY_SIZE(parts); i++)
211 {
212 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
213
215 {
216 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
217
218 refcount = ID3D10Blob_Release(blob2);
219 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
220 }
221 else
222 {
223 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
224 }
225 }
226
227 refcount = ID3D10Blob_Release(blob);
228 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
229
230 /* D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB */
232 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
233
234 size = ID3D10Blob_GetBufferSize(blob);
235 ok(size == 180, "GetBufferSize failed, got %lu, expected %u\n", size, 180);
236
237 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
238 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
239 ok(TAG_ISGN == *(dword+10), "ISGN got %#x, expected %#x.\n", *(dword+10), TAG_ISGN);
240 ok(TAG_OSGN == *(dword+32), "OSGN got %#x, expected %#x.\n", *(dword+32), TAG_OSGN);
241
242 for (i = 0; i < ARRAY_SIZE(parts); i++)
243 {
244 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
245
249 {
250 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
251
252 refcount = ID3D10Blob_Release(blob2);
253 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
254 }
255 else
256 {
257 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
258 }
259 }
260
261 refcount = ID3D10Blob_Release(blob);
262 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
263
264 /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
266 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
267
268 /* D3D_BLOB_ALL_SIGNATURE_BLOB */
270 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
271
272 /* D3D_BLOB_DEBUG_INFO */
273 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
274 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
275
276 /* D3D_BLOB_LEGACY_SHADER */
277 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
278 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
279
280 size = ID3D10Blob_GetBufferSize(blob);
281 ok(size == 92, "GetBufferSize failed, got %lu, expected %u\n", size, 92);
282
283 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
284 ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
285
286 for (i = 0; i < ARRAY_SIZE(parts); i++)
287 {
288 /* There isn't a full DXBC blob returned for D3D_BLOB_LEGACY_SHADER */
289 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
290 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
291 }
292
293 refcount = ID3D10Blob_Release(blob);
294 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
295
296 /* D3D_BLOB_XNA_PREPASS_SHADER */
298 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
299
300 size = ID3D10Blob_GetBufferSize(blob);
301 ok(size == 68, "GetBufferSize failed, got %lu, expected %u\n", size, 68);
302
303 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
304 ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
305
306 for (i = 0; i < ARRAY_SIZE(parts); i++)
307 {
308 /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_PREPASS_SHADER */
309 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
310 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
311 }
312
313 refcount = ID3D10Blob_Release(blob);
314 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
315
316 /* D3D_BLOB_XNA_SHADER */
317 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_SHADER, 0, &blob);
318 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
319
320 size = ID3D10Blob_GetBufferSize(blob);
321 ok(size == 68, "GetBufferSize failed, got %lu, expected %u\n", size, 68);
322
323 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
324 ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
325
326 for (i = 0; i < ARRAY_SIZE(parts); i++)
327 {
328 /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_SHADER */
329 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
330 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
331 }
332
333 refcount = ID3D10Blob_Release(blob);
334 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
335
336 /* check corner cases for D3DStripShader */
337 hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0xffffffff, &blob);
338 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
339
340 refcount = ID3D10Blob_Release(blob);
341 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
342
343 hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0, &blob);
344 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
345
346 refcount = ID3D10Blob_Release(blob);
347 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
348
349 hr = pD3DStripShader(NULL, test_blob_part[6], 0, &blob);
350 ok(hr == D3DERR_INVALIDCALL, "D3DStripShader failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
351
352 hr = pD3DStripShader(test_blob_part, 2, 0, &blob);
353 ok(hr == D3DERR_INVALIDCALL, "D3DStripShader failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
354
355 hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0, NULL);
356 ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
357
358 hr = pD3DStripShader(NULL, test_blob_part[6], 0, NULL);
359 ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
360
361 hr = pD3DStripShader(test_blob_part, 0, 0, NULL);
362 ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
363
364 /* D3DCOMPILER_STRIP_DEBUG_INFO */
366 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
367
368 size = ID3D10Blob_GetBufferSize(blob);
369 ok(size == 736, "GetBufferSize failed, got %lu, expected %u\n", size, 736);
370
371 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
372 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
373 ok(TAG_XNAS == *(dword+16), "XNAS got %#x, expected %#x.\n", *(dword+16), TAG_XNAS);
374 ok(TAG_XNAP == *(dword+35), "XNAP got %#x, expected %#x.\n", *(dword+35), TAG_XNAP);
375 ok(TAG_Aon9 == *(dword+54), "Aon9 got %#x, expected %#x.\n", *(dword+54), TAG_Aon9);
376 ok(TAG_SHDR == *(dword+79), "SHDR got %#x, expected %#x.\n", *(dword+79), TAG_SHDR);
377 ok(TAG_STAT == *(dword+96), "STAT got %#x, expected %#x.\n", *(dword+96), TAG_STAT);
378 ok(TAG_RDEF == *(dword+127), "RDEF got %#x, expected %#x.\n", *(dword+127), TAG_RDEF);
379 ok(TAG_ISGN == *(dword+149), "ISGN got %#x, expected %#x.\n", *(dword+149), TAG_ISGN);
380 ok(TAG_OSGN == *(dword+171), "OSGN got %#x, expected %#x.\n", *(dword+171), TAG_OSGN);
381
382 hr = pD3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
383 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
384
385 refcount = ID3D10Blob_Release(blob);
386 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
387
388 /* D3DCOMPILER_STRIP_REFLECTION_DATA */
390 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
391
392 size = ID3D10Blob_GetBufferSize(blob);
393 ok(size == 516, "GetBufferSize failed, got %lu, expected %u\n", size, 516);
394
395 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
396 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
397 ok(TAG_XNAS == *(dword+14), "XNAS got %#x, expected %#x.\n", *(dword+14), TAG_XNAS);
398 ok(TAG_XNAP == *(dword+33), "XNAP got %#x, expected %#x.\n", *(dword+33), TAG_XNAP);
399 ok(TAG_Aon9 == *(dword+52), "Aon9 got %#x, expected %#x.\n", *(dword+52), TAG_Aon9);
400 ok(TAG_SHDR == *(dword+77), "SHDR got %#x, expected %#x.\n", *(dword+77), TAG_SHDR);
401 ok(TAG_ISGN == *(dword+94), "ISGN got %#x, expected %#x.\n", *(dword+94), TAG_ISGN);
402 ok(TAG_OSGN == *(dword+116), "OSGN got %#x, expected %#x.\n", *(dword+116), TAG_OSGN);
403
404 refcount = ID3D10Blob_Release(blob);
405 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
406}
@ D3D_BLOB_ALL_SIGNATURE_BLOB
Definition: d3dcompiler.h:91
@ D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:89
@ D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
Definition: d3dcompiler.h:90
@ D3D_BLOB_XNA_SHADER
Definition: d3dcompiler.h:95
@ D3D_BLOB_INPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:87
@ D3D_BLOB_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:88
@ D3D_BLOB_DEBUG_INFO
Definition: d3dcompiler.h:92
@ D3D_BLOB_XNA_PREPASS_SHADER
Definition: d3dcompiler.h:94
@ D3D_BLOB_LEGACY_SHADER
Definition: d3dcompiler.h:93
@ D3DCOMPILER_STRIP_DEBUG_INFO
Definition: d3dcompiler.h:78
@ D3DCOMPILER_STRIP_REFLECTION_DATA
Definition: d3dcompiler.h:77
#define TAG_ISGN
#define TAG_Aon9
#define TAG_OSGN
#define TAG_XNAP
#define TAG_XNAS
#define TAG_STAT
#define TAG_RDEF
#define E_FAIL
Definition: ddrawi.h:102
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TAG_SHDR
Definition: blob.c:51
#define TAG_DXBC
Definition: blob.c:45
static const D3D_BLOB_PART parts[]
Definition: blob.c:76
static DWORD test_blob_part[]
Definition: blob.c:93
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ test_get_blob_part2()

static void test_get_blob_part2 ( void  )
static

Definition at line 594 of file blob.c.

595{
596 ID3DBlob *blob, *blob2;
597 HRESULT hr;
598 ULONG refcount;
599 DWORD *dword;
600 SIZE_T size;
601 UINT i;
602
603 /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
605 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
606
607 size = ID3D10Blob_GetBufferSize(blob);
608 ok(size == 232, "GetBufferSize failed, got %lu, expected %u\n", size, 232);
609
610 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
611 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
612 ok(TAG_PCSG == *(dword+9), "PCSG got %#x, expected %#x.\n", *(dword+9), TAG_PCSG);
613
614 for (i = 0; i < ARRAY_SIZE(parts); i++)
615 {
616 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
617
619 {
620 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
621
622 refcount = ID3D10Blob_Release(blob2);
623 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
624 }
625 else
626 {
627 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
628 }
629 }
630
631 refcount = ID3D10Blob_Release(blob);
632 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
633
634 /* D3D_BLOB_ALL_SIGNATURE_BLOB */
636 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
637
638 size = ID3D10Blob_GetBufferSize(blob);
639 ok(size == 344, "GetBufferSize failed, got %lu, expected %u\n", size, 344);
640
641 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
642 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
643 ok(TAG_ISGN == *(dword+11), "ISGN got %#x, expected %#x.\n", *(dword+11), TAG_ISGN);
644 ok(TAG_OSGN == *(dword+24), "OSGN got %#x, expected %#x.\n", *(dword+24), TAG_OSGN);
645 ok(TAG_PCSG == *(dword+37), "PCSG got %#x, expected %#x.\n", *(dword+37), TAG_PCSG);
646
647 for (i = 0; i < ARRAY_SIZE(parts); i++)
648 {
649 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
650
656 {
657 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
658
659 refcount = ID3D10Blob_Release(blob2);
660 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
661 }
662 else
663 {
664 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
665 }
666 }
667
668 refcount = ID3D10Blob_Release(blob);
669 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
670
671 /* D3D_BLOB_DEBUG_INFO */
672 hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
673 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
674
675 size = ID3D10Blob_GetBufferSize(blob);
676 ok(size == 4055, "GetBufferSize failed, got %lu, expected %u\n", size, 4055);
677
678 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
679 ok(TAG_DXBC != *dword, "DXBC failed got %#x.\n", *dword);
680
681 for (i = 0; i < ARRAY_SIZE(parts); i++)
682 {
683 /* There isn't a full DXBC blob returned for D3D_BLOB_DEBUG_INFO */
684 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
685 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
686 }
687
688 refcount = ID3D10Blob_Release(blob);
689 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
690
691 /* D3D_BLOB_LEGACY_SHADER */
692 hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
693 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
694
695 /* D3D_BLOB_XNA_PREPASS_SHADER */
697 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
698
699 /* D3D_BLOB_XNA_SHADER */
700 hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_SHADER, 0, &blob);
701 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
702
703 /* D3DCOMPILER_STRIP_DEBUG_INFO */
705 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
706
707 size = ID3D10Blob_GetBufferSize(blob);
708 ok(size == 952, "GetBufferSize failed, got %lu, expected %u\n", size, 952);
709
710 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
711 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
712 ok(TAG_RDEF == *(dword+14), "RDEF got %#x, expected %#x.\n", *(dword+14), TAG_RDEF);
713 ok(TAG_ISGN == *(dword+44), "ISGN got %#x, expected %#x.\n", *(dword+44), TAG_ISGN);
714 ok(TAG_OSGN == *(dword+57), "OSGN got %#x, expected %#x.\n", *(dword+57), TAG_OSGN);
715 ok(TAG_PCSG == *(dword+70), "PCSG got %#x, expected %#x.\n", *(dword+70), TAG_PCSG);
716 ok(TAG_SHEX == *(dword+119), "SHEX got %#x, expected %#x.\n", *(dword+119), TAG_SHEX);
717 ok(TAG_STAT == *(dword+199), "STAT got %#x, expected %#x.\n", *(dword+199), TAG_STAT);
718
719 hr = pD3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
720 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
721
722 refcount = ID3D10Blob_Release(blob);
723 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
724
725 /* D3DCOMPILER_STRIP_REFLECTION_DATA */
727 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
728
729 size = ID3D10Blob_GetBufferSize(blob);
730 ok(size == 4735, "GetBufferSize failed, got %lu, expected %u\n", size, 4735);
731
732 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
733 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
734 ok(TAG_ISGN == *(dword+13), "ISGN got %#x, expected %#x.\n", *(dword+13), TAG_ISGN);
735 ok(TAG_OSGN == *(dword+26), "OSGN got %#x, expected %#x.\n", *(dword+26), TAG_OSGN);
736 ok(TAG_PCSG == *(dword+39), "PCSG got %#x, expected %#x.\n", *(dword+39), TAG_PCSG);
737 ok(TAG_SHEX == *(dword+88), "SHEX got %#x, expected %#x.\n", *(dword+88), TAG_SHEX);
738 ok(TAG_SDBG == *(dword+168), "SDBG got %#x, expected %#x.\n", *(dword+168), TAG_SDBG);
739
740 refcount = ID3D10Blob_Release(blob);
741 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
742}
#define TAG_SDBG
#define TAG_PCSG
#define TAG_SHEX
Definition: blob.c:52
static DWORD test_blob_part2[]
Definition: blob.c:434

Referenced by START_TEST().

Variable Documentation

◆ D3D_BLOB_PART

Definition at line 37 of file blob.c.

◆ parts

◆ SIZE_T

ID3DBlob **static ID3DBlob **static ID3DBlob **static SIZE_T

Definition at line 37 of file blob.c.

◆ test_blob_part

DWORD test_blob_part[]
static
Initial value:
= {
0x43425844, 0x0ef2a70f, 0x6a548011, 0x91ff9409, 0x9973a43d, 0x00000001, 0x000002e0, 0x00000008,
0x00000040, 0x0000008c, 0x000000d8, 0x0000013c, 0x00000180, 0x000001fc, 0x00000254, 0x000002ac,
0x53414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, 0x00240000,
0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x02000001,
0xc00f0000, 0x80e40000, 0x0000ffff, 0x50414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020,
0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f,
0x80000005, 0x900f0000, 0x02000001, 0xc00f0000, 0x80e40000, 0x0000ffff, 0x396e6f41, 0x0000005c,
0x0000005c, 0xfffe0200, 0x00000034, 0x00000028, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
0x00240001, 0x00000000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x04000004, 0xc0030000,
0x90ff0000, 0xa0e40000, 0x90e40000, 0x02000001, 0xc00c0000, 0x90e40000, 0x0000ffff, 0x52444853,
0x0000003c, 0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2,
0x00000000, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e,
0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c,
0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002,
0x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041,
0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300,
0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
}

Definition at line 93 of file blob.c.

Referenced by test_get_blob_part().

◆ test_blob_part2

DWORD test_blob_part2[]
static

Definition at line 434 of file blob.c.

Referenced by test_get_blob_part2().

◆ test_cso_data

const DWORD test_cso_data[]
static
Initial value:
=
{
0xfffe0200, 0x0014fffe, 0x42415443, 0x0000001c, 0x00000023, 0xfffe0200, 0x00000000, 0x00000000,
0x00000100, 0x0000001c, 0x325f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x0200001f, 0x80000000,
0x900f0000, 0x02000001, 0xc00f0000, 0x90e40000, 0x0000ffff
}

Definition at line 795 of file blob.c.

Referenced by test_D3DReadFileToBlob().

◆ UINT

ID3DBlob **static ID3DBlob **static ID3DBlob **static UINT

Definition at line 37 of file blob.c.