2 * Copyright 2009 Henri Verbeet for CodeWeavers
3 * Copyright 2010 Rico Schüller
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
22 #include "wine/port.h"
24 #include "d3dcompiler_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
28 enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE
30 D3DCOMPILER_SIGNATURE_ELEMENT_SIZE6 = 6,
31 D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7 = 7,
34 const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl;
35 const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl;
37 /* null objects - needed for invalid calls */
38 static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = {{&d3dcompiler_shader_reflection_constant_buffer_vtbl}};
39 static struct d3dcompiler_shader_reflection_variable null_variable = {{&d3dcompiler_shader_reflection_variable_vtbl}, &null_constant_buffer};
41 static BOOL copy_name(const char *ptr, char **name)
45 if (!ptr) return TRUE;
47 name_len = strlen(ptr) + 1;
53 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
56 ERR("Failed to allocate name memory.\n");
60 memcpy(*name, ptr, name_len);
65 static BOOL copy_value(const char *ptr, void **value, DWORD size)
67 if (!ptr || !size) return TRUE;
69 *value = HeapAlloc(GetProcessHeap(), 0, size);
72 ERR("Failed to allocate vlaue memory.\n");
76 memcpy(*value, ptr, size);
81 void *d3dcompiler_rb_alloc(size_t size)
83 return HeapAlloc(GetProcessHeap(), 0, size);
86 void *d3dcompiler_rb_realloc(void *ptr, size_t size)
88 return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
91 void d3dcompiler_rb_free(void *ptr)
93 HeapFree(GetProcessHeap(), 0, ptr);
96 static int d3dcompiler_shader_reflection_type_compare(const void *key, const struct wine_rb_entry *entry)
98 const struct d3dcompiler_shader_reflection_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3dcompiler_shader_reflection_type, entry);
99 const DWORD *id = key;
104 static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *entry, void *context)
106 struct d3dcompiler_shader_reflection_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3dcompiler_shader_reflection_type, entry);
108 TRACE("reflection type %p.\n", t);
110 HeapFree(GetProcessHeap(), 0, t);
113 static const struct wine_rb_functions d3dcompiler_shader_reflection_type_rb_functions =
115 d3dcompiler_rb_alloc,
116 d3dcompiler_rb_realloc,
118 d3dcompiler_shader_reflection_type_compare,
121 static void free_signature(struct d3dcompiler_shader_signature *sig)
123 TRACE("Free signature %p\n", sig);
125 HeapFree(GetProcessHeap(), 0, sig->elements);
126 HeapFree(GetProcessHeap(), 0, sig->string_data);
129 static void free_variable(struct d3dcompiler_shader_reflection_variable *var)
133 HeapFree(GetProcessHeap(), 0, var->name);
134 HeapFree(GetProcessHeap(), 0, var->default_value);
138 static void free_constant_buffer(struct d3dcompiler_shader_reflection_constant_buffer *cb)
144 for (i = 0; i < cb->variable_count; ++i)
146 free_variable(&cb->variables[i]);
148 HeapFree(GetProcessHeap(), 0, cb->variables);
151 HeapFree(GetProcessHeap(), 0, cb->name);
154 static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref)
156 TRACE("Cleanup %p\n", ref);
160 free_signature(ref->isgn);
161 HeapFree(GetProcessHeap(), 0, ref->isgn);
166 free_signature(ref->osgn);
167 HeapFree(GetProcessHeap(), 0, ref->osgn);
172 free_signature(ref->pcsg);
173 HeapFree(GetProcessHeap(), 0, ref->pcsg);
176 if (ref->constant_buffers)
180 for (i = 0; i < ref->constant_buffer_count; ++i)
182 free_constant_buffer(&ref->constant_buffers[i]);
186 wine_rb_destroy(&ref->types, d3dcompiler_shader_reflection_type_destroy, NULL);
187 HeapFree(GetProcessHeap(), 0, ref->constant_buffers);
188 HeapFree(GetProcessHeap(), 0, ref->bound_resources);
189 HeapFree(GetProcessHeap(), 0, ref->resource_string);
190 HeapFree(GetProcessHeap(), 0, ref->creator);
193 /* IUnknown methods */
195 static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface)
197 return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D11ShaderReflection_iface);
200 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object)
202 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
204 if (IsEqualGUID(riid, &IID_ID3D11ShaderReflection)
205 || IsEqualGUID(riid, &IID_IUnknown))
207 IUnknown_AddRef(iface);
212 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
215 return E_NOINTERFACE;
218 static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11ShaderReflection *iface)
220 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
221 ULONG refcount = InterlockedIncrement(&This->refcount);
223 TRACE("%p increasing refcount to %u\n", This, refcount);
228 static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface)
230 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
231 ULONG refcount = InterlockedDecrement(&This->refcount);
233 TRACE("%p decreasing refcount to %u\n", This, refcount);
237 reflection_cleanup(This);
238 HeapFree(GetProcessHeap(), 0, This);
244 /* ID3D11ShaderReflection methods */
246 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc)
248 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
250 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
254 WARN("Invalid argument specified\n");
258 desc->Version = This->version;
259 desc->Creator = This->creator;
260 desc->Flags = This->flags;
261 desc->ConstantBuffers = This->constant_buffer_count;
262 desc->BoundResources = This->bound_resource_count;
263 desc->InputParameters = This->isgn ? This->isgn->element_count : 0;
264 desc->OutputParameters = This->osgn ? This->osgn->element_count : 0;
265 desc->InstructionCount = This->instruction_count;
266 desc->TempRegisterCount = This->temp_register_count;
267 desc->TempArrayCount = This->temp_array_count;
269 desc->DclCount = This->dcl_count;
270 desc->TextureNormalInstructions = This->texture_normal_instructions;
271 desc->TextureLoadInstructions = This->texture_load_instructions;
272 desc->TextureCompInstructions = This->texture_comp_instructions;
273 desc->TextureBiasInstructions = This->texture_bias_instructions;
274 desc->TextureGradientInstructions = This->texture_gradient_instructions;
275 desc->FloatInstructionCount = This->float_instruction_count;
276 desc->IntInstructionCount = This->int_instruction_count;
277 desc->UintInstructionCount = This->uint_instruction_count;
278 desc->StaticFlowControlCount = This->static_flow_control_count;
279 desc->DynamicFlowControlCount = This->dynamic_flow_control_count;
280 desc->MacroInstructionCount = 0;
281 desc->ArrayInstructionCount = This->array_instruction_count;
282 desc->CutInstructionCount = This->cut_instruction_count;
283 desc->EmitInstructionCount = This->emit_instruction_count;
284 desc->GSOutputTopology = This->gs_output_topology;
285 desc->GSMaxOutputVertexCount = This->gs_max_output_vertex_count;
286 desc->InputPrimitive = This->input_primitive;
287 desc->PatchConstantParameters = This->pcsg ? This->pcsg->element_count : 0;
288 desc->cGSInstanceCount = 0;
289 desc->cControlPoints = This->c_control_points;
290 desc->HSOutputPrimitive = This->hs_output_primitive;
291 desc->HSPartitioning = This->hs_prtitioning;
292 desc->TessellatorDomain = This->tessellator_domain;
293 desc->cBarrierInstructions = 0;
294 desc->cInterlockedInstructions = 0;
295 desc->cTextureStoreInstructions = 0;
300 static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByIndex(
301 ID3D11ShaderReflection *iface, UINT index)
303 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
305 TRACE("iface %p, index %u\n", iface, index);
307 if (index >= This->constant_buffer_count)
309 WARN("Invalid argument specified\n");
310 return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
313 return &This->constant_buffers[index].ID3D11ShaderReflectionConstantBuffer_iface;
316 static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName(
317 ID3D11ShaderReflection *iface, LPCSTR name)
319 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
322 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
326 WARN("Invalid argument specified\n");
327 return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
330 for (i = 0; i < This->constant_buffer_count; ++i)
332 struct d3dcompiler_shader_reflection_constant_buffer *d = &This->constant_buffers[i];
334 if (!strcmp(d->name, name))
336 TRACE("Returning ID3D11ShaderReflectionConstantBuffer %p.\n", d);
337 return &d->ID3D11ShaderReflectionConstantBuffer_iface;
341 WARN("Invalid name specified\n");
343 return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
346 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDesc(
347 ID3D11ShaderReflection *iface, UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc)
349 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
351 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
353 if (!desc || index >= This->bound_resource_count)
355 WARN("Invalid argument specified\n");
359 *desc = This->bound_resources[index];
364 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameterDesc(
365 ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
367 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
369 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
371 if (!desc || !This->isgn || index >= This->isgn->element_count)
373 WARN("Invalid argument specified\n");
377 *desc = This->isgn->elements[index];
382 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParameterDesc(
383 ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
385 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
387 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
389 if (!desc || !This->osgn || index >= This->osgn->element_count)
391 WARN("Invalid argument specified\n");
395 *desc = This->osgn->elements[index];
400 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantParameterDesc(
401 ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
403 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
405 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
407 if (!desc || !This->pcsg || index >= This->pcsg->element_count)
409 WARN("Invalid argument specified\n");
413 *desc = This->pcsg->elements[index];
418 static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName(
419 ID3D11ShaderReflection *iface, LPCSTR name)
421 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
424 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
428 WARN("Invalid name specified\n");
429 return &null_variable.ID3D11ShaderReflectionVariable_iface;
432 for (i = 0; i < This->constant_buffer_count; ++i)
434 struct d3dcompiler_shader_reflection_constant_buffer *cb = &This->constant_buffers[i];
436 for (k = 0; k < cb->variable_count; ++k)
438 struct d3dcompiler_shader_reflection_variable *v = &cb->variables[k];
440 if (!strcmp(v->name, name))
442 TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
443 return &v->ID3D11ShaderReflectionVariable_iface;
448 WARN("Invalid name specified\n");
450 return &null_variable.ID3D11ShaderReflectionVariable_iface;
453 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName(
454 ID3D11ShaderReflection *iface, LPCSTR name, D3D11_SHADER_INPUT_BIND_DESC *desc)
456 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
459 TRACE("iface %p, name %s, desc %p\n", iface, debugstr_a(name), desc);
463 WARN("Invalid argument specified\n");
467 for (i = 0; i < This->bound_resource_count; ++i)
469 D3D11_SHADER_INPUT_BIND_DESC *d = &This->bound_resources[i];
471 if (!strcmp(d->Name, name))
473 TRACE("Returning D3D11_SHADER_INPUT_BIND_DESC %p.\n", d);
479 WARN("Invalid name specified\n");
484 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovInstructionCount(
485 ID3D11ShaderReflection *iface)
487 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
489 TRACE("iface %p\n", iface);
491 return This->mov_instruction_count;
494 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovcInstructionCount(
495 ID3D11ShaderReflection *iface)
497 FIXME("iface %p stub!\n", iface);
502 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConversionInstructionCount(
503 ID3D11ShaderReflection *iface)
505 struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
507 TRACE("iface %p\n", iface);
509 return This->conversion_instruction_count;
512 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetBitwiseInstructionCount(
513 ID3D11ShaderReflection *iface)
515 FIXME("iface %p stub!\n", iface);
520 static D3D_PRIMITIVE STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetGSInputPrimitive(
521 ID3D11ShaderReflection *iface)
523 FIXME("iface %p stub!\n", iface);
528 static BOOL STDMETHODCALLTYPE d3dcompiler_shader_reflection_IsSampleFrequencyShader(
529 ID3D11ShaderReflection *iface)
531 FIXME("iface %p stub!\n", iface);
536 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetNumInterfaceSlots(
537 ID3D11ShaderReflection *iface)
539 FIXME("iface %p stub!\n", iface);
544 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMinFeatureLevel(
545 ID3D11ShaderReflection *iface, D3D_FEATURE_LEVEL *level)
547 FIXME("iface %p, level %p stub!\n", iface, level);
552 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetThreadGroupSize(
553 ID3D11ShaderReflection *iface, UINT *sizex, UINT *sizey, UINT *sizez)
555 FIXME("iface %p, sizex %p, sizey %p, sizez %p stub!\n", iface, sizex, sizey, sizez);
560 const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl =
562 /* IUnknown methods */
563 d3dcompiler_shader_reflection_QueryInterface,
564 d3dcompiler_shader_reflection_AddRef,
565 d3dcompiler_shader_reflection_Release,
566 /* ID3D11ShaderReflection methods */
567 d3dcompiler_shader_reflection_GetDesc,
568 d3dcompiler_shader_reflection_GetConstantBufferByIndex,
569 d3dcompiler_shader_reflection_GetConstantBufferByName,
570 d3dcompiler_shader_reflection_GetResourceBindingDesc,
571 d3dcompiler_shader_reflection_GetInputParameterDesc,
572 d3dcompiler_shader_reflection_GetOutputParameterDesc,
573 d3dcompiler_shader_reflection_GetPatchConstantParameterDesc,
574 d3dcompiler_shader_reflection_GetVariableByName,
575 d3dcompiler_shader_reflection_GetResourceBindingDescByName,
576 d3dcompiler_shader_reflection_GetMovInstructionCount,
577 d3dcompiler_shader_reflection_GetMovcInstructionCount,
578 d3dcompiler_shader_reflection_GetConversionInstructionCount,
579 d3dcompiler_shader_reflection_GetBitwiseInstructionCount,
580 d3dcompiler_shader_reflection_GetGSInputPrimitive,
581 d3dcompiler_shader_reflection_IsSampleFrequencyShader,
582 d3dcompiler_shader_reflection_GetNumInterfaceSlots,
583 d3dcompiler_shader_reflection_GetMinFeatureLevel,
584 d3dcompiler_shader_reflection_GetThreadGroupSize,
587 /* ID3D11ShaderReflectionConstantBuffer methods */
589 static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface)
591 return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_constant_buffer, ID3D11ShaderReflectionConstantBuffer_iface);
594 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetDesc(
595 ID3D11ShaderReflectionConstantBuffer *iface, D3D11_SHADER_BUFFER_DESC *desc)
597 struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface);
599 TRACE("iface %p, desc %p\n", iface, desc);
601 if (This == &null_constant_buffer)
603 WARN("Null constant buffer specified\n");
609 WARN("Invalid argument specified\n");
613 desc->Name = This->name;
614 desc->Type = This->type;
615 desc->Variables = This->variable_count;
616 desc->Size = This->size;
617 desc->uFlags = This->flags;
622 static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByIndex(
623 ID3D11ShaderReflectionConstantBuffer *iface, UINT index)
625 struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface);
627 TRACE("iface %p, index %u\n", iface, index);
629 if (index >= This->variable_count)
631 WARN("Invalid index specified\n");
632 return &null_variable.ID3D11ShaderReflectionVariable_iface;
635 return &This->variables[index].ID3D11ShaderReflectionVariable_iface;
638 static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByName(
639 ID3D11ShaderReflectionConstantBuffer *iface, LPCSTR name)
641 struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface);
644 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
648 WARN("Invalid argument specified\n");
649 return &null_variable.ID3D11ShaderReflectionVariable_iface;
652 for (i = 0; i < This->variable_count; ++i)
654 struct d3dcompiler_shader_reflection_variable *v = &This->variables[i];
656 if (!strcmp(v->name, name))
658 TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
659 return &v->ID3D11ShaderReflectionVariable_iface;
663 WARN("Invalid name specified\n");
665 return &null_variable.ID3D11ShaderReflectionVariable_iface;
668 const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl =
670 /* ID3D11ShaderReflectionConstantBuffer methods */
671 d3dcompiler_shader_reflection_constant_buffer_GetDesc,
672 d3dcompiler_shader_reflection_constant_buffer_GetVariableByIndex,
673 d3dcompiler_shader_reflection_constant_buffer_GetVariableByName,
676 /* ID3D11ShaderReflectionVariable methods */
678 static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface)
680 return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_variable, ID3D11ShaderReflectionVariable_iface);
683 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetDesc(
684 ID3D11ShaderReflectionVariable *iface, D3D11_SHADER_VARIABLE_DESC *desc)
686 struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D11ShaderReflectionVariable(iface);
688 TRACE("iface %p, desc %p\n", iface, desc);
690 if (This == &null_variable)
692 WARN("Null variable specified\n");
698 WARN("Invalid argument specified\n");
702 desc->Name = This->name;
703 desc->StartOffset = This->start_offset;
704 desc->Size = This->size;
705 desc->uFlags = This->flags;
706 desc->DefaultValue = This->default_value;
711 static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetType(
712 ID3D11ShaderReflectionVariable *iface)
714 FIXME("iface %p stub!\n", iface);
719 static ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetBuffer(
720 ID3D11ShaderReflectionVariable *iface)
722 struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D11ShaderReflectionVariable(iface);
724 TRACE("iface %p\n", iface);
726 return &This->constant_buffer->ID3D11ShaderReflectionConstantBuffer_iface;
729 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetInterfaceSlot(
730 ID3D11ShaderReflectionVariable *iface, UINT index)
732 FIXME("iface %p, index %u stub!\n", iface, index);
737 const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl =
739 /* ID3D11ShaderReflectionVariable methods */
740 d3dcompiler_shader_reflection_variable_GetDesc,
741 d3dcompiler_shader_reflection_variable_GetType,
742 d3dcompiler_shader_reflection_variable_GetBuffer,
743 d3dcompiler_shader_reflection_variable_GetInterfaceSlot,
746 /* ID3D11ShaderReflectionType methods */
748 static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface)
750 return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_type, ID3D11ShaderReflectionType_iface);
753 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetDesc(
754 ID3D11ShaderReflectionType *iface, D3D11_SHADER_TYPE_DESC *desc)
756 struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface);
758 TRACE("iface %p, desc %p\n", iface, desc);
760 if (This == &null_type)
762 WARN("Null type specified\n");
768 WARN("Invalid argument specified\n");
777 static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByIndex(
778 ID3D11ShaderReflectionType *iface, UINT index)
780 FIXME("iface %p, index %u stub!\n", iface, index);
785 static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByName(
786 ID3D11ShaderReflectionType *iface, LPCSTR name)
788 FIXME("iface %p, name %s stub!\n", iface, name);
793 static LPCSTR STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeName(
794 ID3D11ShaderReflectionType *iface, UINT index)
796 FIXME("iface %p, index %u stub!\n", iface, index);
801 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsEqual(
802 ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type)
804 FIXME("iface %p, type %p stub!\n", iface, type);
809 static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetSubType(
810 ID3D11ShaderReflectionType *iface)
812 FIXME("iface %p stub!\n", iface);
817 static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetBaseClass(
818 ID3D11ShaderReflectionType *iface)
820 FIXME("iface %p stub!\n", iface);
825 static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetNumInterfaces(
826 ID3D11ShaderReflectionType *iface)
828 FIXME("iface %p stub!\n", iface);
833 static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetInterfaceByIndex(
834 ID3D11ShaderReflectionType *iface, UINT index)
836 FIXME("iface %p, index %u stub!\n", iface, index);
841 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsOfType(
842 ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type)
844 FIXME("iface %p, type %p stub!\n", iface, type);
849 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_ImplementsInterface(
850 ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *base)
852 FIXME("iface %p, base %p stub!\n", iface, base);
857 const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl =
859 /* ID3D11ShaderReflectionType methods */
860 d3dcompiler_shader_reflection_type_GetDesc,
861 d3dcompiler_shader_reflection_type_GetMemberTypeByIndex,
862 d3dcompiler_shader_reflection_type_GetMemberTypeByName,
863 d3dcompiler_shader_reflection_type_GetMemberTypeName,
864 d3dcompiler_shader_reflection_type_IsEqual,
865 d3dcompiler_shader_reflection_type_GetSubType,
866 d3dcompiler_shader_reflection_type_GetBaseClass,
867 d3dcompiler_shader_reflection_type_GetNumInterfaces,
868 d3dcompiler_shader_reflection_type_GetInterfaceByIndex,
869 d3dcompiler_shader_reflection_type_IsOfType,
870 d3dcompiler_shader_reflection_type_ImplementsInterface,
873 static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
875 const char *ptr = data;
876 DWORD size = data_size >> 2;
878 TRACE("Size %u\n", size);
880 read_dword(&ptr, &r->instruction_count);
881 TRACE("InstructionCount: %u\n", r->instruction_count);
883 read_dword(&ptr, &r->temp_register_count);
884 TRACE("TempRegisterCount: %u\n", r->temp_register_count);
886 skip_dword_unknown(&ptr, 1);
888 read_dword(&ptr, &r->dcl_count);
889 TRACE("DclCount: %u\n", r->dcl_count);
891 read_dword(&ptr, &r->float_instruction_count);
892 TRACE("FloatInstructionCount: %u\n", r->float_instruction_count);
894 read_dword(&ptr, &r->int_instruction_count);
895 TRACE("IntInstructionCount: %u\n", r->int_instruction_count);
897 read_dword(&ptr, &r->uint_instruction_count);
898 TRACE("UintInstructionCount: %u\n", r->uint_instruction_count);
900 read_dword(&ptr, &r->static_flow_control_count);
901 TRACE("StaticFlowControlCount: %u\n", r->static_flow_control_count);
903 read_dword(&ptr, &r->dynamic_flow_control_count);
904 TRACE("DynamicFlowControlCount: %u\n", r->dynamic_flow_control_count);
906 skip_dword_unknown(&ptr, 1);
908 read_dword(&ptr, &r->temp_array_count);
909 TRACE("TempArrayCount: %u\n", r->temp_array_count);
911 read_dword(&ptr, &r->array_instruction_count);
912 TRACE("ArrayInstructionCount: %u\n", r->array_instruction_count);
914 read_dword(&ptr, &r->cut_instruction_count);
915 TRACE("CutInstructionCount: %u\n", r->cut_instruction_count);
917 read_dword(&ptr, &r->emit_instruction_count);
918 TRACE("EmitInstructionCount: %u\n", r->emit_instruction_count);
920 read_dword(&ptr, &r->texture_normal_instructions);
921 TRACE("TextureNormalInstructions: %u\n", r->texture_normal_instructions);
923 read_dword(&ptr, &r->texture_load_instructions);
924 TRACE("TextureLoadInstructions: %u\n", r->texture_load_instructions);
926 read_dword(&ptr, &r->texture_comp_instructions);
927 TRACE("TextureCompInstructions: %u\n", r->texture_comp_instructions);
929 read_dword(&ptr, &r->texture_bias_instructions);
930 TRACE("TextureBiasInstructions: %u\n", r->texture_bias_instructions);
932 read_dword(&ptr, &r->texture_gradient_instructions);
933 TRACE("TextureGradientInstructions: %u\n", r->texture_gradient_instructions);
935 read_dword(&ptr, &r->mov_instruction_count);
936 TRACE("MovInstructionCount: %u\n", r->mov_instruction_count);
938 skip_dword_unknown(&ptr, 1);
940 read_dword(&ptr, &r->conversion_instruction_count);
941 TRACE("ConversionInstructionCount: %u\n", r->conversion_instruction_count);
943 skip_dword_unknown(&ptr, 1);
945 read_dword(&ptr, &r->input_primitive);
946 TRACE("InputPrimitive: %x\n", r->input_primitive);
948 read_dword(&ptr, &r->gs_output_topology);
949 TRACE("GSOutputTopology: %x\n", r->gs_output_topology);
951 read_dword(&ptr, &r->gs_max_output_vertex_count);
952 TRACE("GSMaxOutputVertexCount: %u\n", r->gs_max_output_vertex_count);
954 skip_dword_unknown(&ptr, 3);
957 if (size == 29) return S_OK;
959 skip_dword_unknown(&ptr, 1);
961 read_dword(&ptr, &r->c_control_points);
962 TRACE("cControlPoints: %u\n", r->c_control_points);
964 read_dword(&ptr, &r->hs_output_primitive);
965 TRACE("HSOutputPrimitive: %x\n", r->hs_output_primitive);
967 read_dword(&ptr, &r->hs_prtitioning);
968 TRACE("HSPartitioning: %x\n", r->hs_prtitioning);
970 read_dword(&ptr, &r->tessellator_domain);
971 TRACE("TessellatorDomain: %x\n", r->tessellator_domain);
973 skip_dword_unknown(&ptr, 3);
976 if (size == 37) return S_OK;
978 FIXME("Unhandled size %u\n", size);
983 static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type *type, const char *data, DWORD offset)
985 const char *ptr = data + offset;
987 D3D11_SHADER_TYPE_DESC *desc;
992 read_dword(&ptr, &temp);
993 desc->Class = temp & 0xffff;
994 desc->Type = temp >> 16;
995 TRACE("Class %x, Type %x\n", desc->Class, desc->Type);
997 read_dword(&ptr, &temp);
998 desc->Rows = temp & 0xffff;
999 desc->Columns = temp >> 16;
1000 TRACE("Rows %u, Columns %u\n", desc->Rows, desc->Columns);
1002 read_dword(&ptr, &temp);
1003 desc->Elements = temp & 0xffff;
1004 desc->Members = temp >> 16;
1005 TRACE("Elements %u, Members %u\n", desc->Elements, desc->Members);
1007 read_dword(&ptr, &temp);
1008 TRACE("Member Offset %u\n", temp);
1010 if ((type->reflection->target & 0xffff) >= 0x500)
1011 skip_dword_unknown(&ptr, 4);
1013 /* todo: Parse type members */
1014 for (i = 0; i < desc->Members; ++i)
1016 skip_dword_unknown(&ptr, 3);
1022 static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, DWORD offset)
1024 struct d3dcompiler_shader_reflection_type *type;
1025 struct wine_rb_entry *entry;
1028 entry = wine_rb_get(&reflection->types, &offset);
1031 TRACE("Returning existing type.\n");
1032 return WINE_RB_ENTRY_VALUE(entry, struct d3dcompiler_shader_reflection_type, entry);
1035 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
1038 ERR("Failed to allocate type memory.\n");
1042 type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3dcompiler_shader_reflection_type_vtbl;
1044 type->reflection = reflection;
1046 hr = d3dcompiler_parse_type(type, data, offset);
1049 ERR("Failed to parse type info, hr %#x.\n", hr);
1050 HeapFree(GetProcessHeap(), 0, type);
1054 if (wine_rb_put(&reflection->types, &offset, &type->entry) == -1)
1056 ERR("Failed to insert type entry.\n");
1057 HeapFree(GetProcessHeap(), 0, type);
1064 static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_constant_buffer *cb,
1065 const char *data, DWORD data_size, const char *ptr)
1067 struct d3dcompiler_shader_reflection_variable *variables;
1071 variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb->variable_count * sizeof(*variables));
1074 ERR("Failed to allocate variables memory.\n");
1075 return E_OUTOFMEMORY;
1078 for (i = 0; i < cb->variable_count; i++)
1080 struct d3dcompiler_shader_reflection_variable *v = &variables[i];
1083 v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl;
1084 v->constant_buffer = cb;
1086 read_dword(&ptr, &offset);
1087 if (!copy_name(data + offset, &v->name))
1089 ERR("Failed to copy name.\n");
1093 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1095 read_dword(&ptr, &v->start_offset);
1096 TRACE("Variable offset: %u\n", v->start_offset);
1098 read_dword(&ptr, &v->size);
1099 TRACE("Variable size: %u\n", v->size);
1101 read_dword(&ptr, &v->flags);
1102 TRACE("Variable flags: %u\n", v->flags);
1104 read_dword(&ptr, &offset);
1105 TRACE("Variable type offset: %x\n", offset);
1106 v->type = get_reflection_type(cb->reflection, data, offset);
1109 ERR("Failed to get type.\n");
1114 read_dword(&ptr, &offset);
1115 TRACE("Variable default value offset: %x\n", offset);
1116 if (!copy_value(data + offset, &v->default_value, offset ? v->size : 0))
1118 ERR("Failed to copy name.\n");
1123 if ((cb->reflection->target & 0xffff) >= 0x500)
1124 skip_dword_unknown(&ptr, 4);
1127 cb->variables = variables;
1132 for (i = 0; i < cb->variable_count; i++)
1134 free_variable(&variables[i]);
1136 HeapFree(GetProcessHeap(), 0, variables);
1140 static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
1142 const char *ptr = data;
1143 DWORD size = data_size >> 2;
1144 DWORD offset, cbuffer_offset, resource_offset, creator_offset;
1145 unsigned int i, string_data_offset, string_data_size;
1146 char *string_data = NULL, *creator = NULL;
1147 D3D11_SHADER_INPUT_BIND_DESC *bound_resources = NULL;
1148 struct d3dcompiler_shader_reflection_constant_buffer *constant_buffers = NULL;
1151 TRACE("Size %u\n", size);
1153 read_dword(&ptr, &r->constant_buffer_count);
1154 TRACE("Constant buffer count: %u\n", r->constant_buffer_count);
1156 read_dword(&ptr, &cbuffer_offset);
1157 TRACE("Constant buffer offset: %#x\n", cbuffer_offset);
1159 read_dword(&ptr, &r->bound_resource_count);
1160 TRACE("Bound resource count: %u\n", r->bound_resource_count);
1162 read_dword(&ptr, &resource_offset);
1163 TRACE("Bound resource offset: %#x\n", resource_offset);
1165 read_dword(&ptr, &r->target);
1166 TRACE("Target: %#x\n", r->target);
1168 read_dword(&ptr, &r->flags);
1169 TRACE("Flags: %u\n", r->flags);
1171 read_dword(&ptr, &creator_offset);
1172 TRACE("Creator at offset %#x.\n", creator_offset);
1174 if (!copy_name(data + creator_offset, &creator))
1176 ERR("Failed to copy name.\n");
1177 return E_OUTOFMEMORY;
1179 TRACE("Creator: %s.\n", debugstr_a(creator));
1181 /* todo: Parse RD11 */
1182 if ((r->target & 0x0000ffff) >= 0x500)
1184 skip_dword_unknown(&ptr, 8);
1187 if (r->bound_resource_count)
1189 /* 8 for each bind desc */
1190 string_data_offset = resource_offset + r->bound_resource_count * 8 * sizeof(DWORD);
1191 string_data_size = (cbuffer_offset ? cbuffer_offset : creator_offset) - string_data_offset;
1193 string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
1196 ERR("Failed to allocate string data memory.\n");
1200 memcpy(string_data, data + string_data_offset, string_data_size);
1202 bound_resources = HeapAlloc(GetProcessHeap(), 0, r->bound_resource_count * sizeof(*bound_resources));
1203 if (!bound_resources)
1205 ERR("Failed to allocate resources memory.\n");
1210 ptr = data + resource_offset;
1211 for (i = 0; i < r->bound_resource_count; i++)
1213 D3D11_SHADER_INPUT_BIND_DESC *desc = &bound_resources[i];
1215 read_dword(&ptr, &offset);
1216 desc->Name = string_data + (offset - string_data_offset);
1217 TRACE("Input bind Name: %s\n", debugstr_a(desc->Name));
1219 read_dword(&ptr, &desc->Type);
1220 TRACE("Input bind Type: %#x\n", desc->Type);
1222 read_dword(&ptr, &desc->ReturnType);
1223 TRACE("Input bind ReturnType: %#x\n", desc->ReturnType);
1225 read_dword(&ptr, &desc->Dimension);
1226 TRACE("Input bind Dimension: %#x\n", desc->Dimension);
1228 read_dword(&ptr, &desc->NumSamples);
1229 TRACE("Input bind NumSamples: %u\n", desc->NumSamples);
1231 read_dword(&ptr, &desc->BindPoint);
1232 TRACE("Input bind BindPoint: %u\n", desc->BindPoint);
1234 read_dword(&ptr, &desc->BindCount);
1235 TRACE("Input bind BindCount: %u\n", desc->BindCount);
1237 read_dword(&ptr, &desc->uFlags);
1238 TRACE("Input bind uFlags: %u\n", desc->uFlags);
1242 if (r->constant_buffer_count)
1244 constant_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, r->constant_buffer_count * sizeof(*constant_buffers));
1245 if (!constant_buffers)
1247 ERR("Failed to allocate constant buffer memory.\n");
1252 ptr = data + cbuffer_offset;
1253 for (i = 0; i < r->constant_buffer_count; i++)
1255 struct d3dcompiler_shader_reflection_constant_buffer *cb = &constant_buffers[i];
1257 cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3dcompiler_shader_reflection_constant_buffer_vtbl;
1260 read_dword(&ptr, &offset);
1261 if (!copy_name(data + offset, &cb->name))
1263 ERR("Failed to copy name.\n");
1267 TRACE("Name: %s.\n", debugstr_a(cb->name));
1269 read_dword(&ptr, &cb->variable_count);
1270 TRACE("Variable count: %u\n", cb->variable_count);
1272 read_dword(&ptr, &offset);
1273 TRACE("Variable offset: %x\n", offset);
1275 hr = d3dcompiler_parse_variables(cb, data, data_size, data + offset);
1278 FIXME("Failed to parse variables.");
1282 read_dword(&ptr, &cb->size);
1283 TRACE("Cbuffer size: %u\n", cb->size);
1285 read_dword(&ptr, &cb->flags);
1286 TRACE("Cbuffer flags: %u\n", cb->flags);
1288 read_dword(&ptr, &cb->type);
1289 TRACE("Cbuffer type: %#x\n", cb->type);
1293 r->creator = creator;
1294 r->resource_string = string_data;
1295 r->bound_resources = bound_resources;
1296 r->constant_buffers = constant_buffers;
1301 for (i = 0; i < r->constant_buffer_count; ++i)
1303 free_constant_buffer(&constant_buffers[i]);
1305 HeapFree(GetProcessHeap(), 0, constant_buffers);
1306 HeapFree(GetProcessHeap(), 0, bound_resources);
1307 HeapFree(GetProcessHeap(), 0, string_data);
1308 HeapFree(GetProcessHeap(), 0, creator);
1313 HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section)
1315 D3D11_SIGNATURE_PARAMETER_DESC *d;
1316 unsigned int string_data_offset;
1317 unsigned int string_data_size;
1318 const char *ptr = section->data;
1322 enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE element_size;
1324 switch (section->tag)
1327 element_size = D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7;
1333 element_size = D3DCOMPILER_SIGNATURE_ELEMENT_SIZE6;
1337 FIXME("Unhandled section %s!\n", debugstr_an((const char *)§ion->tag, 4));
1338 element_size = D3DCOMPILER_SIGNATURE_ELEMENT_SIZE6;
1342 read_dword(&ptr, &count);
1343 TRACE("%u elements\n", count);
1345 skip_dword_unknown(&ptr, 1);
1347 d = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*d));
1350 ERR("Failed to allocate signature memory.\n");
1351 return E_OUTOFMEMORY;
1354 /* 2 DWORDs for the header, element_size for each element. */
1355 string_data_offset = 2 * sizeof(DWORD) + count * element_size * sizeof(DWORD);
1356 string_data_size = section->data_size - string_data_offset;
1358 string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
1361 ERR("Failed to allocate string data memory.\n");
1362 HeapFree(GetProcessHeap(), 0, d);
1363 return E_OUTOFMEMORY;
1365 memcpy(string_data, section->data + string_data_offset, string_data_size);
1367 for (i = 0; i < count; ++i)
1372 if (element_size == D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7)
1374 read_dword(&ptr, &d[i].Stream);
1381 read_dword(&ptr, &name_offset);
1382 d[i].SemanticName = string_data + (name_offset - string_data_offset);
1383 read_dword(&ptr, &d[i].SemanticIndex);
1384 read_dword(&ptr, &d[i].SystemValueType);
1385 read_dword(&ptr, &d[i].ComponentType);
1386 read_dword(&ptr, &d[i].Register);
1387 read_dword(&ptr, &mask);
1388 d[i].ReadWriteMask = (mask >> 8) & 0xff;
1389 d[i].Mask = mask & 0xff;
1391 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
1392 "type %u, register idx: %u, use_mask %#x, input_mask %#x, stream %u\n",
1393 debugstr_a(d[i].SemanticName), d[i].SemanticIndex, d[i].SystemValueType,
1394 d[i].ComponentType, d[i].Register, d[i].Mask, d[i].ReadWriteMask, d[i].Stream);
1398 s->element_count = count;
1399 s->string_data = string_data;
1404 static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
1406 const char *ptr = data;
1408 read_dword(&ptr, &r->version);
1409 TRACE("Shader version: %u\n", r->version);
1411 /* todo: Check if anything else is needed from the shdr or shex blob. */
1416 HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection *reflection,
1417 const void *data, SIZE_T data_size)
1419 struct dxbc src_dxbc;
1423 reflection->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
1424 reflection->refcount = 1;
1426 if (wine_rb_init(&reflection->types, &d3dcompiler_shader_reflection_type_rb_functions) == -1)
1428 ERR("Failed to initialize type rbtree.\n");
1432 hr = dxbc_parse(data, data_size, &src_dxbc);
1435 WARN("Failed to parse reflection\n");
1439 for (i = 0; i < src_dxbc.count; ++i)
1441 struct dxbc_section *section = &src_dxbc.sections[i];
1443 switch (section->tag)
1446 hr = d3dcompiler_parse_stat(reflection, section->data, section->data_size);
1449 WARN("Failed to parse section STAT.\n");
1456 hr = d3dcompiler_parse_shdr(reflection, section->data, section->data_size);
1459 WARN("Failed to parse SHDR section.\n");
1465 hr = d3dcompiler_parse_rdef(reflection, section->data, section->data_size);
1468 WARN("Failed to parse RDEF section.\n");
1474 reflection->isgn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*reflection->isgn));
1475 if (!reflection->isgn)
1477 ERR("Failed to allocate ISGN memory.\n");
1482 hr = d3dcompiler_parse_signature(reflection->isgn, section);
1485 WARN("Failed to parse section ISGN.\n");
1492 reflection->osgn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*reflection->osgn));
1493 if (!reflection->osgn)
1495 ERR("Failed to allocate OSGN memory.\n");
1500 hr = d3dcompiler_parse_signature(reflection->osgn, section);
1503 WARN("Failed to parse section OSGN.\n");
1509 reflection->pcsg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*reflection->pcsg));
1510 if (!reflection->pcsg)
1512 ERR("Failed to allocate PCSG memory.\n");
1517 hr = d3dcompiler_parse_signature(reflection->pcsg, section);
1520 WARN("Failed to parse section PCSG.\n");
1526 FIXME("Unhandled section %s!\n", debugstr_an((const char *)§ion->tag, 4));
1531 dxbc_destroy(&src_dxbc);
1536 reflection_cleanup(reflection);
1537 dxbc_destroy(&src_dxbc);