Commit Graph

436 Commits

Author SHA1 Message Date
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
marc0246
8a1c91f556
Make command buffer/descriptor set allocators Sync again (#2046)
* Make cmd buffer/desc set allocators `Sync` again

* Ingles
2022-10-27 20:59:47 +02:00
marc0246
34b709547f
Memory allocation revamp (#1997)
* Add suballocators

* Add tests

* Retroactively abort `PoolAllocatorCreateInfo`

* Use const generic for `PoolAllocator`'s block size

* Move `new` and `try_into_region` to `Suballocator`

* Move `allocate_unchecked` to `Suballocator`

* Fix constructor visibility

* Move `free_size` to `Suballocator`

* Small fixes

* Merge `BumpAllocator` and `SyncBumpAllocator`

* Restrict `AllocParent::None` to tests

* Rewording

* Add dedicated allocations

* Add `Suballocator::cleanup`

* Make `free_size`s lock-free

* Add `Suballocator::largest_free_chunk`

* Add `ArrayVec`

* Remove useless `unsafe`

* Add `MemoryAllocator`

* Add `GenericMemoryAllocator`

* Small fixes

* Retroactively abort `largest_free_chunk`

* Small docs adjustments

* Rearrange

* Add `MemoryAlloc::mapped_ptr`

* Fix oopsie

* Add support for non-coherent mapped memory

* Add `DeviceOwned` subtrait to `Suballocator`

* Move granularities to suballocators, fix tests

* Add cache control

* Fix oopsie where alignment of 0 is possible

* Store `Arc<DeviceMemory>` in suballocators

* Add `MemoryAllocator::create_{buffer, image}`

* Remove `MemoryPool`

* Fix examples

* Remove `MemoryAlloc::{memory, memory_type_index}`

* Minor improvement to `AllocationCreationError`

* Add some example docs

* Add support for external memory

* Swicheroo

* Small fix

* Shorten sm names, cache atom size in suballocators

* Add config for allocation type to generic allocatr

* Engrish

* Fix a big oopsie

* Spliteroo

* Inglisch
2022-10-26 16:25:01 +02:00
Rua
0b5ad98b44
Move resource locking to submit function (#2041) 2022-10-23 17:29:40 -05:00
Rua
cdab36a322
Remove type parameter from Surface (#2036) 2022-10-20 02:26:34 -05:00
Rua
43223f564b
Add safety checks to semaphores, add importing and exporting (#2035)
* Add safety checks to semaphores, add importing and exporting

* Small fix

* Limit test to unix only
2022-10-12 19:04:54 -05:00
Rua
df26f8105e
Buffer and image uploads take a command buffer instead of making one (#2030) 2022-10-08 08:22:37 -05:00
marc0246
3c6c1c909f
Remove unneccessary muts left after #1957 (#2029) 2022-10-07 08:59:54 +02:00
marc0246
ef65c98ad1
Move to manual management of descriptor set and command buffer allocators (#1957)
* Rename `Pool` -> `Allocator`

* Fix module names

* Rename actual pool types

* Remove internally managed allocators

* Fix doc tests

* Update docs

* Update examples

* Fix merging oopsie

* Fix cb allocators only working for one q family

* Make `DescriptorPool` `!Sync`, remove `&mut`

* Combine lean files

* Consistency

* Rename single layout pools

* Re-export variable descriptor set pool

Co-authored-by: comrademarc <40955683+comrademarc@users.noreply.github.com>
2022-10-05 11:09:26 +02:00
Austin Johnson
6e4d8c3494
Swapchain acquisition checks (#2009)
* Initial solution to swapchain acquisition checks

* replace internal_object comparisons
2022-10-02 10:44:46 +02:00
Rua
f96519a8a3
Add state tracking and validation to Fence (#2010)
* Add state tracking and validation to `Fence`

* Forgot bind_sparse
2022-10-01 21:32:17 -05:00
Rua
6b19b6ccf4
Remove command_buffer::submit module, make new Queue methods public (#2002) 2022-09-27 02:58:47 -05:00
Rua
c085dd8d9f
Queue operations refactoring (#1995) 2022-09-24 01:45:06 -05:00
Rua
0bab019d10
Treat atomic writes in shaders as write accesses (#1989) 2022-09-18 02:45:55 -05:00
Austin Johnson
8f99ceab32
Example Tweaks (#1987)
* Example Tweaks

* use released glium
2022-09-17 17:37:22 +02:00
Rua
46187e85fb
Rename next and chunk methods of CpuBufferPool for consistency (#1978) 2022-09-17 02:51:26 -05:00
Austin Johnson
8e8482016a
Impl Present Wait Feature (#1965)
* impl present_wait feature

* handle timeout case

* add missing doc

* document the return type of wait_for_present

* impl check for VUID-04999

* don't enforce gt if present_id is zero

* impl PresentInfoExt

* Remove NonZeroU64 from wait_for_present in favor of an error

* fix gl-interop example

* fix docs and fmt

* PresentInfoExt -> PresentInfo, Added swapchain + index to info

* fix doc test,  didn't save file...

* fix gl-interop

* Remove Whitespace
2022-09-17 09:38:32 +02:00
Codotaku
e0af8af960
fix (#1977) 2022-09-13 21:11:54 +02:00
Rua
e99ad4fce5
Add khr_external_fence and remaining parts of khr_external_semaphore (#1972) 2022-09-13 04:07:10 -05:00
Rua
4abc27b9e5
Make PhysicalDevice an independent object (#1967)
* Better validation and errors

* Small fix

* Make `PhysicalDevice` an independent object

Co-authored-by: Austin Johnson <me@austinj.work>
2022-09-10 01:00:08 -05:00
Rua
2705984c77
Macrofy all Vulkan bitflag and enum types, check for device support (#1964) 2022-09-05 15:16:40 -05:00
Rua
f96768f556
Slight change 2022-09-05 15:57:53 +02:00
Rua
5a1df026dc
Reword for clarity 2022-09-05 15:57:11 +02:00
Rua
f77644bcef
Refactor bind/push commands (#1962) 2022-09-02 11:02:41 -05:00
Rua
f0e6e4c6b7
Fix or allow all Clippy errors, re-enable dead code and unused variable warnings (#1953) 2022-08-12 05:18:35 -05:00
antonino maniscalco
77e59002de
Merged ImmutableBuffer into DeviceLocalBuffer #1934 (#1936)
* Merged `ImmutableBuffer` into `DeviceLocalBuffer` #1934

* Updated documentation
2022-07-31 11:54:46 +02:00
Rua
14f14f76ee
Update winit to 0.27 (#1933)
* Update winit to 0.27

* Fix windows

* Better fix?
2022-07-30 01:58:44 -05:00
Rua
6a755cd2f3
Add VulkanLibrary as first initialization step before Instance (#1932)
* Add `VulkanLibrary` as first initialization step before `Instance`

* Fix MacOS error

* Fix Vulkano-utils
2022-07-30 01:53:52 -05:00
Austin Johnson
df97b2c55f
Support for VK_KHR_portability_subset Devices (#1927)
* opt-in portability

* Only enable portability flag if extension is present

Automatically enable khr_portability_subset on Device; Remove required_extensions from PhysicalDevice & Device

* enable InstanceCreateInfo.enumerate_portability on all examples

* add additional documentation for enumerate_portability
2022-07-18 15:11:43 +02:00
Joseph Micheli
e8cf282e51
Documentation todos (#1920)
* Added ImageUsage::transient_input_attachment()

* Address TODOs in examples

* Added actual example to command_buffer module documentation.

* Fixed error in command_buffer example

* Check  max_framebuffer_height/width/layers in AttachmentImage constructors.

* Add detailed explanation for shader! macro to triangle examples
2022-07-13 12:26:47 +02:00
Okko Hakola
18f68337a5
Vulkano util proposal (#1918)
* Init vulkano util library

* Add window & renderer structs

* Update fractal to use vulkano utils

* Add general purpose image view generation to storage image

* Add some missing functionality

* Fix game of life

* Rename error

* Fix tests

* Update documentation texts

* Modify license comment

* Add to changelog

* Improve docs

* Allow option to wait on the future

* Update doc text

* Add filter fn

* Modify queue selection

* Fix import error

* Remove non working tests

* Rename start and finish frame to acquire and present

* Allow pub creation of window renderer

* Ensure config members are pub and it has send + sync

* Remove send syncs
2022-06-24 17:27:33 +02:00
Rua
6352adf4ff
Add support for dynamic rendering (#1902) 2022-05-29 11:53:36 -05:00
Ryan Andersen
a89359007b
Image extent zero length (#1893)
* Updating examples and SwapchainCreationError enum to resolve #1892 and related discussion

* Slightly better documentation
2022-05-09 14:25:26 +02:00
Ryan Andersen
ba7f0b20e6
Device local example (#1890) 2022-05-06 18:31:08 +02:00
Rua
9e2b41a5c4
Improve render pass commands, more validation (#1884)
* Use only the selected range of buffer and image views in synchronization

* Improve render pass commands, more validation

Co-authored-by: Austin Johnson <me@austinj.work>
2022-04-23 20:16:19 -05:00
Okko Hakola
f523234e41
Fix debug utils message severity error (#1883) 2022-04-19 16:24:58 +02:00
Rua
201e21d3e6
Rewrite copy commands (#1873)
* Allow `SyncCommandBufferBuilder` commands to specify the access range

* Allow `SyncCommandBufferBuilder` commands to specify the access range

* Better handling of image initialization

* Small fix

* Rewrite copy commands

* Better handling of maintenance1

* Small leftovers

* Remove conflict_key
2022-04-16 15:02:42 +02:00
Rua
44e30574d9
Rename debug commands, add some new ones (#1878) 2022-04-16 07:54:32 -05:00
Okko Hakola
d1ab3f6726
Fix game of life example on macos (#1829) 2022-03-28 15:28:51 +02:00
Rua
c70fcc575f
Rework mapped memory, add BufferContents trait with bytemuck (#1853)
* Rework mapped memory, add `BufferContents` trait with bytemuck

* Platform fix
2022-03-07 02:30:49 +07:00
Rua
9e8682fce7
Add UnsafeImageCreateInfo and ImageViewCreateInfo (#1844) 2022-02-27 00:18:14 -06:00
Rua
a593fee072
Add SamplerCreateInfo and SamplerYcbcrConversionCreateInfo (#1842) 2022-02-26 02:46:53 -06:00
Rua
42b4bd9441
Add CreateInfo for Event, Fence and Semaphore. (#1841)
* Add `CreateInfo` for `Event`, `Fence` and `Semaphore`.

* Small fixup

* Random idea...

* Fix CI error on Windows and Mac
2022-02-26 02:42:14 -06:00
Rua
c61ed1bfe3
Add QueryPoolCreateInfo (#1840) 2022-02-25 17:52:59 -06:00
Rua
786683c2a9
Add DescriptorSetLayoutCreateInfo and PipelineLayoutCreateInfo (#1834)
* Add `DescriptorSetLayoutCreateInfo` and `PipelineLayoutCreateInfo`

* DescriptorType non_exhaustive
2022-02-25 16:52:44 -06:00
Austin Johnson
51c5d197bf
Update examples readme
The readme still redirected users to the vulkano-examples repository. This has since been achieved. Included a step-by-step guide to switching version tag.
2022-02-23 02:17:35 -06:00
Rua
645faa4530
Add SwapchainCreateInfo, various related changes (#1832) 2022-02-20 10:55:34 +01:00
Rua
21330c747a
Add RenderPassCreateInfo and FramebufferCreateInfo (#1828) 2022-02-19 18:14:16 -06:00
Rua
8775777f47
Add InstanceCreateInfo and DeviceCreateInfo (#1814)
* Convert creation of `Instance` and `Device` to use a builder

* Big oops

* Add `InstanceCreateInfo` and `DeviceCreateInfo`

* Doc fix

* impl FromStr for Version, remove elidable qf2
2022-02-14 16:32:27 +07:00
Austin Johnson
901d2b2bc2
Refactor VertexBuffersCollection to acccept Arc<dyn BufferAccess> (#1824) 2022-02-13 11:38:14 +01:00
Okko Hakola
96c52ad11a
Add multi-window game of life application example (#1812) 2022-02-02 17:21:32 +01:00
Rua
0c06394e6c
Better validation of image view creation, descriptor set updates, draw-time resources and others (#1806) 2022-01-30 03:53:33 +07:00
Todd York
ec4f7631e0
Fix support for 2D array images (#1803)
* Fix mipmap generation for arrayed images

* Add example for texture array

* Change ImageView constructor to explicitly require ImageViewType

* Revert "Change ImageView constructor to explicitly require ImageViewType"

This reverts commit 3ad55717c4.
2022-01-29 18:59:45 +01:00
Rua
4c7cdb44fe
Sampler improvements (#1787)
* Sampler improvements

* Check Filter::Cubic for blits as well

* Small doc fix

* Better checks for blits

* Doc fix

* can_be_sampled > can_sample
2022-01-11 10:32:53 +07:00
Rua
16171c51ac
Improve shader analysis, add and refine DescriptorRequirements fields (#1786)
* Improve shader analysis, add and refine DescriptorRequirements fields

* Simplify a bit
2022-01-11 09:06:22 +07:00
Francisco Ayala Le Brun
adef9bd17a
Fix undefined behaviour on external semaphore & image creation; Fix wrong device chosen on hybrid graphics (#1783)
* Fix device memory missing p_next structures

* Fix exportable attachment image missing p_next; Fix mutable bit off

* Fix fd export for StorageImage

* Fix undefined behaviour on external semaphore & image creation

* Add uuid check on physical device creation

* Add rev specification to glium dependency
2022-01-05 04:14:18 +07:00
Amjad Alsharafi
657012142b
Allow copy_image, blit_image and copy_buffer source and destination to be the same image (#1782)
* Allow `copy_image` source and destination to be the same image

The doc: `srcImage and dstImage can be the same image or alias the same
memory`.

This was achieved by locking only one image exclusively if both are the same.

* Allow `blit_image` and `copy_buffer` to have the same src/dest buffers

Regarding this and the previous commits, I noticed an important note in
the docs.
`regions must not overlap`

Before this, it was not important check for us to do, since we can't
have overlapping regions if both buffers are different. But now we must
add some checks to make sure its safe to use these functions while also
allowing for shared buffers between src and dest.

* Added bounds and overlapping checks for `copy_buffer`

* Added overlap checks for `blit_image` and `copy_image`

Created utility file `src/command_buffer/validity/ranges.rs` which hold
functions that help compute if there is overlap in regions.

* Fixed bug in regions overlap check

It should be ANDed together and not ORed

* Added `image_blit` to the `image-self-copy` example

* Added example for `copy_buffer_dimensions` using `basic-compute-shaders`

Also updated copyright year for this and the `image-self-copy-blit`
example.
2022-01-03 03:54:02 +07:00
Amjad Alsharafi
d75390042f
Added command clear_attachment (#1779)
* Added command `clear_attachment`

This command implements `vkClearAttachments`, most checks are done
except for:
- Handling attachments with `VK_ATTACHMENT_UNUSED`, `vulkano` doesn't
  support unused attachments for now.
- command buffer protection and protectedNoFault, which `vulkano` is not
  supporting now.

* Added `clear_attachments` example

This explains the usage of `clear_attachments` command

* Modified `ClearRect.rect_offset` to use `u32`

Since, in vulkan docs, it says that the rect must be inside the render
area, its better to use `u32` so that we don't get negative values since
its not applicable here.

I was using `i32` because in vulkan docs its using `VkRect2D` inside
`VkClearRect` which is a general rectangle object. Since ours is only
specific to `ClearRect` its better to make it specific.
2021-12-19 19:20:51 +07:00
Rua
2151697af0
Remove DescriptorSetBuilder, use descriptor writes directly (#1774)
* Remove DescriptorSetBuilder, use descriptor writes directly

* Merge two error types
2021-12-18 17:32:38 +07:00
Rua
f069fdc35f
Upgrade to Rust 2021, update dependencies (#1772)
* Upgrade to Rust 2021, update dependencies

* Missed one

* Fix raw_window_handle breaking changes
2021-12-16 15:46:44 +07:00
Francisco Ayala Le Brun
5d0c2390ba
Fix gl-interop validation error & window not closing (#1768) 2021-12-06 04:11:59 +07:00
Rua
0ebf05f35d
Bring vertex input in line with other pipeline state, reorganise modules (#1758)
* Bring vertex input in line with other pipeline state, reorganise modules

* Documentation improvement

* Use ShaderInterfaceEntryType in shader interface instead of format

* Example fix
2021-12-06 03:30:56 +07:00
Will Song
aa5a97481e
use repr(C) (#1757) 2021-11-24 21:19:57 +07:00
Rua
9ac0de2842
Allocate less than the maximum descriptor count when variable (#1751)
* Allocate less than the maximum descriptor count when variable

* Workaround for driver bug
2021-11-24 01:33:10 +07:00
Ilya Lakhin
b84b0c9c55 #1734 Changelog update 2021-11-23 19:59:37 +07:00
Francisco Ayala Le Brun
4d0e709c18
Fixes related to Image export & OpenGL Interop (#1734)
* Fix device memory missing p_next structures

* Fix exportable attachment image missing p_next; Fix mutable bit off

* Fix fd export for StorageImage

* Add gl-interop example; Remove debug assert comment

* Fix gl-interop example being run on Windows and MacOS

* Add builder field to DeviceMemoryBuilder
2021-11-23 19:55:32 +07:00
Rua
c6959aa961
Move shader analysis to Vulkano crate, make available for runtime shaders (#1747)
* Move shader parsing and information extraction to Vulkano, make available for runtime shaders

* Small change

* Add new pipeline stages to match shader stages

* Fix review issues
2021-11-13 22:06:16 +07:00
Rua
325ef8ee38
Check against DescriptorRequirements instead of pipeline layout at draw time (#1744) 2021-11-13 17:10:52 +07:00
Rua
189a589002
Arcs, Arcs everywhere (#1739)
* `Arc`s, `Arc`s everywhere

* Additional types that I forgot

* Include Arc when returning image from ImageView
2021-11-03 03:33:58 +07:00
Rua
5a326db546
Add DescriptorRequirements (#1729)
* Add DescriptorRequirements

* Doc fix
2021-10-26 00:16:54 +07:00
Rua
35fed6b577
Add basic support for khr_push_descriptor (#1727)
* Add basic support for khr_push_descriptor

* Add basic support for khr_push_descriptor

* Support arrays in `DescriptorWrite`

* Use assert when creating the builder
2021-10-20 21:56:56 +07:00
Rua
64ca6f78e1
Lots of additional dynamic state, and some new pipeline state (#1724)
* Add extra dynamic state commands to the command buffer builders

* Add TessellationState

* Re-enable InputAssemblyState, add dynamic state, update Ash

* Rework depth_stencil module, add dynamic state

* Rename module raster > rasterization, add dynamic state

* Replace DynamicStateMode with bool, replace Option with StateMode enum for potentially dynamic states, rename Blend > ColorBlendState, add dynamic state

* Re-enable MultisampleState

* Re-enable ViewportState, add state to GraphicsPipeline with retrieval methods, add dynamic state

* Add builder methods for state types

* Color blend improvements

* Further checks on input assembly dynamic state

* Add color_write_enable

* Add topology class, check that it matches

* Add line_stipple

* Move some builder code to the individual state types

* Add discard rectangles

* Trim down GraphicsPipelineCreationError variants, order alphabetically
2021-10-12 19:42:32 +07:00
Rua
885fbc6a4c
Add Send + Sync requirements to various traits (#1720)
* Remove Send + Sync and BufferAccess traits where they are redundant

* Require Send + Sync for ImageViewAbstract

* Require Send + Sync for ImageAccess, AttachmentsList and MemoryPoolAlloc

* Require Send + Sync for DescriptorSet and DescriptorPoolAlloc

* Require Send + Sync for FramebufferAbstract

* Minor rearranging

* Require Send + Sync for PrimaryCommandBuffer, SecondaryCommandBuffer and CommandPoolAlloc

* Require Send + Sync for Command (private trait)

* Cargo fmt
2021-09-29 12:00:56 -05:00
Okko Hakola
2151a4d1ce
Remove validation layer request from fractal example (#1708)
* Add interactive fractal example

* Rename folder

* Update guide

* Remove layers & debug callback from fractal example
2021-09-14 21:45:49 +07:00
Okko Hakola
e0839af295
Add an interactive fractal example (#1707)
* Add interactive fractal example

* Rename folder

* Update guide
2021-09-13 22:14:54 +07:00
Rua
8d321430cb
Add auto-generated SPIR-V parsing (#1701)
* Add auto-generated SPIR-V parsing

* Add further reflection utilities for decorations, names and members, clean up Vulkano-shaders
2021-09-13 19:39:17 +07:00
Ilya Lakhin
ddbde190ff
Sharing generated Rust types between shaders (#1694)
* Vulkano-shader mutual compilation mode

* Tests fixes

* Shared constants option for multi-shader

* Cargo fmt

* Fix doc typos
2021-09-06 02:18:04 +07:00
Austin Johnson
588f91dc59
fix warnings/errors (#1692) 2021-09-04 01:41:17 -05:00
Rua
cd8302328f
Update dependencies (#1689) 2021-09-03 23:21:15 -05:00
Rua
ebf3ace481
Add support for immutable samplers, some small changes (#1688) 2021-09-03 23:20:05 -05:00
Rua
7a50bd5cb5
Add generation of Format to autogen (#1687)
* Add generation of `Format` to autogen

* Better documentation
2021-09-02 04:05:23 -05:00
Austin Johnson
0a3791c303
Support for Runtime Descriptor Arrays (#1674) 2021-09-02 03:29:27 -05:00
Rua
aa1c6eb607
Move command buffer binding and state-setting into their own commands (#1684)
* Move binding and state-setting into their own commands

* Fix test failing on documentation
2021-08-27 01:24:16 -05:00
Rua
874e502545
Replace VertexSource with VertexBuffersCollection, remove pipeline traits (#1671)
* Replace VertexSource with VertexBuffersCollection

* Remove pipeline traits
2021-08-17 02:10:07 +07:00
Rua
3da6c298a8
Add vertex and instance parameters to draw commands (#1661)
* Add vertex and instance parameters to draw commands

* Remove BufferlessDefinition
2021-08-12 21:14:02 +07:00
Will Song
4f4580e749
update push constant ranges to match the spec. overlapping ranges are OK but intersecting stage flags are not (#1659)
* update push constant ranges to match the spec. overlapping ranges are OK but intersecting stage flags are not

* add a check for push constant ranges
2021-08-09 22:19:54 +07:00
Will Song
0bf8c86eea
add some logic for known properties (#1654)
* add some logic for known properties

* update examples

* fix tests

* fix indentation
2021-08-09 20:44:58 +07:00
Rua
7bc7d4ddac
Fix storage buffer detection to work for all SPIR-V versions (#1642) 2021-07-26 00:23:57 -05:00
Rua
0ad56aaeda
Add DescriptorSetWithOffsets type (#1641)
* Add DescriptorSetWithOffsets, remove the dynamic_offsets parameters on AutoCommandBufferBuilder

* Modify StateCacher, add checking to DescriptorSetWithOffsets constructor

* Add DescriptorSetWithOffsets to SyncCommandBufferBuilder
2021-07-21 00:06:22 +07:00
Rua
1771714bc4
Descriptor set/pipeline layout refactoring (#1629)
* Remove DescriptorSetDesc trait, add layout method to DescriptorSet

* Add struct DescriptorSetDesc, forward PipelineLayoutDesc to it, rename is_superset_of to ensure_superset_of, union doesn't take self

* DescriptorSetLayout takes DescriptorSetDesc in constructor

* PipelineLayout takes DescriptorSetLayout in constructor

* EntryPointAbstract takes/returns descriptor set descs and push constant descs separately

* Remove PipelineLayoutDesc

* Remove PipelineLayout::descriptor_set_layout

* Minor changes

* Small additions
2021-07-05 11:35:38 +07:00
Rua
0eebf0c4f4
Rework VertexDefinition trait, add BuffersDefinition, support instance rate divisors (#1619)
* Rework VertexDefinition trait, add BuffersDefinition

* Add support for instance rate divisors
2021-07-05 11:19:32 +07:00
Rua
aee11063d4
Rename Features::superset_of to is_superset_of, add is_superset_of to extensions (#1625) 2021-06-28 16:07:54 +07:00
Rua
d5bcffa902
Rearrange descriptor set modules and types (#1622)
* Move descriptor_set.rs to parent, make descriptor.rs its child

* Rename UnsafeDescriptorSetLayout to DescriptorSetLayout, as there isn't actually anything unsafe about it

* Make fixed_size_pool and persistent modules public, reduce number of re-exports from there

* Split off pool.rs from sys.rs

* Move std_pool module to pool::standard

* Make sys public, remove re-exports

* Move descriptor module and DescriptorSetDesc into layout module

* Move ShaderStages to pipeline::shader

* Make descriptor_set::collection module private

* Documentation
2021-06-28 15:28:09 +07:00
Rua
e5bd8807e4
Move instance/physical_device.rs to device/physical.rs, rewrite and refactor some parts of it (#1617)
* Move instance/physical_device.rs to device/physical.rs, rewrite some of it

* Deprecate supported_by_device_raw as well
2021-06-28 15:04:28 +07:00
Rua
847c81bb88
Better feature and device selection in examples (#1614)
* Don't enable any features in examples unless the example requires it

* More elaborate device selection code in the triangle example

* Better device selection for all other examples
2021-06-28 13:24:44 +07:00
Rua
0d5edc130d
Add auto-generated device properties (#1605)
* Migrate to using Ash as a base

* Small change to test, to make it applicable to Vulkan 1.1

* Auto-generate extensions, check extension requirements

* Add documentation to extensions, use vk.xml from Ash 0.32.1

* Remove `RawDeviceExtensions` and `RawInstanceExtensions`

* Add extension conflict checking

* Small fix

* Add auto-generated features, more requirements checks

* Features documentation

* Macrofy required_if_supported_extensions

* Include vulkano-gen tool

* Move autogen imports to macros

* Change autogen into a build script

* Delete leftover file

* Autogenerate device properties

* Propagate bugfix in properties chain to features
2021-06-14 02:47:10 +07:00
Tim Balsfulland
748097a159
add support for VK_KHR_multiview (#1598)
* initial support for the `VK_KHR_multiview` extension

The `VK_KHR_multiview` extension can be used to efficiently draw to multiple layers of a framebuffer at once with.
This is particularly useful for virtual reality applications or other types of stereoscopic rendering where both eyes need to be rendered and they share almost all visible vertices.

* allow creation of multi-layer attachment images

Using the `AttachmentImage::multisampled_with_usage_with_layers` constructor.
More constructors with different combinations could be added for the `AttachmentImage` but `multisampled_with_usage_with_layers` already exposes all possible options.
I think all these different constructors should be replaced with a constructor that takes a struct that implements `Default` or an enum with the different possibilities.

* compliance with VUID-VkFramebufferCreateInfo-renderPass-02531

* removed changelog entries according to new policy

* migrate `VK_KHR_multiview` support to ash

* add more comments

* add remaining `VK_KHR_multiview` validation

* validate instanced drawing using `multiview` limits

* add some missing validation relating to `VIEW_LOCAL` dependencies

* use the vulkano device feature instead of depending on the `multiview` extension directly
2021-06-07 21:41:13 +07:00
Nicolas Patry
28637e8c67
Fixing the teapot example on ArchLinux (GTX 1650). (#1594) 2021-05-31 03:53:42 +07:00
Rua
f4b189792a
Migrate to using Ash as a base (#1593)
* Migrate to using Ash as a base

* Small change to test, to make it applicable to Vulkan 1.1
2021-05-31 03:42:51 +07:00
CABrinegar
81ec4bff40
Minor correction (#1589)
Correction to outdated comments describing function usage.
Corrections to English grammar.
Opinionated changes to sentence structures.
2021-05-24 17:00:12 +07:00
Rua
5175722c6b
Update winit to 0.25 (#1586) 2021-05-23 23:37:01 +07:00
Rua
2f7e7af7ee
Allow choosing the Vulkan max API version when creating Instance (#1585)
* Allow choosing the Vulkan max API version when creating Instance

* Rewrite feature handling, include all Vulkan 1.1 and 1.2 features

* Fixes

* Move features.rs to device module

* More small fixes

* Changelog
2021-05-23 23:09:50 +07:00
Rua
d36e5a2b1d
Major refactor of shader interface and pipeline layout types (#1581)
* Convert trait `ShaderInterfaceDef` into struct `ShaderInterface`

* Convert some instances of PipelineLayoutDesc to RuntimePipelineDesc

* Use regular Vec for now

* Convert PipelineLayoutDescUnion to RuntimePipelineDesc

* Convert PipelineLayoutDescTweaks to use RuntimePipelineDesc

* Remove PipelineLayoutDesc trait, replace with what used to be RuntimePipelineDesc

* Remove PipelineLayoutAbstract trait

* Fix bug

* Provide value for push constants to entry point instead of type

* Remove GraphicsEntryPointAbstract, allow pipelines without fragment shader

* Move descriptor::pipeline_layout to pipeline::layout

* Small changelog addition

* Fix bug
2021-05-23 22:33:25 +07:00
Rua
87e161cc78
Add SwapchainBuilder for easier (re)creation (#1566)
* Add `SwapchainBuilder` for easier (re)creation

* Small ergonomic improvement

* Add inline, some documentation fixes, remove `Option` from dimensions
2021-05-03 20:07:41 +07:00
Rua
0c1e0ff40d
Simplify handling of command buffer usage flags (#1563) 2021-04-26 21:53:18 +07:00
Rua
bb51359d32
Add an example demonstrating the basics of occlusion queries (#1548)
* Add an example demonstrating the basics of occlusion queries

* Make some functions const
2021-04-10 23:07:15 +07:00
Rua
803eacfcd6
Render pass restructuring (#1531)
* Create generic render pass description type, macro generates that instead of making its own type

* Replace EmptySinglePassRenderPassDesc with empty() constructor

* Remove RenderPass type parameter

* Remove RenderPassAbstract trait, type parameters that use it. Add GraphicsPipelineAbstract::subpass and Framebuffer::render_pass

* Remove RenderPassDescClearValues trait

* Remove RenderPassSubpassInterface and RenderPassCompatible traits

* Change RenderPassDesc into a struct

* Rename framebuffer module to render_pass, move/rename other things

* Rustfmt + changelog

* Documentation update
2021-04-10 18:09:03 +07:00
Rua
3b06879511
Split AutoCommandBuffer into primary and secondary (#1522)
* Split CommandBuffer trait into Primary and Secondary

* Split AutoCommandBuffer

* Rename Kind to CommandBufferLevel, change how it's structured
2021-04-05 18:25:20 +07:00
Daniel Tang
375db33ff9
Add script to run all examples (#1519) 2021-03-29 22:22:33 +07:00
Daniel Tang
b18bb01430
Fix descriptor set TypeStruct readonly detection (#1513) 2021-03-29 01:35:41 +07:00
Rua
58d19e5848
Make execute_commands safe to use (#1511)
* Add pipeline barriers when executing secondary command buffers

* Add locking for secondary command buffers when executed on a primary

* Propagate flags of secondary to primary

* Forgot the vec variant

* Add poisoning as a stopgap measure to protect against inconsistent builder state
2021-03-28 17:36:14 +07:00
gurchetansingh
65254ed10c
More memory changes with some thoughts on error handling (#1510)
* vulkano: instance: derive Ord, PartialOrd for PhysicalDeviceType

Useful for want differeniating integrated and discrete GPUs in a
hash table.

* vulkano: don't pull in all of crossbeam

Just pull in crossbeam-queue, since that's what used.

Having a smaller set of packages is easier for system integrators
such as myself.

* vulkano: memory: add import support, separate device memory and mappings, and much more!

- Chaining structs copied shamelessly and poorly from Ash :-)
- Import support, as previously promised.
- DeviceMemoryMappings so we can maybe one day expose the binding model.
- Attempts to rigorously check Valid Usage IDs (VUIDs).

A note about error handling:

- Currently, Vulkano error handling is a bit unclear.  For example, I
  didn't define a "DeviceMemoryMappingError" and simply reused the
  "DeviceMemoryAllocError" already present in the file.  In reality,
  both a theoretical "DeviceMemoryMappingError" and the already
  present "DeviceMemoryAllocError" should mostly just check the valid
  usage IDs present in the Vulkan spec (or return an error from the
  implementation).  This code pattern is common throughout Vulkano.
  Perhaps we should go to a simpler VulkanoResult<T>??? Just an idea.

- Also, is Vulkano a validation layer??? LunarG tracks every single
  VUIDs in their uber layer already:

  https://www.lunarg.com/wp-content/uploads/2019/04/UberLayer_V3.pdf

  Of course, given how Vulkan drivers are relatively straigtforward
  compared to OpenGL, it's generally possible to match LunarG *using
  Rust* if we just have a big enough community.  Whether we want to or
  not may be up for debate. For now, I just followed the original
  vision of tomaka and added validation.  If we do want to do it, then
  we have to be more rigorous about it.
2021-03-27 20:50:51 +07:00
Ilya Lakhin
b5c756298d
Migration to a newer API for #1296 (#1507) 2021-03-14 21:46:39 +07:00
Daniel Tang
24e8d72a4a
Allow const usage of features and BufferUsage (#1502) 2021-03-14 20:58:42 +07:00
Rua
1faa0c0668
Major rearrange of image and view types (#1499)
* Rename Dimensions > ImageViewDimensions, ViewType > ImageViewType

* Remove cubemap_compatible from ImageDimensions, add ImageCreateFlags to UnsafeImage creation

* Replace various UnsafeImage features/usage methods with new ones that return them directly

* Create image::view module, move view-related types into it

* Create safe ImageView type, remove some of the validity checks from UnsafeImageView

* Removed ImageViewAccess::samples and moved the descriptor_set_* functions to ImageAccess

* Remove ImageViewAccess::dimensions

* Impl ImageAccess for ImageView, remove impl on image types

* Rename ImageViewAccess to ImageViewAbstract, move some methods around

* Remove ImageViewDimensions (formerly Dimensions)

* impl Error for ImageViewCreationError

* Missing pub

* Typo

* Some small documentation changes

* Check for ImageCreateFlags that are currently not properly supported
2021-03-14 19:09:08 +07:00
Kazz
2527f56fda
Add example immutable-buffer-initialization (#1296)
* add example `immutable-buffer-initialization`

* 2017 -> 2020

* 2019 -> 2020

* fix API usage issues

Co-authored-by: Kazzix <kazzix14@gmail.com>
2021-03-14 16:43:59 +07:00
Philipp Renoth
e66e9a1fa2
segfaulting: DebugUtilsMessengerCallbackDataEXT::pMessageIdName may be null in debug callback (#1487)
* vulkano: DebugUtilsMessengerCallbackDataEXT::pMessageIdName may be null in debug callback

- https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDebugUtilsMessengerCallbackDataEXT.html#VUID-VkDebugUtilsMessengerCallbackDataEXT-pMessageIdName-parameter

* make `Message::layer_prefix` an Option
2021-02-11 04:39:15 +07:00
Philipp Renoth
9046655752
add DeviceExtensions::required_extensions(phys) (#1489) 2021-02-11 04:09:39 +07:00
Philipp Renoth
647c99d458
examples: fix debug example layers on macos using "VK_LAYER_KHRONOS_validation" (#1488) 2021-02-10 20:20:41 +07:00
EthanYidong
c57e2f471b
Replace filter map (#1486)
* Replace map to filter_map to prevent panics

* cargo fmt

* Update changelog

* Update docs to reflect changes
2021-02-08 18:43:56 +07:00
Rua
4a98caacbf
Update various dependencies (#1483) 2021-02-06 02:35:24 +07:00
Arc'blroth
32095992f9
[Breaking] Add support for dynamic buffers (#1480)
* Add glue to allow using dynamic uniform buffers

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* **EXTREMELY BREAKING** Add `dynamic_offsets` argument to all draw-related calls in AutoCommandBufferBuilder

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* **BREAKING** Pass data to update_buffer by reference (this allows using unsized data)

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* run cargo fmt

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* Dynamic offset safety checks™

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* Fix tests

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* Make `PipelineLayoutDescTweaks` public

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* Add a dynamic (uniform) buffer example

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>

* all the breaking changes

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
2021-02-05 22:38:36 +07:00
Ilya Lakhin
af3ea98d5e
Shader types derive (#1460)
* Shader struct types derives and impls

* Vulkano Shaders fixes and cleanup. Example for Types-meta option

* Changelog update

* cargo fmt
2020-12-20 12:08:55 +07:00
Rua
ba6fe09155
Upgrade to winit 0.24 (#1457)
* Upgrade to winit 0.24

* Changelog
2020-12-20 05:57:57 +07:00
qnope
d90106d4df
[Vulkano-1441] Adding the possibility to generate mipmaps at image (#1451)
creation

To do so, we created a SubImage that implements the ImageAccess trait
This SubImage will decorate an ImageAccess image and will represent
one or more mip level / array layer level
2020-12-19 10:08:48 +07:00
Ivan Zvonimir Horvat
9320d97115
examples: bin; pipeline_caching, add underscore for unused var (#1448) 2020-12-03 22:44:10 +07:00
Jan Tebernum
dea9a421d0
Finish pipeline cache (#1443)
* Implement caching for GraphicsPipeline

Added the method build_with_cache to set an Option that holds an Arc
containing a PipelineCache. This could probably be optimized to just
hold a vk::PipelineCache(u64) and start with a vk::NULL_HANDLE and
set the value to the internal_object of the PipelineCache. Using the Arc
is probably safer for now, but it is an idea.

* Add changes to the CHANGELOG

* Added a cache option to the ComputePipeline

This is a breaking change as there is no ComputePipelineBuilder and the
cache has to be added in the new function and the underlying functions
that build the ComputePipeline.
This needs to be discussed.

* Document the cache feature for the ComputePipeline

* Formatting with cargo fmt

* Remove outdated documentation

* Added testing for the PipelineCache

Checking that the cache returns the same data if the get_data method is
invoked twice without building a new pipeline.
Checking that the cache returns the same data if the same pipeline is
built two times with the cache.
Checking that the cache returns different data if there is a different
pipeline built in between the get_data calls.

* Create an example for the PipelineCache

* Formatting
2020-11-29 15:40:44 +07:00
Austin Johnson
3ecaaf5f48
Update examples to winit 0.23 (#1438) 2020-11-10 14:32:29 -06:00
Travis Finkenauer
ccd22a4aa4
Convert HTTP links to HTTPS (#1397)
* Convert readme HTTP links to HTTPS

* Convert source files' URLs to HTTPS
2020-11-10 11:03:50 -06:00
Rua
862593abae
Some safety checks for AutoCommandBufferBuilder::execute_commands (#1431)
* Move SubpassContents to command_buffer module, use it as parameter type instead of bool, add RenderPassState internally

* Add some safety checks to execute_commands

* Move Kind and related types to top-level module, add CommandBuffer::kind trait method, keep Kind value in AutoCommandBuffer(Builder)

* Some minor code cleanup

* Documentation update
2020-11-10 11:01:13 -06:00
Trangar
737016c047
Ran rustfmt and added rustfmt checkbox to pull req template (#1367)
* Ran rustfmt, updated PULL_REQUEST_TEMPLATE.md  and added a rustfmt check to CI

* Disabled the travis rustfmt check
2020-06-04 13:47:34 -05:00
Rua
1f27ab3ea9
AutoCommandBufferBuilder takes &mut self instead of self (#1376)
* AutoCommandBufferBuilder takes &mut self instead of self

* Changelog message
2020-06-01 09:41:42 -05:00
Austin Johnson
a4591a20cf
update examples to use ImageUsage::color_attachment instead of caps.supported_usage_flags (#1373)
* add additional ImageUsage constructors

* update examples to use ImageUsage::color_attachment instead of caps.supported_usage_flags

* fix additional usage in multi-window example

* update ignore to not include mandelbrot.png and triangle.png

* update ignore to not include mandelbrot.png and triangle.png
2020-06-01 02:10:02 -05:00
Trangar
df493136cf
Added a .boxed() function to GpuFuture to reduce boilerplate code (#1362) 2020-05-12 18:05:09 -05:00
jeffw387
315f63abe5
new function to check image/device compatibility (#1339)
* new function to check image/device compatibility

* merged master to get rustfmt changes, format all
2020-05-09 19:36:20 -05:00
Ilya Lakhin
4f89414143
Dynamic Compute Shader local size (#1357)
* Exposing additional properties from the physical device

* dynamic-local-size example

* Changelog fix

* Extra whitespaces in changelog removed
2020-05-09 10:46:12 -05:00
jdnewman85
48109761a8
Add CpuBufferPool example (#1352)
* Use traingle example as template

* Remove triangle example comments

* Switch to CpuBufferPool chunks instead of CpuAccessibleBuffer for vertex data

* rustfmt

* Keep unwrap()s on same line
2020-05-08 17:26:34 -05:00
Austin Johnson
b245e6c4dc
Update winit, half, and smallvec; Release 0.18 (#1332)
update winit, half, and smallvec; release 0.18
2020-03-11 20:48:15 -05:00
simdimdim
8ef0beaddf
Update to winit 0.21 (#1321) 2020-02-05 23:31:02 -06:00
Austin Johnson
18189e0724
implement exclusive fullscreen (#1310)
* implement exclusive fullscreen

* fullscreen ext should be device ext

* add acquire/release

* require VK_KHR_get_surface_capabilities2

* fullscreen_exclusive is now an enum; explicit acquire/release methods added; FullscreenExclusiveError added to handle errors; FullscreenExclusiveLost varients added to acquire and present related errors

* add checks for double acquire/release; require AppControlled for acquire/release functions

* update examples and tests; resolve issue with try_gpu_lock() on SwapchainImage; update changelogs
2020-02-04 18:57:16 -06:00
José Miguel Sánchez García
c620aefd29
Add 's' to dimension in Swapchain::recreate_with_dimension (#1315) 2020-01-31 16:37:05 -06:00