internal static unsafe ReflectTypeDescription GetManaged(ref SpirvReflectNative.SpvReflectTypeDescription type_description) { ReflectTypeDescription desc = new ReflectTypeDescription(); PopulateReflectTypeDescription(ref type_description, ref desc); desc.Members = ToManagedArray(type_description.members, type_description.member_count); return(desc); }
private static unsafe void PopulateReflectTypeDescription( ref SpirvReflectNative.SpvReflectTypeDescription type_description, ref ReflectTypeDescription desc) { desc.Id = type_description.id; desc.Op = (Op)type_description.op; desc.TypeName = new string(type_description.type_name); desc.StructMemberName = new string(type_description.struct_member_name); desc.StorageClass = (StorageClass)type_description.storage_class; desc.TypeFlags = (ReflectType)type_description.type_flags.Data; desc.DecorationFlags = (ReflectDecoration)type_description.decoration_flags.Data; desc.Traits = new Traits(type_description.traits); }
internal static unsafe void PopulateReflectInterfaceVariable( ref SpirvReflectNative.SpvReflectInterfaceVariable intf, ref ReflectInterfaceVariable variable) { variable.SpirvId = intf.spirv_id; variable.Name = new string(intf.name); variable.Location = intf.location; variable.StorageClass = (StorageClass)intf.storage_class; variable.Semantic = new string(intf.semantic); variable.DecorationFlags = (ReflectDecoration)intf.decoration_flags.Data; variable.BuiltIn = (BuiltIn)intf.built_in; variable.Format = (ReflectFormat)intf.format; variable.TypeDescription = ReflectTypeDescription.GetManaged(ref *intf.type_description); variable.Array = new ReflectArrayTraits(intf.array); variable.Numeric = new ReflectNumericTraits(intf.numeric); }
private static unsafe ReflectTypeDescription[] ToManagedArray(SpirvReflectNative.SpvReflectTypeDescription *type_description, uint member_count) { ReflectTypeDescription[] intf_vars = new ReflectTypeDescription[member_count]; for (int i = 0; i < member_count; i++) { var typedesc = type_description[i]; ReflectTypeDescription variable = new ReflectTypeDescription(); PopulateReflectTypeDescription(ref typedesc, ref variable); variable.Members = ToManagedArray(typedesc.members, typedesc.member_count); intf_vars[i] = variable; } return(intf_vars); }
internal static unsafe void PopulateReflectBlockVariable( ref SpirvReflectNative.SpvReflectBlockVariable block, ref ReflectBlockVariable variable) { variable.SpirvId = block.spirv_id; variable.Name = new string(block.name); variable.Offset = block.offset; variable.AbsoluteOffset = block.absolute_offset; variable.Size = block.size; variable.PaddedSize = block.padded_size; variable.DecorationFlags = (ReflectDecoration)block.decoration_flags.Data; variable.Flags = (ReflectVariable)block.flags.Data; if (block.type_description != null) { variable.TypeDescription = ReflectTypeDescription.GetManaged(ref *block.type_description); } variable.Array = new ReflectArrayTraits(block.array); variable.Numeric = new ReflectNumericTraits(block.numeric); }
internal unsafe ReflectDescriptorBinding(SpirvReflectNative.SpvReflectDescriptorBinding binding) { Native = binding; Set = binding.set; Accessed = binding.accessed; Name = new string(binding.name); Binding = binding.binding; SpirvId = binding.spirv_id; Count = binding.count; ResourceType = (ReflectResourceType)binding.resource_type; UavCounterId = binding.uav_counter_id; InputAttachmentIndex = binding.input_attachment_index; Image = new ReflectImageTraits(binding.image); Array = new ReflectBindingArrayTraits(binding.array); DescriptorType = (ReflectDescriptorType)binding.descriptor_type; Block = new ReflectBlockVariable(); ReflectBlockVariable.PopulateReflectBlockVariable(ref binding.block, ref Block); TypeDescription = ReflectTypeDescription.GetManaged(ref *binding.type_description); //UavCounterBinding = new ReflectDescriptorBinding(*binding.uav_counter_binding); }