private static unsafe ReflectBlockVariable[] ToManagedArray(SpirvReflectNative.SpvReflectBlockVariable *push_consts, uint var_count) { ReflectBlockVariable[] blockVars = new ReflectBlockVariable[var_count]; for (int i = 0; i < var_count; i++) { var block = push_consts[i]; ReflectBlockVariable variable = new ReflectBlockVariable(); PopulateReflectBlockVariable(ref block, ref variable); variable.Members = ToManagedArray(block.members, block.member_count); blockVars[i] = variable; } return(blockVars); }
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); }