Commit Graph

2722 Commits

Author SHA1 Message Date
mvilim
57cbf80746
Consider included files in automatic shader recompilation (#1529)
* Consider included files in automatic shader recompilation

* Fix shader include test paths on Windows
2021-04-04 07:56:58 +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
mvilim
fc2e470d14
Use include_bytes! in shader! for automatic recompilation (#1523) 2021-03-31 15:35:35 +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
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
c38f484baa
Fix panic string literal warnings (#1515) 2021-03-28 17:46:55 +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
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
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
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
Rua
3da1a3fd8d
Replace deprecated compare_and_swap (#1498) 2021-03-14 16:41:49 +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
Philipp Renoth
9046655752
add DeviceExtensions::required_extensions(phys) (#1489) 2021-02-11 04:09:39 +07:00
A. Cody Schuffelen
6af7ece14c
Fix reuse command buffers test (#1491)
* Fix file out of alignment with `cargo fmt`.

* Make the reuse_command_buffers test more stable.

The per-thread weak reference to StandardCommandPoolPerThread in
StandardCommandPool can expire forcing the recreation of the pool and
its internal objects. This is a problem for the reuse_command_buffers
test which asserts that a destroyed command pool must be reused if
possible.

This change fixes the test by introducing an extra command buffer that
is held through the rest of the test, introducing an extra strong
reference to the command pool that keeps the weak reference alive for
the duration of the test.

This test fails consistently on my machine with a NVidia 1070 Max-Q
otherwise.
2021-02-10 20:55:08 +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
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
gurchetansingh
34d54547f2
vulkano: image: add image usage check (#1479)
We never really validated this yet ...
2021-02-05 22:19:14 +07:00
gurchetansingh
f1b81a0514
vulkano: memory: fix opaque fd support (#1477)
Don't panic if user doesn't request dma-buf and dma-buf
isn't present on the system.

Fixes: 2d60c08c10 ("Initial YUV and external memory support")
2021-01-21 15:23:45 +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
Austin Johnson
3113d1fea5
remove trailing whitespace in github workflows file (#1463) 2020-12-26 16:44:54 -06: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
Ilya Lakhin
9f2257e83e
Update Readme Build Status badge 2020-12-21 07:44:14 +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
6e0e87f222
Fix vulkano-shaders bytes documentation (#1458)
Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
2020-12-20 05:55:42 +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
Ivan Zvonimir Horvat
9320d97115
examples: bin; pipeline_caching, add underscore for unused var (#1448) 2020-12-03 22:44:10 +07:00