845 Commits

Author SHA1 Message Date
Bill Hollings
336b835906
Merge pull request #263 from cdavis5e/extension-cleanup
Pull extension definitions into a common file.
2018-09-20 10:31:31 -04:00
Bill Hollings
c756fa990b
Merge pull request #262 from cdavis5e/multi-viewport
Support the multiViewport feature.
2018-09-20 10:19:36 -04:00
Chip Davis
ec522f0168 Pull extension definitions into a common file.
`#include` this file to define the various bits and pieces needed to
support an extension. Now instead of having to change three places, we
now only need change one.

Also, sort the list of extensions. This list is starting to get a little
long and unruly, so before it gets completely out of hand, let's apply a
little semblance of order to it. The extensions are now arranged in the
following order: first, the Khronos-blessed extensions; then multivendor
extensions; then our (`MVK`) extensions; and finally other vendors'
extensions. These subgroups are sorted alphabetically, as Khronos'
master list is.

I'm not happy about the `MVK_EXTENSION_LAST` kluge. But, C++ apparently
doesn't let you stick a dangling comma on a constructor's initializer
list.
2018-09-19 20:57:29 -05:00
Chip Davis
09ef22d203 Fix coding style around if statements. 2018-09-19 20:46:48 -05:00
Chip Davis
3b9e406573 Support the multiViewport feature.
Clients can now set multiple viewports and scissor rects, but without a
geometry shader, it won't be much use. For now, however, we can support
`VK_EXT_shader_viewport_index_layer`, which will make this feature more
useful despite us not having geometry shaders.
2018-09-19 16:35:10 -05:00
Bill Hollings
c3863dd495 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-09-19 17:28:56 -04:00
Bill Hollings
ce4a41b90a Support filling Metal command buffers on same thread as Vulkan command buffer.
Add MVKConfiguration member prefillMetalCommandBuffers and build setting
MVK_CONFIG_PREFILL_METAL_COMMAND_BUFFERS.
Rename MVKConfiguration member maxActiveMetalCommandBuffersPerPool
to maxActiveMetalCommandBuffersPerQueue.
Support Xcode 10 build settings.
2018-09-19 16:58:43 -04:00
Chip Davis
eeca918c92 Support the sampleRateShading feature.
This is for fragment shaders that run per-sample instead of
per-fragment. It implies that the `SampleId`, `SampleMask`, and
`SamplePosition` builtins, as well as per-sample interpolation, are all
available--using any of these causes the frag shader to run once per
sample. (In Metal, reading the color buffers may also cause a frag
shader to run per-sample.)

Update SPIRV-Cross to pull in a change that properly translates the
`SamplePosition` builtin to a form that Metal can understand.
2018-09-18 09:58:56 -05:00
Bill Hollings
cfce1514f6 Replace use of MVKPhysicalDeviceMetalFeatures::depthClipMode with
existing Vulkan depthClamp feature flag.

Update VK_MVK_moltenvk spec version to 10.
2018-09-17 17:20:01 -04:00
Bill Hollings
5d8d4d2440 Fixes to documentation for extensions and building.
Indicate both vk_KHR_maintenance1 & vk_AMD_negative_viewport_height extensions are available.
2018-09-16 14:46:01 -04:00
Bill Hollings
e546b83852 When creating a surface, accept either a CAMetalLayer or an
NSView/UIView in the pView member, and improve error logging.
2018-09-16 12:39:03 -04:00
Chip Davis
7633299a60 VkPhysicalDevice: Advertise the drawIndirectFirstInstance feature.
Only advertise it if the device supports both indirect drawing and
specifying the base vertex/instance.
2018-09-13 11:55:17 -05:00
Chip Davis
3b97980de0 VkPhysicalDevice: Advertise the fullDrawIndexUint32 feature.
This just means the maximum index for an indexed draw is 2**32 - 1.
2018-09-13 11:55:17 -05:00
Chip Davis
41dfeddc4c VkPhysicalDevice: Advertise the robustBufferAccess feature.
The spec requires all implementations of Vulkan to support this, so we
may as well turn it on. I haven't seen any ill effects from
out-of-bounds accesses, so I think we'll be OK.
2018-09-13 11:55:17 -05:00
Bill Hollings
6e3574dc65 Command execution without queue submission.
MVKCommandEncoder encoding pass in only MTLCommandBuffer.
Make MVKCommandEncodingPool threadsafe and move from queue to command pool.
2018-09-12 14:09:12 -04:00
Bill Hollings
5dac8dc645 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-09-11 16:34:19 -04:00
Bill Hollings
774d4a4040 Remove flushing of command buffer during query commands.
MVKCommandBuffer refactor reset and begin operations.
2018-09-11 16:33:32 -04:00
Chip Davis
9fa8e8c57c Bump extension spec version again after merge. 2018-09-11 12:15:28 -05:00
Chip Davis
ad057e3478 Merge remote-tracking branch 'origin/master' into stencil-image-views 2018-09-11 12:14:38 -05:00
Chip Davis
6947fdf57e Only set MTLTextureUsagePixelFormatView on depth/stencil views...
...and only if the device supports stencil views.
2018-09-11 11:34:46 -05:00
Bill Hollings
26058daba3 Simplify and improve performance of MTLCommandBuffer completion handling.
Manage MTLCommandBuffer in MVKQueueCommandBufferSubmission instead of MVKQueue.
Remove MVKMTLCommandBufferCountdown and its use in MVKQueue.
2018-09-11 10:54:21 -04:00
Chip Davis
1f33a311ae Support views of the stencil aspect of depth/stencil images.
This requires Metal 1.2 (for the `MTLPixelFormatX24_Stencil8` and
`MTLPixelFormatX32_Stencil8` formats). Since Vulkan doesn't actually
have a corresponding format for that, add a new Metal feature for this.
Bump extension spec version.
2018-09-10 17:26:02 -05:00
Bill Hollings
f2cd295b18 Fix configuration access compilation error. 2018-09-10 17:22:21 -04:00
Bill Hollings
c7219636ac Merge branch 'master' of https://github.com/billhollings/MoltenVK 2018-09-10 16:15:15 -04:00
Bill Hollings
74b40f0505 Limit single queue per queue family with settable number of command buffers per queue.
Limit each queue family to one queue.
Add MVKConfiguration::maxActiveMetalCommandBuffersPerPool.
2018-09-10 16:14:39 -04:00
Chip Davis
438cc8c382 Don't pass the offset to the FillBuffer compute kernel.
Just add it to the buffer offset when encoding the command. The reason
for this is that we were using it to index the buffer--which, according
to the C++ spec (on which MSL is based), causes it to be offset by that
many 32-bit words instead of bytes. This caused the buffer to be filled
incorrectly. While Metal does require the offset to be aligned to the
type size (in this case, 4 bytes), Vulkan also requires the offset to
`vkCmdFillBuffer()` to be 4-byte aligned, so this shouldn't run into the
same problem as `vkCmdCopyBuffer()`.
2018-09-08 22:35:22 -05:00
Bill Hollings
e7cb8b35da Update MoltenVK to v1.0.21.
Update to latest version of SPRIV-Cross.
Update What's New document.
2018-09-08 18:38:32 -04:00
Bill Hollings
97f273a9c9 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-09-08 17:48:33 -04:00
Bill Hollings
198b7fbb0f
Merge pull request #247 from cdavis5e/uninit-desc-copy
vkUpdateDescriptorSet: Handle copies of uninitialized descriptors.
2018-09-08 17:45:01 -04:00
Chip Davis
e6fe9c093a Use the older method for vkCmdCopyBuffers(), too. 2018-09-07 14:19:15 -05:00
Chip Davis
38825b9600 vkUpdateDescriptorSet: Handle copies of uninitialized descriptors.
For a copy, the spec requires only that the source and destination
bindings are valid, not that the source has been initialized. If the
source binding hasn't been initialized, then we crash attempting to get
the Metal resources corresponding to the uninitialized descriptors. So,
if the descriptor binding hasn't been initialized, don't try to fetch
Metal resources for it.

Yes, this causes us to accept writes of NULL descriptors (from
templates or otherwise), even though the spec forbids this. I don't know
how to solve this without specializing `writeDescriptorSets()`
specifically for the `VkCopyDescriptorSet` case (thereby duplicating
quite a bit of code). Given the general nature of Vulkan as a framework
that does little to no state validation, I wonder if it's even worth it.
2018-09-07 12:39:52 -05:00
Chip Davis
eb06c9dd5f vkCmdFillBuffer: Use the older method to dispatch the compute kernel.
We're not even running more than one thread, let alone taking advantage
of the new method's automatic threadgroup sizing.
2018-09-07 12:39:13 -05:00
Bill Hollings
d505f71546 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-09-07 11:53:39 -04:00
Bill Hollings
e721dd6e2c Update build process.
Allow building and packaging MoltenVK for of only iOS or only macOS.
Move packaging scripts out of Xcode projects and into script files.
2018-09-07 11:46:58 -04:00
Bill Hollings
7fb064fdee
Merge pull request #244 from cdavis5e/image-fake-2d-view
MVKImageView: Create 3D MTLTextureViews for 2D image views of 3D textures.
2018-09-07 11:12:03 -04:00
Chip Davis
a0d567da92 Fix Clang warning about order of operations. 2018-09-06 20:04:41 -05:00
Chip Davis
78a59a3e37 Try harder to avoid creating texture views with 3D textures.
Also, warn only when the texture may be used for a purpose other than as
a color attachment. Fail outright if it won't ever be used for that
purpose, or if the view doesn't cover the entirety of the volume.
2018-09-05 11:55:39 -05:00
Chip Davis
f1b62ed297 Don't fail creation of the ImageView. 2018-09-05 11:55:35 -05:00
Chip Davis
7fd270edb6 MVKDevice: Fix a segfault walking unknown extension structs.
The problem is that on 64-bit platforms (i.e. every platform we support)
there will be padding between the `sType` and `pNext` members of any
extensible Vulkan structure, because `sType` is only 4 bytes while
`pNext` is 8 (and needs 8-byte alignment).

Should fix a segfault running `vulkaninfo`.
2018-09-05 11:15:04 -05:00
Chip Davis
acf63a16e7 MVKImageView: Create 3D MTLTextureViews for 2D image views of 3D textures.
This won't help using these image views from shaders, but it will help
attaching them to framebuffers.

I've left the warning in `validateImageViewConfig()` in place.
2018-09-05 10:21:09 -05:00
Chip Davis
d557b51433 Fix a silly omission that breaks the build. 2018-09-02 22:23:52 -05:00
Chip Davis
63c6e4d8c4 Support the VK_KHR_descriptor_update_template extension. 2018-09-02 15:28:39 -05:00
Bill Hollings
c369da1cdd Update to What's New document.
Update to latest version of SPIRV-Cross.
2018-09-01 18:27:07 -04:00
Bill Hollings
23df850465 Merge and fix conflicts between extension enhancement commits. 2018-09-01 17:22:33 -04:00
Bill Hollings
63ce4cf1f5 Vulkan extension enhancements.
Add MVKExtensionList struct to track supported and enabled Vulkan extensions within MVKInstance & MVKDevice.
Log supported and enabled Vulkan extensions for VkInstance & VkDevice.
Add error handling for descriptor sets & 3D images in VK_KHR_maintenance1 extension.
All header files load mvk_vulkan.h instead of vulkan.h for consistent use of macOS & iOS extensions.
2018-09-01 16:42:10 -04:00
Chip Davis
54f69c30e7 Support the VK_KHR_push_descriptor extension. 2018-08-31 15:13:46 -05:00
Chip Davis
80bde624cf Support the VK_KHR_get_physical_device_properties2 extension.
This extension is a prerequisite for multiple other extensions, the
`VK_KHR_push_descriptor` extension in particular.
2018-08-31 14:20:44 -05:00
Chip Davis
ccb1afe42b Support the VK_KHR_shader_draw_parameters extension.
Update SPIRV-Cross to support shaders which use the builtins provided by
this extension.
2018-08-30 09:10:47 -05:00
Chip Davis
396add581a Support the VK_KHR_maintenance1 extension.
Much of this was already supported, simply by being supported by Metal.
Of course, this support is incomplete: Metal doesn't yet allow you to
create a 2D texture view from a 3D texture.
2018-08-27 12:42:20 -05:00
Bill Hollings
c8a9841d8c Support pre-linking on both Xcode 9 & 10. Update library dependencies.
Remove linking MoltenVKSPIRVToMSLConverter from Build Phase in favour of PreLink.
Update to Vulkan header 1.1.83.
Update to latest version of library dependencies.
2018-08-23 14:02:05 -04:00