Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CreateInfo for pipelines, require explicit pipeline layout creation #2186

Merged
merged 8 commits into from
Apr 22, 2023

Conversation

Rua
Copy link
Contributor

@Rua Rua commented Apr 22, 2023

Changelog:

Remove:

Changes to shaders and pipelines:
- `EntryPoint` now owns instead of borrows a reference to the `ShaderModule`.
- Instead of an entry point and specialization constants, pipeline construction now takes a `PipelineShaderStageCreateInfo` structure.
- Specialization constants are now provided with a `HashMap` containing `SpecializationConstant` enum values. The `SpecializationConstants` trait is removed, and `vulkano_shaders` no longer generates structs for specialization constants.
- `GraphicsPipelineBuilder` now has a `stages` method that takes an iterator with all shader stages at once, instead of separate methods for each shader type.
- `GraphicsPipelineBuilder` now requires you to provide `input_assembly_state`, `rasterization_state`, `multisample_state` and `color_blend_state` instead of them having default values. You can still call `default()` to generate default values for each of them.
- `GraphicsPipelineBuilder::vertex_input_state` now requires a `VertexInputState` object directly, instead of a `VertexDefinition`. The `VertexDefinition` trait can be used to create the object.

Replace with:

Changes to pipeline construction:
- Pipelines are now constructed with the standard complement of `new`, `new_unchecked` and `from_handle` constructors, that each take a `ComputePipelineCreateInfo` or `GraphicsPipelineCreateInfo` struct.
- Pipeline layouts are no longer automatically constructed when creating a pipeline. You can auto-create a pipeline layout (and modify the auto-generated parameters if needed) using the new `PipelineDescriptorSetLayoutCreateInfo` type.
- `GraphicsPipelineCreateInfo::vertex_input_state` requires a `VertexInputState` struct directly, instead of a `VertexDefinition`. The `VertexDefinition` trait can be used to create the struct.
- `GraphicsPipelineCreateInfo` now requires you to provide `input_assembly_state`, `rasterization_state`, `multisample_state` and `color_blend_state` instead of them having default values. You can still call `default()` to generate default values for each of them.
- Instead of an entry point and specialization constants, pipeline construction now takes a `PipelineShaderStageCreateInfo` structure. `GraphicsPipelineCreateInfo` has a `stages` member that takes all shader stages at once, instead of separate members for each shader type. `EntryPoint` now owns instead of borrows a reference to the `ShaderModule`, so this is easier.
- Specialization constants are now provided with a `HashMap` containing `SpecializationConstant` enum values. The `SpecializationConstants` trait is removed, and `vulkano_shaders` no longer generates structs for specialization constants.

This brings pipeline construction in line with other object types. Pipeline layout construction is no longer automatic in pipeline construction, but I made a new type to make it easier to auto-construct them separately.

Rua and others added 4 commits April 22, 2023 18:57
vulkano/src/pipeline/layout.rs Outdated Show resolved Hide resolved
vulkano/src/pipeline/layout.rs Outdated Show resolved Hide resolved
vulkano/src/pipeline/layout.rs Show resolved Hide resolved
Rua and others added 2 commits April 22, 2023 20:19
Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
@marc0246
Copy link
Contributor

Very nice, again one step closer to Vulkan with the pipeline create infos!

@marc0246 marc0246 merged commit b320dd2 into vulkano-rs:master Apr 22, 2023
marc0246 added a commit that referenced this pull request Apr 22, 2023
@Rua Rua deleted the pipeline-create-info branch October 25, 2023 14:25
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
…on (vulkano-rs#2186)

* Add CreateInfo for pipelines, require explicit pipeline layout creation

* Doc fixes

* Add missing unsafe

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

* Add PipelineCreateFlags

* Small fixes

* -inline

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

* -inline

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants