2 * Copyright 2009 Matteo Bruni
3 * Copyright 2010 Matteo Bruni for CodeWeavers
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "d3dcompiler_private.h"
21 #include "wine/unicode.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler
);
26 #define D3DXERR_INVALIDDATA 0x88760b59
28 #define BUFFER_INITIAL_CAPACITY 256
37 static struct mem_file_desc current_shader
;
38 static ID3DInclude
*current_include
;
39 static const char *initial_filename
;
41 #define INCLUDES_INITIAL_CAPACITY 4
49 static struct loaded_include
*includes
;
50 static int includes_capacity
, includes_size
;
51 static const char *parent_include
;
53 static char *wpp_output
;
54 static int wpp_output_capacity
, wpp_output_size
;
56 static char *wpp_messages
;
57 static int wpp_messages_capacity
, wpp_messages_size
;
59 /* Mutex used to guarantee a single invocation
60 of the D3DXAssembleShader function (or its variants) at a time.
61 This is needed as wpp isn't thread-safe */
62 static CRITICAL_SECTION wpp_mutex
;
63 static CRITICAL_SECTION_DEBUG wpp_mutex_debug
=
66 { &wpp_mutex_debug
.ProcessLocksList
,
67 &wpp_mutex_debug
.ProcessLocksList
},
68 0, 0, { (DWORD_PTR
)(__FILE__
": wpp_mutex") }
70 static CRITICAL_SECTION wpp_mutex
= { &wpp_mutex_debug
, -1, 0, 0, 0, 0 };
72 /* Preprocessor error reporting functions */
73 static void wpp_write_message(const char *fmt
, va_list args
)
78 if(wpp_messages_capacity
== 0)
80 wpp_messages
= HeapAlloc(GetProcessHeap(), 0, MESSAGEBUFFER_INITIAL_SIZE
);
81 if(wpp_messages
== NULL
)
84 wpp_messages_capacity
= MESSAGEBUFFER_INITIAL_SIZE
;
89 rc
= vsnprintf(wpp_messages
+ wpp_messages_size
,
90 wpp_messages_capacity
- wpp_messages_size
, fmt
, args
);
92 if (rc
< 0 || /* C89 */
93 rc
>= wpp_messages_capacity
- wpp_messages_size
) { /* C99 */
94 /* Resize the buffer */
95 newsize
= wpp_messages_capacity
* 2;
96 newbuffer
= HeapReAlloc(GetProcessHeap(), 0, wpp_messages
, newsize
);
99 ERR("Error reallocating memory for parser messages\n");
102 wpp_messages
= newbuffer
;
103 wpp_messages_capacity
= newsize
;
107 wpp_messages_size
+= rc
;
113 static void PRINTF_ATTR(1,2) wpp_write_message_var(const char *fmt
, ...)
118 wpp_write_message(fmt
, args
);
122 static void wpp_error(const char *file
, int line
, int col
, const char *_near
,
123 const char *msg
, va_list ap
)
125 wpp_write_message_var("%s:%d:%d: %s: ", file
? file
: "'main file'",
127 wpp_write_message(msg
, ap
);
128 wpp_write_message_var("\n");
131 static void wpp_warning(const char *file
, int line
, int col
, const char *_near
,
132 const char *msg
, va_list ap
)
134 wpp_write_message_var("%s:%d:%d: %s: ", file
? file
: "'main file'",
135 line
, col
, "Warning");
136 wpp_write_message(msg
, ap
);
137 wpp_write_message_var("\n");
140 static char *wpp_lookup_mem(const char *filename
, int type
, const char *parent_name
,
141 char **include_path
, int include_path_count
)
143 /* Here we return always ok. We will maybe fail on the next wpp_open_mem */
147 TRACE("Looking for include %s.\n", debugstr_a(filename
));
149 parent_include
= NULL
;
150 if (strcmp(parent_name
, initial_filename
))
152 for(i
= 0; i
< includes_size
; i
++)
154 if(!strcmp(parent_name
, includes
[i
].name
))
156 parent_include
= includes
[i
].data
;
160 if(parent_include
== NULL
)
162 ERR("Parent include %s missing.\n", debugstr_a(parent_name
));
167 path
= malloc(strlen(filename
) + 1);
169 memcpy(path
, filename
, strlen(filename
) + 1);
173 static void *wpp_open_mem(const char *filename
, int type
)
175 struct mem_file_desc
*desc
;
178 TRACE("Opening include %s.\n", debugstr_a(filename
));
180 if(!strcmp(filename
, initial_filename
))
182 current_shader
.pos
= 0;
183 return ¤t_shader
;
186 if(current_include
== NULL
) return NULL
;
187 desc
= HeapAlloc(GetProcessHeap(), 0, sizeof(*desc
));
191 if (FAILED(hr
= ID3DInclude_Open(current_include
, type
? D3D_INCLUDE_LOCAL
: D3D_INCLUDE_SYSTEM
,
192 filename
, parent_include
, (const void **)&desc
->buffer
, &desc
->size
)))
194 HeapFree(GetProcessHeap(), 0, desc
);
198 if(includes_capacity
== includes_size
)
200 if(includes_capacity
== 0)
202 includes
= HeapAlloc(GetProcessHeap(), 0, INCLUDES_INITIAL_CAPACITY
* sizeof(*includes
));
205 ERR("Error allocating memory for the loaded includes structure\n");
208 includes_capacity
= INCLUDES_INITIAL_CAPACITY
* sizeof(*includes
);
212 int newcapacity
= includes_capacity
* 2;
213 struct loaded_include
*newincludes
=
214 HeapReAlloc(GetProcessHeap(), 0, includes
, newcapacity
);
215 if(newincludes
== NULL
)
217 ERR("Error reallocating memory for the loaded includes structure\n");
220 includes
= newincludes
;
221 includes_capacity
= newcapacity
;
224 includes
[includes_size
].name
= filename
;
225 includes
[includes_size
++].data
= desc
->buffer
;
231 ID3DInclude_Close(current_include
, desc
->buffer
);
232 HeapFree(GetProcessHeap(), 0, desc
);
236 static void wpp_close_mem(void *file
)
238 struct mem_file_desc
*desc
= file
;
240 if(desc
!= ¤t_shader
)
243 ID3DInclude_Close(current_include
, desc
->buffer
);
245 ERR("current_include == NULL, desc == %p, buffer = %s\n",
248 HeapFree(GetProcessHeap(), 0, desc
);
252 static int wpp_read_mem(void *file
, char *buffer
, unsigned int len
)
254 struct mem_file_desc
*desc
= file
;
256 len
= min(len
, desc
->size
- desc
->pos
);
257 memcpy(buffer
, desc
->buffer
+ desc
->pos
, len
);
262 static void wpp_write_mem(const char *buffer
, unsigned int len
)
264 char *new_wpp_output
;
266 if(wpp_output_capacity
== 0)
268 wpp_output
= HeapAlloc(GetProcessHeap(), 0, BUFFER_INITIAL_CAPACITY
);
272 wpp_output_capacity
= BUFFER_INITIAL_CAPACITY
;
274 if(len
> wpp_output_capacity
- wpp_output_size
)
276 while(len
> wpp_output_capacity
- wpp_output_size
)
278 wpp_output_capacity
*= 2;
280 new_wpp_output
= HeapReAlloc(GetProcessHeap(), 0, wpp_output
,
281 wpp_output_capacity
);
284 ERR("Error allocating memory\n");
287 wpp_output
= new_wpp_output
;
289 memcpy(wpp_output
+ wpp_output_size
, buffer
, len
);
290 wpp_output_size
+= len
;
293 static int wpp_close_output(void)
295 char *new_wpp_output
= HeapReAlloc(GetProcessHeap(), 0, wpp_output
,
296 wpp_output_size
+ 1);
297 if(!new_wpp_output
) return 0;
298 wpp_output
= new_wpp_output
;
299 wpp_output
[wpp_output_size
]='\0';
304 static HRESULT
preprocess_shader(const void *data
, SIZE_T data_size
, const char *filename
,
305 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
, ID3DBlob
**error_messages
)
309 const D3D_SHADER_MACRO
*def
= defines
;
311 static const struct wpp_callbacks wpp_callbacks
=
324 while (def
->Name
!= NULL
)
326 wpp_add_define(def
->Name
, def
->Definition
);
330 current_include
= include
;
333 wpp_output_size
= wpp_output_capacity
= 0;
336 wpp_set_callbacks(&wpp_callbacks
);
337 wpp_messages_size
= wpp_messages_capacity
= 0;
339 current_shader
.buffer
= data
;
340 current_shader
.size
= data_size
;
341 initial_filename
= filename
? filename
: "";
343 ret
= wpp_parse(initial_filename
, NULL
);
344 if (!wpp_close_output())
348 TRACE("Error during shader preprocessing\n");
354 TRACE("Preprocessor messages:\n%s\n", debugstr_a(wpp_messages
));
358 size
= strlen(wpp_messages
) + 1;
359 hr
= D3DCreateBlob(size
, &buffer
);
362 CopyMemory(ID3D10Blob_GetBufferPointer(buffer
), wpp_messages
, size
);
363 *error_messages
= buffer
;
367 TRACE("Shader source:\n%s\n", debugstr_an(data
, data_size
));
372 /* Remove the previously added defines */
375 while (defines
->Name
!= NULL
)
377 wpp_del_define(defines
->Name
);
381 HeapFree(GetProcessHeap(), 0, wpp_messages
);
385 static HRESULT
assemble_shader(const char *preproc_shader
,
386 ID3DBlob
**shader_blob
, ID3DBlob
**error_messages
)
388 struct bwriter_shader
*shader
;
389 char *messages
= NULL
;
395 shader
= SlAssembleShader(preproc_shader
, &messages
);
399 TRACE("Assembler messages:\n");
400 TRACE("%s\n", debugstr_a(messages
));
402 TRACE("Shader source:\n");
403 TRACE("%s\n", debugstr_a(preproc_shader
));
407 const char *preproc_messages
= *error_messages
? ID3D10Blob_GetBufferPointer(*error_messages
) : NULL
;
409 size
= strlen(messages
) + (preproc_messages
? strlen(preproc_messages
) : 0) + 1;
410 hr
= D3DCreateBlob(size
, &buffer
);
413 HeapFree(GetProcessHeap(), 0, messages
);
414 if (shader
) SlDeleteShader(shader
);
417 pos
= ID3D10Blob_GetBufferPointer(buffer
);
418 if (preproc_messages
)
420 CopyMemory(pos
, preproc_messages
, strlen(preproc_messages
) + 1);
421 pos
+= strlen(preproc_messages
);
423 CopyMemory(pos
, messages
, strlen(messages
) + 1);
425 if (*error_messages
) ID3D10Blob_Release(*error_messages
);
426 *error_messages
= buffer
;
428 HeapFree(GetProcessHeap(), 0, messages
);
433 ERR("Asm reading failed\n");
434 return D3DXERR_INVALIDDATA
;
437 hr
= SlWriteBytecode(shader
, 9, &res
, &size
);
438 SlDeleteShader(shader
);
441 ERR("SlWriteBytecode failed with 0x%08x\n", hr
);
442 return D3DXERR_INVALIDDATA
;
447 hr
= D3DCreateBlob(size
, &buffer
);
450 HeapFree(GetProcessHeap(), 0, res
);
453 CopyMemory(ID3D10Blob_GetBufferPointer(buffer
), res
, size
);
454 *shader_blob
= buffer
;
457 HeapFree(GetProcessHeap(), 0, res
);
462 HRESULT WINAPI
D3DAssemble(const void *data
, SIZE_T datasize
, const char *filename
,
463 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
, UINT flags
,
464 ID3DBlob
**shader
, ID3DBlob
**error_messages
)
468 TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, sflags %#x,\n"
469 "shader %p, error_messages %p\n",
470 data
, datasize
, debugstr_a(filename
), defines
, include
, flags
, shader
, error_messages
);
472 EnterCriticalSection(&wpp_mutex
);
475 if (flags
) FIXME("flags %x\n", flags
);
477 if (shader
) *shader
= NULL
;
478 if (error_messages
) *error_messages
= NULL
;
480 hr
= preprocess_shader(data
, datasize
, filename
, defines
, include
, error_messages
);
482 hr
= assemble_shader(wpp_output
, shader
, error_messages
);
484 HeapFree(GetProcessHeap(), 0, wpp_output
);
485 LeaveCriticalSection(&wpp_mutex
);
491 enum shader_type type
;
500 /* Must be kept sorted for binary search */
501 static const struct target_info targets_info
[] = {
502 { "cs_4_0", ST_UNKNOWN
, 4, 0, 0, 0, FALSE
, FALSE
},
503 { "cs_4_1", ST_UNKNOWN
, 4, 1, 0, 0, FALSE
, FALSE
},
504 { "cs_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
505 { "ds_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
506 { "fx_2_0", ST_UNKNOWN
, 2, 0, 0, 0, FALSE
, FALSE
},
507 { "fx_4_0", ST_UNKNOWN
, 4, 0, 0, 0, FALSE
, FALSE
},
508 { "fx_4_1", ST_UNKNOWN
, 4, 1, 0, 0, FALSE
, FALSE
},
509 { "fx_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
510 { "gs_4_0", ST_UNKNOWN
, 4, 0, 0, 0, FALSE
, FALSE
},
511 { "gs_4_1", ST_UNKNOWN
, 4, 1, 0, 0, FALSE
, FALSE
},
512 { "gs_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
513 { "hs_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
514 { "ps.1.0", ST_PIXEL
, 1, 0, 0, 0, FALSE
, TRUE
},
515 { "ps.1.1", ST_PIXEL
, 1, 1, 0, 0, FALSE
, FALSE
},
516 { "ps.1.2", ST_PIXEL
, 1, 2, 0, 0, FALSE
, FALSE
},
517 { "ps.1.3", ST_PIXEL
, 1, 3, 0, 0, FALSE
, FALSE
},
518 { "ps.1.4", ST_PIXEL
, 1, 4, 0, 0, FALSE
, FALSE
},
519 { "ps.2.0", ST_PIXEL
, 2, 0, 0, 0, FALSE
, TRUE
},
520 { "ps.2.a", ST_PIXEL
, 2, 1, 0, 0, FALSE
, FALSE
},
521 { "ps.2.b", ST_PIXEL
, 2, 2, 0, 0, FALSE
, FALSE
},
522 { "ps.2.sw", ST_PIXEL
, 2, 0, 0, 0, TRUE
, FALSE
},
523 { "ps.3.0", ST_PIXEL
, 3, 0, 0, 0, FALSE
, TRUE
},
524 { "ps_1_0", ST_PIXEL
, 1, 0, 0, 0, FALSE
, TRUE
},
525 { "ps_1_1", ST_PIXEL
, 1, 1, 0, 0, FALSE
, FALSE
},
526 { "ps_1_2", ST_PIXEL
, 1, 2, 0, 0, FALSE
, FALSE
},
527 { "ps_1_3", ST_PIXEL
, 1, 3, 0, 0, FALSE
, FALSE
},
528 { "ps_1_4", ST_PIXEL
, 1, 4, 0, 0, FALSE
, FALSE
},
529 { "ps_2_0", ST_PIXEL
, 2, 0, 0, 0, FALSE
, TRUE
},
530 { "ps_2_a", ST_PIXEL
, 2, 1, 0, 0, FALSE
, FALSE
},
531 { "ps_2_b", ST_PIXEL
, 2, 2, 0, 0, FALSE
, FALSE
},
532 { "ps_2_sw", ST_PIXEL
, 2, 0, 0, 0, TRUE
, FALSE
},
533 { "ps_3_0", ST_PIXEL
, 3, 0, 0, 0, FALSE
, TRUE
},
534 { "ps_3_sw", ST_PIXEL
, 3, 0, 0, 0, TRUE
, FALSE
},
535 { "ps_4_0", ST_PIXEL
, 4, 0, 0, 0, FALSE
, TRUE
},
536 { "ps_4_0_level_9_0", ST_PIXEL
, 4, 0, 9, 0, FALSE
, FALSE
},
537 { "ps_4_0_level_9_1", ST_PIXEL
, 4, 0, 9, 1, FALSE
, FALSE
},
538 { "ps_4_0_level_9_3", ST_PIXEL
, 4, 0, 9, 3, FALSE
, FALSE
},
539 { "ps_4_1", ST_PIXEL
, 4, 1, 0, 0, FALSE
, TRUE
},
540 { "ps_5_0", ST_PIXEL
, 5, 0, 0, 0, FALSE
, TRUE
},
541 { "tx_1_0", ST_UNKNOWN
, 1, 0, 0, 0, FALSE
, FALSE
},
542 { "vs.1.0", ST_VERTEX
, 1, 0, 0, 0, FALSE
, TRUE
},
543 { "vs.1.1", ST_VERTEX
, 1, 1, 0, 0, FALSE
, TRUE
},
544 { "vs.2.0", ST_VERTEX
, 2, 0, 0, 0, FALSE
, TRUE
},
545 { "vs.2.a", ST_VERTEX
, 2, 1, 0, 0, FALSE
, FALSE
},
546 { "vs.2.sw", ST_VERTEX
, 2, 0, 0, 0, TRUE
, FALSE
},
547 { "vs.3.0", ST_VERTEX
, 3, 0, 0, 0, FALSE
, TRUE
},
548 { "vs.3.sw", ST_VERTEX
, 3, 0, 0, 0, TRUE
, FALSE
},
549 { "vs_1_0", ST_VERTEX
, 1, 0, 0, 0, FALSE
, TRUE
},
550 { "vs_1_1", ST_VERTEX
, 1, 1, 0, 0, FALSE
, TRUE
},
551 { "vs_2_0", ST_VERTEX
, 2, 0, 0, 0, FALSE
, TRUE
},
552 { "vs_2_a", ST_VERTEX
, 2, 1, 0, 0, FALSE
, FALSE
},
553 { "vs_2_sw", ST_VERTEX
, 2, 0, 0, 0, TRUE
, FALSE
},
554 { "vs_3_0", ST_VERTEX
, 3, 0, 0, 0, FALSE
, TRUE
},
555 { "vs_3_sw", ST_VERTEX
, 3, 0, 0, 0, TRUE
, FALSE
},
556 { "vs_4_0", ST_VERTEX
, 4, 0, 0, 0, FALSE
, TRUE
},
557 { "vs_4_0_level_9_0", ST_VERTEX
, 4, 0, 9, 0, FALSE
, FALSE
},
558 { "vs_4_0_level_9_1", ST_VERTEX
, 4, 0, 9, 1, FALSE
, FALSE
},
559 { "vs_4_0_level_9_3", ST_VERTEX
, 4, 0, 9, 3, FALSE
, FALSE
},
560 { "vs_4_1", ST_VERTEX
, 4, 1, 0, 0, FALSE
, TRUE
},
561 { "vs_5_0", ST_VERTEX
, 5, 0, 0, 0, FALSE
, TRUE
},
564 static const struct target_info
* get_target_info(const char *target
)
567 LONG max
= sizeof(targets_info
) / sizeof(targets_info
[0]) - 1;
573 cur
= (min
+ max
) / 2;
574 res
= strcmp(target
, targets_info
[cur
].name
);
580 return &targets_info
[cur
];
586 static HRESULT
compile_shader(const char *preproc_shader
, const char *target
, const char *entrypoint
,
587 ID3DBlob
**shader_blob
, ID3DBlob
**error_messages
)
589 struct bwriter_shader
*shader
;
590 char *messages
= NULL
;
592 DWORD
*res
, size
, major
, minor
;
595 enum shader_type shader_type
;
596 const struct target_info
*info
;
598 TRACE("Preprocessed shader source: %s\n", debugstr_a(preproc_shader
));
600 TRACE("Checking compilation target %s\n", debugstr_a(target
));
601 info
= get_target_info(target
);
604 FIXME("Unknown compilation target %s\n", debugstr_a(target
));
605 return D3DERR_INVALIDCALL
;
611 FIXME("Compilation target %s not yet supported\n", debugstr_a(target
));
612 return D3DERR_INVALIDCALL
;
616 shader_type
= info
->type
;
617 major
= info
->sm_major
;
618 minor
= info
->sm_minor
;
622 shader
= parse_hlsl_shader(preproc_shader
, shader_type
, major
, minor
, entrypoint
, &messages
);
626 TRACE("Compiler messages:\n");
627 TRACE("%s\n", debugstr_a(messages
));
629 TRACE("Shader source:\n");
630 TRACE("%s\n", debugstr_a(preproc_shader
));
634 const char *preproc_messages
= *error_messages
? ID3D10Blob_GetBufferPointer(*error_messages
) : NULL
;
636 size
= strlen(messages
) + (preproc_messages
? strlen(preproc_messages
) : 0) + 1;
637 hr
= D3DCreateBlob(size
, &buffer
);
640 HeapFree(GetProcessHeap(), 0, messages
);
641 if (shader
) SlDeleteShader(shader
);
644 pos
= ID3D10Blob_GetBufferPointer(buffer
);
645 if (preproc_messages
)
647 memcpy(pos
, preproc_messages
, strlen(preproc_messages
) + 1);
648 pos
+= strlen(preproc_messages
);
650 memcpy(pos
, messages
, strlen(messages
) + 1);
652 if (*error_messages
) ID3D10Blob_Release(*error_messages
);
653 *error_messages
= buffer
;
655 HeapFree(GetProcessHeap(), 0, messages
);
660 ERR("HLSL shader parsing failed.\n");
661 return D3DXERR_INVALIDDATA
;
664 hr
= SlWriteBytecode(shader
, 9, &res
, &size
);
665 SlDeleteShader(shader
);
668 ERR("SlWriteBytecode failed with error 0x%08x.\n", hr
);
669 return D3DXERR_INVALIDDATA
;
674 hr
= D3DCreateBlob(size
, &buffer
);
677 HeapFree(GetProcessHeap(), 0, res
);
680 memcpy(ID3D10Blob_GetBufferPointer(buffer
), res
, size
);
681 *shader_blob
= buffer
;
684 HeapFree(GetProcessHeap(), 0, res
);
689 HRESULT WINAPI
D3DCompile(const void *data
, SIZE_T data_size
, const char *filename
,
690 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
, const char *entrypoint
,
691 const char *target
, UINT sflags
, UINT eflags
, ID3DBlob
**shader
, ID3DBlob
**error_messages
)
695 TRACE("data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s,\n"
696 "target %s, sflags %#x, eflags %#x, shader %p, error_messages %p\n",
697 data
, data_size
, debugstr_a(filename
), defines
, include
, debugstr_a(entrypoint
),
698 debugstr_a(target
), sflags
, eflags
, shader
, error_messages
);
700 if (shader
) *shader
= NULL
;
701 if (error_messages
) *error_messages
= NULL
;
703 EnterCriticalSection(&wpp_mutex
);
705 hr
= preprocess_shader(data
, data_size
, filename
, defines
, include
, error_messages
);
707 hr
= compile_shader(wpp_output
, target
, entrypoint
, shader
, error_messages
);
709 HeapFree(GetProcessHeap(), 0, wpp_output
);
710 LeaveCriticalSection(&wpp_mutex
);
714 HRESULT WINAPI
D3DPreprocess(const void *data
, SIZE_T size
, const char *filename
,
715 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
,
716 ID3DBlob
**shader
, ID3DBlob
**error_messages
)
721 TRACE("data %p, size %lu, filename %s, defines %p, include %p, shader %p, error_messages %p\n",
722 data
, size
, debugstr_a(filename
), defines
, include
, shader
, error_messages
);
727 EnterCriticalSection(&wpp_mutex
);
729 if (shader
) *shader
= NULL
;
730 if (error_messages
) *error_messages
= NULL
;
732 hr
= preprocess_shader(data
, size
, filename
, defines
, include
, error_messages
);
738 hr
= D3DCreateBlob(wpp_output_size
, &buffer
);
741 CopyMemory(ID3D10Blob_GetBufferPointer(buffer
), wpp_output
, wpp_output_size
);
749 HeapFree(GetProcessHeap(), 0, wpp_output
);
750 LeaveCriticalSection(&wpp_mutex
);
754 HRESULT WINAPI
D3DDisassemble(const void *data
, SIZE_T size
, UINT flags
, const char *comments
, ID3DBlob
**disassembly
)
756 FIXME("data %p, size %lu, flags %#x, comments %p, disassembly %p stub!\n",
757 data
, size
, flags
, comments
, disassembly
);