Skip to content

Commit

Permalink
Rename existing Info struct constructors to new (#2643)
Browse files Browse the repository at this point in the history
* Rename existing `Info` struct constructors to `new`

* Make `const` where possible

* fmt
  • Loading branch information
Rua authored Feb 9, 2025
1 parent d3b3de0 commit 5df2dc5
Show file tree
Hide file tree
Showing 79 changed files with 402 additions and 321 deletions.
2 changes: 1 addition & 1 deletion examples/async-update/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-compute-shader/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn main() {
ComputePipeline::new(
device.clone(),
None,
ComputePipelineCreateInfo::stage_layout(stage, layout),
ComputePipelineCreateInfo::new(stage, layout),
)
.unwrap()
};
Expand Down
4 changes: 2 additions & 2 deletions examples/bloom/bloom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl BloomTask {
ComputePipeline::new(
app.device.clone(),
None,
ComputePipelineCreateInfo::stage_layout(stage, pipeline_layout.clone()),
ComputePipelineCreateInfo::new(stage, pipeline_layout.clone()),
)
.unwrap()
};
Expand All @@ -54,7 +54,7 @@ impl BloomTask {
ComputePipeline::new(
app.device.clone(),
None,
ComputePipelineCreateInfo::stage_layout(stage, pipeline_layout.clone()),
ComputePipelineCreateInfo::new(stage, pipeline_layout.clone()),
)
.unwrap()
};
Expand Down
12 changes: 3 additions & 9 deletions examples/bloom/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,28 +244,22 @@ impl ApplicationHandler for App {
0,
DescriptorSetLayoutBinding {
stages: ShaderStages::FRAGMENT | ShaderStages::COMPUTE,
..DescriptorSetLayoutBinding::descriptor_type(
DescriptorType::Sampler,
)
..DescriptorSetLayoutBinding::new(DescriptorType::Sampler)
},
),
(
1,
DescriptorSetLayoutBinding {
stages: ShaderStages::FRAGMENT | ShaderStages::COMPUTE,
..DescriptorSetLayoutBinding::descriptor_type(
DescriptorType::SampledImage,
)
..DescriptorSetLayoutBinding::new(DescriptorType::SampledImage)
},
),
(
2,
DescriptorSetLayoutBinding {
stages: ShaderStages::COMPUTE,
descriptor_count: MAX_BLOOM_MIP_LEVELS,
..DescriptorSetLayoutBinding::descriptor_type(
DescriptorType::StorageImage,
)
..DescriptorSetLayoutBinding::new(DescriptorType::StorageImage)
},
),
]
Expand Down
2 changes: 1 addition & 1 deletion examples/bloom/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl SceneTask {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(pipeline_layout.clone())
..GraphicsPipelineCreateInfo::new(pipeline_layout.clone())
},
)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion examples/bloom/tonemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl TonemapTask {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(pipeline_layout.clone())
..GraphicsPipelineCreateInfo::new(pipeline_layout.clone())
},
)
.unwrap()
Expand Down
7 changes: 2 additions & 5 deletions examples/buffer-allocator/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -459,10 +459,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
5 changes: 1 addition & 4 deletions examples/clear-attachments/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
2 changes: 1 addition & 1 deletion examples/debug/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn main() {
message_type: DebugUtilsMessageType::GENERAL
| DebugUtilsMessageType::VALIDATION
| DebugUtilsMessageType::PERFORMANCE,
..DebugUtilsMessengerCreateInfo::user_callback(DebugUtilsMessengerCallback::new(
..DebugUtilsMessengerCreateInfo::new(DebugUtilsMessengerCallback::new(
|message_severity, message_type, callback_data| {
let severity = if message_severity
.intersects(DebugUtilsMessageSeverity::ERROR)
Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/frame/ambient_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl AmbientLightingSystem {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/frame/directional_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl DirectionalLightingSystem {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/frame/point_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl PointLightingSystem {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down
5 changes: 1 addition & 4 deletions examples/deferred/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/triangle_draw_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl TriangleDrawSystem {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic-buffers/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn main() {
ComputePipeline::new(
device.clone(),
None,
ComputePipelineCreateInfo::stage_layout(stage, layout),
ComputePipelineCreateInfo::new(stage, layout),
)
.unwrap()
};
Expand Down
4 changes: 2 additions & 2 deletions examples/dynamic-local-size/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ fn main() {
ComputePipeline::new(
device.clone(),
None,
ComputePipelineCreateInfo::stage_layout(stage, layout),
ComputePipelineCreateInfo::new(stage, layout),
)
.unwrap()
};
Expand Down Expand Up @@ -271,7 +271,7 @@ fn main() {
unsafe { builder.dispatch([1024 / local_size_x, 1024 / local_size_y, 1]) }.unwrap();

builder
.copy_image_to_buffer(CopyImageToBufferInfo::image_buffer(image, buf.clone()))
.copy_image_to_buffer(CopyImageToBufferInfo::new(image, buf.clone()))
.unwrap();

let command_buffer = builder.build().unwrap();
Expand Down
7 changes: 2 additions & 5 deletions examples/gl-interop/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ mod linux {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -740,10 +740,7 @@ mod linux {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
15 changes: 6 additions & 9 deletions examples/image-self-copy-blit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl App {
// Here, we perform image copying and blitting on the same image.
uploads
// Clear the image buffer.
.clear_color_image(ClearColorImageInfo::image(image.clone()))
.clear_color_image(ClearColorImageInfo::new(image.clone()))
.unwrap()
// Put our image in the top left corner.
.copy_buffer_to_image(CopyBufferToImageInfo {
Expand All @@ -246,7 +246,7 @@ impl App {
..Default::default()
}]
.into(),
..CopyBufferToImageInfo::buffer_image(upload_buffer, image.clone())
..CopyBufferToImageInfo::new(upload_buffer, image.clone())
})
.unwrap()
// Copy from the top left corner to the bottom right corner.
Expand All @@ -264,7 +264,7 @@ impl App {
..Default::default()
}]
.into(),
..CopyImageInfo::images(image.clone(), image.clone())
..CopyImageInfo::new(image.clone(), image.clone())
})
.unwrap()
// Blit from the bottom right corner to the top right corner (flipped).
Expand All @@ -288,7 +288,7 @@ impl App {
}]
.into(),
filter: Filter::Nearest,
..BlitImageInfo::images(image.clone(), image.clone())
..BlitImageInfo::new(image.clone(), image.clone())
})
.unwrap();

Expand Down Expand Up @@ -427,7 +427,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -568,10 +568,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
12 changes: 3 additions & 9 deletions examples/image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,7 @@ impl App {
.unwrap();

uploads
.copy_buffer_to_image(CopyBufferToImageInfo::buffer_image(
upload_buffer,
image.clone(),
))
.copy_buffer_to_image(CopyBufferToImageInfo::new(upload_buffer, image.clone()))
.unwrap();

ImageView::new_default(image).unwrap()
Expand Down Expand Up @@ -371,7 +368,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -512,10 +509,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
12 changes: 3 additions & 9 deletions examples/immutable-sampler/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,7 @@ impl App {
.unwrap();

uploads
.copy_buffer_to_image(CopyBufferToImageInfo::buffer_image(
upload_buffer,
image.clone(),
))
.copy_buffer_to_image(CopyBufferToImageInfo::new(upload_buffer, image.clone()))
.unwrap();

ImageView::new_default(image).unwrap()
Expand Down Expand Up @@ -390,7 +387,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -531,10 +528,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
9 changes: 3 additions & 6 deletions examples/indirect/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl App {
ComputePipeline::new(
device.clone(),
None,
ComputePipelineCreateInfo::stage_layout(stage, layout),
ComputePipelineCreateInfo::new(stage, layout),
)
.unwrap()
};
Expand Down Expand Up @@ -397,7 +397,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -578,10 +578,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
7 changes: 2 additions & 5 deletions examples/instancing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl ApplicationHandler for App {
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
..GraphicsPipelineCreateInfo::new(layout)
},
)
.unwrap()
Expand Down Expand Up @@ -492,10 +492,7 @@ impl ApplicationHandler for App {
.unwrap()
.then_swapchain_present(
self.queue.clone(),
SwapchainPresentInfo::swapchain_image_index(
rcx.swapchain.clone(),
image_index,
),
SwapchainPresentInfo::new(rcx.swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
Loading

0 comments on commit 5df2dc5

Please sign in to comment.