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