mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-23 07:15:31 +00:00
Fix typos and introduce a workflow (#2537)
* Fix typos and introduce a workflow * Revert vk.xml * Update .typos.toml * fix typos config
This commit is contained in:
parent
e949e35f91
commit
07736487d6
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -14,7 +14,7 @@
|
|||||||
Please remove any items from the template below that are not applicable.
|
Please remove any items from the template below that are not applicable.
|
||||||
|
|
||||||
6. [ ] Describe in common words what is the purpose of this change, related
|
6. [ ] Describe in common words what is the purpose of this change, related
|
||||||
Github Issues, and highlight important implementation aspects.
|
GitHub Issues, and highlight important implementation aspects.
|
||||||
|
|
||||||
Changelog:
|
Changelog:
|
||||||
```markdown
|
```markdown
|
||||||
|
12
.github/workflows/rust.yml
vendored
12
.github/workflows/rust.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: rustup toolchain install stable
|
- run: rustup toolchain install stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
if: ${{ ! matrix.self-hosted }}
|
if: ${{ ! matrix.self-hosted }}
|
||||||
@ -44,7 +44,7 @@ jobs:
|
|||||||
clippy:
|
clippy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: rustup toolchain install stable --component clippy
|
- run: rustup toolchain install stable --component clippy
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
@ -55,7 +55,13 @@ jobs:
|
|||||||
fmt:
|
fmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: rustup toolchain install nightly --component rustfmt
|
- run: rustup toolchain install nightly --component rustfmt
|
||||||
- name: Run fmt check
|
- name: Run fmt check
|
||||||
run: cargo +nightly fmt --check
|
run: cargo +nightly fmt --check
|
||||||
|
typos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Run typos
|
||||||
|
uses: crate-ci/typos@master
|
||||||
|
14
.typos.toml
Normal file
14
.typos.toml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[files]
|
||||||
|
extend-exclude = [
|
||||||
|
".git/",
|
||||||
|
"vulkano/spirv.core.grammar.json",
|
||||||
|
"vulkano/vk.xml",
|
||||||
|
]
|
||||||
|
ignore-hidden = false
|
||||||
|
|
||||||
|
[default.extend-words]
|
||||||
|
lod = "lod"
|
||||||
|
uscaled = "uscaled"
|
||||||
|
|
||||||
|
[default.extend-identifiers]
|
||||||
|
ANDed = "ANDed"
|
16
CHANGELOG.md
16
CHANGELOG.md
@ -363,7 +363,7 @@ Changes to the physical device:
|
|||||||
- vulkano-shaders: Use a placeholder name instead of erroring out, when the shader doesn't contain a name for a struct.
|
- vulkano-shaders: Use a placeholder name instead of erroring out, when the shader doesn't contain a name for a struct.
|
||||||
- [#2203](https://github.com/vulkano-rs/vulkano/issues/2203): Shader reflection fails to find descriptor set variables if multiple `OpAccessChain` instructions are themselves chained.
|
- [#2203](https://github.com/vulkano-rs/vulkano/issues/2203): Shader reflection fails to find descriptor set variables if multiple `OpAccessChain` instructions are themselves chained.
|
||||||
- vulkano-shaders: Invalid emitted code for shader input/output interfaces if the shader is missing a name decoration.
|
- vulkano-shaders: Invalid emitted code for shader input/output interfaces if the shader is missing a name decoration.
|
||||||
- Fixed potential UB when using `MemoryAlloc::try_unwrap`, where the allocation was mapped on contruction of the `MemoryAlloc` but not unmapped on unwrapping, allowing double-mapping.
|
- Fixed potential UB when using `MemoryAlloc::try_unwrap`, where the allocation was mapped on construction of the `MemoryAlloc` but not unmapped on unwrapping, allowing double-mapping.
|
||||||
- Fixed a bug in `GenericMemoryAllocator::allocate`, where the root allocations weren't created with the configured `AllocationType`.
|
- Fixed a bug in `GenericMemoryAllocator::allocate`, where the root allocations weren't created with the configured `AllocationType`.
|
||||||
- Specialization constants are now applied to the reflected SPIR-V code before any other reflection is performed.
|
- Specialization constants are now applied to the reflected SPIR-V code before any other reflection is performed.
|
||||||
- Fragment shaders cannot use `dual_src_blend` device feature due to interface errors.
|
- Fragment shaders cannot use `dual_src_blend` device feature due to interface errors.
|
||||||
@ -939,7 +939,7 @@ Miscellaneous:
|
|||||||
|
|
||||||
# Version 0.27.1 (2021-12-07)
|
# Version 0.27.1 (2021-12-07)
|
||||||
|
|
||||||
- Reimplement generic impl's for `BufferAcces`, `TypedBufferAccess` & `ImageAccess`.
|
- Reimplement generic impl's for `BufferAccess`, `TypedBufferAccess` & `ImageAccess`.
|
||||||
|
|
||||||
# Version 0.27.0 (2021-12-06)
|
# Version 0.27.0 (2021-12-06)
|
||||||
|
|
||||||
@ -1164,7 +1164,7 @@ already needed khr_external_memory and khr_external_memory_fd.
|
|||||||
- **Breaking** (but unlikely) Vulkano-shaders now compiles to SPIR-V 1.0 by default. If your shader needs features only available in a higher version, you can specify the target version on the `shader!` macro with the new `vulkan_version: "major.minor"` and `spirv_version: "major.minor"` arguments.
|
- **Breaking** (but unlikely) Vulkano-shaders now compiles to SPIR-V 1.0 by default. If your shader needs features only available in a higher version, you can specify the target version on the `shader!` macro with the new `vulkan_version: "major.minor"` and `spirv_version: "major.minor"` arguments.
|
||||||
- **Breaking** Changes to how image sample counts are represented.
|
- **Breaking** Changes to how image sample counts are represented.
|
||||||
- Instead of an integer, functions with a parameter for number of image samples now take a value of `SampleCount`, an enum with variants named `SampleN`, where `N` is a power-of-two integer. It can be converted to a Vulkan `SampleCountFlags`, and from an integer with `try_from`.
|
- Instead of an integer, functions with a parameter for number of image samples now take a value of `SampleCount`, an enum with variants named `SampleN`, where `N` is a power-of-two integer. It can be converted to a Vulkan `SampleCountFlags`, and from an integer with `try_from`.
|
||||||
- `sample_counts` field is originaly represented as u32 type, which is now represented by `SampleCounts` struct-type which is a boolean collection of supported `sample_counts`. It can be converted to and from a Vulkan `SampleCountFlags`.
|
- `sample_counts` field is originally represented as u32 type, which is now represented by `SampleCounts` struct-type which is a boolean collection of supported `sample_counts`. It can be converted to and from a Vulkan `SampleCountFlags`.
|
||||||
- **Breaking** Changes to shader interfaces and pipeline layouts.
|
- **Breaking** Changes to shader interfaces and pipeline layouts.
|
||||||
- The module `descriptor::pipeline_layout` has been renamed to `pipeline::layout`.
|
- The module `descriptor::pipeline_layout` has been renamed to `pipeline::layout`.
|
||||||
- The trait `ShaderInterfaceDef` has been replaced by a simple struct `ShaderInterface`, and its `elements` method returns a slice instead of an iterator. This means you no longer need to define a new type for a shader interface. The accompanying type `ShaderInterfaceDefEntry` has been renamed to `ShaderInterfaceEntry` to match. The `ShaderInterfaceDefMatch` trait and `EmptyShaderInterfaceDef` struct have been removed.
|
- The trait `ShaderInterfaceDef` has been replaced by a simple struct `ShaderInterface`, and its `elements` method returns a slice instead of an iterator. This means you no longer need to define a new type for a shader interface. The accompanying type `ShaderInterfaceDefEntry` has been renamed to `ShaderInterfaceEntry` to match. The `ShaderInterfaceDefMatch` trait and `EmptyShaderInterfaceDef` struct have been removed.
|
||||||
@ -1394,7 +1394,7 @@ already needed khr_external_memory and khr_external_memory_fd.
|
|||||||
- **Breaking** Swapchain::new() now doesnt need to have the old_swapchain parameter anymore but requires the ColorSpace
|
- **Breaking** Swapchain::new() now doesnt need to have the old_swapchain parameter anymore but requires the ColorSpace
|
||||||
- **Breaking** Decouple descriptor sets from pipeline
|
- **Breaking** Decouple descriptor sets from pipeline
|
||||||
- **Breaking** Update Winit to 0.21.0
|
- **Breaking** Update Winit to 0.21.0
|
||||||
- **Breaking** Add `host_cached` field to all `CpuAccessibleBuffer` initializers to allow the user to perfer host cached memory.
|
- **Breaking** Add `host_cached` field to all `CpuAccessibleBuffer` initializers to allow the user to prefer host cached memory.
|
||||||
- **Breaking** Added `fullscreen_exclusive` field to `Swapchain` initializers to allow the user to specify how fullscreen exclusivity should be handled.
|
- **Breaking** Added `fullscreen_exclusive` field to `Swapchain` initializers to allow the user to specify how fullscreen exclusivity should be handled.
|
||||||
+ Swapchain methods added: `Swapchain::acquire_fullscreen_exclusive()`, `Swapchain::release_fullscreen_exclusive()`, and `Swapchain::is_fullscreen_exclusive()`
|
+ Swapchain methods added: `Swapchain::acquire_fullscreen_exclusive()`, `Swapchain::release_fullscreen_exclusive()`, and `Swapchain::is_fullscreen_exclusive()`
|
||||||
- Add function `execute_commands_from_vec` to handle submission of multiple secondary command buffers.
|
- Add function `execute_commands_from_vec` to handle submission of multiple secondary command buffers.
|
||||||
@ -1403,9 +1403,9 @@ already needed khr_external_memory and khr_external_memory_fd.
|
|||||||
- Update MacOS dependency cocoa to 0.20
|
- Update MacOS dependency cocoa to 0.20
|
||||||
- Fixed code generated by `shader!` macro so that SSBO's are supported again (broken in 0.16.0).
|
- Fixed code generated by `shader!` macro so that SSBO's are supported again (broken in 0.16.0).
|
||||||
- Added Swapchain::surface() - which returns the saved surface
|
- Added Swapchain::surface() - which returns the saved surface
|
||||||
- Propogate new lines correctly in shader compile errors.
|
- Propagate new lines correctly in shader compile errors.
|
||||||
- `Queue` and `QueueFamily` now implement `PartialEq` and `Eq`
|
- `Queue` and `QueueFamily` now implement `PartialEq` and `Eq`
|
||||||
- `Swapchain::acquire_next_image()`` now returns ``(image_id, suboptimal, aquire_future)``
|
- `Swapchain::acquire_next_image()`` now returns ``(image_id, suboptimal, acquire_future)``
|
||||||
+ *suboptimal indicates that the swapchain is usable, but should be recreated*
|
+ *suboptimal indicates that the swapchain is usable, but should be recreated*
|
||||||
- Fixed Join Future implementation to not submit joined command buffers twice.
|
- Fixed Join Future implementation to not submit joined command buffers twice.
|
||||||
- The traits `GraphicsPipelineAbstract` and `DescriptorSet` now require `DeviceOwned`.
|
- The traits `GraphicsPipelineAbstract` and `DescriptorSet` now require `DeviceOwned`.
|
||||||
@ -1452,7 +1452,7 @@ This is an emergency breaking breaking change. It fixes Undefined Behaviour that
|
|||||||
# Version 0.12.0 (2019-05-24)
|
# Version 0.12.0 (2019-05-24)
|
||||||
|
|
||||||
- Update shaderc to 0.5. New shaderc has improved pre-built options for libshaderc that significantly reduce package build time and are appropriate for use in CI
|
- Update shaderc to 0.5. New shaderc has improved pre-built options for libshaderc that significantly reduce package build time and are appropriate for use in CI
|
||||||
- `QueueFamily::explicitly_supports_tranfers` only returns true if `vk::QUEUE_TRANSFER_BIT` is set instead of also always returning true. Removed `supports_transfers`.
|
- `QueueFamily::explicitly_supports_transfers` only returns true if `vk::QUEUE_TRANSFER_BIT` is set instead of also always returning true. Removed `supports_transfers`.
|
||||||
- Update to winit 0.19
|
- Update to winit 0.19
|
||||||
- Add support for `#include "..."` and `#include <...>` directives within source
|
- Add support for `#include "..."` and `#include <...>` directives within source
|
||||||
files.
|
files.
|
||||||
@ -1473,7 +1473,7 @@ This is an emergency breaking breaking change. It fixes Undefined Behaviour that
|
|||||||
+ `instance::Features` -> `device::Features`
|
+ `instance::Features` -> `device::Features`
|
||||||
+ `instance::DeviceExtensions` -> `device::DeviceExtensions`
|
+ `instance::DeviceExtensions` -> `device::DeviceExtensions`
|
||||||
+ `instance::RawDeviceExtensions` -> `device::RawDeviceExtensions`
|
+ `instance::RawDeviceExtensions` -> `device::RawDeviceExtensions`
|
||||||
- Added `vulkano_shaders::shader!` proc macro, use this instead of `vulkano_shader_deriver::VulkanoShaders`.
|
- Added `vulkano_shaders::shader!` proc macro, use this instead of `vulkano_shader_derive::VulkanoShaders`.
|
||||||
- The entire `vulkano_shader_derive` crate is deprecated.
|
- The entire `vulkano_shader_derive` crate is deprecated.
|
||||||
- `vulkano_shaders::{reflect, compile, Error}` are no longer public.
|
- `vulkano_shaders::{reflect, compile, Error}` are no longer public.
|
||||||
- Remove vulkano_shaders::build_glsl_shaders
|
- Remove vulkano_shaders::build_glsl_shaders
|
||||||
|
@ -91,11 +91,11 @@ To get started you are encouraged to use the following resources:
|
|||||||
examples (~50 lines of code) and then works up to rendering triangles and mandelbrots.
|
examples (~50 lines of code) and then works up to rendering triangles and mandelbrots.
|
||||||
The guide is currently outdated a little. We are planning to update it in the future, but it's
|
The guide is currently outdated a little. We are planning to update it in the future, but it's
|
||||||
a good place to start understanding the base building blocks of Vulkano API.
|
a good place to start understanding the base building blocks of Vulkano API.
|
||||||
- Github [Issues](https://github.com/vulkano-rs/vulkano/issues) - Raise a topic, ask a question
|
- GitHub [Issues](https://github.com/vulkano-rs/vulkano/issues) - Raise a topic, ask a question
|
||||||
or report a bug. The new topics there are watched regularly by maintainers and other
|
or report a bug. The new topics there are watched regularly by maintainers and other
|
||||||
community users.
|
community users.
|
||||||
- Gitter [Chat](https://gitter.im/vulkano-rs/Lobby) - Another place to raise a question. However,
|
- Gitter [Chat](https://gitter.im/vulkano-rs/Lobby) - Another place to raise a question. However,
|
||||||
the chat is not maintained regularly at this moment. Better use Github Issues for this purpose.
|
the chat is not maintained regularly at this moment. Better use GitHub Issues for this purpose.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
**The examples shown here will not necessarily work for the latest stable release of Vulkano. By default, Github shows the most recent unstable revision, rather than the last stable release. You can switch Github to show the examples for stable releases as follows.**
|
**The examples shown here will not necessarily work for the latest stable release of Vulkano. By default, GitHub shows the most recent unstable revision, rather than the last stable release. You can switch GitHub to show the examples for stable releases as follows.**
|
||||||
|
|
||||||
## Selecting the version tag:
|
## Selecting the version tag:
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
// during the transfers either and the two tasks are truly asynchronous.
|
// during the transfers either and the two tasks are truly asynchronous.
|
||||||
//
|
//
|
||||||
// For this, we need to find the queue family with the fewest queue flags set, since if the
|
// For this, we need to find the queue family with the fewest queue flags set, since if the
|
||||||
// queue fmaily has more flags than `TRANSFER | SPARSE_BINDING`, that means it is not dedicated
|
// queue family has more flags than `TRANSFER | SPARSE_BINDING`, that means it is not dedicated
|
||||||
// to transfer operations.
|
// to transfer operations.
|
||||||
let transfer_family_index = physical_device
|
let transfer_family_index = physical_device
|
||||||
.queue_family_properties()
|
.queue_family_properties()
|
||||||
@ -157,12 +157,12 @@ fn main() -> Result<(), impl Error> {
|
|||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|(_, q)| {
|
.filter(|(_, q)| {
|
||||||
q.queue_flags.intersects(QueueFlags::TRANSFER)
|
q.queue_flags.intersects(QueueFlags::TRANSFER)
|
||||||
// Queue familes dedicated to transfers are not required to support partial
|
// Queue families dedicated to transfers are not required to support partial
|
||||||
// transfers of images, reported by a mininum granularity of [0, 0, 0]. If you need
|
// transfers of images, reported by a minimum granularity of [0, 0, 0]. If you need
|
||||||
// to do partial transfers of images like we do in this example, you therefore have
|
// to do partial transfers of images like we do in this example, you therefore have
|
||||||
// to make sure the queue family supports that.
|
// to make sure the queue family supports that.
|
||||||
&& q.min_image_transfer_granularity != [0; 3]
|
&& q.min_image_transfer_granularity != [0; 3]
|
||||||
// Unlike queue familes for graphics and/or compute, queue familes dedicated to
|
// Unlike queue families for graphics and/or compute, queue families dedicated to
|
||||||
// transfers don't have to support image transfers of arbitrary granularity.
|
// transfers don't have to support image transfers of arbitrary granularity.
|
||||||
// Therefore, if you are going to use one, you have to either make sure the
|
// Therefore, if you are going to use one, you have to either make sure the
|
||||||
// granularity is granular enough for your needs, or you have to align your
|
// granularity is granular enough for your needs, or you have to align your
|
||||||
@ -182,7 +182,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// It's possible that the physical device doesn't have any queue familes supporting
|
// It's possible that the physical device doesn't have any queue families supporting
|
||||||
// transfers other than the graphics and/or compute queue family. In that case we must make
|
// transfers other than the graphics and/or compute queue family. In that case we must make
|
||||||
// sure we don't request the same queue family twice.
|
// sure we don't request the same queue family twice.
|
||||||
if transfer_family_index != graphics_family_index {
|
if transfer_family_index != graphics_family_index {
|
||||||
@ -623,7 +623,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
(
|
(
|
||||||
// Bind the uniform buffer designated for this frame.
|
// Bind the uniform buffer designated for this frame.
|
||||||
uniform_buffer_sets[image_index as usize].clone(),
|
uniform_buffer_sets[image_index as usize].clone(),
|
||||||
// Bind the currenly most up-to-date texture.
|
// Bind the currently most up-to-date texture.
|
||||||
sampler_sets[current_texture_index.load(Ordering::Acquire) as usize]
|
sampler_sets[current_texture_index.load(Ordering::Acquire) as usize]
|
||||||
.clone(),
|
.clone(),
|
||||||
),
|
),
|
||||||
|
@ -99,7 +99,7 @@ fn main() {
|
|||||||
|
|
||||||
// We set `local_size_x` and `local_size_y` to be variables configurable values
|
// We set `local_size_x` and `local_size_y` to be variables configurable values
|
||||||
// through specialization constants. Values `1` and `2` both define a constant ID
|
// through specialization constants. Values `1` and `2` both define a constant ID
|
||||||
// as well as a default value of 1 and 2 of the constants respecively. The
|
// as well as a default value of 1 and 2 of the constants respectively. The
|
||||||
// `local_size_z = 1` here is an ordinary constant of the local size on the Z axis.
|
// `local_size_z = 1` here is an ordinary constant of the local size on the Z axis.
|
||||||
//
|
//
|
||||||
// Unfortunately current GLSL language capabilities doesn't let us define exact
|
// Unfortunately current GLSL language capabilities doesn't let us define exact
|
||||||
|
@ -454,7 +454,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
|
|
||||||
// Pass the two buffers to the compute shader.
|
// Pass the two buffers to the compute shader.
|
||||||
let layout = &compute_pipeline.layout().set_layouts()[0];
|
let layout = &compute_pipeline.layout().set_layouts()[0];
|
||||||
let cs_desciptor_set = DescriptorSet::new(
|
let cs_descriptor_set = DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
layout.clone(),
|
layout.clone(),
|
||||||
[
|
[
|
||||||
@ -485,7 +485,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
PipelineBindPoint::Compute,
|
PipelineBindPoint::Compute,
|
||||||
compute_pipeline.layout().clone(),
|
compute_pipeline.layout().clone(),
|
||||||
0,
|
0,
|
||||||
cs_desciptor_set,
|
cs_descriptor_set,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This example is a copy of `basic-compute-shaders.rs`, but initalizes half of the input buffer
|
// This example is a copy of `basic-compute-shaders.rs`, but initializes half of the input buffer
|
||||||
// and then we use `copy_buffer_dimensions` to copy the first half of the input buffer to the
|
// and then we use `copy_buffer_dimensions` to copy the first half of the input buffer to the
|
||||||
// second half.
|
// second half.
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ fn main() {
|
|||||||
| MemoryTypeFilter::HOST_RANDOM_ACCESS,
|
| MemoryTypeFilter::HOST_RANDOM_ACCESS,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
// We intitialize half of the array and leave the other half at 0, we will use the copy
|
// We initialize half of the array and leave the other half at 0, we will use the copy
|
||||||
// command later to fill it.
|
// command later to fill it.
|
||||||
(0..65536u32).map(|n| if n < 65536 / 2 { n } else { 0 }),
|
(0..65536u32).map(|n| if n < 65536 / 2 { n } else { 0 }),
|
||||||
)
|
)
|
||||||
@ -213,9 +213,9 @@ fn main() {
|
|||||||
|
|
||||||
let data_buffer_content = data_buffer.read().unwrap();
|
let data_buffer_content = data_buffer.read().unwrap();
|
||||||
|
|
||||||
// Here we have the same data in the two halfs of the buffer.
|
// Here we have the same data in the two halves of the buffer.
|
||||||
for n in 0..65536 / 2 {
|
for n in 0..65536 / 2 {
|
||||||
// The two halfs should have the same data.
|
// The two halves should have the same data.
|
||||||
assert_eq!(data_buffer_content[n as usize], n * 12);
|
assert_eq!(data_buffer_content[n as usize], n * 12);
|
||||||
assert_eq!(data_buffer_content[n as usize + 65536 / 2], n * 12);
|
assert_eq!(data_buffer_content[n as usize + 65536 / 2], n * 12);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ fn main() {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Bar {
|
Bar {
|
||||||
// `Padded<T, N>` implementes `From<T>`, so you can construct it this way as well.
|
// `Padded<T, N>` implements `From<T>`, so you can construct it this way as well.
|
||||||
y: [5.1, 6.2].into(),
|
y: [5.1, 6.2].into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// A minimal particle-sandbox to demonstrate a reasonable use-case for a device-local buffer. We
|
// A minimal particle-sandbox to demonstrate a reasonable use-case for a device-local buffer. We
|
||||||
// gain significant runtime performance by writing the inital vertex values to the GPU using a
|
// gain significant runtime performance by writing the initial vertex values to the GPU using a
|
||||||
// staging buffer and then copying the data to a device-local buffer to be accessed solely by the
|
// staging buffer and then copying the data to a device-local buffer to be accessed solely by the
|
||||||
// GPU through the compute shader and as a vertex array.
|
// GPU through the compute shader and as a vertex array.
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
|
|
||||||
// Storage buffer binding, which we optimize by using a DeviceLocalBuffer.
|
// Storage buffer binding, which we optimize by using a DeviceLocalBuffer.
|
||||||
layout (binding = 0) buffer VertexBuffer {
|
layout (binding = 0) buffer VertexBuffer {
|
||||||
VertexData verticies[];
|
VertexData vertices[];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Allow push constants to define a parameters of compute.
|
// Allow push constants to define a parameters of compute.
|
||||||
@ -229,10 +229,10 @@ fn main() -> Result<(), impl Error> {
|
|||||||
void main() {
|
void main() {
|
||||||
const uint index = gl_GlobalInvocationID.x;
|
const uint index = gl_GlobalInvocationID.x;
|
||||||
|
|
||||||
vec2 vel = verticies[index].vel;
|
vec2 vel = vertices[index].vel;
|
||||||
|
|
||||||
// Update particle position according to velocity.
|
// Update particle position according to velocity.
|
||||||
vec2 pos = verticies[index].pos + push.delta_time * vel;
|
vec2 pos = vertices[index].pos + push.delta_time * vel;
|
||||||
|
|
||||||
// Bounce particle off screen-border.
|
// Bounce particle off screen-border.
|
||||||
if (abs(pos.x) > 1.0) {
|
if (abs(pos.x) > 1.0) {
|
||||||
@ -260,8 +260,8 @@ fn main() -> Result<(), impl Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set new values back into buffer.
|
// Set new values back into buffer.
|
||||||
verticies[index].pos = pos;
|
vertices[index].pos = pos;
|
||||||
verticies[index].vel = vel * exp(friction * push.delta_time);
|
vertices[index].vel = vel * exp(friction * push.delta_time);
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
}
|
}
|
||||||
@ -539,7 +539,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
let delta_time = now.duration_since(last_frame_time).unwrap().as_secs_f32();
|
let delta_time = now.duration_since(last_frame_time).unwrap().as_secs_f32();
|
||||||
last_frame_time = now;
|
last_frame_time = now;
|
||||||
|
|
||||||
// Create push contants to be passed to compute shader.
|
// Create push constants to be passed to compute shader.
|
||||||
let push_constants = cs::PushConstants {
|
let push_constants = cs::PushConstants {
|
||||||
attractor: [0.75 * (3. * time).cos(), 0.6 * (0.75 * time).sin()],
|
attractor: [0.75 * (3. * time).cos(), 0.6 * (0.75 * time).sin()],
|
||||||
attractor_strength: 1.2 * (2. * time).cos(),
|
attractor_strength: 1.2 * (2. * time).cos(),
|
||||||
@ -574,7 +574,7 @@ fn main() -> Result<(), impl Error> {
|
|||||||
let previous_future = match fences[previous_fence_index as usize].take() {
|
let previous_future = match fences[previous_fence_index as usize].take() {
|
||||||
// Ensure current frame is synchronized with previous.
|
// Ensure current frame is synchronized with previous.
|
||||||
Some(fence) => fence.boxed(),
|
Some(fence) => fence.boxed(),
|
||||||
// Create new future to guarentee synchronization with (fake) previous frame.
|
// Create new future to guarantee synchronization with (fake) previous frame.
|
||||||
None => sync::now(device.clone()).boxed(),
|
None => sync::now(device.clone()).boxed(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Welcome to the triangle-util example!
|
// Welcome to the triangle-util example!
|
||||||
//
|
//
|
||||||
// This is almost exactly the same as the triange example, except that it uses utility functions
|
// This is almost exactly the same as the triangle example, except that it uses utility functions
|
||||||
// to make life easier.
|
// to make life easier.
|
||||||
//
|
//
|
||||||
// This example assumes that you are already more or less familiar with graphics programming and
|
// This example assumes that you are already more or less familiar with graphics programming and
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//! Vulkano does not perform any specific marshalling of buffer data. The representation of the
|
//! Vulkano does not perform any specific marshalling of buffer data. The representation of the
|
||||||
//! buffer in memory is identical between the CPU and GPU. Because the Rust compiler is allowed to
|
//! buffer in memory is identical between the CPU and GPU. Because the Rust compiler is allowed to
|
||||||
//! reorder struct fields at will by default when using `#[repr(Rust)]`, it is advised to mark each
|
//! reorder struct fields at will by default when using `#[repr(Rust)]`, it is advised to mark each
|
||||||
//! struct requiring imput assembly as `#[repr(C)]`. This forces Rust to follow the standard C
|
//! struct requiring input assembly as `#[repr(C)]`. This forces Rust to follow the standard C
|
||||||
//! procedure. Each element is laid out in memory in the order of declaration and aligned to a
|
//! procedure. Each element is laid out in memory in the order of declaration and aligned to a
|
||||||
//! multiple of their alignment.
|
//! multiple of their alignment.
|
||||||
//!
|
//!
|
||||||
|
@ -957,7 +957,7 @@ impl BufferContentsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `BufferContentsLayout` from a sized layout. This is inteded for use by the
|
/// Creates a new `BufferContentsLayout` from a sized layout. This is intended for use by the
|
||||||
/// derive macro only.
|
/// derive macro only.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -974,7 +974,7 @@ impl BufferContentsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `BufferContentsLayout` from a head and element layout. This is inteded for
|
/// Creates a new `BufferContentsLayout` from a head and element layout. This is intended for
|
||||||
/// use by the derive macro only.
|
/// use by the derive macro only.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -1056,7 +1056,7 @@ impl BufferContentsLayout {
|
|||||||
/// the nearest multiple of the alignment of the element type and aligning the head to the
|
/// the nearest multiple of the alignment of the element type and aligning the head to the
|
||||||
/// alignment of the element type if there is a sized part. Doesn't do anything if there is no
|
/// alignment of the element type if there is a sized part. Doesn't do anything if there is no
|
||||||
/// sized part. Returns [`None`] if the new head size would exceed [`DeviceLayout::MAX_SIZE`].
|
/// sized part. Returns [`None`] if the new head size would exceed [`DeviceLayout::MAX_SIZE`].
|
||||||
/// This is inteded for use by the derive macro only.
|
/// This is intended for use by the derive macro only.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn pad_to_alignment(&self) -> Option<Self> {
|
pub const fn pad_to_alignment(&self) -> Option<Self> {
|
||||||
|
@ -391,7 +391,7 @@ impl Entry {
|
|||||||
// there will be 2 references to the pool (one here and one in the allocation) and so
|
// there will be 2 references to the pool (one here and one in the allocation) and so
|
||||||
// the pool won't be returned to the reserve when deallocating. However, since there
|
// the pool won't be returned to the reserve when deallocating. However, since there
|
||||||
// are no other allocations alive, there would be no other allocations that could
|
// are no other allocations alive, there would be no other allocations that could
|
||||||
// return it to the reserve. To avoid dropping the pool unneccessarily, we simply
|
// return it to the reserve. To avoid dropping the pool unnecessarily, we simply
|
||||||
// continue using it. In the case where there are other references, we drop ours, at
|
// continue using it. In the case where there are other references, we drop ours, at
|
||||||
// which point an allocation still holding a reference will be able to put the pool
|
// which point an allocation still holding a reference will be able to put the pool
|
||||||
// into the reserve when deallocated.
|
// into the reserve when deallocated.
|
||||||
|
@ -334,7 +334,7 @@ pub struct RawCommandBuffer {
|
|||||||
// `RawRecordingCommandBuffer` is `!Send + !Sync` so that the implementation of
|
// `RawRecordingCommandBuffer` is `!Send + !Sync` so that the implementation of
|
||||||
// `CommandBufferAllocator::allocate` can assume that a command buffer in the recording state
|
// `CommandBufferAllocator::allocate` can assume that a command buffer in the recording state
|
||||||
// doesn't leave the thread it was allocated on. However, as the safety contract states,
|
// doesn't leave the thread it was allocated on. However, as the safety contract states,
|
||||||
// `CommandBufferAllocator::deallocate` must acccount for the possibility that a command buffer is
|
// `CommandBufferAllocator::deallocate` must account for the possibility that a command buffer is
|
||||||
// moved between threads after the recording is finished, and thus deallocated from another thread.
|
// moved between threads after the recording is finished, and thus deallocated from another thread.
|
||||||
// That's why this is sound.
|
// That's why this is sound.
|
||||||
unsafe impl Send for RawCommandBuffer {}
|
unsafe impl Send for RawCommandBuffer {}
|
||||||
|
@ -451,7 +451,7 @@ impl VariableEntry {
|
|||||||
// 2 references to the pool (one here and one in the allocation) and so the pool won't
|
// 2 references to the pool (one here and one in the allocation) and so the pool won't
|
||||||
// be returned to the reserve when deallocating. However, since there are no other
|
// be returned to the reserve when deallocating. However, since there are no other
|
||||||
// allocations alive, there would be no other allocations that could return it to the
|
// allocations alive, there would be no other allocations that could return it to the
|
||||||
// reserve. To avoid dropping the pool unneccessarily, we simply continue using it. In
|
// reserve. To avoid dropping the pool unnecessarily, we simply continue using it. In
|
||||||
// the case where there are other references, we drop ours, at which point an
|
// the case where there are other references, we drop ours, at which point an
|
||||||
// allocation still holding a reference will be able to put the pool into the reserve
|
// allocation still holding a reference will be able to put the pool into the reserve
|
||||||
// when deallocated. If the user created a reference themself that will most certainly
|
// when deallocated. If the user created a reference themself that will most certainly
|
||||||
|
@ -302,7 +302,7 @@ pub struct DescriptorSetLayoutCreateInfo {
|
|||||||
/// Specifies how to create the descriptor set layout.
|
/// Specifies how to create the descriptor set layout.
|
||||||
pub flags: DescriptorSetLayoutCreateFlags,
|
pub flags: DescriptorSetLayoutCreateFlags,
|
||||||
|
|
||||||
/// The bindings of the desriptor set layout. These are specified according to binding number.
|
/// The bindings of the descriptor set layout. These are specified according to binding number.
|
||||||
///
|
///
|
||||||
/// It is generally advisable to keep the binding numbers low. Higher binding numbers may
|
/// It is generally advisable to keep the binding numbers low. Higher binding numbers may
|
||||||
/// use more memory inside Vulkan.
|
/// use more memory inside Vulkan.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
//!
|
//!
|
||||||
//! In the vulkano library, images that have memory bound to them are represented by [`Image`]. You
|
//! In the vulkano library, images that have memory bound to them are represented by [`Image`]. You
|
||||||
//! can [create an `Image` directly] by providing a memory allocator and all the info for the image
|
//! can [create an `Image` directly] by providing a memory allocator and all the info for the image
|
||||||
//! and allocation you want to create. This should satisify most use cases. The more low-level use
|
//! and allocation you want to create. This should satisfy most use cases. The more low-level use
|
||||||
//! cases such as importing memory for the image are described below.
|
//! cases such as importing memory for the image are described below.
|
||||||
//!
|
//!
|
||||||
//! You can create an [`ImageView`] from any `Image`.
|
//! You can create an [`ImageView`] from any `Image`.
|
||||||
|
@ -206,7 +206,7 @@ impl Packed24_8 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow refering to crate by its name to work around limitations of proc-macros
|
// Allow referring to crate by its name to work around limitations of proc-macros
|
||||||
// in doctests.
|
// in doctests.
|
||||||
// See https://github.com/rust-lang/cargo/issues/9886
|
// See https://github.com/rust-lang/cargo/issues/9886
|
||||||
// and https://github.com/bkchr/proc-macro-crate/issues/10
|
// and https://github.com/bkchr/proc-macro-crate/issues/10
|
||||||
|
@ -511,7 +511,7 @@ impl MemoryTypeFilter {
|
|||||||
/// because the memory is only written once before being consumed by the device and becoming
|
/// because the memory is only written once before being consumed by the device and becoming
|
||||||
/// outdated, it doesn't matter that the data is potentially transferred over the PCIe bus
|
/// outdated, it doesn't matter that the data is potentially transferred over the PCIe bus
|
||||||
/// since it only happens once. Since this is only a preference, if you have some requirements
|
/// since it only happens once. Since this is only a preference, if you have some requirements
|
||||||
/// such as the memory being [`HOST_VISIBLE`], those requirements will take precendence.
|
/// such as the memory being [`HOST_VISIBLE`], those requirements will take precedence.
|
||||||
///
|
///
|
||||||
/// For memory that the host doesn't access, and the device doesn't access directly, you may
|
/// For memory that the host doesn't access, and the device doesn't access directly, you may
|
||||||
/// still prefer device-local memory if the memory is used regularly. For instance, an image
|
/// still prefer device-local memory if the memory is used regularly. For instance, an image
|
||||||
|
@ -366,7 +366,7 @@ impl From<AllocationType> for SuballocationType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if resouces A and B share a page.
|
/// Checks if resources A and B share a page.
|
||||||
///
|
///
|
||||||
/// > **Note**: Assumes `a_offset + a_size > 0` and `a_offset + a_size <= b_offset`.
|
/// > **Note**: Assumes `a_offset + a_size > 0` and `a_offset + a_size <= b_offset`.
|
||||||
fn are_blocks_on_same_page(
|
fn are_blocks_on_same_page(
|
||||||
|
@ -764,7 +764,7 @@ impl DeviceMemory {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the amount of lazily-allocated memory that is currently commited to this
|
/// Retrieves the amount of lazily-allocated memory that is currently committed to this
|
||||||
/// memory object.
|
/// memory object.
|
||||||
///
|
///
|
||||||
/// The device may change this value at any time, and the returned value may be
|
/// The device may change this value at any time, and the returned value may be
|
||||||
|
@ -154,7 +154,7 @@ where
|
|||||||
.take(2)
|
.take(2)
|
||||||
.filter(|(start, Entry { end, value: _ })| {
|
.filter(|(start, Entry { end, value: _ })| {
|
||||||
// Does the candidate range either overlap
|
// Does the candidate range either overlap
|
||||||
// or immediately preceed the range to insert?
|
// or immediately precede the range to insert?
|
||||||
// (Remember that it might actually cover the _whole_
|
// (Remember that it might actually cover the _whole_
|
||||||
// range to insert and then some.)
|
// range to insert and then some.)
|
||||||
(*start..end).touches(&(&range.start..&range.end))
|
(*start..end).touches(&(&range.start..&range.end))
|
||||||
|
@ -430,7 +430,7 @@ impl Spirv {
|
|||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// - Panics if `id` is not defined in this module. This can in theory only happpen if you are
|
/// - Panics if `id` is not defined in this module. This can in theory only happen if you are
|
||||||
/// mixing `Id`s from different modules.
|
/// mixing `Id`s from different modules.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn id(&self, id: Id) -> &IdInfo {
|
pub fn id(&self, id: Id) -> &IdInfo {
|
||||||
@ -441,7 +441,7 @@ impl Spirv {
|
|||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// - Panics if `id` is not defined in this module. This can in theory only happpen if you are
|
/// - Panics if `id` is not defined in this module. This can in theory only happen if you are
|
||||||
/// mixing `Id`s from different modules.
|
/// mixing `Id`s from different modules.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn function(&self, id: Id) -> &FunctionInfo {
|
pub fn function(&self, id: Id) -> &FunctionInfo {
|
||||||
|
@ -1440,7 +1440,7 @@ impl Surface {
|
|||||||
|
|
||||||
/// Resizes the sublayer bounds on iOS.
|
/// Resizes the sublayer bounds on iOS.
|
||||||
/// It may not be necessary if original window size matches device's, but often it does not.
|
/// It may not be necessary if original window size matches device's, but often it does not.
|
||||||
/// Thus this should be called after a resize has occurred abd swapchain has been recreated.
|
/// Thus this should be called after a resize has occurred and swapchain has been recreated.
|
||||||
///
|
///
|
||||||
/// On iOS, we've created CAMetalLayer as a sublayer. However, when the view changes size,
|
/// On iOS, we've created CAMetalLayer as a sublayer. However, when the view changes size,
|
||||||
/// its sublayers are not automatically resized, and we must resize
|
/// its sublayers are not automatically resized, and we must resize
|
||||||
|
Loading…
Reference in New Issue
Block a user