Commit Graph

376 Commits

Author SHA1 Message Date
marc0246
2c0067067c
Switch to a more expressive way to specify memory usage (#2264)
* Switch to a more expressive way to specify memory usage

* Fix tests

* Fix examples

* Forgot to adjust `SubbufferAllocatorCreateInfo::location_preference`s

* Oopsie

* Redo all of it

* Oopsie
2023-07-19 11:11:17 +02:00
Rua
0f5e298f29
Add Format::UNDEFINED (#2262)
* Add `Format::UNDEFINED`

* Use `iter::once`
2023-07-14 16:44:34 +02:00
marc0246
6dc8e64ac7
Fix suboptimal MemoryUsage for download in examples (#2260) 2023-07-10 22:30:27 +02:00
Rua
3a5b8a4432
ValidationError-ify images and image views, fix DRM format modifiers (#2252)
* ValidationError-ify images and image views, fix DRM format modifiers

* Update examples/src/bin/triangle-v1_3.rs

Co-authored-by: Austin Johnson <me@austinj.me>

* Update examples/src/bin/triangle.rs

Co-authored-by: Austin Johnson <me@austinj.me>

---------

Co-authored-by: Austin Johnson <me@austinj.me>
2023-07-06 03:52:11 -05:00
marc0246
7a8fec9e75
Unify all image types (#2247)
* Move `Image` to the `image` module

* Unify all image types

* Fix tests

* Fix examples

* Oopsie

* Don't re-export `ImageViewType`

* Fix docs

* Fix gl-interop example
2023-07-03 22:37:29 +02:00
Rua
204811de19
ValidationError-ify samplers (#2245)
* ValidationError-ify samplers

* Fix doctests
2023-06-30 11:21:18 +02:00
Rua
da09477d01
ValidationError-ify Surface and Swapchain (#2236)
* Add `RequiresAllOf`, automatically enable required extensions and features

* Add more missing backticks and backslashes to error messages

* Use updated VUIDs that require `acceleration_structure`

* ValidationError-ify `Surface` and `Swapchain`

* Update vulkano/src/lib.rs

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

* Update vulkano/src/lib.rs

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

* Don't draw if the window has zero size

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
2023-06-26 11:17:53 +02:00
Rua
69677346d2
ValidationError-ify GraphicsPipeline (#2234)
* Add `RequiresAllOf`, automatically enable required extensions and features

* Add more missing backticks and backslashes to error messages

* Use updated VUIDs that require `acceleration_structure`

* ValidationError-ify `GraphicsPipeline`

* Update vulkano/src/lib.rs

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

* Update vulkano/src/lib.rs

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

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
2023-06-25 20:08:27 +02:00
Rua
9fd6e0ff45
Add support for khr_device_group_creation (#2227)
* Add support for `khr_device_group_creation`

* Fix vulkano-utils

* Apply fixes
2023-06-17 20:18:48 +00:00
Rua
45f69c17a2
Add support for two render pass extensions (#2223)
* Reorganise render pass objects, add support for some extensions

* Handle stencil initial/final layout in the macro

* This was promoted to 1.2, not 1.1

* Doctests again...

* Missing docs

* Fix bad validation

* Convert Framebuffer to ValidationError while we're at it

* FramebufferCreateFlags

* Make render pass creation more like Vulkan again

* TODO for depth_resolve_mode and stencil_resolve_mode in the macro

* Depth/stencil resolve modes

* Missed validation

* Forgot some testing code...

* msaa-renderpass docs

* Doc fixes

* Add missing backslashes
2023-06-17 19:01:50 +00:00
Arnoldas Rauba
409b620217
Fixed some examples freezing on fullscreen mode on MacOS for #2208 (#2221)
* Updated  #2208

This commit solves the problem of freezing when going fullscreen for MacOS.
It was caused because winit may behave unexpectedly when using
run_return. Winit crate generally discourages the use of that
(see: <https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return>).

NOTE. This commit only solves the problem for `interactive_fractal`
binary, but not the `multi_window_game_of_life` binary.

* Some display servers (like X.org) are not redrawing for every frame.

* Fixed the same bug for  example binary.

* Remove ControlFlow::Poll (it is the default anyway) in interactive_fractal

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

* Remove ControlFlow::Poll (it is the default anyway) in multi_window_game_of_life

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

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
2023-06-04 09:15:21 +02:00
Rua
3e7ac8e0d4
Add support for descriptor set copies and other things (#2219)
* Add support for descriptor set copies and other things

* Typo

* Errors

* Doctest fix

* Add missing non_exhaustive
2023-06-03 14:56:27 +02:00
Gábor Gyebnár
cd9f081e3a
Fixes all examples to use at least two swapchain buffers (#2218)
* Fixes all examples to use at least two swapchain buffers.

* Fix build error
2023-06-02 22:01:38 +02:00
marc0246
08c245d7c5
Remove vulkano-win dependency from examples (#2209) 2023-05-18 14:07:30 +02:00
Rua
6816292750
Merge SyncCommandBuffer into *AutoCommandBuffer (#2207)
* Merge `SyncCommandBuffer` into `*AutoCommandBuffer`

* Commands take containers directly instead of iterators

* Use allocator as the type parameter for built command buffers

* Don't make `UnsafeCommandBuffer` keep objects alive

* Re-add impl for Arc

* Fixes

* Doc fix
2023-05-18 13:03:37 +02:00
Rua
7b8225f364
Fix warnings from earlier PRs (#2206) 2023-05-12 20:26:49 +02:00
marc0246
56e6871da0
Add async update example (#2202)
* Add async update example

* Add generation

* Minor rearrange

* One more note
2023-05-12 09:53:36 +02:00
marc0246
77fa2bbfcc
Add Surface::from_window[_ref], deprecate vulkano-win (#2204)
* Add `Surface::from_window[_ref]`

* Add `Surface::required_extensions`

* Deprecate vulkano-win

* Fix SPIR-V word alignment in tests

* Fix oopsie

* Remove pointer transmute
2023-05-12 09:52:20 +02:00
marc0246
11ce974c0a
Fix attributions 2023-05-07 15:05:24 +02:00
Rua
93babbebae
Replace ImageAccess::descriptor_layouts() (#2197)
* Replace `ImageAccess::descriptor_layouts()`

* Add `WriteDescriptorSet` constructors for image views with layout

* Replace `descriptor_layouts` for real

* Small changes

* More improvements
2023-05-03 17:19:28 +02:00
dsentinel
7741e00348
Fix reading from life_out output buffer instead of life_in. (#2198)
Co-authored-by: lloyd <digitalsentinel@gmail.com>
2023-05-03 11:05:28 +02:00
Rua
b320dd26c3
Add CreateInfo for pipelines, require explicit pipeline layout creation (#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>
2023-04-22 20:46:22 +02:00
Rua
958a72539e
Require explicit VertexInputState creation (#2183) 2023-04-19 17:45:27 +02:00
Rua
b7679f8bbb
Rewrite shader and specialization handling in pipelines (#2181)
* Rewrite shader and specialization handling in pipelines

* Make the shader loading in examples a bit cleaner

* Forgot some

* Fix incorrect color blend states in examples

* Nicer fix

* Use mem::discriminant

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

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
2023-04-18 20:53:08 +02:00
marc0246
59be815314
Refactor AllocationCreateInfo (#2174)
* Refactor `AllocationCreateInfo`

* `debug_assert` -> `assert`
2023-04-02 15:07:16 +02:00
marc0246
ad530ed48a
Preemptively rename stuff, mark enums as non-exhaustive (#2172) 2023-04-01 18:51:58 +02:00
marc0246
5ab869156d
Fix inconsistent trailing command in renderpass macro calls (#2163) 2023-03-25 10:25:25 +01:00
marc0246
28a98f7a5f
Fix game of life example constructing one memory allocator per window (#2157) 2023-03-24 14:03:49 +01:00
marc0246
127b3eae61
Generate device properties that are alignment as DeviceAlignment (#2155)
* Move `DeviceAlignment`

* Generate alignment-properties with the type `DeviceAlignment`

* Small fix

* Another small fix

* Switch to using `is_aligned` where possible

* Oopsie
2023-03-15 22:21:44 +01:00
Francisco Ayala Le Brun
19acc71be3
Fix gl-interop not compiling (#2154)
Running this results in a segmentation fault in my machine.
2023-03-11 21:14:37 +01:00
Rua
41ded32156
Update dependencies, clippy warnings (#2142)
* Update dependencies, clippy warnings

* Remove allowed clippy lint that no longer triggers as of Rust 1.67.1
2023-03-05 20:12:17 -06:00
marc0246
baf863ce33
Resolve restrictions of BufferContents, add support for allocating all types of buffers, and rework vulkano-shaders (#2132)
* Add `BufferContentsLayout`

* Rework `BufferContents`

* Add `BufferContents` derive macro

* Relax restrictions of shader code generation

* Fix examples

* Add additional invariant to `Subbuffer`

* Shorten paths a bit

* Remove a bit of bloat

* Add `Sized` constraint to element traits

* Fix an oopsie

* Add `Aligned`

* Add support for deriving `BufferContents` for sized types

* Fix alignment and padding issues

* Fix docs and add examples for `BufferContents`

* Adjust shader macro

* Add tests

* Adjust `Vertex` example

* Remove bytemuck re-export

* Update examples

* Workaround bytemuck's array elements that are `AnyBitPattern` limitation

* Add more alignments

* Fix an earlier oopsie

* Rework vulkano-shaders

* Fix examples

* Fix some rogue tabs in examples

* Add `AsRef` and `AsMut` implementation for `Padded`

* Remove useless code duplication

* Make the `BufferContents` derive macro the same for all types

* Add example docs for `Padded`

* Work around trivial bounds

* More example docs

* Minor consistency adjustment

* Add `serde` to the list of cargo features

* Make clippy happy again
2023-03-05 19:56:35 +01:00
marc0246
abfde840fa
Unify all buffer types (#2127)
* `CpuBufferPool` revamp

* Fix oopsie

* Fix docs

* Add `Subbuffer`

* Move `Buffer` to `buffer` module

* Replace all buffer types with `Subbuffer`

* Add constraints to `Index` and `QueryResultElement` traits

* Fix oopsies

* Fix examples

* Fix doc tests

* Rename `_unsized` to `_slice`

* Rename `CpuBufferAllocator`

* Implement `DeviceOwned` for `SubbufferAllocator`

* Use better generic type params

* Fix requirement message

* Fix docs

* Fix missing buffer alignment for texel buffer usage

* Add more docs to `Subbuffer`

* Add more utility functions to `Subbuffer`

* Remove superfluous `dst_offset`s

* Murder `FillBufferInfo`

* Fix example

* Add `Subbuffer::range`

* Fix wrong atom size alignment check

* Specify all fields in create infos derived from `BufferAllocateInfo`
2023-01-12 13:56:10 +01:00
Rua
4927b2ea62
Make triangle-v1_3 example work with khr_dynamic_rendering too (#2123)
* Make `triangle-v1_3` example work with `khr_dynamic_rendering` too

* Small comment fix
2023-01-07 20:37:21 -06:00
Nik Voss
834cc1eea5
Better custom vertex buffer layouts support (#2119)
* Implement VertexDefinition for VertexBufferInfo, change Vertex signature to return VertexInfo and implement VertexInput-trait helper for Vertex to construct VertexBufferInfo objects from Vertex types. Updated teapot example to show usage.

* Reimplement BuffersDefinition leveraging VertexBufferInfo

* Reduce the amount of types required, remove VertexInfo, expose VertexBufferInfo methods on Vertex and use std HashMap transparently instead.

* Fix teapot example

* Fix outdated docs and use full path to Vertex trait to avoid issues

* Fix formatting of imports

* Remove clone and directly instantiate VertexInputBindingDescription.

* Rename VertexBufferInfo to VertexBufferDescription and being update of examples to use it

* Run cargo clippy fix to cleanup imports in examples

* Remove obsolete comment

* cargo fmt
2023-01-03 18:49:12 +01:00
Rua
41a37735d1
Automatically derive Pod and Zeroable for structs generated by vulkano-shaders (#2117) 2022-12-30 03:18:25 -06:00
Nik Voss
dcc1b58fab
Refactor Vertex trait to allow user-defined formats (#2106)
* Refactor Vertex trait to not rely on ShaderInterfaceEntryType::to_format and instead rely on Format provided by VertexMember trait.

* Add test for impl_vertex macro, remove tuple implementations as they do not implement Pod, minor cleanups to impl_vertex macro.

* #[derive(Vertex)] proc-macro implementation with support for format and name attributes. Tests are implemented for both attributes and inferral matching impl_vertex macro

* Rename num_elements into num_locations to make purpose clear, add helper function to calculate num_components and check them properly in BufferDefinition's VertexDefinition implementation.

* Rename num_locations back to num_elements to make distinction to locations clear. Updated VertexDefinition implementation for BuffersDefinition to support double precision formats exceeding a single location.

* Add additional validation for vertex attributes with formats exceeding their location.

* Collect unnecessary, using iterator in loop to avoid unnecessary allocations.

* Use field type directly and avoid any form of unsafe blocks.

* Match shader scalar type directly in GraphicsPipelineBuilder

* Rename impl_vertex test to fit macro name

* Add VertexMember implementatinos for nalgebra and cgmath (incl matrices).

* Add missing copyright headers to new files in proc macro crate

* Document derive vertex with field-attribute options on the Vertex trait

* Add example for vertex derive approach.

* Do not publish internal macros crate as it is re-exported by vulkano itself

* Deprecate impl_vertex and VertexMember and update documentation for Vertex accordingly

* Make format field-level attribute mandatory for derive vertex

* Update all examples to derive Vertex trait instead of impl_vertex macro

* Fix doctests by adding missing imports and re-exporting crate self as vulkano to workaround limitations of distinguishing doctests in proc-macros
2022-12-28 11:23:36 +01:00
Rua
6eb526322b
Fix clippy warnings from Rust 1.66 (#2105) 2022-12-18 10:23:40 -06:00
Rua
3aca5dc190
Fix #1643 (#2103)
* Fix #1643

* Remove old code that was incorrect anyway
2022-12-16 04:40:46 -06:00
Rua
4d95604e1a
Update Ash to 0.37.1 (#2096)
* Update Ash to 0.37.1

* typo

* Add support for new shader/pipeline stages and access flags

* Small change

* Fixes

* Use ^ for version
2022-12-02 10:17:45 -06:00
Austin Johnson
93b5164b73
Fix runtime_array example (#2095) 2022-12-01 11:56:11 +01:00
Rua
9bc69940d0
Split sync module into multiple submodules, other changes to sync (#2086) 2022-11-15 02:05:03 -06:00
Rua
4ccfc925fa
Refactor DescriptorRequirements (#2081) 2022-11-09 03:35:50 -06:00
Okko Hakola
facee332ec
Fix black screen on some devices in interactive examples (#2082) 2022-11-07 08:48:25 +01:00
marc0246
fe01ddd5e3
CpuBufferPool revamp (#2076)
* `CpuBufferPool` revamp

* Fix oopsie

* Fix docs
2022-11-05 08:50:46 +01:00
Rua
a984a925c4
Use actual integer bitflags for Vulkan bitflag types (#2073)
* Use actual integer bitflags for Vulkan bitflag types

* Fix doc tests

* Fix Fence and Semaphore on Win32 and Fuchsia

* Add macro for bitflags that have a corresponding enum

* Fix bug
2022-11-05 00:02:28 -05:00
marc0246
6b2d21e9f5
Fix StandardCommandBufferAllocator example docs (#2072) 2022-10-31 09:06:08 +01:00
marc0246
45f3eb9ac8
Implement allocator traits for Arcs (#2068) 2022-10-31 08:08:59 +01:00
Rua
bdcb79609e
Update render pass checks for new VUID (#2055) 2022-10-30 04:37:34 -05:00
marc0246
d5d47d7757
Further improvements to command buffer allocation (#2053) 2022-10-29 19:34:07 +02:00