internal PipelineLayout(Device parent, ref PipelineLayoutCreateInfo createInfo, ref AllocationCallbacks?allocator) { Parent = parent; Allocator = allocator; int setLayoutCount = createInfo.SetLayouts?.Length ?? 0; var layoutsPtr = stackalloc long[setLayoutCount]; for (int i = 0; i < setLayoutCount; i++) layoutsPtr[i] = createInfo.SetLayouts[i]; fixed(PushConstantRange *pushConstantRangesPtr = createInfo.PushConstantRanges) { createInfo.ToNative(out PipelineLayoutCreateInfo.Native nativeCreateInfo, layoutsPtr, pushConstantRangesPtr); long handle; Result result = vkCreatePipelineLayout(Parent, &nativeCreateInfo, NativeAllocator, &handle); VulkanException.ThrowForInvalidResult(result); Handle = handle; } }
/// <summary> /// Creates a new pipeline layout object. /// </summary> /// <param name="createInfo"> /// The structure specifying the state of the pipeline layout object. /// </param> /// <param name="allocator">Controls host memory allocation.</param> /// <returns>Handle in which the resulting pipeline layout object is returned.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public PipelineLayout CreatePipelineLayout( PipelineLayoutCreateInfo createInfo = default(PipelineLayoutCreateInfo), AllocationCallbacks?allocator = null) { return(new PipelineLayout(this, ref createInfo, ref allocator)); }
// Helper function to create a pipeline layout private static Vk.PipelineLayout CreateLayout(Vk.Device device) { var lci = new Vk.PipelineLayoutCreateInfo(null, null); // TODO: Check shader to get layout return(device.CreatePipelineLayout(lci)); }