ReactOS  0.4.15-dev-494-g1d8c567
reflection.c
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Henri Verbeet for CodeWeavers
3  * Copyright 2010 Rico Schüller
4  *
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.
9  *
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.
14  *
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
18  *
19  */
20 
21 #include "initguid.h"
22 #include "d3dcompiler_private.h"
23 #include "wine/winternl.h"
24 
25 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
26 
28 {
31 };
32 
33 #define D3DCOMPILER_SHADER_TARGET_VERSION_MASK 0xffff
34 #define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_MASK 0xffff0000
35 
37 {
40  char *string_data;
41 };
42 
44 {
45  ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface;
46 
49 
51 
54  char *name;
55 };
56 
58 {
59  char *name;
62 };
63 
65 {
66  ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable_iface;
67 
70 
71  char *name;
76 };
77 
79 {
80  ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer_iface;
81 
83 
84  char *name;
89 
91 };
92 
93 /* ID3D11ShaderReflection */
95 {
96  ID3D11ShaderReflection ID3D11ShaderReflection_iface;
98 
100  char *creator;
105 
132 
140 };
141 
143 
144 static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl;
145 static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl;
146 static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl;
147 
148 /* null objects - needed for invalid calls */
153 
154 static BOOL copy_name(const char *ptr, char **name)
155 {
156  size_t name_len;
157 
158  if (!ptr) return TRUE;
159 
160  name_len = strlen(ptr) + 1;
161  if (name_len == 1)
162  {
163  return TRUE;
164  }
165 
166  *name = HeapAlloc(GetProcessHeap(), 0, name_len);
167  if (!*name)
168  {
169  ERR("Failed to allocate name memory.\n");
170  return FALSE;
171  }
172 
173  memcpy(*name, ptr, name_len);
174 
175  return TRUE;
176 }
177 
178 static BOOL copy_value(const char *ptr, void **value, DWORD size)
179 {
180  if (!ptr || !size) return TRUE;
181 
183  if (!*value)
184  {
185  ERR("Failed to allocate value memory.\n");
186  return FALSE;
187  }
188 
189  memcpy(*value, ptr, size);
190 
191  return TRUE;
192 }
193 
195 {
197  const DWORD *id = key;
198 
199  return *id - t->id;
200 }
201 
203 {
204  if (member)
205  {
207  }
208 }
209 
211 {
213  unsigned int i;
214 
215  TRACE("reflection type %p.\n", t);
216 
217  if (t->members)
218  {
219  for (i = 0; i < t->desc.Members; ++i)
220  {
221  free_type_member(&t->members[i]);
222  }
223  HeapFree(GetProcessHeap(), 0, t->members);
224  }
225 
226  heap_free(t->name);
227  HeapFree(GetProcessHeap(), 0, t);
228 }
229 
231 {
232  TRACE("Free signature %p\n", sig);
233 
234  HeapFree(GetProcessHeap(), 0, sig->elements);
235  HeapFree(GetProcessHeap(), 0, sig->string_data);
236 }
237 
239 {
240  if (var)
241  {
242  HeapFree(GetProcessHeap(), 0, var->name);
243  HeapFree(GetProcessHeap(), 0, var->default_value);
244  }
245 }
246 
248 {
249  if (cb->variables)
250  {
251  unsigned int i;
252 
253  for (i = 0; i < cb->variable_count; ++i)
254  {
255  free_variable(&cb->variables[i]);
256  }
257  HeapFree(GetProcessHeap(), 0, cb->variables);
258  }
259 
260  HeapFree(GetProcessHeap(), 0, cb->name);
261 }
262 
264 {
265  TRACE("Cleanup %p\n", ref);
266 
267  if (ref->isgn)
268  {
269  free_signature(ref->isgn);
270  HeapFree(GetProcessHeap(), 0, ref->isgn);
271  }
272 
273  if (ref->osgn)
274  {
275  free_signature(ref->osgn);
276  HeapFree(GetProcessHeap(), 0, ref->osgn);
277  }
278 
279  if (ref->pcsg)
280  {
281  free_signature(ref->pcsg);
282  HeapFree(GetProcessHeap(), 0, ref->pcsg);
283  }
284 
285  if (ref->constant_buffers)
286  {
287  unsigned int i;
288 
289  for (i = 0; i < ref->constant_buffer_count; ++i)
290  {
291  free_constant_buffer(&ref->constant_buffers[i]);
292  }
293  }
294 
296  HeapFree(GetProcessHeap(), 0, ref->constant_buffers);
297  HeapFree(GetProcessHeap(), 0, ref->bound_resources);
298  HeapFree(GetProcessHeap(), 0, ref->resource_string);
299  HeapFree(GetProcessHeap(), 0, ref->creator);
300 }
301 
302 /* IUnknown methods */
303 
304 static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface)
305 {
307 }
308 
309 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object)
310 {
311  TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
312 
313  if (IsEqualGUID(riid, &IID_ID3D11ShaderReflection)
315  {
316  IUnknown_AddRef(iface);
317  *object = iface;
318  return S_OK;
319  }
320 
321  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
322 
323  *object = NULL;
324  return E_NOINTERFACE;
325 }
326 
327 static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11ShaderReflection *iface)
328 {
330  ULONG refcount = InterlockedIncrement(&This->refcount);
331 
332  TRACE("%p increasing refcount to %u\n", This, refcount);
333 
334  return refcount;
335 }
336 
337 static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface)
338 {
340  ULONG refcount = InterlockedDecrement(&This->refcount);
341 
342  TRACE("%p decreasing refcount to %u\n", This, refcount);
343 
344  if (!refcount)
345  {
348  }
349 
350  return refcount;
351 }
352 
353 /* ID3D11ShaderReflection methods */
354 
356 {
358 
359  FIXME("iface %p, desc %p partial stub!\n", iface, desc);
360 
361  if (!desc)
362  {
363  WARN("Invalid argument specified\n");
364  return E_FAIL;
365  }
366 
367  desc->Version = This->version;
368  desc->Creator = This->creator;
369  desc->Flags = This->flags;
370  desc->ConstantBuffers = This->constant_buffer_count;
371  desc->BoundResources = This->bound_resource_count;
372  desc->InputParameters = This->isgn ? This->isgn->element_count : 0;
373  desc->OutputParameters = This->osgn ? This->osgn->element_count : 0;
374  desc->InstructionCount = This->instruction_count;
375  desc->TempRegisterCount = This->temp_register_count;
376  desc->TempArrayCount = This->temp_array_count;
377  desc->DefCount = 0;
378  desc->DclCount = This->dcl_count;
379  desc->TextureNormalInstructions = This->texture_normal_instructions;
380  desc->TextureLoadInstructions = This->texture_load_instructions;
381  desc->TextureCompInstructions = This->texture_comp_instructions;
382  desc->TextureBiasInstructions = This->texture_bias_instructions;
383  desc->TextureGradientInstructions = This->texture_gradient_instructions;
384  desc->FloatInstructionCount = This->float_instruction_count;
385  desc->IntInstructionCount = This->int_instruction_count;
386  desc->UintInstructionCount = This->uint_instruction_count;
387  desc->StaticFlowControlCount = This->static_flow_control_count;
388  desc->DynamicFlowControlCount = This->dynamic_flow_control_count;
389  desc->MacroInstructionCount = 0;
390  desc->ArrayInstructionCount = This->array_instruction_count;
391  desc->CutInstructionCount = This->cut_instruction_count;
392  desc->EmitInstructionCount = This->emit_instruction_count;
393  desc->GSOutputTopology = This->gs_output_topology;
394  desc->GSMaxOutputVertexCount = This->gs_max_output_vertex_count;
395  desc->InputPrimitive = This->input_primitive;
396  desc->PatchConstantParameters = This->pcsg ? This->pcsg->element_count : 0;
397  desc->cGSInstanceCount = 0;
398  desc->cControlPoints = This->c_control_points;
399  desc->HSOutputPrimitive = This->hs_output_primitive;
400  desc->HSPartitioning = This->hs_prtitioning;
401  desc->TessellatorDomain = This->tessellator_domain;
402  desc->cBarrierInstructions = 0;
403  desc->cInterlockedInstructions = 0;
404  desc->cTextureStoreInstructions = 0;
405 
406  return S_OK;
407 }
408 
409 static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByIndex(
410  ID3D11ShaderReflection *iface, UINT index)
411 {
413 
414  TRACE("iface %p, index %u\n", iface, index);
415 
416  if (index >= This->constant_buffer_count)
417  {
418  WARN("Invalid argument specified\n");
419  return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
420  }
421 
422  return &This->constant_buffers[index].ID3D11ShaderReflectionConstantBuffer_iface;
423 }
424 
425 static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName(
426  ID3D11ShaderReflection *iface, const char *name)
427 {
429  unsigned int i;
430 
431  TRACE("iface %p, name %s\n", iface, debugstr_a(name));
432 
433  if (!name)
434  {
435  WARN("Invalid argument specified\n");
436  return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
437  }
438 
439  for (i = 0; i < This->constant_buffer_count; ++i)
440  {
441  struct d3dcompiler_shader_reflection_constant_buffer *d = &This->constant_buffers[i];
442 
443  if (!strcmp(d->name, name))
444  {
445  TRACE("Returning ID3D11ShaderReflectionConstantBuffer %p.\n", d);
446  return &d->ID3D11ShaderReflectionConstantBuffer_iface;
447  }
448  }
449 
450  WARN("Invalid name specified\n");
451 
452  return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
453 }
454 
456  ID3D11ShaderReflection *iface, UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc)
457 {
459 
460  TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
461 
462  if (!desc || index >= This->bound_resource_count)
463  {
464  WARN("Invalid argument specified\n");
465  return E_INVALIDARG;
466  }
467 
468  *desc = This->bound_resources[index];
469 
470  return S_OK;
471 }
472 
474  ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
475 {
477 
478  TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
479 
480  if (!desc || !This->isgn || index >= This->isgn->element_count)
481  {
482  WARN("Invalid argument specified\n");
483  return E_INVALIDARG;
484  }
485 
486  *desc = This->isgn->elements[index];
487 
488  return S_OK;
489 }
490 
492  ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
493 {
495 
496  TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
497 
498  if (!desc || !This->osgn || index >= This->osgn->element_count)
499  {
500  WARN("Invalid argument specified\n");
501  return E_INVALIDARG;
502  }
503 
504  *desc = This->osgn->elements[index];
505 
506  return S_OK;
507 }
508 
510  ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
511 {
513 
514  TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
515 
516  if (!desc || !This->pcsg || index >= This->pcsg->element_count)
517  {
518  WARN("Invalid argument specified\n");
519  return E_INVALIDARG;
520  }
521 
522  *desc = This->pcsg->elements[index];
523 
524  return S_OK;
525 }
526 
527 static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName(
528  ID3D11ShaderReflection *iface, const char *name)
529 {
531  unsigned int i, k;
532 
533  TRACE("iface %p, name %s\n", iface, debugstr_a(name));
534 
535  if (!name)
536  {
537  WARN("Invalid name specified\n");
538  return &null_variable.ID3D11ShaderReflectionVariable_iface;
539  }
540 
541  for (i = 0; i < This->constant_buffer_count; ++i)
542  {
543  struct d3dcompiler_shader_reflection_constant_buffer *cb = &This->constant_buffers[i];
544 
545  for (k = 0; k < cb->variable_count; ++k)
546  {
547  struct d3dcompiler_shader_reflection_variable *v = &cb->variables[k];
548 
549  if (!strcmp(v->name, name))
550  {
551  TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
552  return &v->ID3D11ShaderReflectionVariable_iface;
553  }
554  }
555  }
556 
557  WARN("Invalid name specified\n");
558 
559  return &null_variable.ID3D11ShaderReflectionVariable_iface;
560 }
561 
563  ID3D11ShaderReflection *iface, const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc)
564 {
566  unsigned int i;
567 
568  TRACE("iface %p, name %s, desc %p\n", iface, debugstr_a(name), desc);
569 
570  if (!desc || !name)
571  {
572  WARN("Invalid argument specified\n");
573  return E_INVALIDARG;
574  }
575 
576  for (i = 0; i < This->bound_resource_count; ++i)
577  {
578  D3D11_SHADER_INPUT_BIND_DESC *d = &This->bound_resources[i];
579 
580  if (!strcmp(d->Name, name))
581  {
582  TRACE("Returning D3D11_SHADER_INPUT_BIND_DESC %p.\n", d);
583  *desc = *d;
584  return S_OK;
585  }
586  }
587 
588  WARN("Invalid name specified\n");
589 
590  return E_INVALIDARG;
591 }
592 
594  ID3D11ShaderReflection *iface)
595 {
597 
598  TRACE("iface %p\n", iface);
599 
600  return This->mov_instruction_count;
601 }
602 
604  ID3D11ShaderReflection *iface)
605 {
606  FIXME("iface %p stub!\n", iface);
607 
608  return 0;
609 }
610 
612  ID3D11ShaderReflection *iface)
613 {
615 
616  TRACE("iface %p\n", iface);
617 
618  return This->conversion_instruction_count;
619 }
620 
622  ID3D11ShaderReflection *iface)
623 {
624  FIXME("iface %p stub!\n", iface);
625 
626  return 0;
627 }
628 
630  ID3D11ShaderReflection *iface)
631 {
632  FIXME("iface %p stub!\n", iface);
633 
634  return 0;
635 }
636 
638  ID3D11ShaderReflection *iface)
639 {
640  FIXME("iface %p stub!\n", iface);
641 
642  return FALSE;
643 }
644 
646  ID3D11ShaderReflection *iface)
647 {
648  FIXME("iface %p stub!\n", iface);
649 
650  return 0;
651 }
652 
654  ID3D11ShaderReflection *iface, D3D_FEATURE_LEVEL *level)
655 {
656  FIXME("iface %p, level %p stub!\n", iface, level);
657 
658  return E_NOTIMPL;
659 }
660 
662  ID3D11ShaderReflection *iface, UINT *sizex, UINT *sizey, UINT *sizez)
663 {
664  FIXME("iface %p, sizex %p, sizey %p, sizez %p stub!\n", iface, sizex, sizey, sizez);
665 
666  return 0;
667 }
668 
670  ID3D11ShaderReflection *iface)
671 {
672  FIXME("iface %p stub!\n", iface);
673 
674  return 0;
675 }
676 
677 static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl =
678 {
679  /* IUnknown methods */
683  /* ID3D11ShaderReflection methods */
703 };
704 
705 /* ID3D11ShaderReflectionConstantBuffer methods */
706 
707 static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface)
708 {
710 }
711 
713  ID3D11ShaderReflectionConstantBuffer *iface, D3D11_SHADER_BUFFER_DESC *desc)
714 {
716 
717  TRACE("iface %p, desc %p\n", iface, desc);
718 
719  if (This == &null_constant_buffer)
720  {
721  WARN("Null constant buffer specified\n");
722  return E_FAIL;
723  }
724 
725  if (!desc)
726  {
727  WARN("Invalid argument specified\n");
728  return E_FAIL;
729  }
730 
731  desc->Name = This->name;
732  desc->Type = This->type;
733  desc->Variables = This->variable_count;
734  desc->Size = This->size;
735  desc->uFlags = This->flags;
736 
737  return S_OK;
738 }
739 
741  ID3D11ShaderReflectionConstantBuffer *iface, UINT index)
742 {
744 
745  TRACE("iface %p, index %u\n", iface, index);
746 
747  if (index >= This->variable_count)
748  {
749  WARN("Invalid index specified\n");
750  return &null_variable.ID3D11ShaderReflectionVariable_iface;
751  }
752 
753  return &This->variables[index].ID3D11ShaderReflectionVariable_iface;
754 }
755 
757  ID3D11ShaderReflectionConstantBuffer *iface, const char *name)
758 {
760  unsigned int i;
761 
762  TRACE("iface %p, name %s\n", iface, debugstr_a(name));
763 
764  if (!name)
765  {
766  WARN("Invalid argument specified\n");
767  return &null_variable.ID3D11ShaderReflectionVariable_iface;
768  }
769 
770  for (i = 0; i < This->variable_count; ++i)
771  {
772  struct d3dcompiler_shader_reflection_variable *v = &This->variables[i];
773 
774  if (!strcmp(v->name, name))
775  {
776  TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
777  return &v->ID3D11ShaderReflectionVariable_iface;
778  }
779  }
780 
781  WARN("Invalid name specified\n");
782 
783  return &null_variable.ID3D11ShaderReflectionVariable_iface;
784 }
785 
786 static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl =
787 {
788  /* ID3D11ShaderReflectionConstantBuffer methods */
792 };
793 
794 /* ID3D11ShaderReflectionVariable methods */
795 
796 static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface)
797 {
799 }
800 
802  ID3D11ShaderReflectionVariable *iface, D3D11_SHADER_VARIABLE_DESC *desc)
803 {
805 
806  TRACE("iface %p, desc %p\n", iface, desc);
807 
808  if (This == &null_variable)
809  {
810  WARN("Null variable specified\n");
811  return E_FAIL;
812  }
813 
814  if (!desc)
815  {
816  WARN("Invalid argument specified\n");
817  return E_FAIL;
818  }
819 
820  desc->Name = This->name;
821  desc->StartOffset = This->start_offset;
822  desc->Size = This->size;
823  desc->uFlags = This->flags;
824  desc->DefaultValue = This->default_value;
825 
826  return S_OK;
827 }
828 
830  ID3D11ShaderReflectionVariable *iface)
831 {
833 
834  TRACE("iface %p\n", iface);
835 
836  return &This->type->ID3D11ShaderReflectionType_iface;
837 }
838 
839 static ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetBuffer(
840  ID3D11ShaderReflectionVariable *iface)
841 {
843 
844  TRACE("iface %p\n", iface);
845 
846  return &This->constant_buffer->ID3D11ShaderReflectionConstantBuffer_iface;
847 }
848 
850  ID3D11ShaderReflectionVariable *iface, UINT index)
851 {
852  FIXME("iface %p, index %u stub!\n", iface, index);
853 
854  return 0;
855 }
856 
857 static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl =
858 {
859  /* ID3D11ShaderReflectionVariable methods */
864 };
865 
866 /* ID3D11ShaderReflectionType methods */
867 
868 static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface)
869 {
871 }
872 
874  ID3D11ShaderReflectionType *iface, D3D11_SHADER_TYPE_DESC *desc)
875 {
877 
878  TRACE("iface %p, desc %p\n", iface, desc);
879 
880  if (This == &null_type)
881  {
882  WARN("Null type specified\n");
883  return E_FAIL;
884  }
885 
886  if (!desc)
887  {
888  WARN("Invalid argument specified\n");
889  return E_FAIL;
890  }
891 
892  *desc = This->desc;
893 
894  return S_OK;
895 }
896 
898  ID3D11ShaderReflectionType *iface, UINT index)
899 {
901 
902  TRACE("iface %p, index %u\n", iface, index);
903 
904  if (index >= This->desc.Members)
905  {
906  WARN("Invalid index specified\n");
907  return &null_type.ID3D11ShaderReflectionType_iface;
908  }
909 
910  return &This->members[index].type->ID3D11ShaderReflectionType_iface;
911 }
912 
914  ID3D11ShaderReflectionType *iface, const char *name)
915 {
917  unsigned int i;
918 
919  TRACE("iface %p, name %s\n", iface, debugstr_a(name));
920 
921  if (!name)
922  {
923  WARN("Invalid argument specified\n");
924  return &null_type.ID3D11ShaderReflectionType_iface;
925  }
926 
927  for (i = 0; i < This->desc.Members; ++i)
928  {
930 
931  if (!strcmp(member->name, name))
932  {
933  TRACE("Returning ID3D11ShaderReflectionType %p.\n", member->type);
934  return &member->type->ID3D11ShaderReflectionType_iface;
935  }
936  }
937 
938  WARN("Invalid name specified\n");
939 
940  return &null_type.ID3D11ShaderReflectionType_iface;
941 }
942 
944  ID3D11ShaderReflectionType *iface, UINT index)
945 {
947 
948  TRACE("iface %p, index %u\n", iface, index);
949 
950  if (This == &null_type)
951  {
952  WARN("Null type specified\n");
953  return "$Invalid";
954  }
955 
956  if (index >= This->desc.Members)
957  {
958  WARN("Invalid index specified\n");
959  return NULL;
960  }
961 
962  return This->members[index].name;
963 }
964 
966  ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type)
967 {
969 
970  TRACE("iface %p, type %p\n", iface, type);
971 
972  if (This == &null_type)
973  {
974  WARN("Null type specified\n");
975  return E_FAIL;
976  }
977 
978  if (iface == type)
979  return S_OK;
980 
981  return S_FALSE;
982 }
983 
985  ID3D11ShaderReflectionType *iface)
986 {
987  FIXME("iface %p stub!\n", iface);
988 
989  return NULL;
990 }
991 
993  ID3D11ShaderReflectionType *iface)
994 {
995  FIXME("iface %p stub!\n", iface);
996 
997  return NULL;
998 }
999 
1001  ID3D11ShaderReflectionType *iface)
1002 {
1003  FIXME("iface %p stub!\n", iface);
1004 
1005  return 0;
1006 }
1007 
1009  ID3D11ShaderReflectionType *iface, UINT index)
1010 {
1011  FIXME("iface %p, index %u stub!\n", iface, index);
1012 
1013  return NULL;
1014 }
1015 
1017  ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type)
1018 {
1019  FIXME("iface %p, type %p stub!\n", iface, type);
1020 
1021  return E_NOTIMPL;
1022 }
1023 
1025  ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *base)
1026 {
1027  FIXME("iface %p, base %p stub!\n", iface, base);
1028 
1029  return E_NOTIMPL;
1030 }
1031 
1032 static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl =
1033 {
1034  /* ID3D11ShaderReflectionType methods */
1046 };
1047 
1049 {
1050  const char *ptr = data;
1051  DWORD size = data_size >> 2;
1052 
1053  TRACE("Size %u\n", size);
1054 
1055  read_dword(&ptr, &r->instruction_count);
1056  TRACE("InstructionCount: %u\n", r->instruction_count);
1057 
1058  read_dword(&ptr, &r->temp_register_count);
1059  TRACE("TempRegisterCount: %u\n", r->temp_register_count);
1060 
1061  skip_dword_unknown(&ptr, 1);
1062 
1063  read_dword(&ptr, &r->dcl_count);
1064  TRACE("DclCount: %u\n", r->dcl_count);
1065 
1066  read_dword(&ptr, &r->float_instruction_count);
1067  TRACE("FloatInstructionCount: %u\n", r->float_instruction_count);
1068 
1069  read_dword(&ptr, &r->int_instruction_count);
1070  TRACE("IntInstructionCount: %u\n", r->int_instruction_count);
1071 
1072  read_dword(&ptr, &r->uint_instruction_count);
1073  TRACE("UintInstructionCount: %u\n", r->uint_instruction_count);
1074 
1075  read_dword(&ptr, &r->static_flow_control_count);
1076  TRACE("StaticFlowControlCount: %u\n", r->static_flow_control_count);
1077 
1078  read_dword(&ptr, &r->dynamic_flow_control_count);
1079  TRACE("DynamicFlowControlCount: %u\n", r->dynamic_flow_control_count);
1080 
1081  skip_dword_unknown(&ptr, 1);
1082 
1083  read_dword(&ptr, &r->temp_array_count);
1084  TRACE("TempArrayCount: %u\n", r->temp_array_count);
1085 
1086  read_dword(&ptr, &r->array_instruction_count);
1087  TRACE("ArrayInstructionCount: %u\n", r->array_instruction_count);
1088 
1089  read_dword(&ptr, &r->cut_instruction_count);
1090  TRACE("CutInstructionCount: %u\n", r->cut_instruction_count);
1091 
1092  read_dword(&ptr, &r->emit_instruction_count);
1093  TRACE("EmitInstructionCount: %u\n", r->emit_instruction_count);
1094 
1095  read_dword(&ptr, &r->texture_normal_instructions);
1096  TRACE("TextureNormalInstructions: %u\n", r->texture_normal_instructions);
1097 
1098  read_dword(&ptr, &r->texture_load_instructions);
1099  TRACE("TextureLoadInstructions: %u\n", r->texture_load_instructions);
1100 
1101  read_dword(&ptr, &r->texture_comp_instructions);
1102  TRACE("TextureCompInstructions: %u\n", r->texture_comp_instructions);
1103 
1104  read_dword(&ptr, &r->texture_bias_instructions);
1105  TRACE("TextureBiasInstructions: %u\n", r->texture_bias_instructions);
1106 
1107  read_dword(&ptr, &r->texture_gradient_instructions);
1108  TRACE("TextureGradientInstructions: %u\n", r->texture_gradient_instructions);
1109 
1110  read_dword(&ptr, &r->mov_instruction_count);
1111  TRACE("MovInstructionCount: %u\n", r->mov_instruction_count);
1112 
1113  skip_dword_unknown(&ptr, 1);
1114 
1115  read_dword(&ptr, &r->conversion_instruction_count);
1116  TRACE("ConversionInstructionCount: %u\n", r->conversion_instruction_count);
1117 
1118  skip_dword_unknown(&ptr, 1);
1119 
1120 #ifdef __REACTOS__ /* DWORD* cast added */
1121  read_dword(&ptr, (DWORD*)&r->input_primitive);
1122 #else
1123  read_dword(&ptr, &r->input_primitive);
1124 #endif
1125  TRACE("InputPrimitive: %x\n", r->input_primitive);
1126 
1127 #ifdef __REACTOS__ /* DWORD* cast added */
1128  read_dword(&ptr, (DWORD*)&r->gs_output_topology);
1129 #else
1130  read_dword(&ptr, &r->gs_output_topology);
1131 #endif
1132  TRACE("GSOutputTopology: %x\n", r->gs_output_topology);
1133 
1134  read_dword(&ptr, &r->gs_max_output_vertex_count);
1135  TRACE("GSMaxOutputVertexCount: %u\n", r->gs_max_output_vertex_count);
1136 
1137  skip_dword_unknown(&ptr, 2);
1138 
1139  /* old dx10 stat size */
1140  if (size == 28) return S_OK;
1141 
1142  skip_dword_unknown(&ptr, 1);
1143 
1144  /* dx10 stat size */
1145  if (size == 29) return S_OK;
1146 
1147  skip_dword_unknown(&ptr, 1);
1148 
1149  read_dword(&ptr, &r->c_control_points);
1150  TRACE("cControlPoints: %u\n", r->c_control_points);
1151 
1152 #ifdef __REACTOS__ /* DWORD* cast added */
1153  read_dword(&ptr, (DWORD*)&r->hs_output_primitive);
1154 #else
1155  read_dword(&ptr, &r->hs_output_primitive);
1156 #endif
1157  TRACE("HSOutputPrimitive: %x\n", r->hs_output_primitive);
1158 
1159 #ifdef __REACTOS__ /* DWORD* cast added */
1160  read_dword(&ptr, (DWORD*)&r->hs_prtitioning);
1161 #else
1162  read_dword(&ptr, &r->hs_prtitioning);
1163 #endif
1164  TRACE("HSPartitioning: %x\n", r->hs_prtitioning);
1165 
1166 #ifdef __REACTOS__ /* DWORD* cast added */
1167  read_dword(&ptr, (DWORD*)&r->tessellator_domain);
1168 #else
1169  read_dword(&ptr, &r->tessellator_domain);
1170 #endif
1171  TRACE("TessellatorDomain: %x\n", r->tessellator_domain);
1172 
1173  skip_dword_unknown(&ptr, 3);
1174 
1175  /* dx11 stat size */
1176  if (size == 37) return S_OK;
1177 
1178  FIXME("Unhandled size %u\n", size);
1179 
1180  return E_FAIL;
1181 }
1182 
1184  struct d3dcompiler_shader_reflection_type_member *member, const char *data, const char **ptr)
1185 {
1186  DWORD offset;
1187 
1188  read_dword(ptr, &offset);
1189  if (!copy_name(data + offset, &member->name))
1190  {
1191  ERR("Failed to copy name.\n");
1192  return E_OUTOFMEMORY;
1193  }
1194  TRACE("Member name: %s.\n", debugstr_a(member->name));
1195 
1196  read_dword(ptr, &offset);
1197  TRACE("Member type offset: %x\n", offset);
1198 
1200  if (!member->type)
1201  {
1202  ERR("Failed to get member type\n");
1204  return E_FAIL;
1205  }
1206 
1207  read_dword(ptr, &member->offset);
1208  TRACE("Member offset %x\n", member->offset);
1209 
1210  return S_OK;
1211 }
1212 
1214 {
1215  const char *ptr = data + offset;
1216  DWORD temp;
1218  unsigned int i;
1220  HRESULT hr;
1221  DWORD member_offset;
1222 
1223  desc = &type->desc;
1224 
1225  read_dword(&ptr, &temp);
1226  desc->Class = temp & 0xffff;
1227  desc->Type = temp >> 16;
1228  TRACE("Class %s, Type %s\n", debug_d3dcompiler_shader_variable_class(desc->Class),
1230 
1231  read_dword(&ptr, &temp);
1232  desc->Rows = temp & 0xffff;
1233  desc->Columns = temp >> 16;
1234  TRACE("Rows %u, Columns %u\n", desc->Rows, desc->Columns);
1235 
1236  read_dword(&ptr, &temp);
1237  desc->Elements = temp & 0xffff;
1238  desc->Members = temp >> 16;
1239  TRACE("Elements %u, Members %u\n", desc->Elements, desc->Members);
1240 
1241  read_dword(&ptr, &member_offset);
1242  TRACE("Member Offset %u\n", member_offset);
1243 
1244  if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1245  skip_dword_unknown(&ptr, 4);
1246 
1247  if (desc->Members)
1248  {
1249  const char *ptr2 = data + member_offset;
1250 
1251  members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*members) * desc->Members);
1252  if (!members)
1253  {
1254  ERR("Failed to allocate type memory.\n");
1255  return E_OUTOFMEMORY;
1256  }
1257 
1258  for (i = 0; i < desc->Members; ++i)
1259  {
1260  hr = d3dcompiler_parse_type_members(type->reflection, &members[i], data, &ptr2);
1261  if (hr != S_OK)
1262  {
1263  FIXME("Failed to parse type members.\n");
1264  goto err_out;
1265  }
1266  }
1267  }
1268 
1269  if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1270  {
1271  read_dword(&ptr, &offset);
1272  if (!copy_name(data + offset, &type->name))
1273  {
1274  ERR("Failed to copy name.\n");
1275  heap_free(members);
1276  return E_OUTOFMEMORY;
1277  }
1278  desc->Name = type->name;
1279  TRACE("Type name: %s.\n", debugstr_a(type->name));
1280  }
1281 
1282  type->members = members;
1283 
1284  return S_OK;
1285 
1286 err_out:
1287  for (i = 0; i < desc->Members; ++i)
1288  {
1289  free_type_member(&members[i]);
1290  }
1291  HeapFree(GetProcessHeap(), 0, members);
1292  return hr;
1293 }
1294 
1296 {
1298  struct wine_rb_entry *entry;
1299  HRESULT hr;
1300 
1301  entry = wine_rb_get(&reflection->types, &offset);
1302  if (entry)
1303  {
1304  TRACE("Returning existing type.\n");
1306  }
1307 
1309  if (!type)
1310  return NULL;
1311 
1312  type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3dcompiler_shader_reflection_type_vtbl;
1313  type->id = offset;
1314  type->reflection = reflection;
1315 
1317  if (FAILED(hr))
1318  {
1319  ERR("Failed to parse type info, hr %#x.\n", hr);
1320  HeapFree(GetProcessHeap(), 0, type);
1321  return NULL;
1322  }
1323 
1324  if (wine_rb_put(&reflection->types, &offset, &type->entry) == -1)
1325  {
1326  ERR("Failed to insert type entry.\n");
1327  HeapFree(GetProcessHeap(), 0, type);
1328  return NULL;
1329  }
1330 
1331  return type;
1332 }
1333 
1335  const char *data, DWORD data_size, const char *ptr)
1336 {
1337  struct d3dcompiler_shader_reflection_variable *variables;
1338  unsigned int i;
1339  HRESULT hr;
1340 
1341  variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb->variable_count * sizeof(*variables));
1342  if (!variables)
1343  {
1344  ERR("Failed to allocate variables memory.\n");
1345  return E_OUTOFMEMORY;
1346  }
1347 
1348  for (i = 0; i < cb->variable_count; i++)
1349  {
1350  struct d3dcompiler_shader_reflection_variable *v = &variables[i];
1351  DWORD offset;
1352 
1353  v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl;
1354  v->constant_buffer = cb;
1355 
1356  read_dword(&ptr, &offset);
1357  if (!copy_name(data + offset, &v->name))
1358  {
1359  ERR("Failed to copy name.\n");
1360  hr = E_OUTOFMEMORY;
1361  goto err_out;
1362  }
1363  TRACE("Variable name: %s.\n", debugstr_a(v->name));
1364 
1365  read_dword(&ptr, &v->start_offset);
1366  TRACE("Variable offset: %u\n", v->start_offset);
1367 
1368  read_dword(&ptr, &v->size);
1369  TRACE("Variable size: %u\n", v->size);
1370 
1371  read_dword(&ptr, &v->flags);
1372  TRACE("Variable flags: %u\n", v->flags);
1373 
1374  read_dword(&ptr, &offset);
1375  TRACE("Variable type offset: %x\n", offset);
1376  v->type = get_reflection_type(cb->reflection, data, offset);
1377  if (!v->type)
1378  {
1379  ERR("Failed to get type.\n");
1380  hr = E_FAIL;
1381  goto err_out;
1382  }
1383 
1384  read_dword(&ptr, &offset);
1385  TRACE("Variable default value offset: %x\n", offset);
1386  if (!copy_value(data + offset, &v->default_value, offset ? v->size : 0))
1387  {
1388  ERR("Failed to copy name.\n");
1389  hr = E_OUTOFMEMORY;
1390  goto err_out;
1391  }
1392 
1393  if ((cb->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1394  skip_dword_unknown(&ptr, 4);
1395  }
1396 
1397  cb->variables = variables;
1398 
1399  return S_OK;
1400 
1401 err_out:
1402  for (i = 0; i < cb->variable_count; i++)
1403  {
1404  free_variable(&variables[i]);
1405  }
1406  HeapFree(GetProcessHeap(), 0, variables);
1407  return hr;
1408 }
1409 
1411 {
1412  const char *ptr = data;
1413  DWORD size = data_size >> 2;
1414  DWORD offset, cbuffer_offset, resource_offset, creator_offset;
1415  unsigned int i, string_data_offset, string_data_size;
1416  char *string_data = NULL, *creator = NULL;
1417  D3D11_SHADER_INPUT_BIND_DESC *bound_resources = NULL;
1418  struct d3dcompiler_shader_reflection_constant_buffer *constant_buffers = NULL;
1419  HRESULT hr;
1420 
1421  TRACE("Size %u\n", size);
1422 
1423  read_dword(&ptr, &r->constant_buffer_count);
1424  TRACE("Constant buffer count: %u\n", r->constant_buffer_count);
1425 
1426  read_dword(&ptr, &cbuffer_offset);
1427  TRACE("Constant buffer offset: %#x\n", cbuffer_offset);
1428 
1429  read_dword(&ptr, &r->bound_resource_count);
1430  TRACE("Bound resource count: %u\n", r->bound_resource_count);
1431 
1432  read_dword(&ptr, &resource_offset);
1433  TRACE("Bound resource offset: %#x\n", resource_offset);
1434 
1435  read_dword(&ptr, &r->target);
1436  TRACE("Target: %#x\n", r->target);
1437 
1438  read_dword(&ptr, &r->flags);
1439  TRACE("Flags: %u\n", r->flags);
1440 
1441  read_dword(&ptr, &creator_offset);
1442  TRACE("Creator at offset %#x.\n", creator_offset);
1443 
1444  if (!copy_name(data + creator_offset, &creator))
1445  {
1446  ERR("Failed to copy name.\n");
1447  return E_OUTOFMEMORY;
1448  }
1449  TRACE("Creator: %s.\n", debugstr_a(creator));
1450 
1451  /* todo: Parse RD11 */
1452  if ((r->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1453  {
1454  skip_dword_unknown(&ptr, 8);
1455  }
1456 
1457  if (r->bound_resource_count)
1458  {
1459  /* 8 for each bind desc */
1460  string_data_offset = resource_offset + r->bound_resource_count * 8 * sizeof(DWORD);
1461  string_data_size = (cbuffer_offset ? cbuffer_offset : creator_offset) - string_data_offset;
1462 
1463  string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
1464  if (!string_data)
1465  {
1466  ERR("Failed to allocate string data memory.\n");
1467  hr = E_OUTOFMEMORY;
1468  goto err_out;
1469  }
1470  memcpy(string_data, data + string_data_offset, string_data_size);
1471 
1472  bound_resources = HeapAlloc(GetProcessHeap(), 0, r->bound_resource_count * sizeof(*bound_resources));
1473  if (!bound_resources)
1474  {
1475  ERR("Failed to allocate resources memory.\n");
1476  hr = E_OUTOFMEMORY;
1477  goto err_out;
1478  }
1479 
1480  ptr = data + resource_offset;
1481  for (i = 0; i < r->bound_resource_count; i++)
1482  {
1483  D3D11_SHADER_INPUT_BIND_DESC *desc = &bound_resources[i];
1484 
1485  read_dword(&ptr, &offset);
1486  desc->Name = string_data + (offset - string_data_offset);
1487  TRACE("Input bind Name: %s\n", debugstr_a(desc->Name));
1488 
1489 #ifdef __REACTOS__ /* DWORD* cast added */
1490  read_dword(&ptr, (DWORD*)&desc->Type);
1491 #else
1492  read_dword(&ptr, &desc->Type);
1493 #endif
1494  TRACE("Input bind Type: %#x\n", desc->Type);
1495 
1496 #ifdef __REACTOS__ /* DWORD* cast added */
1497  read_dword(&ptr, (DWORD*)&desc->ReturnType);
1498 #else
1499  read_dword(&ptr, &desc->ReturnType);
1500 #endif
1501  TRACE("Input bind ReturnType: %#x\n", desc->ReturnType);
1502 
1503 #ifdef __REACTOS__ /* DWORD* cast added */
1504  read_dword(&ptr, (DWORD*)&desc->Dimension);
1505 #else
1506  read_dword(&ptr, &desc->Dimension);
1507 #endif
1508  TRACE("Input bind Dimension: %#x\n", desc->Dimension);
1509 
1510  read_dword(&ptr, &desc->NumSamples);
1511  TRACE("Input bind NumSamples: %u\n", desc->NumSamples);
1512 
1513  read_dword(&ptr, &desc->BindPoint);
1514  TRACE("Input bind BindPoint: %u\n", desc->BindPoint);
1515 
1516  read_dword(&ptr, &desc->BindCount);
1517  TRACE("Input bind BindCount: %u\n", desc->BindCount);
1518 
1519  read_dword(&ptr, &desc->uFlags);
1520  TRACE("Input bind uFlags: %u\n", desc->uFlags);
1521  }
1522  }
1523 
1524  if (r->constant_buffer_count)
1525  {
1526  constant_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, r->constant_buffer_count * sizeof(*constant_buffers));
1527  if (!constant_buffers)
1528  {
1529  ERR("Failed to allocate constant buffer memory.\n");
1530  hr = E_OUTOFMEMORY;
1531  goto err_out;
1532  }
1533 
1534  ptr = data + cbuffer_offset;
1535  for (i = 0; i < r->constant_buffer_count; i++)
1536  {
1537  struct d3dcompiler_shader_reflection_constant_buffer *cb = &constant_buffers[i];
1538 
1539  cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3dcompiler_shader_reflection_constant_buffer_vtbl;
1540  cb->reflection = r;
1541 
1542  read_dword(&ptr, &offset);
1543  if (!copy_name(data + offset, &cb->name))
1544  {
1545  ERR("Failed to copy name.\n");
1546  hr = E_OUTOFMEMORY;
1547  goto err_out;
1548  }
1549  TRACE("Name: %s.\n", debugstr_a(cb->name));
1550 
1551  read_dword(&ptr, &cb->variable_count);
1552  TRACE("Variable count: %u\n", cb->variable_count);
1553 
1554  read_dword(&ptr, &offset);
1555  TRACE("Variable offset: %x\n", offset);
1556 
1557  hr = d3dcompiler_parse_variables(cb, data, data_size, data + offset);
1558  if (hr != S_OK)
1559  {
1560  FIXME("Failed to parse variables.\n");
1561  goto err_out;
1562  }
1563 
1564  read_dword(&ptr, &cb->size);
1565  TRACE("Cbuffer size: %u\n", cb->size);
1566 
1567  read_dword(&ptr, &cb->flags);
1568  TRACE("Cbuffer flags: %u\n", cb->flags);
1569 
1570 #ifdef __REACTOS__ /* DWORD* cast added */
1571  read_dword(&ptr, (DWORD*)&cb->type);
1572 #else
1573  read_dword(&ptr, &cb->type);
1574 #endif
1575  TRACE("Cbuffer type: %#x\n", cb->type);
1576  }
1577  }
1578 
1579  r->creator = creator;
1580  r->resource_string = string_data;
1581  r->bound_resources = bound_resources;
1582  r->constant_buffers = constant_buffers;
1583 
1584  return S_OK;
1585 
1586 err_out:
1587  for (i = 0; i < r->constant_buffer_count; ++i)
1588  {
1589  free_constant_buffer(&constant_buffers[i]);
1590  }
1591  HeapFree(GetProcessHeap(), 0, constant_buffers);
1592  HeapFree(GetProcessHeap(), 0, bound_resources);
1593  HeapFree(GetProcessHeap(), 0, string_data);
1594  HeapFree(GetProcessHeap(), 0, creator);
1595 
1596  return hr;
1597 }
1598 
1600 {
1602  unsigned int string_data_offset;
1603  unsigned int string_data_size;
1604  const char *ptr = section->data;
1605  char *string_data;
1606  unsigned int i;
1607  DWORD count;
1608  enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE element_size;
1609 
1610  switch (section->tag)
1611  {
1612  case TAG_OSG5:
1613  element_size = D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7;
1614  break;
1615 
1616  case TAG_ISGN:
1617  case TAG_OSGN:
1618  case TAG_PCSG:
1619  element_size = D3DCOMPILER_SIGNATURE_ELEMENT_SIZE6;
1620  break;
1621 
1622  default:
1623  FIXME("Unhandled section %s!\n", debugstr_an((const char *)&section->tag, 4));
1624  element_size = D3DCOMPILER_SIGNATURE_ELEMENT_SIZE6;
1625  break;
1626  }
1627 
1628  read_dword(&ptr, &count);
1629  TRACE("%u elements\n", count);
1630 
1631  skip_dword_unknown(&ptr, 1);
1632 
1633  d = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*d));
1634  if (!d)
1635  {
1636  ERR("Failed to allocate signature memory.\n");
1637  return E_OUTOFMEMORY;
1638  }
1639 
1640  /* 2 DWORDs for the header, element_size for each element. */
1641  string_data_offset = 2 * sizeof(DWORD) + count * element_size * sizeof(DWORD);
1642  string_data_size = section->data_size - string_data_offset;
1643 
1644  string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
1645  if (!string_data)
1646  {
1647  ERR("Failed to allocate string data memory.\n");
1648  HeapFree(GetProcessHeap(), 0, d);
1649  return E_OUTOFMEMORY;
1650  }
1651  memcpy(string_data, section->data + string_data_offset, string_data_size);
1652 
1653  for (i = 0; i < count; ++i)
1654  {
1655  UINT name_offset;
1656  DWORD mask;
1657 
1658  if (element_size == D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7)
1659  {
1660  read_dword(&ptr, &d[i].Stream);
1661  }
1662  else
1663  {
1664  d[i].Stream = 0;
1665  }
1666 
1667  read_dword(&ptr, &name_offset);
1668  d[i].SemanticName = string_data + (name_offset - string_data_offset);
1669  read_dword(&ptr, &d[i].SemanticIndex);
1670 #ifdef __REACTOS__ /* DWORD* casts added */
1671  read_dword(&ptr, (DWORD*)&d[i].SystemValueType);
1672  read_dword(&ptr, (DWORD*)&d[i].ComponentType);
1673 #else
1674  read_dword(&ptr, &d[i].SystemValueType);
1675  read_dword(&ptr, &d[i].ComponentType);
1676 #endif
1677  read_dword(&ptr, &d[i].Register);
1678  read_dword(&ptr, &mask);
1679  d[i].ReadWriteMask = (mask >> 8) & 0xff;
1680  d[i].Mask = mask & 0xff;
1681 
1682  /* pixel shaders have a special handling for SystemValueType in the output signature */
1683  if (((target & D3DCOMPILER_SHADER_TARGET_SHADERTYPE_MASK) == 0xffff0000) && (section->tag == TAG_OSG5 || section->tag == TAG_OSGN))
1684  {
1685  TRACE("Pixelshader output signature fixup.\n");
1686 
1687  if (d[i].Register == 0xffffffff)
1688  {
1689  if (!_strnicmp(d[i].SemanticName, "sv_depth", -1))
1690  d[i].SystemValueType = D3D_NAME_DEPTH;
1691  else if (!_strnicmp(d[i].SemanticName, "sv_coverage", -1))
1692  d[i].SystemValueType = D3D_NAME_COVERAGE;
1693  else if (!_strnicmp(d[i].SemanticName, "sv_depthgreaterequal", -1))
1694  d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL;
1695  else if (!_strnicmp(d[i].SemanticName, "sv_depthlessequal", -1))
1696  d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL;
1697  }
1698  else
1699  {
1700  d[i].SystemValueType = D3D_NAME_TARGET;
1701  }
1702  }
1703 
1704  TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
1705  "type %u, register idx: %u, use_mask %#x, input_mask %#x, stream %u\n",
1706  debugstr_a(d[i].SemanticName), d[i].SemanticIndex, d[i].SystemValueType,
1707  d[i].ComponentType, d[i].Register, d[i].Mask, d[i].ReadWriteMask, d[i].Stream);
1708  }
1709 
1710  s->elements = d;
1711  s->element_count = count;
1712  s->string_data = string_data;
1713 
1714  return S_OK;
1715 }
1716 
1718 {
1719  const char *ptr = data;
1720 
1721  read_dword(&ptr, &r->version);
1722  TRACE("Shader version: %u\n", r->version);
1723 
1724  /* todo: Check if anything else is needed from the shdr or shex blob. */
1725 
1726  return S_OK;
1727 }
1728 
1730  const void *data, SIZE_T data_size)
1731 {
1732  struct dxbc src_dxbc;
1733  HRESULT hr;
1734  unsigned int i;
1735 
1737  reflection->refcount = 1;
1738 
1740 
1741  hr = dxbc_parse(data, data_size, &src_dxbc);
1742  if (FAILED(hr))
1743  {
1744  WARN("Failed to parse reflection\n");
1745  return hr;
1746  }
1747 
1748  for (i = 0; i < src_dxbc.count; ++i)
1749  {
1750  struct dxbc_section *section = &src_dxbc.sections[i];
1751 
1752  switch (section->tag)
1753  {
1754  case TAG_RDEF:
1755  hr = d3dcompiler_parse_rdef(reflection, section->data, section->data_size);
1756  if (FAILED(hr))
1757  {
1758  WARN("Failed to parse RDEF section.\n");
1759  goto err_out;
1760  }
1761  break;
1762 
1763  case TAG_ISGN:
1764  reflection->isgn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*reflection->isgn));
1765  if (!reflection->isgn)
1766  {
1767  ERR("Failed to allocate ISGN memory.\n");
1768  hr = E_OUTOFMEMORY;
1769  goto err_out;
1770  }
1771 
1772  hr = d3dcompiler_parse_signature(reflection->isgn, section, reflection->target);
1773  if (FAILED(hr))
1774  {
1775  WARN("Failed to parse section ISGN.\n");
1776  goto err_out;
1777  }
1778  break;
1779 
1780  case TAG_OSG5:
1781  case TAG_OSGN:
1782  reflection->osgn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*reflection->osgn));
1783  if (!reflection->osgn)
1784  {
1785  ERR("Failed to allocate OSGN memory.\n");
1786  hr = E_OUTOFMEMORY;
1787  goto err_out;
1788  }
1789 
1790  hr = d3dcompiler_parse_signature(reflection->osgn, section, reflection->target);
1791  if (FAILED(hr))
1792  {
1793  WARN("Failed to parse section OSGN.\n");
1794  goto err_out;
1795  }
1796  break;
1797 
1798  case TAG_PCSG:
1799  reflection->pcsg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*reflection->pcsg));
1800  if (!reflection->pcsg)
1801  {
1802  ERR("Failed to allocate PCSG memory.\n");
1803  hr = E_OUTOFMEMORY;
1804  goto err_out;
1805  }
1806 
1807  hr = d3dcompiler_parse_signature(reflection->pcsg, section, reflection->target);
1808  if (FAILED(hr))
1809  {
1810  WARN("Failed to parse section PCSG.\n");
1811  goto err_out;
1812  }
1813  break;
1814 
1815  case TAG_SHEX:
1816  case TAG_SHDR:
1817  hr = d3dcompiler_parse_shdr(reflection, section->data, section->data_size);
1818  if (FAILED(hr))
1819  {
1820  WARN("Failed to parse SHDR section.\n");
1821  goto err_out;
1822  }
1823  break;
1824 
1825  case TAG_STAT:
1826  hr = d3dcompiler_parse_stat(reflection, section->data, section->data_size);
1827  if (FAILED(hr))
1828  {
1829  WARN("Failed to parse section STAT.\n");
1830  goto err_out;
1831  }
1832  break;
1833 
1834  default:
1835  FIXME("Unhandled section %s!\n", debugstr_an((const char *)&section->tag, 4));
1836  break;
1837  }
1838  }
1839 
1840  dxbc_destroy(&src_dxbc);
1841 
1842  return hr;
1843 
1844 err_out:
1845  reflection_cleanup(reflection);
1846  dxbc_destroy(&src_dxbc);
1847 
1848  return hr;
1849 }
1850 
1851 HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector)
1852 {
1854  HRESULT hr;
1855  const DWORD *temp = data;
1856 
1857  TRACE("data %p, data_size %lu, riid %s, blob %p\n", data, data_size, debugstr_guid(riid), reflector);
1858 
1859  if (!data || data_size < 32)
1860  {
1861  WARN("Invalid argument supplied.\n");
1862  return D3DERR_INVALIDCALL;
1863  }
1864 
1865  if (temp[6] != data_size)
1866  {
1867  WARN("Wrong size supplied.\n");
1868  return E_FAIL;
1869  }
1870 
1871  if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection))
1872  {
1873  WARN("Wrong riid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection));
1874  return E_NOINTERFACE;
1875  }
1876 
1877  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1878  if (!object)
1879  return E_OUTOFMEMORY;
1880 
1881  hr = d3dcompiler_shader_reflection_init(object, data, data_size);
1882  if (FAILED(hr))
1883  {
1884  WARN("Failed to initialize shader reflection\n");
1885  HeapFree(GetProcessHeap(), 0, object);
1886  return hr;
1887  }
1888 
1889  *reflector = object;
1890 
1891  TRACE("Created ID3D11ShaderReflection %p\n", object);
1892 
1893  return S_OK;
1894 }
const char * var
Definition: shader.c:5666
unsigned int type
Definition: reflection.c:1205
static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl
Definition: reflection.c:145
GLint level
Definition: gl.h:1546
static D3D_PRIMITIVE STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetGSInputPrimitive(ID3D11ShaderReflection *iface)
Definition: reflection.c:629
#define TRUE
Definition: types.h:120
#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_MASK
Definition: reflection.c:34
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection *reflection, const void *data, SIZE_T data_size)
Definition: reflection.c:1729
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetThreadGroupSize(ID3D11ShaderReflection *iface, UINT *sizex, UINT *sizey, UINT *sizez)
Definition: reflection.c:661
static int d3dcompiler_shader_reflection_type_compare(const void *key, const struct wine_rb_entry *entry)
Definition: reflection.c:194
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetInterfaceSlot(ID3D11ShaderReflectionVariable *iface, UINT index)
Definition: reflection.c:849
static const char *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeName(ID3D11ShaderReflectionType *iface, UINT index)
Definition: reflection.c:943
struct d3dcompiler_shader_reflection * reflection
Definition: reflection.c:82
#define TAG_OSGN
HRESULT hr
Definition: shlfolder.c:183
Definition: http.c:7094
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
struct d3dcompiler_shader_signature * pcsg
Definition: reflection.c:135
static void read_dword(const char **ptr, DWORD *d)
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetDesc(ID3D11ShaderReflectionVariable *iface, D3D11_SHADER_VARIABLE_DESC *desc)
Definition: reflection.c:801
static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref)
Definition: reflection.c:263
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetInterfaceByIndex(ID3D11ShaderReflectionType *iface, UINT index)
Definition: reflection.c:1008
GLuint GLuint GLsizei count
Definition: gl.h:1545
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1204
#define WARN(fmt,...)
Definition: debug.h:112
static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *entry, void *context)
Definition: reflection.c:210
D3D11_SIGNATURE_PARAMETER_DESC * elements
Definition: reflection.c:38
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetBitwiseInstructionCount(ID3D11ShaderReflection *iface)
Definition: reflection.c:621
GLintptr offset
Definition: glext.h:5920
static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
Definition: reflection.c:1048
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetDesc(ID3D11ShaderReflectionType *iface, D3D11_SHADER_TYPE_DESC *desc)
Definition: reflection.c:873
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetNumInterfaceSlots(ID3D11ShaderReflection *iface)
Definition: reflection.c:645
static struct d3dcompiler_shader_reflection * impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface)
Definition: reflection.c:304
static BOOL copy_value(const char *ptr, void **value, DWORD size)
Definition: reflection.c:178
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameterDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
Definition: reflection.c:473
Definition: parser.c:55
#define E_FAIL
Definition: ddrawi.h:102
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByName(ID3D11ShaderReflectionType *iface, const char *name)
Definition: reflection.c:913
#define DWORD
Definition: nt_native.h:44
HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector)
Definition: reflection.c:1851
Definition: send.c:48
static void free_type_member(struct d3dcompiler_shader_reflection_type_member *member)
Definition: reflection.c:202
static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface)
Definition: reflection.c:337
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc)
Definition: reflection.c:355
static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_constant_buffer *cb, const char *data, DWORD data_size, const char *ptr)
Definition: reflection.c:1334
D3D_TESSELLATOR_OUTPUT_PRIMITIVE hs_output_primitive
Definition: reflection.c:129
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
D3D_CBUFFER_TYPE
Definition: d3dcommon.idl:491
GLenum GLint GLuint mask
Definition: glext.h:6028
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl
Definition: reflection.c:146
static struct d3dcompiler_shader_reflection_type * get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, DWORD offset)
Definition: reflection.c:1295
unsigned int BOOL
Definition: ntddk_ex.h:94
struct d3dcompiler_shader_signature * isgn
Definition: reflection.c:133
long LONG
Definition: pedump.c:60
D3D_TESSELLATOR_OUTPUT_PRIMITIVE
Definition: d3dcommon.idl:477
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
#define FIXME(fmt,...)
Definition: debug.h:111
D3D_TESSELLATOR_PARTITIONING
Definition: d3dcommon.idl:463
static UINT64 STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetRequiresFlags(ID3D11ShaderReflection *iface)
Definition: reflection.c:669
D3D11_SHADER_INPUT_BIND_DESC * bound_resources
Definition: reflection.c:137
static PVOID ptr
Definition: dispmode.c:27
static ID3D11ShaderReflectionVariable *STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByName(ID3D11ShaderReflectionConstantBuffer *iface, const char *name)
Definition: reflection.c:756
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
struct wine_rb_entry entry
Definition: reflection.c:48
const char * debug_d3dcompiler_shader_variable_class(D3D_SHADER_VARIABLE_CLASS c) DECLSPEC_HIDDEN
Definition: utils.c:32
smooth NULL
Definition: ftsmooth.c:416
#define TAG_OSG5
static ID3D11ShaderReflectionConstantBuffer *STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetBuffer(ID3D11ShaderReflectionVariable *iface)
Definition: reflection.c:839
#define D3DCOMPILER_SHADER_TARGET_VERSION_MASK
Definition: reflection.c:33
ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer_iface
Definition: reflection.c:80
#define TAG_SHEX
static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
Definition: reflection.c:1717
static struct d3dcompiler_shader_reflection_variable null_variable
Definition: reflection.c:151
D3D_TESSELLATOR_PARTITIONING hs_prtitioning
Definition: reflection.c:130
GLuint index
Definition: glext.h:6031
struct d3dcompiler_shader_reflection * reflection
Definition: reflection.c:50
#define TAG_ISGN
char name[MAX_NAME_LEN]
#define debugstr_guid
Definition: kernel32.h:35
static void free_constant_buffer(struct d3dcompiler_shader_reflection_constant_buffer *cb)
Definition: reflection.c:247
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovcInstructionCount(ID3D11ShaderReflection *iface)
Definition: reflection.c:603
static struct ID3D11ShaderReflectionConstantBuffer *STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByIndex(ID3D11ShaderReflection *iface, UINT index)
Definition: reflection.c:409
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
struct dxbc_section * sections
static void free_variable(struct d3dcompiler_shader_reflection_variable *var)
Definition: reflection.c:238
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static struct d3dcompiler_shader_reflection_type null_type
Definition: reflection.c:150
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static struct ID3D11ShaderReflectionConstantBuffer *STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName(ID3D11ShaderReflection *iface, const char *name)
Definition: reflection.c:425
#define d
Definition: ke_i.h:81
Definition: cmds.c:130
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:78
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc) DECLSPEC_HIDDEN
Definition: utils.c:577
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
#define TAG_RDEF
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
char * name
Definition: compiler.c:66
unsigned long DWORD
Definition: ntddk_ex.h:95
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByIndex(ID3D11ShaderReflectionType *iface, UINT index)
Definition: reflection.c:897
static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11ShaderReflection *iface)
Definition: reflection.c:327
static struct d3dcompiler_shader_reflection_variable * impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface)
Definition: reflection.c:796
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc)
Definition: reflection.c:455
static void free_signature(struct d3dcompiler_shader_signature *sig)
Definition: reflection.c:230
void skip_dword_unknown(const char **ptr, unsigned int count) DECLSPEC_HIDDEN
Definition: utils.c:510
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct d3dcompiler_shader_reflection_type * type
Definition: reflection.c:69
const char * debug_d3dcompiler_shader_variable_type(D3D_SHADER_VARIABLE_TYPE t) DECLSPEC_HIDDEN
Definition: utils.c:50
D3DCOMPILER_SIGNATURE_ELEMENT_SIZE
Definition: reflection.c:27
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovInstructionCount(ID3D11ShaderReflection *iface)
Definition: reflection.c:593
static ID3D11ShaderReflectionVariable *STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByIndex(ID3D11ShaderReflectionConstantBuffer *iface, UINT index)
Definition: reflection.c:740
D3D11_SHADER_TYPE_DESC desc
Definition: reflection.c:52
struct d3dcompiler_shader_reflection_constant_buffer * constant_buffer
Definition: reflection.c:68
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:198
#define index(s, c)
Definition: various.h:29
struct d3dcompiler_shader_reflection_type * type
Definition: reflection.c:61
#define InterlockedDecrement
Definition: armddk.h:52
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetSubType(ID3D11ShaderReflectionType *iface)
Definition: reflection.c:984
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47
static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type *type, const char *data, DWORD offset)
Definition: reflection.c:1213
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLdouble s
Definition: gl.h:2039
static struct ID3D11ShaderReflectionVariable *STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName(ID3D11ShaderReflection *iface, const char *name)
Definition: reflection.c:527
ID3D11ShaderReflection ID3D11ShaderReflection_iface
Definition: reflection.c:96
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetDesc(ID3D11ShaderReflectionConstantBuffer *iface, D3D11_SHADER_BUFFER_DESC *desc)
Definition: reflection.c:712
D3D_FEATURE_LEVEL
Definition: d3dcommon.idl:81
ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable_iface
Definition: reflection.c:66
struct d3dcompiler_shader_reflection_variable * variables
Definition: reflection.c:90
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsOfType(ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type)
Definition: reflection.c:1016
static BOOL STDMETHODCALLTYPE d3dcompiler_shader_reflection_IsSampleFrequencyShader(ID3D11ShaderReflection *iface)
Definition: reflection.c:637
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConversionInstructionCount(ID3D11ShaderReflection *iface)
Definition: reflection.c:611
void dxbc_destroy(struct dxbc *dxbc) DECLSPEC_HIDDEN
Definition: utils.c:648
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantParameterDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
Definition: reflection.c:509
#define ERR(fmt,...)
Definition: debug.h:110
static struct d3dcompiler_shader_reflection_type * impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface)
Definition: reflection.c:868
ULONG_PTR SIZE_T
Definition: typedefs.h:79
#define TAG_STAT
static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section, DWORD target)
Definition: reflection.c:1599
#define TAG_PCSG
DWORD type
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
const GLdouble * v
Definition: gl.h:2040
static HRESULT d3dcompiler_parse_type_members(struct d3dcompiler_shader_reflection *ref, struct d3dcompiler_shader_reflection_type_member *member, const char *data, const char **ptr)
Definition: reflection.c:1183
static calc_node_t temp
Definition: rpn_ieee.c:38
Definition: rbtree.h:35
#define E_NOTIMPL
Definition: ddrawi.h:99
struct d3dcompiler_shader_reflection_constant_buffer * constant_buffers
Definition: reflection.c:138
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
D3D_PRIMITIVE_TOPOLOGY gs_output_topology
Definition: reflection.c:110
unsigned int UINT
Definition: ndis.h:50
static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetNumInterfaces(ID3D11ShaderReflectionType *iface)
Definition: reflection.c:1000
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_ImplementsInterface(ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *base)
Definition: reflection.c:1024
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler)
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
D3D_PRIMITIVE
Definition: d3dcommon.idl:267
static BOOL copy_name(const char *ptr, char **name)
Definition: reflection.c:154
Definition: name.c:38
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:203
static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer
Definition: reflection.c:149
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsEqual(ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type)
Definition: reflection.c:965
static struct d3dcompiler_shader_reflection_constant_buffer * impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface)
Definition: reflection.c:707
unsigned int ULONG
Definition: retypes.h:1
GLenum target
Definition: glext.h:7315
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
struct d3dcompiler_shader_reflection_type_member * members
Definition: reflection.c:53
struct wine_rb_tree types
Definition: reflection.c:139
#define TAG_SHDR
static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl
Definition: reflection.c:144
D3D_PRIMITIVE_TOPOLOGY
Definition: d3dcommon.idl:353
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object)
Definition: reflection.c:309
ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface
Definition: reflection.c:45
unsigned long long UINT64
static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
Definition: reflection.c:1410
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParameterDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
Definition: reflection.c:491
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName(ID3D11ShaderReflection *iface, const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc)
Definition: reflection.c:562
int k
Definition: mpi.c:3369
#define HeapFree(x, y, z)
Definition: compat.h:403
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
void * object
Definition: jmemsys.h:48
D3D_TESSELLATOR_DOMAIN tessellator_domain
Definition: reflection.c:131
D3D_TESSELLATOR_DOMAIN
Definition: d3dcommon.idl:451
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMinFeatureLevel(ID3D11ShaderReflection *iface, D3D_FEATURE_LEVEL *level)
Definition: reflection.c:653
static REFIID
Definition: reflection.c:43
struct d3dcompiler_shader_signature * osgn
Definition: reflection.c:134
#define D3DERR_INVALIDCALL
Definition: reflection.c:41
static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl
Definition: reflection.c:677
Definition: path.c:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetBaseClass(ID3D11ShaderReflectionType *iface)
Definition: reflection.c:992
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetType(ID3D11ShaderReflectionVariable *iface)
Definition: reflection.c:829