Commit Graph

111 Commits

Author SHA1 Message Date
Rua
5577099029
Partial safe support for queries (#1542)
* Add get_results to UnsafeQueriesRange

* Add copy_query_pool_results command, remove "Unsafe" from names

* Documentation + changelog

* Add reset_query_pool

* Add begin_query and end_query

* Add query feature checks when starting an AutoCommandBufferBuilder

* Add write_timestamp

* Re-exports

* Further safety checks for write_timestamp

* Track query active state in AutoCommandBufferBuilder, further safety checks

* Move query/mod.rs to query.rs as there's no other submodules

* Check for query state when building
2021-04-10 19:07:59 +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
a3465537cc
Fix check for array layer count with cube descriptors (#1541) 2021-04-10 13:40:32 +07:00
Rua
78b12ca64f
Add component mapping to ImageView, create ImageViewBuilder (#1538) 2021-04-10 13:35:09 +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
Rua
1af922a607
Fix and refine the generation of readonly descriptor attribute (#1534)
* Vulkano-shaders: Improve handling of readonly descriptors

* Changelog

* Fixed image readonly detection for real this time
2021-04-05 17:53:18 +07:00
Rua
c68882eb7f
Replace deprecated Error::cause with source (#1532)
* Replace deprecated Error::cause with source

* Changelog
2021-04-04 09:31:35 +07:00
Rua
440a34b2bb
Comment in changelog with formatting instructions (#1526)
* Comment in changelog with formatting instructions

* Remove duplicate
2021-03-31 17:55:54 +07:00
Ilya Lakhin
7e32ae9b88
Release 0.22.0 (#1525) 2021-03-31 16:40:50 +07:00
Rua
4f009c3c93
Convert all code to Rust 2018 edition (#1508)
* Convert to 2018 edition of Rust

* Merge branch 'master' of https://github.com/vulkano-rs/vulkano into edition2018
2021-03-31 16:20:41 +07:00
stephan-cr
eb21fea03b
Make {CpuAccessibleBuffer,ImmutableBuffer}::from_data sound (#1517)
from_data needs flat memory structures. Types which implement
Copy (either implicity or explicitly) ensure this property.

This commit adds the Copy trait bound to
{CpuAccessibleBuffer,ImmutableBuffer}::from_data and adapts the unit
tests accordingly.
2021-03-31 11:51:38 +07:00
Rua
c2d404c669
Add dispatch_indirect to AutoCommandBufferBuilder (#1516)
* Add dispatch_indirect to AutoCommandBufferBuilder

* Merge branch 'master' of https://github.com/vulkano-rs/vulkano into dispatch-indirect

* Pfff...

* Fix bug in dispatch_indirect assert
2021-03-30 21:18:45 +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
Rua
4a58b34545
UnsafeCommandBuffer and SyncCommandBuffer no longer contain a command pool reference (#1504) 2021-03-15 02:49:07 +07:00
Daniel Tang
24e8d72a4a
Allow const usage of features and BufferUsage (#1502) 2021-03-14 20:58:42 +07:00
Okko Hakola
0e581c07b2
Allow external memory support with DeviceLocalBuffers (#1506)
* Add posix handle type shortcut

* Expose device local buffer's memory

* Add exportable memory option for pools & device local memory

* Add test for device local with exportable fd

* Use a convenience function in test

* Dont expose memory, but instead allow export fd directly

* Fix mistakes & clean

* Remove test due to IncompatibleDriver error
2021-03-14 20:56:27 +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
Ilya Lakhin
5b4aee845b Missing changelogs 2021-03-14 18:35:50 +07:00
Arc'blroth
73eb8e7a9f
Fix generated descriptor set layouts for shader modules with multiple entrypoints (#1497)
* Write descriptor set layout structs for each entrypoint rather than for the entire module

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

* Fix descriptor set calculation for all storage classes across all SPIRV versions by inspecting each entrypoint's instruction tree. Also adds 27 instructions to parse.rs.

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

* Add unit tests for descriptor set calculations

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

* Fix BufferBlock not counting as a Block decoration on structs (this fixes the unit tests from 4875bcc2)

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

* cargo fmt

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

* Update changelog

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
2021-03-14 16:33:44 +07:00
Ilya Lakhin
b39086182b
Release 0.21.0 (#1503) 2021-03-05 14:19: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
Ilya Lakhin
ff1dd87a32
Changelog for #1489 2021-02-11 04:16:35 +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
bcdbd35ec9
Fix descriptor pool allocation for layouts that contain arrays (#1481)
Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
2021-02-06 02:30: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
Arc'blroth
ccb5a1091b
Store shader bytecode as a static rather than on the stack. This fixes stack overflow errors for large shaders. (#1476)
Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
2021-01-18 08:38:29 +07:00
funmaker
8c6ff4aba9
Fixed race condition in StandardCommandPool when allocating buffers. (#1474) 2021-01-17 08:19:29 +07:00
stephan-cr
3e990190f7
Fix invalid reference to dropped PipelineCache object in ComputePipeline (#1469)
* Fix invalid reference to dropped cache object in compute pipeline

This is achieved by preventing the cache object from being partially
moved.

This fixes issue #1466.

* Add entry to changelog
2021-01-11 23:16:06 +07:00
gurchetansingh
2d60c08c10
Initial YUV and external memory support (#1467)
* vulkano: image: improve formatting

Ran cargo fmt --all.  Should we use clippy too ?

* vk_sys: add additional formats

This updates the vk formats enum to the header that's on my
system (vk 1.2-ish).

* vulkano: image: Add NV12 and YV12 support

These formats are commonly used as targets for hardware and
software video decode.  The common case is the swapchain allocator
(gralloc in the Android use case) allocates some memory, the video
stack decodes to it, and then memory can be composited by Vulkan
or sent directly to the display.

* vk_sys: update structure types

This updates the structure types to a VK 1.2-ish state.  Long term,
it makes a ton of sense to autogenerate vk-sys to make adding
additional features and enumerations easier [1].  For now, we can
hand edit.

[1] (https://github.com/vulkano-rs/vulkano/issues/89)

* vk_sys: add VK_KHR_external_memory_fd bindings

This adds some basic external memory features.  Most of these
features are core in VK1.1.

* vulkano: memory: add and use DeviceMemoryBuilder

We'll need to:

(a) Create exportable memory
(b) import from a OS descriptor to create DeviceMemory
(c) Also support dedicated allocations

The device memory API is becoming rather complicated.  Let's use
the common builder pattern to simplify this.

* vulkano: memory: implement some external features

This change is sufficient to create exportable memory and
export it.  It's only been tested on Linux platforms and depends
on Unix file descriptors, so enable it only there for now.

Import support will be added later.  Support for external buffers
and images can also be added later if someone needs it.
2021-01-09 19:02:08 +07:00
Ilya Lakhin
de01dff7c8 Vulkano version bump to 0.20.0 and vk-sys to 0.5.3 2020-12-26 19:25:09 +07:00
Sam Blazes
e03a80d341
Fix Cubemap and CubemapArray framebuffer attachments (#1459)
* change framebuffer attachment dimensions so cubemap and cubemap arrays are properly cleared

* update changelog
2020-12-20 17:27:15 +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
Arc'blroth
c2495404b2
Add support for including precompiled shaders in vulkano-shaders (#1455)
Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
2020-12-19 10:22:04 +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
Robin Heinemann
d8f1e77502
Add 8bit storage support (#1452) 2020-12-09 05:36:14 +07:00
Robin Heinemann
63aaa853ff
CpuAccessibleBuffer: switch to parking_lot RwLock (#1450)
This allows ReadLock and WriteLock to be Send and Sync.
2020-12-09 05:23:14 +07:00
Jan Tebernum
782272c08d
Unlock images correctly on Err (#1449)
* Unlock images correctly on Err

If the CommandBuffer encountered an error in the lock_submit function,
it would unlock all the previously locked resources and return the
error. It would unlock all the images with a None value which would
panic in an assertion in the unlock method of the images. Now it checks
for the final_layout and unlocks the image this way.
This change should help with the panics mentioned in #1441 and #1447.
With this fix it should return the error that is occuring instead of
panicking.

* Add fix to the change log to inform users.
2020-12-05 06:28:01 +07:00
Rua
a5553e14e1
Check usage bits on image when creating image view (#1444)
* Check usage bits on image when creating image view

* Changelog entry
2020-12-03 22:36:59 +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
Cassiano Honorio da Silva
620b829bdb
Rename feature shader_f3264 to shader_float64 (#1440)
Fixes shader_f3264 device feature name
2020-11-23 17:34:02 +07:00
Matej Kormuth
4ebc2c8211
add debug_marker_{begin, end, insert} methods (#1439) 2020-11-20 07:40:07 +07:00
Austin Johnson
3ecaaf5f48
Update examples to winit 0.23 (#1438) 2020-11-10 14:32:29 -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
Ilya Lakhin
770ea22bb8
Changelog entry for PR #1410 and turning off Travis Linux Nightly build job (#1424)
Changelog entry for PR #1410; Nightly build temporary disabled until #1423 resolved
2020-10-25 19:30:44 +07:00
Tetrel
70186b5034
Copy buffer dimensions (#1407)
Add a method to AutoCommandBufferBuilder that allows copying elements of buffers containing arrays
2020-10-08 14:31:32 +07:00
Antonino Siena
c5dd6eda3e
Feature: Create a Surface from a RawWindowHandle (#1381)
* Feature: Create a Surface from a RawWindowHandle

* Comment on the new features

* Updated changelog

* Corrected feature name

* Compiler error corrections

* Empty commit for CI

Co-authored-by: Antonino Siena <a.siena@gmx.de>
2020-06-09 03:23:22 -05:00