public void CmdBindDescriptorSets(PipelineBindPoint pipelineBindPoint, PipelineLayout layout, UInt32 firstSet, DescriptorSet[] pDescriptorSets, UInt32[] pDynamicOffsets) { unsafe { var arraypDescriptorSets = pDescriptorSets == null ? IntPtr.Zero : Marshal.AllocHGlobal(pDescriptorSets.Length * sizeof(UInt64)); var lenpDescriptorSets = pDescriptorSets == null ? 0 : pDescriptorSets.Length; if (pDescriptorSets != null) { for (int i = 0; i < pDescriptorSets.Length; i++) { ((UInt64 *)arraypDescriptorSets) [i] = (pDescriptorSets [i].m); } } var arraypDynamicOffsets = pDynamicOffsets == null ? IntPtr.Zero : Marshal.AllocHGlobal(pDynamicOffsets.Length * sizeof(UInt32)); var lenpDynamicOffsets = pDynamicOffsets == null ? 0 : pDynamicOffsets.Length; if (pDynamicOffsets != null) { for (int i = 0; i < pDynamicOffsets.Length; i++) { ((UInt32 *)arraypDynamicOffsets) [i] = (pDynamicOffsets [i]); } } Interop.NativeMethods.vkCmdBindDescriptorSets(this.m, pipelineBindPoint, layout != null ? layout.m : default(UInt64), firstSet, (uint)lenpDescriptorSets, (UInt64 *)arraypDescriptorSets, (uint)lenpDynamicOffsets, (UInt32 *)arraypDynamicOffsets); Marshal.FreeHGlobal(arraypDescriptorSets); Marshal.FreeHGlobal(arraypDynamicOffsets); } }
/// <param name="PipelineBindPoint">Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now</param> public SubpassDescription(PipelineBindPoint PipelineBindPoint, AttachmentReference[] InputAttachments, AttachmentReference[] ColorAttachments, UInt32[] PreserveAttachments) : this() { this.PipelineBindPoint = PipelineBindPoint; this.InputAttachments = InputAttachments; this.ColorAttachments = ColorAttachments; this.PreserveAttachments = PreserveAttachments; }
public DescriptorUpdateTemplateCreateInfoKHR ( StructureType sType = StructureType.DescriptorUpdateTemplateCreateInfo, void *pNext = default, uint flags = default, uint descriptorUpdateEntryCount = default, DescriptorUpdateTemplateEntry *pDescriptorUpdateEntries = default, DescriptorUpdateTemplateType templateType = default, DescriptorSetLayout descriptorSetLayout = default, PipelineBindPoint pipelineBindPoint = default, PipelineLayout pipelineLayout = default, uint set = default ) { SType = sType; PNext = pNext; Flags = flags; DescriptorUpdateEntryCount = descriptorUpdateEntryCount; PDescriptorUpdateEntries = pDescriptorUpdateEntries; TemplateType = templateType; DescriptorSetLayout = descriptorSetLayout; PipelineBindPoint = pipelineBindPoint; PipelineLayout = pipelineLayout; Set = set; }
public GeneratedCommandsInfoNV ( StructureType sType = StructureType.GeneratedCommandsInfoNV, void *pNext = default, PipelineBindPoint pipelineBindPoint = default, Pipeline pipeline = default, IndirectCommandsLayoutNV indirectCommandsLayout = default, uint streamCount = default, IndirectCommandsStreamNV *pStreams = default, uint sequencesCount = default, Buffer preprocessBuffer = default, ulong preprocessOffset = default, ulong preprocessSize = default, Buffer sequencesCountBuffer = default, ulong sequencesCountOffset = default, Buffer sequencesIndexBuffer = default, ulong sequencesIndexOffset = default ) { SType = sType; PNext = pNext; PipelineBindPoint = pipelineBindPoint; Pipeline = pipeline; IndirectCommandsLayout = indirectCommandsLayout; StreamCount = streamCount; PStreams = pStreams; SequencesCount = sequencesCount; PreprocessBuffer = preprocessBuffer; PreprocessOffset = preprocessOffset; PreprocessSize = preprocessSize; SequencesCountBuffer = sequencesCountBuffer; SequencesCountOffset = sequencesCountOffset; SequencesIndexBuffer = sequencesIndexBuffer; SequencesIndexOffset = sequencesIndexOffset; }
public SubpassDescription ( SubpassDescriptionFlags flags = default, PipelineBindPoint pipelineBindPoint = default, uint inputAttachmentCount = default, AttachmentReference *pInputAttachments = default, uint colorAttachmentCount = default, AttachmentReference *pColorAttachments = default, AttachmentReference *pResolveAttachments = default, AttachmentReference *pDepthStencilAttachment = default, uint preserveAttachmentCount = default, uint *pPreserveAttachments = default ) { Flags = flags; PipelineBindPoint = pipelineBindPoint; InputAttachmentCount = inputAttachmentCount; PInputAttachments = pInputAttachments; ColorAttachmentCount = colorAttachmentCount; PColorAttachments = pColorAttachments; PResolveAttachments = pResolveAttachments; PDepthStencilAttachment = pDepthStencilAttachment; PreserveAttachmentCount = preserveAttachmentCount; PPreserveAttachments = pPreserveAttachments; }
public SubpassDescription2 ( StructureType sType = StructureType.SubpassDescription2, void *pNext = default, SubpassDescriptionFlags flags = default, PipelineBindPoint pipelineBindPoint = default, uint viewMask = default, uint inputAttachmentCount = default, AttachmentReference2 *pInputAttachments = default, uint colorAttachmentCount = default, AttachmentReference2 *pColorAttachments = default, AttachmentReference2 *pResolveAttachments = default, AttachmentReference2 *pDepthStencilAttachment = default, uint preserveAttachmentCount = default, uint *pPreserveAttachments = default ) { SType = sType; PNext = pNext; Flags = flags; PipelineBindPoint = pipelineBindPoint; ViewMask = viewMask; InputAttachmentCount = inputAttachmentCount; PInputAttachments = pInputAttachments; ColorAttachmentCount = colorAttachmentCount; PColorAttachments = pColorAttachments; PResolveAttachments = pResolveAttachments; PDepthStencilAttachment = pDepthStencilAttachment; PreserveAttachmentCount = preserveAttachmentCount; PPreserveAttachments = pPreserveAttachments; }
/// <summary> /// Initializes a new instance of the <see cref="IndirectCommandsLayoutCreateInfoNvx"/> structure. /// </summary> /// <param name="pipelineBindPoint"> /// The <see cref="VulkanCore.PipelineBindPoint"/> that this layout targets. /// </param> /// <param name="flags">A bitmask providing usage hints of this layout.</param> /// <param name="tokens"> /// An array describing each command token in detail. See <see /// cref="IndirectCommandsTokenTypeNvx"/> and <see cref="IndirectCommandsLayoutTokenNvx"/> /// for details. /// </param> public IndirectCommandsLayoutCreateInfoNvx(PipelineBindPoint pipelineBindPoint, IndirectCommandsLayoutUsagesNvx flags, params IndirectCommandsLayoutTokenNvx[] tokens) { PipelineBindPoint = pipelineBindPoint; Flags = flags; Tokens = tokens; }
public void CmdBindDescriptorSet(PipelineBindPoint pipelineBindPoint, PipelineLayout layout, UInt32 firstSet, DescriptorSet pDescriptorSet, UInt32?pDynamicOffset) { unsafe { fixed(UInt64 *ptrpDescriptorSet = &pDescriptorSet.m) { UInt32 valpDynamicOffset = pDynamicOffset ?? default(UInt32); UInt32 *ptrpDynamicOffset = pDynamicOffset != null ? &valpDynamicOffset : (UInt32 *)IntPtr.Zero; Interop.NativeMethods.vkCmdBindDescriptorSets(this.m, pipelineBindPoint, layout != null ? layout.m : default(UInt64), firstSet, (UInt32)(pDescriptorSet != null ? 1 : 0), ptrpDescriptorSet, (UInt32)(pDynamicOffset != null ? 1 : 0), ptrpDynamicOffset); } } }
public void CmdPushDescriptorSetKHR(PipelineBindPoint pipelineBindPoint, PipelineLayout layout, UInt32 set, WriteDescriptorSet[] pDescriptorWrites) { unsafe { var arraypDescriptorWrites = pDescriptorWrites == null ? IntPtr.Zero : Marshal.AllocHGlobal(pDescriptorWrites.Length * sizeof(Interop.WriteDescriptorSet)); var lenpDescriptorWrites = pDescriptorWrites == null ? 0 : pDescriptorWrites.Length; if (pDescriptorWrites != null) { for (int i = 0; i < pDescriptorWrites.Length; i++) { ((Interop.WriteDescriptorSet *)arraypDescriptorWrites) [i] = *(pDescriptorWrites [i].m); } } Interop.NativeMethods.vkCmdPushDescriptorSetKHR(this.m, pipelineBindPoint, layout != null ? layout.m : default(UInt64), set, (uint)lenpDescriptorWrites, (Interop.WriteDescriptorSet *)arraypDescriptorWrites); Marshal.FreeHGlobal(arraypDescriptorWrites); } }
public GeneratedCommandsMemoryRequirementsInfoNV ( StructureType sType = StructureType.GeneratedCommandsMemoryRequirementsInfoNV, void *pNext = default, PipelineBindPoint pipelineBindPoint = default, Pipeline pipeline = default, IndirectCommandsLayoutNV indirectCommandsLayout = default, uint maxSequencesCount = default ) { SType = sType; PNext = pNext; PipelineBindPoint = pipelineBindPoint; Pipeline = pipeline; IndirectCommandsLayout = indirectCommandsLayout; MaxSequencesCount = maxSequencesCount; }
/// <summary> /// Pushes descriptor updates into a command buffer. /// </summary> /// <param name="commandBuffer"> /// The command buffer that the descriptors will be recorded in. /// </param> /// <param name="pipelineBindPoint"> /// Indicates whether the descriptors will be used by graphics pipelines or compute pipelines. /// <para> /// There is a separate set of push descriptor bindings for each of graphics and compute, so /// binding one does not disturb the other. /// </para> /// </param> /// <param name="layout">The object used to program the bindings.</param> /// <param name="set"> /// The set number of the descriptor set in the pipeline layout that will be updated. /// </param> /// <param name="descriptorWrites">Structures describing the descriptors to be updated.</param> public static void CmdPushDescriptorSetKhr(this CommandBuffer commandBuffer, PipelineBindPoint pipelineBindPoint, PipelineLayout layout, int set, WriteDescriptorSet[] descriptorWrites) { int count = descriptorWrites?.Length ?? 0; var nativeDescriptorWrites = stackalloc WriteDescriptorSet.Native[count]; for (int i = 0; i < count; i++) { descriptorWrites[i].ToNative(&nativeDescriptorWrites[i]); } vkCmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, count, nativeDescriptorWrites); for (int i = 0; i < count; i++) { nativeDescriptorWrites[i].Free(); } }
public void UpdateAndBindDescriptorSets(CommandBufferScoped cbs, PipelineBindPoint pbp) { if ((_dirty & DirtyFlags.All) == 0) { return; } // System.Console.WriteLine("modified " + _dirty + " " + _modified + " on program " + _program.GetHashCode().ToString("X")); if (_dirty.HasFlag(DirtyFlags.Uniform)) { UpdateAndBind(cbs, PipelineBase.UniformSetIndex, DirtyFlags.Uniform, pbp); } if (_dirty.HasFlag(DirtyFlags.Storage)) { UpdateAndBind(cbs, PipelineBase.StorageSetIndex, DirtyFlags.Storage, pbp); } if (_dirty.HasFlag(DirtyFlags.Texture)) { UpdateAndBind(cbs, PipelineBase.TextureSetIndex, DirtyFlags.Texture, pbp); } if (_dirty.HasFlag(DirtyFlags.Image)) { UpdateAndBind(cbs, PipelineBase.ImageSetIndex, DirtyFlags.Image, pbp); } if (_dirty.HasFlag(DirtyFlags.BufferTexture)) { UpdateAndBind(cbs, PipelineBase.BufferTextureSetIndex, DirtyFlags.BufferTexture, pbp); } if (_dirty.HasFlag(DirtyFlags.BufferImage)) { UpdateAndBind(cbs, PipelineBase.BufferImageSetIndex, DirtyFlags.BufferImage, pbp); } _dirty = DirtyFlags.None; }
public IndirectCommandsLayoutCreateInfoNV ( StructureType sType = StructureType.IndirectCommandsLayoutCreateInfoNV, void *pNext = default, IndirectCommandsLayoutUsageFlagsNV flags = default, PipelineBindPoint pipelineBindPoint = default, uint tokenCount = default, IndirectCommandsLayoutTokenNV *pTokens = default, uint streamCount = default, uint *pStreamStrides = default ) { SType = sType; PNext = pNext; Flags = flags; PipelineBindPoint = pipelineBindPoint; TokenCount = tokenCount; PTokens = pTokens; StreamCount = streamCount; PStreamStrides = pStreamStrides; }
public void Bind(CommandBuffer commandBuffer, PipelineBindPoint pipelineBindPoint, int frame) { _vk.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, _pipelineLayout, 0, 1, _descriptorSets[frame].DescriptorSet, 0, null); }
public unsafe void BindDescriptorSets(PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint firstSet, uint descriptorSetCount, DescriptorSet* descriptorSets, uint dynamicOffsetCount, uint* dynamicOffsets) { vkCmdBindDescriptorSets(this, pipelineBindPoint, layout, firstSet, descriptorSetCount, descriptorSets, dynamicOffsetCount, dynamicOffsets); }
public partial void CmdBindPipelineShaderGroup([Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] PipelineBindPoint pipelineBindPoint, [Count(Count = 0)] Pipeline pipeline, [Count(Count = 0)] uint groupIndex);
internal static unsafe extern void vkCmdBindDescriptorSets(CommandBuffer commandBuffer, PipelineBindPoint pipelineBindPoint, PipelineLayout layout, UInt32 firstSet, UInt32 descriptorSetCount, IntPtr pDescriptorSets, UInt32 dynamicOffsetCount, UInt32 *DynamicOffsets);
internal static unsafe extern void vkCmdBindPipeline(CommandBuffer commandBuffer, PipelineBindPoint pipelineBindPoint, Pipeline pipeline);
public unsafe void BindPipeline(PipelineBindPoint pipelineBindPoint, Pipeline pipeline) { vkCmdBindPipeline(this, pipelineBindPoint, pipeline); }
public unsafe partial void CmdPushDescriptorSet([Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] PipelineBindPoint pipelineBindPoint, [Count(Count = 0)] PipelineLayout layout, [Count(Count = 0)] uint set, [Count(Count = 0)] uint descriptorWriteCount, [Count(Computed = "descriptorWriteCount"), Flow(FlowDirection.In)] WriteDescriptorSet *pDescriptorWrites);
/// <summary>To be documented.</summary> public static unsafe void CmdPushDescriptorSet(this KhrPushDescriptor thisApi, [Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] PipelineBindPoint pipelineBindPoint, [Count(Count = 0)] PipelineLayout layout, [Count(Count = 0)] uint set, [Count(Count = 0)] uint descriptorWriteCount, [Count(Computed = "descriptorWriteCount"), Flow(FlowDirection.In)] ReadOnlySpan <WriteDescriptorSet> pDescriptorWrites) { // SpanOverloader thisApi.CmdPushDescriptorSet(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, in pDescriptorWrites.GetPinnableReference()); }
private void UpdateAndBind(CommandBufferScoped cbs, int setIndex, DirtyFlags flag, PipelineBindPoint pbp) { int stagesCount = _program.Bindings[setIndex].Length; if (stagesCount == 0 && setIndex != PipelineBase.UniformSetIndex) { return; } var dsc = _program.GetNewDescriptorSetCollection(_gd, cbs.CommandBufferIndex, setIndex, out var isNew).Get(cbs); if (isNew) { Initialize(cbs, setIndex, dsc); } if (setIndex == PipelineBase.UniformSetIndex) { Span <DescriptorBufferInfo> uniformBuffer = stackalloc DescriptorBufferInfo[1]; uniformBuffer[0] = new DescriptorBufferInfo() { Offset = 0, Range = SupportBuffer.RequiredSize, Buffer = _pipeline.RenderScaleBuffer.GetBuffer().Get(cbs, 0, SupportBuffer.RequiredSize).Value }; dsc.UpdateBuffers(0, 0, uniformBuffer, DescriptorType.UniformBuffer); } for (int stageIndex = 0; stageIndex < stagesCount; stageIndex++) { var stageBindings = _program.Bindings[setIndex][stageIndex]; int bindingsCount = stageBindings.Length; int count; for (int bindingIndex = 0; bindingIndex < bindingsCount; bindingIndex += count) { int binding = stageBindings[bindingIndex]; count = 1; while (bindingIndex + count < bindingsCount && stageBindings[bindingIndex + count] == binding + count) { count++; } if (setIndex == PipelineBase.UniformSetIndex) { count = Math.Min(count, _uniformBuffers.Length - binding); if (count <= 0) { break; } for (int i = 0; i < count; i++) { UpdateBuffer(cbs, ref _uniformBuffers[binding + i], _uniformBufferRefs[binding + i]); } ReadOnlySpan <DescriptorBufferInfo> uniformBuffers = _uniformBuffers; dsc.UpdateBuffers(0, binding, uniformBuffers.Slice(binding, count), DescriptorType.UniformBuffer); } else if (setIndex == PipelineBase.StorageSetIndex) { count = Math.Min(count, _storageBuffers.Length - binding); if (count <= 0) { break; } for (int i = 0; i < count; i++) { UpdateBuffer(cbs, ref _storageBuffers[binding + i], _storageBufferRefs[binding + i]); } ReadOnlySpan <DescriptorBufferInfo> storageBuffers = _storageBuffers; dsc.UpdateStorageBuffers(0, binding, storageBuffers.Slice(binding, count)); } else if (setIndex == PipelineBase.TextureSetIndex) { for (int i = 0; i < count; i++) { ref var texture = ref _textures[binding + i]; texture.ImageView = _textureRefs[binding + i]?.Get(cbs).Value ?? default; texture.Sampler = _samplerRefs[binding + i]?.Get(cbs).Value ?? default; texture.ImageLayout = ImageLayout.General; if (texture.ImageView.Handle == 0 || texture.Sampler.Handle == 0) { texture.ImageView = _dummyTexture.GetImageView().Get(cbs).Value; texture.Sampler = _dummySampler.GetSampler().Get(cbs).Value; } } ReadOnlySpan <DescriptorImageInfo> textures = _textures; dsc.UpdateImages(0, binding, textures.Slice(binding, count), DescriptorType.CombinedImageSampler); }
public static extern void vkCmdBindPipeline(IntPtr commandBuffer, PipelineBindPoint pipelineBindPoint, ulong pipeline);
public void CmdPushDescriptorSetKHR(PipelineBindPoint pipelineBindPoint, PipelineLayout layout, UInt32 set, WriteDescriptorSet pDescriptorWrite) { unsafe { Interop.NativeMethods.vkCmdPushDescriptorSetKHR(this.m, pipelineBindPoint, layout != null ? layout.m : default(UInt64), set, (UInt32)(pDescriptorWrite != null ? 1 : 0), pDescriptorWrite != null ? pDescriptorWrite.m : (Interop.WriteDescriptorSet *) default(IntPtr)); } }
public abstract void CmdPushDescriptorSet([Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] PipelineBindPoint pipelineBindPoint, [Count(Count = 0)] PipelineLayout layout, [Count(Count = 0)] uint set, [Count(Count = 0)] uint descriptorWriteCount, [Count(Computed = "descriptorWriteCount"), Flow(FlowDirection.In)] ref WriteDescriptorSet pDescriptorWrites);
internal static unsafe extern void vkCmdBindPipeline(IntPtr commandBuffer, PipelineBindPoint pipelineBindPoint, UInt64 pipeline);
public partial void CmdPushDescriptorSet([Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] PipelineBindPoint pipelineBindPoint, [Count(Count = 0)] PipelineLayout layout, [Count(Count = 0)] uint set, [Count(Count = 0)] uint descriptorWriteCount, [Count(Parameter = "descriptorWriteCount"), Flow(FlowDirection.In)] in WriteDescriptorSet pDescriptorWrites);
public void CmdBindPipeline(PipelineBindPoint pipelineBindPoint, Pipeline pipeline) { unsafe { Interop.NativeMethods.vkCmdBindPipeline(this.m, pipelineBindPoint, pipeline != null ? pipeline.m : default(UInt64)); } }
public static extern unsafe void vkCmdBindDescriptorSets(IntPtr commandBuffer, PipelineBindPoint pipelineBindPoint, ulong layout, uint firstSet, uint descriptorSetCount, ulong *pDescriptorSets, uint dynamicOffsetCount, uint *pDynamicOffsets);
internal static unsafe extern void vkCmdBindDescriptorSets(CommandBuffer commandBuffer, PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint firstSet, uint descriptorSetCount, DescriptorSet* descriptorSets, uint dynamicOffsetCount, uint* dynamicOffsets);