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 parent_include
= NULL
;
148 if(parent_name
[0] != '\0')
150 for(i
= 0; i
< includes_size
; i
++)
152 if(!strcmp(parent_name
, includes
[i
].name
))
154 parent_include
= includes
[i
].data
;
158 if(parent_include
== NULL
)
160 ERR("Parent include file missing\n");
165 path
= malloc(strlen(filename
) + 1);
167 memcpy(path
, filename
, strlen(filename
) + 1);
171 static void *wpp_open_mem(const char *filename
, int type
)
173 struct mem_file_desc
*desc
;
176 if(!strcmp(filename
, initial_filename
))
178 current_shader
.pos
= 0;
179 return ¤t_shader
;
182 if(current_include
== NULL
) return NULL
;
183 desc
= HeapAlloc(GetProcessHeap(), 0, sizeof(*desc
));
187 hr
= ID3DInclude_Open(current_include
,
188 type
? D3D_INCLUDE_LOCAL
: D3D_INCLUDE_SYSTEM
,
189 filename
, parent_include
, (LPCVOID
*)&desc
->buffer
,
193 HeapFree(GetProcessHeap(), 0, desc
);
197 if(includes_capacity
== includes_size
)
199 if(includes_capacity
== 0)
201 includes
= HeapAlloc(GetProcessHeap(), 0, INCLUDES_INITIAL_CAPACITY
* sizeof(*includes
));
204 ERR("Error allocating memory for the loaded includes structure\n");
207 includes_capacity
= INCLUDES_INITIAL_CAPACITY
* sizeof(*includes
);
211 int newcapacity
= includes_capacity
* 2;
212 struct loaded_include
*newincludes
=
213 HeapReAlloc(GetProcessHeap(), 0, includes
, newcapacity
);
214 if(newincludes
== NULL
)
216 ERR("Error reallocating memory for the loaded includes structure\n");
219 includes
= newincludes
;
220 includes_capacity
= newcapacity
;
223 includes
[includes_size
].name
= filename
;
224 includes
[includes_size
++].data
= desc
->buffer
;
230 ID3DInclude_Close(current_include
, desc
->buffer
);
231 HeapFree(GetProcessHeap(), 0, desc
);
235 static void wpp_close_mem(void *file
)
237 struct mem_file_desc
*desc
= file
;
239 if(desc
!= ¤t_shader
)
242 ID3DInclude_Close(current_include
, desc
->buffer
);
244 ERR("current_include == NULL, desc == %p, buffer = %s\n",
247 HeapFree(GetProcessHeap(), 0, desc
);
251 static int wpp_read_mem(void *file
, char *buffer
, unsigned int len
)
253 struct mem_file_desc
*desc
= file
;
255 len
= min(len
, desc
->size
- desc
->pos
);
256 memcpy(buffer
, desc
->buffer
+ desc
->pos
, len
);
261 static void wpp_write_mem(const char *buffer
, unsigned int len
)
263 char *new_wpp_output
;
265 if(wpp_output_capacity
== 0)
267 wpp_output
= HeapAlloc(GetProcessHeap(), 0, BUFFER_INITIAL_CAPACITY
);
271 wpp_output_capacity
= BUFFER_INITIAL_CAPACITY
;
273 if(len
> wpp_output_capacity
- wpp_output_size
)
275 while(len
> wpp_output_capacity
- wpp_output_size
)
277 wpp_output_capacity
*= 2;
279 new_wpp_output
= HeapReAlloc(GetProcessHeap(), 0, wpp_output
,
280 wpp_output_capacity
);
283 ERR("Error allocating memory\n");
286 wpp_output
= new_wpp_output
;
288 memcpy(wpp_output
+ wpp_output_size
, buffer
, len
);
289 wpp_output_size
+= len
;
292 static int wpp_close_output(void)
294 char *new_wpp_output
= HeapReAlloc(GetProcessHeap(), 0, wpp_output
,
295 wpp_output_size
+ 1);
296 if(!new_wpp_output
) return 0;
297 wpp_output
= new_wpp_output
;
298 wpp_output
[wpp_output_size
]='\0';
303 static HRESULT
preprocess_shader(const void *data
, SIZE_T data_size
, const char *filename
,
304 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
, ID3DBlob
**error_messages
)
308 const D3D_SHADER_MACRO
*def
= defines
;
310 static const struct wpp_callbacks wpp_callbacks
=
323 while (def
->Name
!= NULL
)
325 wpp_add_define(def
->Name
, def
->Definition
);
329 current_include
= include
;
332 wpp_output_size
= wpp_output_capacity
= 0;
335 wpp_set_callbacks(&wpp_callbacks
);
336 wpp_messages_size
= wpp_messages_capacity
= 0;
338 current_shader
.buffer
= data
;
339 current_shader
.size
= data_size
;
340 initial_filename
= filename
? filename
: "";
342 ret
= wpp_parse(initial_filename
, NULL
);
343 if (!wpp_close_output())
347 TRACE("Error during shader preprocessing\n");
353 TRACE("Preprocessor messages:\n%s\n", debugstr_a(wpp_messages
));
357 size
= strlen(wpp_messages
) + 1;
358 hr
= D3DCreateBlob(size
, &buffer
);
361 CopyMemory(ID3D10Blob_GetBufferPointer(buffer
), wpp_messages
, size
);
362 *error_messages
= buffer
;
366 TRACE("Shader source:\n%s\n", debugstr_an(data
, data_size
));
371 /* Remove the previously added defines */
374 while (defines
->Name
!= NULL
)
376 wpp_del_define(defines
->Name
);
380 HeapFree(GetProcessHeap(), 0, wpp_messages
);
384 static HRESULT
assemble_shader(const char *preproc_shader
,
385 ID3DBlob
**shader_blob
, ID3DBlob
**error_messages
)
387 struct bwriter_shader
*shader
;
388 char *messages
= NULL
;
394 shader
= SlAssembleShader(preproc_shader
, &messages
);
398 TRACE("Assembler messages:\n");
399 TRACE("%s\n", debugstr_a(messages
));
401 TRACE("Shader source:\n");
402 TRACE("%s\n", debugstr_a(preproc_shader
));
406 const char *preproc_messages
= *error_messages
? ID3D10Blob_GetBufferPointer(*error_messages
) : NULL
;
408 size
= strlen(messages
) + (preproc_messages
? strlen(preproc_messages
) : 0) + 1;
409 hr
= D3DCreateBlob(size
, &buffer
);
412 HeapFree(GetProcessHeap(), 0, messages
);
413 if (shader
) SlDeleteShader(shader
);
416 pos
= ID3D10Blob_GetBufferPointer(buffer
);
417 if (preproc_messages
)
419 CopyMemory(pos
, preproc_messages
, strlen(preproc_messages
) + 1);
420 pos
+= strlen(preproc_messages
);
422 CopyMemory(pos
, messages
, strlen(messages
) + 1);
424 if (*error_messages
) ID3D10Blob_Release(*error_messages
);
425 *error_messages
= buffer
;
427 HeapFree(GetProcessHeap(), 0, messages
);
432 ERR("Asm reading failed\n");
433 return D3DXERR_INVALIDDATA
;
436 hr
= SlWriteBytecode(shader
, 9, &res
, &size
);
437 SlDeleteShader(shader
);
440 ERR("SlWriteBytecode failed with 0x%08x\n", hr
);
441 return D3DXERR_INVALIDDATA
;
446 hr
= D3DCreateBlob(size
, &buffer
);
449 HeapFree(GetProcessHeap(), 0, res
);
452 CopyMemory(ID3D10Blob_GetBufferPointer(buffer
), res
, size
);
453 *shader_blob
= buffer
;
456 HeapFree(GetProcessHeap(), 0, res
);
461 HRESULT WINAPI
D3DAssemble(const void *data
, SIZE_T datasize
, const char *filename
,
462 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
, UINT flags
,
463 ID3DBlob
**shader
, ID3DBlob
**error_messages
)
467 TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, sflags %#x,\n"
468 "shader %p, error_messages %p\n",
469 data
, datasize
, debugstr_a(filename
), defines
, include
, flags
, shader
, error_messages
);
471 EnterCriticalSection(&wpp_mutex
);
474 if (flags
) FIXME("flags %x\n", flags
);
476 if (shader
) *shader
= NULL
;
477 if (error_messages
) *error_messages
= NULL
;
479 hr
= preprocess_shader(data
, datasize
, filename
, defines
, include
, error_messages
);
481 hr
= assemble_shader(wpp_output
, shader
, error_messages
);
483 HeapFree(GetProcessHeap(), 0, wpp_output
);
484 LeaveCriticalSection(&wpp_mutex
);
490 enum shader_type type
;
499 /* Must be kept sorted for binary search */
500 static const struct target_info targets_info
[] = {
501 { "cs_4_0", ST_UNKNOWN
, 4, 0, 0, 0, FALSE
, FALSE
},
502 { "cs_4_1", ST_UNKNOWN
, 4, 1, 0, 0, FALSE
, FALSE
},
503 { "cs_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
504 { "ds_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
505 { "fx_2_0", ST_UNKNOWN
, 2, 0, 0, 0, FALSE
, FALSE
},
506 { "fx_4_0", ST_UNKNOWN
, 4, 0, 0, 0, FALSE
, FALSE
},
507 { "fx_4_1", ST_UNKNOWN
, 4, 1, 0, 0, FALSE
, FALSE
},
508 { "fx_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
509 { "gs_4_0", ST_UNKNOWN
, 4, 0, 0, 0, FALSE
, FALSE
},
510 { "gs_4_1", ST_UNKNOWN
, 4, 1, 0, 0, FALSE
, FALSE
},
511 { "gs_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
512 { "hs_5_0", ST_UNKNOWN
, 5, 0, 0, 0, FALSE
, FALSE
},
513 { "ps.1.0", ST_PIXEL
, 1, 0, 0, 0, FALSE
, TRUE
},
514 { "ps.1.1", ST_PIXEL
, 1, 1, 0, 0, FALSE
, FALSE
},
515 { "ps.1.2", ST_PIXEL
, 1, 2, 0, 0, FALSE
, FALSE
},
516 { "ps.1.3", ST_PIXEL
, 1, 3, 0, 0, FALSE
, FALSE
},
517 { "ps.1.4", ST_PIXEL
, 1, 4, 0, 0, FALSE
, FALSE
},
518 { "ps.2.0", ST_PIXEL
, 2, 0, 0, 0, FALSE
, TRUE
},
519 { "ps.2.a", ST_PIXEL
, 2, 1, 0, 0, FALSE
, FALSE
},
520 { "ps.2.b", ST_PIXEL
, 2, 2, 0, 0, FALSE
, FALSE
},
521 { "ps.2.sw", ST_PIXEL
, 2, 0, 0, 0, TRUE
, FALSE
},
522 { "ps.3.0", ST_PIXEL
, 3, 0, 0, 0, FALSE
, TRUE
},
523 { "ps_1_0", ST_PIXEL
, 1, 0, 0, 0, FALSE
, TRUE
},
524 { "ps_1_1", ST_PIXEL
, 1, 1, 0, 0, FALSE
, FALSE
},
525 { "ps_1_2", ST_PIXEL
, 1, 2, 0, 0, FALSE
, FALSE
},
526 { "ps_1_3", ST_PIXEL
, 1, 3, 0, 0, FALSE
, FALSE
},
527 { "ps_1_4", ST_PIXEL
, 1, 4, 0, 0, FALSE
, FALSE
},
528 { "ps_2_0", ST_PIXEL
, 2, 0, 0, 0, FALSE
, TRUE
},
529 { "ps_2_a", ST_PIXEL
, 2, 1, 0, 0, FALSE
, FALSE
},
530 { "ps_2_b", ST_PIXEL
, 2, 2, 0, 0, FALSE
, FALSE
},
531 { "ps_2_sw", ST_PIXEL
, 2, 0, 0, 0, TRUE
, FALSE
},
532 { "ps_3_0", ST_PIXEL
, 3, 0, 0, 0, FALSE
, TRUE
},
533 { "ps_3_sw", ST_PIXEL
, 3, 0, 0, 0, TRUE
, FALSE
},
534 { "ps_4_0", ST_PIXEL
, 4, 0, 0, 0, FALSE
, TRUE
},
535 { "ps_4_0_level_9_0", ST_PIXEL
, 4, 0, 9, 0, FALSE
, FALSE
},
536 { "ps_4_0_level_9_1", ST_PIXEL
, 4, 0, 9, 1, FALSE
, FALSE
},
537 { "ps_4_0_level_9_3", ST_PIXEL
, 4, 0, 9, 3, FALSE
, FALSE
},
538 { "ps_4_1", ST_PIXEL
, 4, 1, 0, 0, FALSE
, TRUE
},
539 { "ps_5_0", ST_PIXEL
, 5, 0, 0, 0, FALSE
, TRUE
},
540 { "tx_1_0", ST_UNKNOWN
, 1, 0, 0, 0, FALSE
, FALSE
},
541 { "vs.1.0", ST_VERTEX
, 1, 0, 0, 0, FALSE
, TRUE
},
542 { "vs.1.1", ST_VERTEX
, 1, 1, 0, 0, FALSE
, TRUE
},
543 { "vs.2.0", ST_VERTEX
, 2, 0, 0, 0, FALSE
, TRUE
},
544 { "vs.2.a", ST_VERTEX
, 2, 1, 0, 0, FALSE
, FALSE
},
545 { "vs.2.sw", ST_VERTEX
, 2, 0, 0, 0, TRUE
, FALSE
},
546 { "vs.3.0", ST_VERTEX
, 3, 0, 0, 0, FALSE
, TRUE
},
547 { "vs.3.sw", ST_VERTEX
, 3, 0, 0, 0, TRUE
, FALSE
},
548 { "vs_1_0", ST_VERTEX
, 1, 0, 0, 0, FALSE
, TRUE
},
549 { "vs_1_1", ST_VERTEX
, 1, 1, 0, 0, FALSE
, TRUE
},
550 { "vs_2_0", ST_VERTEX
, 2, 0, 0, 0, FALSE
, TRUE
},
551 { "vs_2_a", ST_VERTEX
, 2, 1, 0, 0, FALSE
, FALSE
},
552 { "vs_2_sw", ST_VERTEX
, 2, 0, 0, 0, TRUE
, FALSE
},
553 { "vs_3_0", ST_VERTEX
, 3, 0, 0, 0, FALSE
, TRUE
},
554 { "vs_3_sw", ST_VERTEX
, 3, 0, 0, 0, TRUE
, FALSE
},
555 { "vs_4_0", ST_VERTEX
, 4, 0, 0, 0, FALSE
, TRUE
},
556 { "vs_4_0_level_9_0", ST_VERTEX
, 4, 0, 9, 0, FALSE
, FALSE
},
557 { "vs_4_0_level_9_1", ST_VERTEX
, 4, 0, 9, 1, FALSE
, FALSE
},
558 { "vs_4_0_level_9_3", ST_VERTEX
, 4, 0, 9, 3, FALSE
, FALSE
},
559 { "vs_4_1", ST_VERTEX
, 4, 1, 0, 0, FALSE
, TRUE
},
560 { "vs_5_0", ST_VERTEX
, 5, 0, 0, 0, FALSE
, TRUE
},
563 static const struct target_info
* get_target_info(const char *target
)
566 LONG max
= sizeof(targets_info
) / sizeof(targets_info
[0]) - 1;
572 cur
= (min
+ max
) / 2;
573 res
= strcmp(target
, targets_info
[cur
].name
);
579 return &targets_info
[cur
];
585 static HRESULT
compile_shader(const char *preproc_shader
, const char *target
, const char *entrypoint
,
586 ID3DBlob
**shader_blob
, ID3DBlob
**error_messages
)
588 struct bwriter_shader
*shader
;
589 char *messages
= NULL
;
591 DWORD
*res
, size
, major
, minor
;
594 enum shader_type shader_type
;
595 const struct target_info
*info
;
597 TRACE("Preprocessed shader source: %s\n", debugstr_a(preproc_shader
));
599 TRACE("Checking compilation target %s\n", debugstr_a(target
));
600 info
= get_target_info(target
);
603 FIXME("Unknown compilation target %s\n", debugstr_a(target
));
604 return D3DERR_INVALIDCALL
;
610 FIXME("Compilation target %s not yet supported\n", debugstr_a(target
));
611 return D3DERR_INVALIDCALL
;
615 shader_type
= info
->type
;
616 major
= info
->sm_major
;
617 minor
= info
->sm_minor
;
621 shader
= parse_hlsl_shader(preproc_shader
, shader_type
, major
, minor
, entrypoint
, &messages
);
625 TRACE("Compiler messages:\n");
626 TRACE("%s\n", debugstr_a(messages
));
628 TRACE("Shader source:\n");
629 TRACE("%s\n", debugstr_a(preproc_shader
));
633 const char *preproc_messages
= *error_messages
? ID3D10Blob_GetBufferPointer(*error_messages
) : NULL
;
635 size
= strlen(messages
) + (preproc_messages
? strlen(preproc_messages
) : 0) + 1;
636 hr
= D3DCreateBlob(size
, &buffer
);
639 HeapFree(GetProcessHeap(), 0, messages
);
640 if (shader
) SlDeleteShader(shader
);
643 pos
= ID3D10Blob_GetBufferPointer(buffer
);
644 if (preproc_messages
)
646 memcpy(pos
, preproc_messages
, strlen(preproc_messages
) + 1);
647 pos
+= strlen(preproc_messages
);
649 memcpy(pos
, messages
, strlen(messages
) + 1);
651 if (*error_messages
) ID3D10Blob_Release(*error_messages
);
652 *error_messages
= buffer
;
654 HeapFree(GetProcessHeap(), 0, messages
);
659 ERR("HLSL shader parsing failed.\n");
660 return D3DXERR_INVALIDDATA
;
663 hr
= SlWriteBytecode(shader
, 9, &res
, &size
);
664 SlDeleteShader(shader
);
667 ERR("SlWriteBytecode failed with error 0x%08x.\n", hr
);
668 return D3DXERR_INVALIDDATA
;
673 hr
= D3DCreateBlob(size
, &buffer
);
676 HeapFree(GetProcessHeap(), 0, res
);
679 memcpy(ID3D10Blob_GetBufferPointer(buffer
), res
, size
);
680 *shader_blob
= buffer
;
683 HeapFree(GetProcessHeap(), 0, res
);
688 HRESULT WINAPI
D3DCompile(const void *data
, SIZE_T data_size
, const char *filename
,
689 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
, const char *entrypoint
,
690 const char *target
, UINT sflags
, UINT eflags
, ID3DBlob
**shader
, ID3DBlob
**error_messages
)
694 TRACE("data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s,\n"
695 "target %s, sflags %#x, eflags %#x, shader %p, error_messages %p\n",
696 data
, data_size
, debugstr_a(filename
), defines
, include
, debugstr_a(entrypoint
),
697 debugstr_a(target
), sflags
, eflags
, shader
, error_messages
);
699 if (shader
) *shader
= NULL
;
700 if (error_messages
) *error_messages
= NULL
;
702 EnterCriticalSection(&wpp_mutex
);
704 hr
= preprocess_shader(data
, data_size
, filename
, defines
, include
, error_messages
);
706 hr
= compile_shader(wpp_output
, target
, entrypoint
, shader
, error_messages
);
708 HeapFree(GetProcessHeap(), 0, wpp_output
);
709 LeaveCriticalSection(&wpp_mutex
);
713 HRESULT WINAPI
D3DPreprocess(const void *data
, SIZE_T size
, const char *filename
,
714 const D3D_SHADER_MACRO
*defines
, ID3DInclude
*include
,
715 ID3DBlob
**shader
, ID3DBlob
**error_messages
)
720 TRACE("data %p, size %lu, filename %s, defines %p, include %p, shader %p, error_messages %p\n",
721 data
, size
, debugstr_a(filename
), defines
, include
, shader
, error_messages
);
726 EnterCriticalSection(&wpp_mutex
);
728 if (shader
) *shader
= NULL
;
729 if (error_messages
) *error_messages
= NULL
;
731 hr
= preprocess_shader(data
, size
, filename
, defines
, include
, error_messages
);
737 hr
= D3DCreateBlob(wpp_output_size
, &buffer
);
740 CopyMemory(ID3D10Blob_GetBufferPointer(buffer
), wpp_output
, wpp_output_size
);
748 HeapFree(GetProcessHeap(), 0, wpp_output
);
749 LeaveCriticalSection(&wpp_mutex
);
753 HRESULT WINAPI
D3DDisassemble(const void *data
, SIZE_T size
, UINT flags
, const char *comments
, ID3DBlob
**disassembly
)
755 FIXME("data %p, size %lu, flags %#x, comments %p, disassembly %p stub!\n",
756 data
, size
, flags
, comments
, disassembly
);