ReactOS 0.4.17-dev-966-gf06eace
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 "d3d10.h"
24
25#if !D3D_COMPILER_VERSION
26#define ID3D11ShaderReflection ID3D10ShaderReflection
27#define ID3D11ShaderReflectionVtbl ID3D10ShaderReflectionVtbl
28#define ID3D11ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer
29#define ID3D11ShaderReflectionConstantBufferVtbl ID3D10ShaderReflectionConstantBufferVtbl
30#define ID3D11ShaderReflectionType ID3D10ShaderReflectionType
31#define ID3D11ShaderReflectionTypeVtbl ID3D10ShaderReflectionTypeVtbl
32#define ID3D11ShaderReflectionVariable ID3D10ShaderReflectionVariable
33#define ID3D11ShaderReflectionVariableVtbl ID3D10ShaderReflectionVariableVtbl
34#define IID_ID3D11ShaderReflection IID_ID3D10ShaderReflection
35#define D3D11_SHADER_BUFFER_DESC D3D10_SHADER_BUFFER_DESC
36#define D3D11_SHADER_DESC D3D10_SHADER_DESC
37#define D3D11_SHADER_INPUT_BIND_DESC D3D10_SHADER_INPUT_BIND_DESC
38#define D3D11_SHADER_TYPE_DESC D3D10_SHADER_TYPE_DESC
39#define D3D11_SHADER_VARIABLE_DESC D3D10_SHADER_VARIABLE_DESC
40#define D3D11_SIGNATURE_PARAMETER_DESC D3D10_SIGNATURE_PARAMETER_DESC
41#endif
42
44
46{
49};
50
51#define D3DCOMPILER_SHADER_TARGET_VERSION_MASK 0xffff
52#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_MASK 0xffff0000
53#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_SHIFT 16
54
55#define D3DCOMPILER_SHDR_SHADER_TYPE_CS 0x4353
56
58{
60};
61
63{
65 unsigned int element_count;
67};
68
70{
72
75
77
80 char *name;
81};
82
84{
85 char *name;
88};
89
91{
93
96
97 char *name;
102};
103
105{
107
109
110 char *name;
115
117};
118
120{
124};
125
126/* ID3D11ShaderReflection */
128{
131
133
135 char *creator;
140
172
180};
181
183
187
188/* null objects - needed for invalid calls */
190{
192};
194{
196};
198{
201 &null_type
202};
203
204static BOOL copy_name(const char *ptr, char **name)
205{
206 if (!ptr || !ptr[0]) return TRUE;
207
208 *name = strdup(ptr);
209 if (!*name)
210 {
211 ERR("Failed to allocate name memory.\n");
212 return FALSE;
213 }
214
215 return TRUE;
216}
217
218static BOOL copy_value(const char *ptr, void **value, uint32_t size)
219{
220 if (!ptr || !size) return TRUE;
221
222 *value = malloc(size);
223 if (!*value)
224 {
225 ERR("Failed to allocate value memory.\n");
226 return FALSE;
227 }
228
229 memcpy(*value, ptr, size);
230
231 return TRUE;
232}
233
235{
237 const uint32_t *id = key;
238
239 return *id - t->id;
240}
241
243{
244 if (member)
245 {
246 free(member->name);
247 }
248}
249
251{
253 unsigned int i;
254
255 TRACE("reflection type %p.\n", t);
256
257 if (t->members)
258 {
259 for (i = 0; i < t->desc.Members; ++i)
260 {
261 free_type_member(&t->members[i]);
262 }
263 free(t->members);
264 }
265
266 free(t->name);
267 free(t);
268}
269
271{
272 TRACE("Free signature %p\n", sig);
273
274 free(sig->elements);
275 free(sig->string_data);
276}
277
279{
280 if (var)
281 {
282 free(var->name);
283 free(var->default_value);
284 }
285}
286
288{
289 if (cb->variables)
290 {
291 unsigned int i;
292
293 for (i = 0; i < cb->variable_count; ++i)
294 {
295 free_variable(&cb->variables[i]);
296 }
297 free(cb->variables);
298 }
299
300 free(cb->name);
301}
302
304{
305 TRACE("Cleanup %p\n", ref);
306
307 if (ref->isgn)
308 {
309 free_signature(ref->isgn);
310 free(ref->isgn);
311 }
312
313 if (ref->osgn)
314 {
315 free_signature(ref->osgn);
316 free(ref->osgn);
317 }
318
319 if (ref->pcsg)
320 {
321 free_signature(ref->pcsg);
322 free(ref->pcsg);
323 }
324
325 if (ref->constant_buffers)
326 {
327 unsigned int i;
328
329 for (i = 0; i < ref->constant_buffer_count; ++i)
330 {
331 free_constant_buffer(&ref->constant_buffers[i]);
332 }
333 }
334
336 free(ref->constant_buffers);
337 free(ref->bound_resources);
338 free(ref->resource_string);
339 free(ref->creator);
340}
341
342/* IUnknown methods */
343
345{
347}
348
350{
351 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
352
355 || (D3D_COMPILER_VERSION >= 47 && IsEqualGUID(riid, &IID_ID3D12ShaderReflection)))
356 {
357 IUnknown_AddRef(iface);
358 *object = iface;
359 return S_OK;
360 }
361
362 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
363
364 *object = NULL;
365 return E_NOINTERFACE;
366}
367
369{
372
373 TRACE("%p increasing refcount to %lu.\n", This, refcount);
374
375 return refcount;
376}
377
379{
382
383 TRACE("%p decreasing refcount to %lu.\n", This, refcount);
384
385 if (!refcount)
386 {
388 free(This);
389 }
390
391 return refcount;
392}
393
394/* ID3D11ShaderReflection methods */
395
397{
399
400 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
401
402 if (!desc)
403 {
404 WARN("Invalid argument specified\n");
405 return E_FAIL;
406 }
407
408 desc->Version = reflection->version;
409 desc->Creator = reflection->creator;
410 desc->Flags = reflection->flags;
411 desc->ConstantBuffers = reflection->constant_buffer_count;
412 desc->BoundResources = reflection->bound_resource_count;
413 desc->InputParameters = reflection->isgn ? reflection->isgn->element_count : 0;
414 desc->OutputParameters = reflection->osgn ? reflection->osgn->element_count : 0;
415 desc->InstructionCount = reflection->instruction_count;
416 desc->TempRegisterCount = reflection->temp_register_count;
417 desc->TempArrayCount = reflection->temp_array_count;
418 desc->DefCount = reflection->def_count;
419 desc->DclCount = reflection->dcl_count;
420 desc->TextureNormalInstructions = reflection->texture_normal_instructions;
421 desc->TextureLoadInstructions = reflection->texture_load_instructions;
422 desc->TextureCompInstructions = reflection->texture_comp_instructions;
423 desc->TextureBiasInstructions = reflection->texture_bias_instructions;
424 desc->TextureGradientInstructions = reflection->texture_gradient_instructions;
425 desc->FloatInstructionCount = reflection->float_instruction_count;
426 desc->IntInstructionCount = reflection->int_instruction_count;
427 desc->UintInstructionCount = reflection->uint_instruction_count;
428 desc->StaticFlowControlCount = reflection->static_flow_control_count;
429 desc->DynamicFlowControlCount = reflection->dynamic_flow_control_count;
430 desc->MacroInstructionCount = reflection->macro_instruction_count;
431 desc->ArrayInstructionCount = reflection->array_instruction_count;
432 desc->CutInstructionCount = reflection->cut_instruction_count;
433 desc->EmitInstructionCount = reflection->emit_instruction_count;
434 desc->GSOutputTopology = reflection->gs_output_topology;
435 desc->GSMaxOutputVertexCount = reflection->gs_max_output_vertex_count;
436#if D3D_COMPILER_VERSION
437 desc->InputPrimitive = reflection->input_primitive;
438 desc->PatchConstantParameters = reflection->pcsg ? reflection->pcsg->element_count : 0;
439 desc->cGSInstanceCount = 0;
440 desc->cControlPoints = reflection->c_control_points;
441 desc->HSOutputPrimitive = reflection->hs_output_primitive;
442 desc->HSPartitioning = reflection->hs_partitioning;
443 desc->TessellatorDomain = reflection->tessellator_domain;
444 desc->cBarrierInstructions = 0;
445 desc->cInterlockedInstructions = 0;
446 desc->cTextureStoreInstructions = 0;
447#endif
448
449 return S_OK;
450}
451
454{
456
457 TRACE("iface %p, index %u\n", iface, index);
458
459 if (index >= This->constant_buffer_count)
460 {
461 WARN("Invalid argument specified\n");
462 return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
463 }
464
465 return &This->constant_buffers[index].ID3D11ShaderReflectionConstantBuffer_iface;
466}
467
469 ID3D11ShaderReflection *iface, const char *name)
470{
472 unsigned int i;
473
474 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
475
476 if (!name)
477 {
478 WARN("Invalid argument specified\n");
479 return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
480 }
481
482 for (i = 0; i < This->constant_buffer_count; ++i)
483 {
484 struct d3dcompiler_shader_reflection_constant_buffer *d = &This->constant_buffers[i];
485
486 if (!strcmp(d->name, name))
487 {
488 TRACE("Returning ID3D11ShaderReflectionConstantBuffer %p.\n", d);
489 return &d->ID3D11ShaderReflectionConstantBuffer_iface;
490 }
491 }
492
493 WARN("Invalid name specified\n");
494
495 return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface;
496}
497
500{
502
503 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
504
505 if (!desc || index >= reflection->bound_resource_count)
506 {
507 WARN("Invalid argument specified\n");
508 return E_INVALIDARG;
509 }
510
511 memcpy(desc, &reflection->bound_resources[index],
514
515 return S_OK;
516}
517
520{
522
523 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
524
525 if (!desc || !reflection->isgn || index >= reflection->isgn->element_count)
526 {
527 WARN("Invalid argument specified\n");
528 return E_INVALIDARG;
529 }
530
531 *desc = reflection->isgn->elements[index];
532
533 return S_OK;
534}
535
538{
540
541 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
542
543 if (!desc || !reflection->osgn || index >= reflection->osgn->element_count)
544 {
545 WARN("Invalid argument specified\n");
546 return E_INVALIDARG;
547 }
548
549 *desc = reflection->osgn->elements[index];
550
551 return S_OK;
552}
553
554#if D3D_COMPILER_VERSION
555static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantParameterDesc(
557{
559
560 TRACE("iface %p, index %u, desc %p\n", iface, index, desc);
561
562 if (!desc || !reflection->pcsg || index >= reflection->pcsg->element_count)
563 {
564 WARN("Invalid argument specified\n");
565 return E_INVALIDARG;
566 }
567
568 *desc = reflection->pcsg->elements[index];
569
570 return S_OK;
571}
572
573static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName(
574 ID3D11ShaderReflection *iface, const char *name)
575{
577 unsigned int i, k;
578
579 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
580
581 if (!name)
582 {
583 WARN("Invalid name specified\n");
584 return &null_variable.ID3D11ShaderReflectionVariable_iface;
585 }
586
587 for (i = 0; i < This->constant_buffer_count; ++i)
588 {
589 struct d3dcompiler_shader_reflection_constant_buffer *cb = &This->constant_buffers[i];
590
591 for (k = 0; k < cb->variable_count; ++k)
592 {
593 struct d3dcompiler_shader_reflection_variable *v = &cb->variables[k];
594
595 if (!strcmp(v->name, name))
596 {
597 TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
598 return &v->ID3D11ShaderReflectionVariable_iface;
599 }
600 }
601 }
602
603 WARN("Invalid name specified\n");
604
605 return &null_variable.ID3D11ShaderReflectionVariable_iface;
606}
607
608static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName(
610{
612 unsigned int i;
613
614 TRACE("iface %p, name %s, desc %p\n", iface, debugstr_a(name), desc);
615
616 if (!desc || !name)
617 {
618 WARN("Invalid argument specified\n");
619 return E_INVALIDARG;
620 }
621
622 for (i = 0; i < reflection->bound_resource_count; ++i)
623 {
625
626 if (!strcmp(d->Name, name))
627 {
628 TRACE("Returning D3D11_SHADER_INPUT_BIND_DESC %p.\n", d);
631 return S_OK;
632 }
633 }
634
635 WARN("Invalid name specified\n");
636
637 return E_INVALIDARG;
638}
639
640static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovInstructionCount(
642{
644
645 TRACE("iface %p\n", iface);
646
647 return This->mov_instruction_count;
648}
649
650static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovcInstructionCount(
652{
653 FIXME("iface %p stub!\n", iface);
654
655 return 0;
656}
657
658static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConversionInstructionCount(
660{
662
663 TRACE("iface %p\n", iface);
664
665 return This->conversion_instruction_count;
666}
667
668static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetBitwiseInstructionCount(
670{
671 FIXME("iface %p stub!\n", iface);
672
673 return 0;
674}
675
676static D3D_PRIMITIVE STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetGSInputPrimitive(
678{
679 FIXME("iface %p stub!\n", iface);
680
681 return 0;
682}
683
684static BOOL STDMETHODCALLTYPE d3dcompiler_shader_reflection_IsSampleFrequencyShader(
686{
687 FIXME("iface %p stub!\n", iface);
688
689 return FALSE;
690}
691
692static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetNumInterfaceSlots(
694{
695 FIXME("iface %p stub!\n", iface);
696
697 return 0;
698}
699
700static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMinFeatureLevel(
702{
703 FIXME("iface %p, level %p stub!\n", iface, level);
704
705 return E_NOTIMPL;
706}
707
708static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetThreadGroupSize(
709 ID3D11ShaderReflection *iface, UINT *sizex, UINT *sizey, UINT *sizez)
710{
712
713 TRACE("iface %p, sizex %p, sizey %p, sizez %p.\n", iface, sizex, sizey, sizez);
714
715 if (!sizex || !sizey || !sizez)
716 {
717 WARN("Invalid argument specified.\n");
718 return E_INVALIDARG;
719 }
720
721 *sizex = reflection->thread_group_size_x;
722 *sizey = reflection->thread_group_size_y;
723 *sizez = reflection->thread_group_size_z;
724
725 return *sizex * *sizey * *sizez;
726}
727
728static UINT64 STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetRequiresFlags(
730{
731 FIXME("iface %p stub!\n", iface);
732
733 return 0;
734}
735#endif
736
738{
739 /* IUnknown methods */
743 /* ID3D11ShaderReflection methods */
750#if D3D_COMPILER_VERSION
751 d3dcompiler_shader_reflection_GetPatchConstantParameterDesc,
752 d3dcompiler_shader_reflection_GetVariableByName,
753 d3dcompiler_shader_reflection_GetResourceBindingDescByName,
754 d3dcompiler_shader_reflection_GetMovInstructionCount,
755 d3dcompiler_shader_reflection_GetMovcInstructionCount,
756 d3dcompiler_shader_reflection_GetConversionInstructionCount,
757 d3dcompiler_shader_reflection_GetBitwiseInstructionCount,
758 d3dcompiler_shader_reflection_GetGSInputPrimitive,
759 d3dcompiler_shader_reflection_IsSampleFrequencyShader,
760 d3dcompiler_shader_reflection_GetNumInterfaceSlots,
761 d3dcompiler_shader_reflection_GetMinFeatureLevel,
762 d3dcompiler_shader_reflection_GetThreadGroupSize,
763 d3dcompiler_shader_reflection_GetRequiresFlags,
764#endif
765};
766
767/* ID3D11ShaderReflectionConstantBuffer methods */
768
770{
772}
773
776{
778
779 TRACE("iface %p, desc %p\n", iface, desc);
780
782 {
783 WARN("Null constant buffer specified\n");
784 return E_FAIL;
785 }
786
787 if (!desc)
788 {
789 WARN("Invalid argument specified\n");
790 return E_FAIL;
791 }
792
793 desc->Name = This->name;
794 desc->Type = This->type;
795 desc->Variables = This->variable_count;
796 desc->Size = This->size;
797 desc->uFlags = This->flags;
798
799 return S_OK;
800}
801
804{
806
807 TRACE("iface %p, index %u\n", iface, index);
808
809 if (index >= This->variable_count)
810 {
811 WARN("Invalid index specified\n");
812 return &null_variable.ID3D11ShaderReflectionVariable_iface;
813 }
814
815 return &This->variables[index].ID3D11ShaderReflectionVariable_iface;
816}
817
819 ID3D11ShaderReflectionConstantBuffer *iface, const char *name)
820{
822 unsigned int i;
823
824 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
825
826 if (!name)
827 {
828 WARN("Invalid argument specified\n");
829 return &null_variable.ID3D11ShaderReflectionVariable_iface;
830 }
831
832 for (i = 0; i < This->variable_count; ++i)
833 {
834 struct d3dcompiler_shader_reflection_variable *v = &This->variables[i];
835
836 if (!strcmp(v->name, name))
837 {
838 TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
839 return &v->ID3D11ShaderReflectionVariable_iface;
840 }
841 }
842
843 WARN("Invalid name specified\n");
844
845 return &null_variable.ID3D11ShaderReflectionVariable_iface;
846}
847
849{
850 /* ID3D11ShaderReflectionConstantBuffer methods */
854};
855
856/* ID3D11ShaderReflectionVariable methods */
857
859{
861}
862
865{
867
868 TRACE("iface %p, desc %p\n", iface, desc);
869
870 if (This == &null_variable)
871 {
872 WARN("Null variable 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->Name = This->name;
883 desc->StartOffset = This->start_offset;
884 desc->Size = This->size;
885 desc->uFlags = This->flags;
886 desc->DefaultValue = This->default_value;
887
888#if D3D_COMPILER_VERSION
889 /* TODO test and set proper values for texture. */
890 desc->StartTexture = 0xffffffff;
891 desc->TextureSize = 0;
892 desc->StartSampler = 0xffffffff;
893 desc->SamplerSize = 0;
894#endif
895
896 return S_OK;
897}
898
901{
903
904 TRACE("iface %p\n", iface);
905
906 return &This->type->ID3D11ShaderReflectionType_iface;
907}
908
909#if D3D_COMPILER_VERSION
910static ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetBuffer(
912{
914
915 TRACE("iface %p\n", iface);
916
917 return &This->constant_buffer->ID3D11ShaderReflectionConstantBuffer_iface;
918}
919
920static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetInterfaceSlot(
922{
923 FIXME("iface %p, index %u stub!\n", iface, index);
924
925 return 0;
926}
927#endif
928
930{
931 /* ID3D11ShaderReflectionVariable methods */
934#if D3D_COMPILER_VERSION
935 d3dcompiler_shader_reflection_variable_GetBuffer,
936 d3dcompiler_shader_reflection_variable_GetInterfaceSlot,
937#endif
938};
939
940/* ID3D11ShaderReflectionType methods */
941
943{
945}
946
949{
951
952 TRACE("iface %p, desc %p\n", iface, desc);
953
954 if (This == &null_type)
955 {
956 WARN("Null type specified\n");
957 return E_FAIL;
958 }
959
960 if (!desc)
961 {
962 WARN("Invalid argument specified\n");
963 return E_FAIL;
964 }
965
966 *desc = This->desc;
967
968 return S_OK;
969}
970
973{
975
976 TRACE("iface %p, index %u\n", iface, index);
977
978 if (index >= This->desc.Members)
979 {
980 WARN("Invalid index specified\n");
981 return &null_type.ID3D11ShaderReflectionType_iface;
982 }
983
984 return &This->members[index].type->ID3D11ShaderReflectionType_iface;
985}
986
988 ID3D11ShaderReflectionType *iface, const char *name)
989{
991 unsigned int i;
992
993 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
994
995 if (!name)
996 {
997 WARN("Invalid argument specified\n");
998 return &null_type.ID3D11ShaderReflectionType_iface;
999 }
1000
1001 for (i = 0; i < This->desc.Members; ++i)
1002 {
1004
1005 if (!strcmp(member->name, name))
1006 {
1007 TRACE("Returning ID3D11ShaderReflectionType %p.\n", member->type);
1008 return &member->type->ID3D11ShaderReflectionType_iface;
1009 }
1010 }
1011
1012 WARN("Invalid name specified\n");
1013
1014 return &null_type.ID3D11ShaderReflectionType_iface;
1015}
1016
1019{
1021
1022 TRACE("iface %p, index %u\n", iface, index);
1023
1024 if (This == &null_type)
1025 {
1026 WARN("Null type specified\n");
1027 return "$Invalid";
1028 }
1029
1030 if (index >= This->desc.Members)
1031 {
1032 WARN("Invalid index specified\n");
1033 return NULL;
1034 }
1035
1036 return This->members[index].name;
1037}
1038
1039#if D3D_COMPILER_VERSION
1040static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsEqual(
1042{
1044
1045 TRACE("iface %p, type %p\n", iface, type);
1046
1047 if (This == &null_type)
1048 {
1049 WARN("Null type specified\n");
1050 return E_FAIL;
1051 }
1052
1053 if (iface == type)
1054 return S_OK;
1055
1056 return S_FALSE;
1057}
1058
1059static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetSubType(
1061{
1062 FIXME("iface %p stub!\n", iface);
1063
1064 return NULL;
1065}
1066
1067static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetBaseClass(
1069{
1070 FIXME("iface %p stub!\n", iface);
1071
1072 return NULL;
1073}
1074
1075static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetNumInterfaces(
1077{
1078 FIXME("iface %p stub!\n", iface);
1079
1080 return 0;
1081}
1082
1083static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetInterfaceByIndex(
1085{
1086 FIXME("iface %p, index %u stub!\n", iface, index);
1087
1088 return NULL;
1089}
1090
1091static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsOfType(
1093{
1094 FIXME("iface %p, type %p stub!\n", iface, type);
1095
1096 return E_NOTIMPL;
1097}
1098
1099static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_ImplementsInterface(
1101{
1102 FIXME("iface %p, base %p stub!\n", iface, base);
1103
1104 return E_NOTIMPL;
1105}
1106#endif
1107
1109{
1110 /* ID3D11ShaderReflectionType methods */
1115#if D3D_COMPILER_VERSION
1116 d3dcompiler_shader_reflection_type_IsEqual,
1117 d3dcompiler_shader_reflection_type_GetSubType,
1118 d3dcompiler_shader_reflection_type_GetBaseClass,
1119 d3dcompiler_shader_reflection_type_GetNumInterfaces,
1120 d3dcompiler_shader_reflection_type_GetInterfaceByIndex,
1121 d3dcompiler_shader_reflection_type_IsOfType,
1122 d3dcompiler_shader_reflection_type_ImplementsInterface,
1123#endif
1124};
1125
1126static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
1127{
1128 const char *ptr = data;
1129 size_t size = data_size >> 2;
1130
1131 TRACE("Size %Iu.\n", size);
1132
1133 r->instruction_count = read_u32(&ptr);
1134 TRACE("InstructionCount: %u.\n", r->instruction_count);
1135
1136 r->temp_register_count = read_u32(&ptr);
1137 TRACE("TempRegisterCount: %u.\n", r->temp_register_count);
1138
1139 r->def_count = read_u32(&ptr);
1140 TRACE("DefCount: %u.\n", r->def_count);
1141
1142 r->dcl_count = read_u32(&ptr);
1143 TRACE("DclCount: %u.\n", r->dcl_count);
1144
1145 r->float_instruction_count = read_u32(&ptr);
1146 TRACE("FloatInstructionCount: %u.\n", r->float_instruction_count);
1147
1148 r->int_instruction_count = read_u32(&ptr);
1149 TRACE("IntInstructionCount: %u.\n", r->int_instruction_count);
1150
1151 r->uint_instruction_count = read_u32(&ptr);
1152 TRACE("UintInstructionCount: %u.\n", r->uint_instruction_count);
1153
1154 r->static_flow_control_count = read_u32(&ptr);
1155 TRACE("StaticFlowControlCount: %u.\n", r->static_flow_control_count);
1156
1157 r->dynamic_flow_control_count = read_u32(&ptr);
1158 TRACE("DynamicFlowControlCount: %u.\n", r->dynamic_flow_control_count);
1159
1160 r->macro_instruction_count = read_u32(&ptr);
1161 TRACE("MacroInstructionCount: %u.\n", r->macro_instruction_count);
1162
1163 r->temp_array_count = read_u32(&ptr);
1164 TRACE("TempArrayCount: %u.\n", r->temp_array_count);
1165
1166 r->array_instruction_count = read_u32(&ptr);
1167 TRACE("ArrayInstructionCount: %u.\n", r->array_instruction_count);
1168
1169 r->cut_instruction_count = read_u32(&ptr);
1170 TRACE("CutInstructionCount: %u.\n", r->cut_instruction_count);
1171
1172 r->emit_instruction_count = read_u32(&ptr);
1173 TRACE("EmitInstructionCount: %u.\n", r->emit_instruction_count);
1174
1175 r->texture_normal_instructions = read_u32(&ptr);
1176 TRACE("TextureNormalInstructions: %u.\n", r->texture_normal_instructions);
1177
1178 r->texture_load_instructions = read_u32(&ptr);
1179 TRACE("TextureLoadInstructions: %u.\n", r->texture_load_instructions);
1180
1181 r->texture_comp_instructions = read_u32(&ptr);
1182 TRACE("TextureCompInstructions: %u.\n", r->texture_comp_instructions);
1183
1184 r->texture_bias_instructions = read_u32(&ptr);
1185 TRACE("TextureBiasInstructions: %u.\n", r->texture_bias_instructions);
1186
1187 r->texture_gradient_instructions = read_u32(&ptr);
1188 TRACE("TextureGradientInstructions: %u.\n", r->texture_gradient_instructions);
1189
1190 r->mov_instruction_count = read_u32(&ptr);
1191 TRACE("MovInstructionCount: %u.\n", r->mov_instruction_count);
1192
1193 skip_u32_unknown(&ptr, 1);
1194
1195 r->conversion_instruction_count = read_u32(&ptr);
1196 TRACE("ConversionInstructionCount: %u.\n", r->conversion_instruction_count);
1197
1198 skip_u32_unknown(&ptr, 1);
1199
1200 r->input_primitive = read_u32(&ptr);
1201 TRACE("InputPrimitive: %x.\n", r->input_primitive);
1202
1203 r->gs_output_topology = read_u32(&ptr);
1204 TRACE("GSOutputTopology: %x.\n", r->gs_output_topology);
1205
1206 r->gs_max_output_vertex_count = read_u32(&ptr);
1207 TRACE("GSMaxOutputVertexCount: %u.\n", r->gs_max_output_vertex_count);
1208
1209 skip_u32_unknown(&ptr, 2);
1210
1211 /* old dx10 stat size */
1212 if (size == 28) return S_OK;
1213
1214 skip_u32_unknown(&ptr, 1);
1215
1216 /* dx10 stat size */
1217 if (size == 29) return S_OK;
1218
1219 skip_u32_unknown(&ptr, 1);
1220
1221 r->c_control_points = read_u32(&ptr);
1222 TRACE("cControlPoints: %u.\n", r->c_control_points);
1223
1224 r->hs_output_primitive = read_u32(&ptr);
1225 TRACE("HSOutputPrimitive: %x.\n", r->hs_output_primitive);
1226
1227 r->hs_partitioning = read_u32(&ptr);
1228 TRACE("HSPartitioning: %x.\n", r->hs_partitioning);
1229
1230 r->tessellator_domain = read_u32(&ptr);
1231 TRACE("TessellatorDomain: %x.\n", r->tessellator_domain);
1232
1233 skip_u32_unknown(&ptr, 3);
1234
1235 /* dx11 stat size */
1236 if (size == 37) return S_OK;
1237
1238 FIXME("Unhandled size %Iu.\n", size);
1239
1240 return E_FAIL;
1241}
1242
1244 struct d3dcompiler_shader_reflection_type_member *member, const char *data, const char **ptr)
1245{
1247
1248 offset = read_u32(ptr);
1249 if (!copy_name(data + offset, &member->name))
1250 {
1251 ERR("Failed to copy name.\n");
1252 return E_OUTOFMEMORY;
1253 }
1254 TRACE("Member name: %s.\n", debugstr_a(member->name));
1255
1256 offset = read_u32(ptr);
1257 TRACE("Member type offset: %x.\n", offset);
1258
1260 if (!member->type)
1261 {
1262 ERR("Failed to get member type\n");
1263 free(member->name);
1264 return E_FAIL;
1265 }
1266
1267 member->offset = read_u32(ptr);
1268 TRACE("Member offset %x.\n", member->offset);
1269
1270 return S_OK;
1271}
1272
1274{
1275 const char *ptr = data + offset;
1276 uint32_t temp;
1278 unsigned int i;
1280 HRESULT hr;
1281 uint32_t member_offset;
1282
1283 desc = &type->desc;
1284
1285 temp = read_u32(&ptr);
1286 desc->Class = temp & 0xffff;
1287 desc->Type = temp >> 16;
1288 TRACE("Class %s, Type %s\n", debug_d3dcompiler_shader_variable_class(desc->Class),
1290
1291 temp = read_u32(&ptr);
1292 desc->Rows = temp & 0xffff;
1293 desc->Columns = temp >> 16;
1294 TRACE("Rows %u, Columns %u\n", desc->Rows, desc->Columns);
1295
1296 temp = read_u32(&ptr);
1297 desc->Elements = temp & 0xffff;
1298 desc->Members = temp >> 16;
1299 TRACE("Elements %u, Members %u\n", desc->Elements, desc->Members);
1300
1301 member_offset = read_u32(&ptr);
1302 TRACE("Member Offset %u.\n", member_offset);
1303
1304 if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1305 skip_u32_unknown(&ptr, 4);
1306
1307 if (desc->Members)
1308 {
1309 const char *ptr2 = data + member_offset;
1310
1311 members = calloc(desc->Members, sizeof(*members));
1312 if (!members)
1313 {
1314 ERR("Failed to allocate type memory.\n");
1315 return E_OUTOFMEMORY;
1316 }
1317
1318 for (i = 0; i < desc->Members; ++i)
1319 {
1320 hr = d3dcompiler_parse_type_members(type->reflection, &members[i], data, &ptr2);
1321 if (hr != S_OK)
1322 {
1323 FIXME("Failed to parse type members.\n");
1324 goto err_out;
1325 }
1326 }
1327 }
1328
1329#if D3D_COMPILER_VERSION
1330 if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1331 {
1332 offset = read_u32(&ptr);
1333 if (!copy_name(data + offset, &type->name))
1334 {
1335 ERR("Failed to copy name.\n");
1336 free(members);
1337 return E_OUTOFMEMORY;
1338 }
1339 desc->Name = type->name;
1340 TRACE("Type name: %s.\n", debugstr_a(type->name));
1341 }
1342#endif
1343
1344 type->members = members;
1345
1346 return S_OK;
1347
1348err_out:
1349 for (i = 0; i < desc->Members; ++i)
1350 {
1351 free_type_member(&members[i]);
1352 }
1353 free(members);
1354 return hr;
1355}
1356
1358{
1360 struct wine_rb_entry *entry;
1361 HRESULT hr;
1362
1363 entry = wine_rb_get(&reflection->types, &offset);
1364 if (entry)
1365 {
1366 TRACE("Returning existing type.\n");
1368 }
1369
1370 type = calloc(1, sizeof(*type));
1371 if (!type)
1372 return NULL;
1373
1374 type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3dcompiler_shader_reflection_type_vtbl;
1375 type->id = offset;
1376 type->reflection = reflection;
1377
1379 if (FAILED(hr))
1380 {
1381 ERR("Failed to parse type info, hr %#lx.\n", hr);
1382 free(type);
1383 return NULL;
1384 }
1385
1386 if (wine_rb_put(&reflection->types, &offset, &type->entry) == -1)
1387 {
1388 ERR("Failed to insert type entry.\n");
1389 free(type);
1390 return NULL;
1391 }
1392
1393 return type;
1394}
1395
1397 const char *data, size_t data_size, const char *ptr)
1398{
1400 unsigned int i;
1401 HRESULT hr;
1402
1403 variables = calloc(cb->variable_count, sizeof(*variables));
1404 if (!variables)
1405 {
1406 ERR("Failed to allocate variables memory.\n");
1407 return E_OUTOFMEMORY;
1408 }
1409
1410 for (i = 0; i < cb->variable_count; i++)
1411 {
1412 struct d3dcompiler_shader_reflection_variable *v = &variables[i];
1414
1415 v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl;
1416 v->constant_buffer = cb;
1417
1418 offset = read_u32(&ptr);
1419 if (!copy_name(data + offset, &v->name))
1420 {
1421 ERR("Failed to copy name.\n");
1422 hr = E_OUTOFMEMORY;
1423 goto err_out;
1424 }
1425 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1426
1427 v->start_offset = read_u32(&ptr);
1428 TRACE("Variable offset: %u\n", v->start_offset);
1429
1430 v->size = read_u32(&ptr);
1431 TRACE("Variable size: %u\n", v->size);
1432
1433 v->flags = read_u32(&ptr);
1434 TRACE("Variable flags: %u\n", v->flags);
1435
1436 offset = read_u32(&ptr);
1437 TRACE("Variable type offset: %x.\n", offset);
1438 v->type = get_reflection_type(cb->reflection, data, offset);
1439 if (!v->type)
1440 {
1441 ERR("Failed to get type.\n");
1442 hr = E_FAIL;
1443 goto err_out;
1444 }
1445
1446 offset = read_u32(&ptr);
1447 TRACE("Variable default value offset: %x.\n", offset);
1448 if (!copy_value(data + offset, &v->default_value, offset ? v->size : 0))
1449 {
1450 ERR("Failed to copy name.\n");
1451 hr = E_OUTOFMEMORY;
1452 goto err_out;
1453 }
1454
1455 if ((cb->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
1456 skip_u32_unknown(&ptr, 4);
1457 }
1458
1459 cb->variables = variables;
1460
1461 return S_OK;
1462
1463err_out:
1464 for (i = 0; i < cb->variable_count; i++)
1465 {
1466 free_variable(&variables[i]);
1467 }
1468 free(variables);
1469 return hr;
1470}
1471
1472static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
1473{
1474 struct d3dcompiler_shader_reflection_constant_buffer *constant_buffers = NULL;
1475 uint32_t offset, cbuffer_offset, resource_offset, creator_offset;
1476 unsigned int i, string_data_offset, string_data_size;
1477 D3D12_SHADER_INPUT_BIND_DESC *bound_resources = NULL;
1478 char *string_data = NULL, *creator = NULL;
1479 size_t size = data_size >> 2;
1480 uint32_t target_version;
1481 const char *ptr = data;
1482#if D3D_COMPILER_VERSION < 47
1484#endif
1485 HRESULT hr;
1486
1487 TRACE("Size %Iu.\n", size);
1488
1489 r->constant_buffer_count = read_u32(&ptr);
1490 TRACE("Constant buffer count: %u.\n", r->constant_buffer_count);
1491
1492 cbuffer_offset = read_u32(&ptr);
1493 TRACE("Constant buffer offset: %#x.\n", cbuffer_offset);
1494
1495 r->bound_resource_count = read_u32(&ptr);
1496 TRACE("Bound resource count: %u.\n", r->bound_resource_count);
1497
1498 resource_offset = read_u32(&ptr);
1499 TRACE("Bound resource offset: %#x.\n", resource_offset);
1500
1501 r->target = read_u32(&ptr);
1502 TRACE("Target: %#x.\n", r->target);
1503
1504 target_version = r->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK;
1505#if D3D_COMPILER_VERSION < 47
1508 if ((target_version >= 0x501 && shader_type != D3DCOMPILER_SHDR_SHADER_TYPE_CS)
1510 {
1511 WARN("Target version %#x is not supported in d3dcompiler %u.\n", target_version, D3D_COMPILER_VERSION);
1512 return E_INVALIDARG;
1513 }
1514#endif
1515
1516 r->flags = read_u32(&ptr);
1517 TRACE("Flags: %u.\n", r->flags);
1518
1519 creator_offset = read_u32(&ptr);
1520 TRACE("Creator at offset %#x.\n", creator_offset);
1521
1522 if (!copy_name(data + creator_offset, &creator))
1523 {
1524 ERR("Failed to copy name.\n");
1525 return E_OUTOFMEMORY;
1526 }
1527 TRACE("Creator: %s.\n", debugstr_a(creator));
1528
1529 /* todo: Parse RD11 */
1530 if (target_version >= 0x500)
1531 {
1532 skip_u32_unknown(&ptr, 8);
1533 }
1534
1535 if (r->bound_resource_count)
1536 {
1537 /* 8 for each bind desc */
1538 string_data_offset = resource_offset + r->bound_resource_count * 8 * sizeof(uint32_t);
1539 string_data_size = (cbuffer_offset ? cbuffer_offset : creator_offset) - string_data_offset;
1540
1541 string_data = malloc(string_data_size);
1542 if (!string_data)
1543 {
1544 ERR("Failed to allocate string data memory.\n");
1545 hr = E_OUTOFMEMORY;
1546 goto err_out;
1547 }
1548 memcpy(string_data, data + string_data_offset, string_data_size);
1549
1550 bound_resources = calloc(r->bound_resource_count, sizeof(*bound_resources));
1551 if (!bound_resources)
1552 {
1553 ERR("Failed to allocate resources memory.\n");
1554 hr = E_OUTOFMEMORY;
1555 goto err_out;
1556 }
1557
1558 ptr = data + resource_offset;
1559 for (i = 0; i < r->bound_resource_count; i++)
1560 {
1561 D3D12_SHADER_INPUT_BIND_DESC *desc = &bound_resources[i];
1562
1563 offset = read_u32(&ptr);
1564 desc->Name = string_data + (offset - string_data_offset);
1565 TRACE("Input bind Name: %s.\n", debugstr_a(desc->Name));
1566
1567 desc->Type = read_u32(&ptr);
1568 TRACE("Input bind Type: %#x.\n", desc->Type);
1569
1570 desc->ReturnType = read_u32(&ptr);
1571 TRACE("Input bind ReturnType: %#x.\n", desc->ReturnType);
1572
1573 desc->Dimension = read_u32(&ptr);
1574 TRACE("Input bind Dimension: %#x.\n", desc->Dimension);
1575
1576 desc->NumSamples = read_u32(&ptr);
1577 TRACE("Input bind NumSamples: %u.\n", desc->NumSamples);
1578
1579 desc->BindPoint = read_u32(&ptr);
1580 TRACE("Input bind BindPoint: %u.\n", desc->BindPoint);
1581
1582 desc->BindCount = read_u32(&ptr);
1583 TRACE("Input bind BindCount: %u.\n", desc->BindCount);
1584
1585 desc->uFlags = read_u32(&ptr);
1586 TRACE("Input bind uFlags: %u.\n", desc->uFlags);
1587
1588 if (target_version >= 0x501)
1589 {
1590 desc->Space = read_u32(&ptr);
1591 TRACE("Input bind Space %u.\n", desc->Space);
1592 desc->uID = read_u32(&ptr);
1593 TRACE("Input bind uID %u.\n", desc->uID);
1594 }
1595 else
1596 {
1597 desc->uID = desc->BindPoint;
1598 }
1599 }
1600 }
1601
1602 if (r->constant_buffer_count)
1603 {
1604 constant_buffers = calloc(r->constant_buffer_count, sizeof(*constant_buffers));
1605 if (!constant_buffers)
1606 {
1607 ERR("Failed to allocate constant buffer memory.\n");
1608 hr = E_OUTOFMEMORY;
1609 goto err_out;
1610 }
1611
1612 ptr = data + cbuffer_offset;
1613 for (i = 0; i < r->constant_buffer_count; i++)
1614 {
1615 struct d3dcompiler_shader_reflection_constant_buffer *cb = &constant_buffers[i];
1616
1617 cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3dcompiler_shader_reflection_constant_buffer_vtbl;
1618 cb->reflection = r;
1619
1620 offset = read_u32(&ptr);
1621 if (!copy_name(data + offset, &cb->name))
1622 {
1623 ERR("Failed to copy name.\n");
1624 hr = E_OUTOFMEMORY;
1625 goto err_out;
1626 }
1627 TRACE("Name: %s.\n", debugstr_a(cb->name));
1628
1629 cb->variable_count = read_u32(&ptr);
1630 TRACE("Variable count: %u.\n", cb->variable_count);
1631
1632 offset = read_u32(&ptr);
1633 TRACE("Variable offset: %x.\n", offset);
1634
1635 hr = d3dcompiler_parse_variables(cb, data, data_size, data + offset);
1636 if (hr != S_OK)
1637 {
1638 FIXME("Failed to parse variables.\n");
1639 goto err_out;
1640 }
1641
1642 cb->size = read_u32(&ptr);
1643 TRACE("Cbuffer size: %u.\n", cb->size);
1644
1645 cb->flags = read_u32(&ptr);
1646 TRACE("Cbuffer flags: %u.\n", cb->flags);
1647
1648 cb->type = read_u32(&ptr);
1649 TRACE("Cbuffer type: %#x.\n", cb->type);
1650 }
1651 }
1652
1653 r->creator = creator;
1654 r->resource_string = string_data;
1655 r->bound_resources = bound_resources;
1656 r->constant_buffers = constant_buffers;
1657
1658 return S_OK;
1659
1660err_out:
1661 for (i = 0; i < r->constant_buffer_count; ++i)
1662 {
1663 free_constant_buffer(&constant_buffers[i]);
1664 }
1665 free(constant_buffers);
1666 free(bound_resources);
1667 free(string_data);
1668 free(creator);
1669
1670 return hr;
1671}
1672
1675{
1677 const char *ptr = section->data.code;
1679 unsigned int string_data_offset;
1680 unsigned int string_data_size;
1681 unsigned int i, count;
1682 char *string_data;
1683
1684 switch (section->tag)
1685 {
1686 case TAG_OSG5:
1688 break;
1689
1690 case TAG_ISGN:
1691 case TAG_OSGN:
1692 case TAG_PCSG:
1694 break;
1695
1696 default:
1697 FIXME("Unhandled section %s!\n", debugstr_fourcc(section->tag));
1699 break;
1700 }
1701
1702 count = read_u32(&ptr);
1703 TRACE("%u elements\n", count);
1704
1705 skip_u32_unknown(&ptr, 1);
1706
1707 d = calloc(count, sizeof(*d));
1708 if (!d)
1709 {
1710 ERR("Failed to allocate signature memory.\n");
1711 return E_OUTOFMEMORY;
1712 }
1713
1714 /* 2 u32s for the header, element_size for each element. */
1715 string_data_offset = 2 * sizeof(uint32_t) + count * element_size * sizeof(uint32_t);
1716 string_data_size = section->data.size - string_data_offset;
1717
1718 string_data = malloc(string_data_size);
1719 if (!string_data)
1720 {
1721 ERR("Failed to allocate string data memory.\n");
1722 free(d);
1723 return E_OUTOFMEMORY;
1724 }
1725 memcpy(string_data, (const char *)section->data.code + string_data_offset, string_data_size);
1726
1727 for (i = 0; i < count; ++i)
1728 {
1729 uint32_t name_offset, mask;
1730
1731#if D3D_COMPILER_VERSION >= 46
1732 /* FIXME */
1733 d[i].MinPrecision = D3D_MIN_PRECISION_DEFAULT;
1734#endif
1735#if D3D_COMPILER_VERSION
1737 {
1738 d[i].Stream = read_u32(&ptr);
1739 }
1740#endif
1741
1742 name_offset = read_u32(&ptr);
1743 d[i].SemanticName = string_data + (name_offset - string_data_offset);
1744 d[i].SemanticIndex = read_u32(&ptr);
1745 d[i].SystemValueType = read_u32(&ptr);
1746 d[i].ComponentType = read_u32(&ptr);
1747 d[i].Register = read_u32(&ptr);
1748 mask = read_u32(&ptr);
1749 d[i].ReadWriteMask = (mask >> 8) & 0xff;
1750 d[i].Mask = mask & 0xff;
1751
1752 if (!stricmp(d[i].SemanticName, "sv_depth"))
1753 d[i].SystemValueType = D3D_NAME_DEPTH;
1754 else if (!stricmp(d[i].SemanticName, "sv_coverage"))
1755 d[i].SystemValueType = D3D_NAME_COVERAGE;
1756 else if (!stricmp(d[i].SemanticName, "sv_depthgreaterequal"))
1757 d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL;
1758 else if (!stricmp(d[i].SemanticName, "sv_depthlessequal"))
1759 d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL;
1760 else if (!stricmp(d[i].SemanticName, "sv_target"))
1761 d[i].SystemValueType = D3D_NAME_TARGET;
1762 }
1763
1764 s->elements = d;
1765 s->element_count = count;
1766 s->string_data = string_data;
1767
1768 return S_OK;
1769}
1770
1771#define SM4_OPCODE_MASK 0xff
1772#define SM4_INSTRUCTION_LENGTH_SHIFT 24
1773#define SM4_INSTRUCTION_LENGTH_MASK (0x1fu << SM4_INSTRUCTION_LENGTH_SHIFT)
1774
1776{
1778};
1779
1780static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
1781{
1782 uint32_t opcode_token, opcode;
1784 const char *ptr = data;
1785 const uint32_t *u_ptr;
1786 unsigned int len;
1787
1788 r->version = read_u32(&ptr);
1789 TRACE("Shader version: %u\n", r->version);
1790
1793
1795 {
1796 /* TODO: Check if anything else is needed from the SHDR or SHEX blob. */
1797 return S_OK;
1798 }
1799
1800 size = read_u32(&ptr);
1801 TRACE("size %u.\n", size);
1802 if (size * sizeof(uint32_t) != data_size || size < 2)
1803 {
1804 WARN("Invalid size %u.\n", size);
1805 return E_FAIL;
1806 }
1807 size -= 2;
1808 u_ptr = (uint32_t *)ptr;
1809 while (size)
1810 {
1811 opcode_token = *u_ptr;
1812 opcode = opcode_token & SM4_OPCODE_MASK;
1814 if (!len)
1815 {
1816 if (size < 2)
1817 {
1818 WARN("End of byte-code, failed to read length token.\n");
1819 return E_FAIL;
1820 }
1821 len = u_ptr[1];
1822 }
1823 if (!len || size < len)
1824 {
1825 WARN("Invalid instruction length %u, size %u.\n", len, size);
1826 return E_FAIL;
1827 }
1828 if (opcode == SM5_OP_DCL_THREAD_GROUP)
1829 {
1830 if (len != 4)
1831 {
1832 WARN("Invalid dcl_thread_group opcode length %u.\n", len);
1833 return E_FAIL;
1834 }
1835 r->thread_group_size_x = u_ptr[1];
1836 r->thread_group_size_y = u_ptr[2];
1837 r->thread_group_size_z = u_ptr[3];
1838 TRACE("Found dcl_thread_group %u, %u, %u.\n",
1839 r->thread_group_size_x, r->thread_group_size_y, r->thread_group_size_z);
1840 }
1841 size -= len;
1842 u_ptr += len;
1843 }
1844 return S_OK;
1845}
1846
1848 const void *data, SIZE_T data_size)
1849{
1850 const struct vkd3d_shader_code src_dxbc = {.code = data, .size = data_size};
1851 struct vkd3d_shader_dxbc_desc src_dxbc_desc;
1852 HRESULT hr = S_OK;
1853 unsigned int i;
1854 int ret;
1855
1857
1858 if ((ret = vkd3d_shader_parse_dxbc(&src_dxbc, 0, &src_dxbc_desc, NULL)) < 0)
1859 {
1860 WARN("Failed to parse reflection, ret %d.\n", ret);
1861 return E_FAIL;
1862 }
1863
1864 for (i = 0; i < src_dxbc_desc.section_count; ++i)
1865 {
1866 const struct vkd3d_shader_dxbc_section_desc *section = &src_dxbc_desc.sections[i];
1867
1868 switch (section->tag)
1869 {
1870 case TAG_RDEF:
1871 hr = d3dcompiler_parse_rdef(reflection, section->data.code, section->data.size);
1872 if (FAILED(hr))
1873 {
1874 WARN("Failed to parse RDEF section.\n");
1875 goto err_out;
1876 }
1877 break;
1878
1879 case TAG_ISGN:
1880 reflection->isgn = calloc(1, sizeof(*reflection->isgn));
1881 if (!reflection->isgn)
1882 {
1883 ERR("Failed to allocate ISGN memory.\n");
1884 hr = E_OUTOFMEMORY;
1885 goto err_out;
1886 }
1887
1889 if (FAILED(hr))
1890 {
1891 WARN("Failed to parse section ISGN.\n");
1892 goto err_out;
1893 }
1894 break;
1895
1896 case TAG_OSG5:
1897 case TAG_OSGN:
1898 reflection->osgn = calloc(1, sizeof(*reflection->osgn));
1899 if (!reflection->osgn)
1900 {
1901 ERR("Failed to allocate OSGN memory.\n");
1902 hr = E_OUTOFMEMORY;
1903 goto err_out;
1904 }
1905
1907 if (FAILED(hr))
1908 {
1909 WARN("Failed to parse section OSGN.\n");
1910 goto err_out;
1911 }
1912 break;
1913
1914 case TAG_PCSG:
1915 reflection->pcsg = calloc(1, sizeof(*reflection->pcsg));
1916 if (!reflection->pcsg)
1917 {
1918 ERR("Failed to allocate PCSG memory.\n");
1919 hr = E_OUTOFMEMORY;
1920 goto err_out;
1921 }
1922
1924 if (FAILED(hr))
1925 {
1926 WARN("Failed to parse section PCSG.\n");
1927 goto err_out;
1928 }
1929 break;
1930
1931 case TAG_SHEX:
1932 case TAG_SHDR:
1933 hr = d3dcompiler_parse_shdr(reflection, section->data.code, section->data.size);
1934 if (FAILED(hr))
1935 {
1936 WARN("Failed to parse SHDR section.\n");
1937 goto err_out;
1938 }
1939 break;
1940
1941 case TAG_STAT:
1942 hr = d3dcompiler_parse_stat(reflection, section->data.code, section->data.size);
1943 if (FAILED(hr))
1944 {
1945 WARN("Failed to parse section STAT.\n");
1946 goto err_out;
1947 }
1948 break;
1949
1950 default:
1951 FIXME("Unhandled section %s!\n", debugstr_fourcc(section->tag));
1952 break;
1953 }
1954 }
1955
1956 vkd3d_shader_free_dxbc(&src_dxbc_desc);
1957
1958 return hr;
1959
1960err_out:
1961 reflection_cleanup(reflection);
1962 vkd3d_shader_free_dxbc(&src_dxbc_desc);
1963
1964 return hr;
1965}
1966
1967/* d3d10 reflection methods. */
1968#if !D3D_COMPILER_VERSION
1970{
1972 HRESULT hr;
1973
1974 TRACE("data %p, data_size %Iu, reflector %p.\n", data, data_size, reflector);
1975
1976 if (!(object = calloc(1, sizeof(*object))))
1977 {
1978 ERR("Failed to allocate D3D10 shader reflection object memory.\n");
1979 return E_OUTOFMEMORY;
1980 }
1981
1982 object->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
1983 object->interface_version = D3DCOMPILER_REFLECTION_VERSION_D3D10;
1984 object->refcount = 1;
1985
1986 hr = d3dcompiler_shader_reflection_init(object, data, data_size);
1987 if (FAILED(hr))
1988 {
1989 WARN("Failed to initialize shader reflection.\n");
1990 free(object);
1991 return hr;
1992 }
1993
1994 *reflector = (ID3D10ShaderReflection *)&object->ID3D11ShaderReflection_iface;
1995
1996 TRACE("Created ID3D10ShaderReflection %p.\n", object);
1997
1998 return S_OK;
1999}
2000#else
2001HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector)
2002{
2004 const uint32_t *temp = data;
2005 HRESULT hr;
2006
2007 TRACE("data %p, data_size %Iu, riid %s, blob %p.\n", data, data_size, debugstr_guid(riid), reflector);
2008
2009 if (!data || data_size < 32)
2010 {
2011 WARN("Invalid argument supplied.\n");
2012 return D3DERR_INVALIDCALL;
2013 }
2014
2015 if (temp[6] != data_size)
2016 {
2017 WARN("Wrong size supplied.\n");
2018#if D3D_COMPILER_VERSION >= 46
2019 return D3DERR_INVALIDCALL;
2020#else
2021 return E_FAIL;
2022#endif
2023 }
2024
2026 && (D3D_COMPILER_VERSION < 47 || !IsEqualGUID(riid, &IID_ID3D12ShaderReflection)))
2027 {
2028 WARN("Wrong riid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection));
2029#if D3D_COMPILER_VERSION >= 46
2030 return E_INVALIDARG;
2031#else
2032 return E_NOINTERFACE;
2033#endif
2034 }
2035
2036 object = calloc(1, sizeof(*object));
2037 if (!object)
2038 return E_OUTOFMEMORY;
2039
2040 object->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
2041 object->refcount = 1;
2042 object->interface_version = IsEqualGUID(riid, &IID_ID3D12ShaderReflection)
2044
2045 hr = d3dcompiler_shader_reflection_init(object, data, data_size);
2046 if (FAILED(hr))
2047 {
2048 WARN("Failed to initialize shader reflection\n");
2049 free(object);
2050 return hr;
2051 }
2052
2053 *reflector = object;
2054 TRACE("Created ID3D11ShaderReflection %p\n", object);
2055
2056 return S_OK;
2057}
2058#endif
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
#define D3D_COMPILER_VERSION
Definition: d3d11shader.h:26
D3D_FEATURE_LEVEL
Definition: d3dcommon.idl:102
D3D_TESSELLATOR_OUTPUT_PRIMITIVE
Definition: d3dcommon.idl:508
D3D_TESSELLATOR_PARTITIONING
Definition: d3dcommon.idl:494
D3D_TESSELLATOR_DOMAIN
Definition: d3dcommon.idl:482
@ D3D_NAME_TARGET
Definition: d3dcommon.idl:656
@ D3D_NAME_DEPTH_GREATER_EQUAL
Definition: d3dcommon.idl:659
@ D3D_NAME_DEPTH_LESS_EQUAL
Definition: d3dcommon.idl:660
@ D3D_NAME_DEPTH
Definition: d3dcommon.idl:657
@ D3D_NAME_COVERAGE
Definition: d3dcommon.idl:658
@ D3D_MIN_PRECISION_DEFAULT
Definition: d3dcommon.idl:523
D3D_CBUFFER_TYPE
Definition: d3dcommon.idl:534
D3D_PRIMITIVE
Definition: d3dcommon.idl:298
D3D_PRIMITIVE_TOPOLOGY
Definition: d3dcommon.idl:384
HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector)
#define TAG_SHEX
#define TAG_SHDR
#define TAG_ISGN
#define TAG_OSGN
#define TAG_STAT
#define TAG_OSG5
const char * debug_d3dcompiler_shader_variable_type(D3D_SHADER_VARIABLE_TYPE t)
Definition: utils.c:50
#define TAG_PCSG
const char * debug_d3dcompiler_shader_variable_class(D3D_SHADER_VARIABLE_CLASS c)
Definition: utils.c:32
#define TAG_RDEF
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
size_t const element_size
Definition: debug_heap.cpp:510
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 uint32_t
Definition: types.h:75
static struct d3dcompiler_shader_reflection_type * get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, uint32_t offset)
Definition: reflection.c:1357
static struct d3dcompiler_shader_reflection_variable * impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface)
Definition: reflection.c:858
#define ID3D11ShaderReflectionConstantBufferVtbl
Definition: reflection.c:29
#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_SHIFT
Definition: reflection.c:53
#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_MASK
Definition: reflection.c:52
#define ID3D11ShaderReflectionVtbl
Definition: reflection.c:27
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetDesc(ID3D11ShaderReflectionConstantBuffer *iface, D3D11_SHADER_BUFFER_DESC *desc)
Definition: reflection.c:774
#define ID3D11ShaderReflectionVariableVtbl
Definition: reflection.c:33
#define D3DCOMPILER_SHADER_TARGET_VERSION_MASK
Definition: reflection.c:51
static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl
Definition: reflection.c:185
static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *entry, void *context)
Definition: reflection.c:250
static struct ID3D11ShaderReflectionConstantBuffer *STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName(ID3D11ShaderReflection *iface, const char *name)
Definition: reflection.c:468
D3DCOMPILER_SIGNATURE_ELEMENT_SIZE
Definition: reflection.c:46
@ D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7
Definition: reflection.c:48
@ D3DCOMPILER_SIGNATURE_ELEMENT_SIZE6
Definition: reflection.c:47
static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl
Definition: reflection.c:737
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByIndex(ID3D11ShaderReflectionType *iface, UINT index)
Definition: reflection.c:971
#define ID3D11ShaderReflectionType
Definition: reflection.c:30
#define SM4_OPCODE_MASK
Definition: reflection.c:1771
#define ID3D11ShaderReflectionTypeVtbl
Definition: reflection.c:31
static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11ShaderReflection *iface)
Definition: reflection.c:368
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetDesc(ID3D11ShaderReflectionType *iface, D3D11_SHADER_TYPE_DESC *desc)
Definition: reflection.c:947
static void free_signature(struct d3dcompiler_shader_signature *sig)
Definition: reflection.c:270
#define ID3D11ShaderReflectionConstantBuffer
Definition: reflection.c:28
static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type *type, const char *data, uint32_t offset)
Definition: reflection.c:1273
static void free_type_member(struct d3dcompiler_shader_reflection_type_member *member)
Definition: reflection.c:242
d3dcompiler_shader_type
Definition: reflection.c:58
@ D3DCOMPILER_SHADER_TYPE_CS
Definition: reflection.c:59
#define ID3D11ShaderReflection
Definition: reflection.c:26
#define ID3D11ShaderReflectionVariable
Definition: reflection.c:32
static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl
Definition: reflection.c:184
static const char *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeName(ID3D11ShaderReflectionType *iface, UINT index)
Definition: reflection.c:1017
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByName(ID3D11ShaderReflectionType *iface, const char *name)
Definition: reflection.c:987
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc)
Definition: reflection.c:498
static struct d3dcompiler_shader_reflection_constant_buffer * impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface)
Definition: reflection.c:769
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameterDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
Definition: reflection.c:518
static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
Definition: reflection.c:1126
D3DCOMPILER_REFLECTION_VERSION
Definition: reflection.c:120
@ D3DCOMPILER_REFLECTION_VERSION_D3D10
Definition: reflection.c:121
@ D3DCOMPILER_REFLECTION_VERSION_D3D11
Definition: reflection.c:122
@ D3DCOMPILER_REFLECTION_VERSION_D3D12
Definition: reflection.c:123
#define IID_ID3D11ShaderReflection
Definition: reflection.c:34
static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_constant_buffer *cb, const char *data, size_t data_size, const char *ptr)
Definition: reflection.c:1396
static BOOL copy_value(const char *ptr, void **value, uint32_t size)
Definition: reflection.c:218
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParameterDesc(ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc)
Definition: reflection.c:536
static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
Definition: reflection.c:1472
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:1243
#define SM4_INSTRUCTION_LENGTH_SHIFT
Definition: reflection.c:1772
#define SM4_INSTRUCTION_LENGTH_MASK
Definition: reflection.c:1773
static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
Definition: reflection.c:1780
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object)
Definition: reflection.c:349
static void free_constant_buffer(struct d3dcompiler_shader_reflection_constant_buffer *cb)
Definition: reflection.c:287
static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface)
Definition: reflection.c:378
static int d3dcompiler_shader_reflection_type_compare(const void *key, const struct wine_rb_entry *entry)
Definition: reflection.c:234
static ID3D11ShaderReflectionType *STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetType(ID3D11ShaderReflectionVariable *iface)
Definition: reflection.c:899
static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection *reflection, const void *data, SIZE_T data_size)
Definition: reflection.c:1847
static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref)
Definition: reflection.c:303
static struct d3dcompiler_shader_reflection * impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface)
Definition: reflection.c:344
static struct d3dcompiler_shader_reflection_type * impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface)
Definition: reflection.c:942
HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector)
Definition: reflection.c:1969
static ID3D11ShaderReflectionVariable *STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByIndex(ID3D11ShaderReflectionConstantBuffer *iface, UINT index)
Definition: reflection.c:802
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetDesc(ID3D11ShaderReflectionVariable *iface, D3D11_SHADER_VARIABLE_DESC *desc)
Definition: reflection.c:863
static struct d3dcompiler_shader_reflection_variable null_variable
Definition: reflection.c:197
static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl
Definition: reflection.c:186
static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer
Definition: reflection.c:189
static void free_variable(struct d3dcompiler_shader_reflection_variable *var)
Definition: reflection.c:278
static BOOL copy_name(const char *ptr, char **name)
Definition: reflection.c:204
sm4_opcode
Definition: reflection.c:1776
@ SM5_OP_DCL_THREAD_GROUP
Definition: reflection.c:1777
static struct d3dcompiler_shader_reflection_type null_type
Definition: reflection.c:193
static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc)
Definition: reflection.c:396
static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, const struct vkd3d_shader_dxbc_section_desc *section)
Definition: reflection.c:1673
#define D3DCOMPILER_SHDR_SHADER_TYPE_CS
Definition: reflection.c:55
static ID3D11ShaderReflectionVariable *STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByName(ID3D11ShaderReflectionConstantBuffer *iface, const char *name)
Definition: reflection.c:818
static struct ID3D11ShaderReflectionConstantBuffer *STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByIndex(ID3D11ShaderReflection *iface, UINT index)
Definition: reflection.c:452
void skip_u32_unknown(const char **ptr, unsigned int count)
Definition: utils.c:516
static uint32_t read_u32(const char **ptr)
Definition: utils.h:24
#define stricmp(_String1, _String2)
Definition: compat.h:24
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
static char * strdup(const char *buf)
Definition: string.h:83
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint level
Definition: gl.h:1546
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint index
Definition: glext.h:6031
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLsizei len
Definition: glext.h:6722
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
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
#define d
Definition: ke_i.h:81
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
const char * var
Definition: shader.c:5879
int k
Definition: mpi.c:3369
#define uint32_t
Definition: nsiface.idl:61
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
static calc_node_t temp
Definition: rpn_ieee.c:38
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
#define wine_rb_entry
Definition: rbtree.h:404
#define WINE_RB_ENTRY_VALUE
Definition: rbtree.h:414
#define wine_rb_put
Definition: rbtree.h:410
#define wine_rb_tree
Definition: rbtree.h:405
#define wine_rb_init
Definition: rbtree.h:406
#define wine_rb_destroy
Definition: rbtree.h:408
#define wine_rb_get
Definition: rbtree.h:409
#define TRACE(s)
Definition: solgame.cpp:4
Definition: http.c:7252
ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer_iface
Definition: reflection.c:106
struct d3dcompiler_shader_reflection * reflection
Definition: reflection.c:108
struct d3dcompiler_shader_reflection_variable * variables
Definition: reflection.c:116
struct d3dcompiler_shader_reflection_type * type
Definition: reflection.c:87
struct wine_rb_entry entry
Definition: reflection.c:74
ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface
Definition: reflection.c:71
D3D11_SHADER_TYPE_DESC desc
Definition: reflection.c:78
struct d3dcompiler_shader_reflection * reflection
Definition: reflection.c:76
struct d3dcompiler_shader_reflection_type_member * members
Definition: reflection.c:79
struct d3dcompiler_shader_reflection_constant_buffer * constant_buffer
Definition: reflection.c:94
ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable_iface
Definition: reflection.c:92
struct d3dcompiler_shader_reflection_type * type
Definition: reflection.c:95
struct d3dcompiler_shader_signature * osgn
Definition: reflection.c:174
D3D_TESSELLATOR_OUTPUT_PRIMITIVE hs_output_primitive
Definition: reflection.c:166
struct d3dcompiler_shader_signature * pcsg
Definition: reflection.c:175
D3D12_SHADER_INPUT_BIND_DESC * bound_resources
Definition: reflection.c:177
enum D3DCOMPILER_REFLECTION_VERSION interface_version
Definition: reflection.c:132
D3D_PRIMITIVE_TOPOLOGY gs_output_topology
Definition: reflection.c:145
ID3D11ShaderReflection ID3D11ShaderReflection_iface
Definition: reflection.c:129
D3D_TESSELLATOR_PARTITIONING hs_partitioning
Definition: reflection.c:167
struct d3dcompiler_shader_reflection_constant_buffer * constant_buffers
Definition: reflection.c:178
struct d3dcompiler_shader_signature * isgn
Definition: reflection.c:173
D3D_TESSELLATOR_DOMAIN tessellator_domain
Definition: reflection.c:168
struct wine_rb_tree types
Definition: reflection.c:179
D3D11_SIGNATURE_PARAMETER_DESC * elements
Definition: reflection.c:64
char * name
Definition: wpp.c:52
Definition: copy.c:22
char name[MAX_NAME_LEN]
DWORD type
Definition: name.c:39
Definition: send.c:48
Definition: parser.c:56
Definition: cmds.c:130
const void * code
Definition: vkd3d_shader.h:413
struct vkd3d_shader_dxbc_section_desc * sections
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:64
VKD3D_SHADER_API void vkd3d_shader_free_dxbc(struct vkd3d_shader_dxbc_desc *dxbc)
Definition: dxbc.c:290
VKD3D_SHADER_API int vkd3d_shader_parse_dxbc(const struct vkd3d_shader_code *dxbc, uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages)
Definition: dxbc.c:320
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479