1078 Commits

Author SHA1 Message Date
Michael Barriault
ea5e38093a Work around potential Metal bug with stage in indirect buffers. Exact size isn't needed in our case anyway. 2019-04-17 21:31:38 +01:00
Michael Barriault
be54e748f0 Fix tessellated indirect draws using wrong kernels to map parameters. 2019-04-17 21:30:42 +01:00
Bill Hollings
eca03b8de1 MoltenVKShaderConverter tool add MSL version and platform command-line options.
Add SPIRVToMSLConverterOptions::platform to track platform. Default to build platform.
Update default SPIRVToMSLConverterOptions MSL version to 2.1.
MoltenVKShaderConverter test MSL compilation use same MSL version as conversion.
Default min perf tracking value to 0.0.
SPIRVToMSLConverter.h reference spirv.hpp via SPIRV-Cross framework.
Update What's New document.
2019-04-17 16:09:07 -04:00
Chip Davis
48d319432a MVKCountingEvent -> MVKSemaphoreImpl.
Remove the redundant class I added. Simplify a bit.
2019-04-17 10:42:25 -05:00
Michael Barriault
0aed9167c1 Tweak tabbing for consistency. 2019-04-16 18:12:10 +01:00
Michael Barriault
ef3e590617 Use empty depth state for tessellation vertex pre-pass. 2019-04-16 18:03:51 +01:00
Michael Barriault
2d627c6b8f Fix intermediate Metal renderpasses load and store actions maintaining attachments appropriately. 2019-04-16 18:03:15 +01:00
Bill Hollings
6bbd0eca75
Merge pull request #574 from mbarriault/master
Fix zero local threadgroup size in indirect rendering.
2019-04-15 17:33:35 -04:00
Michael Barriault
4c4332b848 Fix zero local threadgroup size in indirect rendering. 2019-04-15 17:58:26 +01:00
Bill Hollings
588f0ed5c8
Merge pull request #572 from cdavis5e/fix-tess-vertex-count
Don't use setVertexBytes() for passing vertex counts.
2019-04-15 11:38:23 -04:00
Chip Davis
5df1b1b7db Don't use setVertexBytes() for passing vertex counts.
In a tessellated draw, the vertex shader will take a `device` pointer to
the vertex count. It must be a `device` pointer, because the `constant`
AS on Mac requires 256-byte alignment, which we cannot guarantee,
particularly with an indirect draw. But, the `setVertexBytes:...` method
cannot be used with the `device` AS. So, we need yet another temporary
buffer to hold this value in the `device` AS.

Fixes #566.
2019-04-13 12:49:20 -05:00
Chip Davis
9a0c4f6cef Fix a race condition between sync objects and queries.
In the past, MoltenVK signaled fences and semaphores immediately when
Metal reported that the batch was finished executing. But, some commands
do work in completion handlers that run concurrently with this. In
particular, in #278 I shunted copying query pool results onto a
different dispatch queue. This caused a race between this block and the
block which signals fences and semaphores.

Since some commands do work in completion handlers, the handler which
signals semaphores and fences must wait until these handlers finish
running. Also because of this, it is not adequate to submit a fence-only
request to implement `vkQueueWaitIdle()`. So, that function must now
wait for all submissions to complete. To preserve the invariant that
fence-only submissions are equivalent to `vkQueueWaitIdle()`, this
change also makes fence signaling wait for all submissions.

If the queue is continually supplied with new work, this implementation
may delay signaling fences indefinitely. Ideally, fences would only wait
for all work up to that point to complete before signaling. But I'm not
sure how to accomplish that yet.

Fixes #454.
2019-04-12 00:17:46 -05:00
Bill Hollings
d57704b69f
Merge pull request #570 from billhollings/master
Update dependency libraries for SDK 1.1.106.
2019-04-11 18:41:18 -04:00
Bill Hollings
c425602ee7
Merge pull request #569 from mbarriault/master
Fix tessellation pipeline re-clearing attachments.
2019-04-11 18:31:15 -04:00
Bill Hollings
189a41e8d2 Update dependency libraries for SDK 1.1.106. 2019-04-11 17:52:50 -04:00
Michael Barriault
9e7fe1b642 Fix tessellation pipeline re-clearing attachments. 2019-04-11 22:37:19 +01:00
Bill Hollings
ebce19b0b7 Add MoltenVKShaderConverter tool option to log shader conversion performance.
Move MVKOSExtension.h/mm to from MoltenVK to Common
and move MTLDevice functions to MVKDevice.
2019-04-11 14:26:35 -04:00
Bill Hollings
b09f52c50a Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-04-11 10:00:20 -04:00
Bill Hollings
562093d2ed
Merge pull request #565 from mbarriault/master
Several fixes regarding tessellation, especially in indexed and instanced rendering
2019-04-11 09:55:14 -04:00
Bill Hollings
f326f0caec Log shader performance statistics in any runtime if
MVKConfiguration::performanceLoggingFrameCount is non-zero.
2019-04-09 23:24:44 -04:00
Michael Barriault
90baed604e Fix crash vertex pre-pass in tessellation pipeline due to being created with line topology but rendered with points. 2019-04-09 20:03:18 +01:00
Michael Barriault
761d80f81f Fix vertex pre-pass in tessellation pipeline not encoding. 2019-04-09 20:00:44 +01:00
Michael Barriault
a995a3b926 Fix patch count in tessellation pipeline. 2019-04-09 19:59:46 +01:00
Michael Barriault
7e1eafcee5 Fix reading storage images in shaders. 2019-04-09 19:59:09 +01:00
Michael Barriault
159a0c3919 Fix Metal version check macro 2019-04-09 19:58:05 +01:00
Bill Hollings
55a0ed95b4
Merge pull request #563 from billhollings/master
Update to latest version of SPIRV-Cross and add Vulkan call tracing option.
2019-04-05 12:55:55 -04:00
Bill Hollings
ef86d58552 Update to latest version of SPIRV-Cross.
Clean up demo build warnings.
Update What's New document.
2019-04-05 12:08:32 -04:00
Bill Hollings
3e5b735355 Add MVK_CONFIG_TRACE_VULKAN_CALLS env var and build setting to log Vulkan calls made by application. 2019-04-03 16:39:27 -04:00
Bill Hollings
2e7bb20835
Merge pull request #562 from billhollings/master
Set MTLRenderPassDescriptor renderTargetWidth & renderTargetHeight only when layered rendering supported, to avoid GPU crashes on older devices.
2019-04-03 16:02:56 -04:00
Bill Hollings
cf13ab08a2 Set MTLRenderPassDescriptor renderTargetWidth & renderTargetHeight
only when layered rendering supported, to avoid GPU crashes on older devices.
2019-04-03 14:58:57 -04:00
Bill Hollings
07771c965c
Merge pull request #560 from billhollings/master
API: Add MVKPhysicalDeviceMetalFeatures::depthSampleCompare & fixes.
2019-04-02 14:21:14 -04:00
Bill Hollings
c388619792 Suppress visibility warning spam when building Debug macOS from SPIRV-Cross Release
Pass -Xlinker -w when building Debug macOS dylibs.
Include -w in OTHER_LDFLAGS when building Debug macOS MoltenVKShaderConverter tool.
2019-04-02 12:25:49 -04:00
Bill Hollings
75a088dbe0 API: Add MVKPhysicalDeviceMetalFeatures::depthSampleCompare.
Set MTLSamplerDescriptor.compareFunction only if depthSampleCompare enabled.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 19.
2019-04-02 00:40:57 -04:00
Bill Hollings
6a77fc950a Clean up recent commits for iOS compatibility.
Test for _pMetalFeatures->layeredRendering before setting
MTLRenderPassDescriptor.renderTargetArrayLength.
Change NSString comparisons using isEqualTo: to isEqualToString:.
2019-04-01 23:05:42 -04:00
Bill Hollings
dfd5638a0f Clean up use of SPIRV_CROSS_NAMESPACE_OVERRIDE in Xcode projects.
Setting of SPIRV_CROSS_NAMESPACE_OVERRIDE in Xcode projects was stomping on DEBUG setting.
Update What's New document.
2019-04-01 22:41:20 -04:00
Bill Hollings
0ce9fccd17
Merge pull request #559 from cdavis5e/rtarray-a12-fix
Actually set the renderTargetArrayLength property on iOS 12.
2019-04-01 21:56:18 -04:00
Bill Hollings
7fd61a4610
Merge pull request #557 from cdavis5e/surface-loss
Handle surface loss.
2019-04-01 21:55:27 -04:00
Chip Davis
9736aace54 Detect surface loss in the swapchain on iOS as well. 2019-04-01 16:43:13 -05:00
Chip Davis
d24ddb1831 Add missing braces. 2019-04-01 16:28:27 -05:00
Chip Davis
77ddaff4d4 Actually set the renderTargetArrayLength property on iOS 12.
Fixes #558.
2019-04-01 13:42:35 -05:00
Chip Davis
b8f22700d5 Handle surface loss.
Sometimes, the `CAMetalLayer` backing a view can be replaced--for
example, when the window is moved to another screen, or the style bits
on the window are changed. In that case, we must allow the client the
opportunity to recreate the surface and swapchain.

Layer-backed views always set themselves as the layer's delegate; we use
this fact to Key-Value Observe the view's `layer` property.

Other alternatives considered:

* Registering for `NSViewGlobalFrameDidChange` notifications. Aside from
  only working on macOS, this doesn't actually catch every case where we
  want to report a lost surface. I'm not even sure it works at all for
  Metal.
* Holding a reference to the view, and checking when its layer property
  has changed.
* Holding a weak reference to the layer; that way, the reference will
  become `nil` when the layer is replaced. But this requires ARC.
2019-04-01 13:11:01 -05:00
Bill Hollings
d95ea7e9a7
Merge pull request #554 from danginsburg/render_area_offset_fix
Fix https://github.com/KhronosGroup/MoltenVK/issues/553 by making the…
2019-03-29 15:16:19 -04:00
danginsburg
7199c2570b Fix https://github.com/KhronosGroup/MoltenVK/issues/553 by making the Metal renderpass descriptor width/height clamped to the renderArea including the offset, not just the extent. 2019-03-29 14:32:27 -04:00
Bill Hollings
3437621f90
Merge pull request #552 from billhollings/master
MSL: Fix crash where variable storage buffer pointers are passed down.
2019-03-29 14:31:48 -04:00
Bill Hollings
4183a6489b
Merge branch 'master' into master 2019-03-29 13:06:00 -04:00
Bill Hollings
6eedbbf5c2
Merge pull request #550 from HansKristian-Work/override-spirv-cross-namespace
Override namespace for SPIRV-Cross.
2019-03-29 12:40:52 -04:00
Hans-Kristian Arntzen
38edfdb3de Override namespace for SPIRV-Cross.
Some projects also link against SPIRV-Cross statically, and in order to
avoid ABI conflicts, we should use a private namespace for the
SPIRV-Cross dependency to avoid bugs. See SPIRV-Cross issue #902 for
more information. The new namespace is MVK_spirv_cross, and the code
now makes use of the SPIRV_CROSS_NAMESPACE macro rather than spirv_cross.
2019-03-29 11:34:55 +01:00
Bill Hollings
0f22e2a70e MSL: Fix crash where variable storage buffer pointers are passed down.
Explicitly build dSYM files in BUILT_PRODUCTS_DIR
to avoid conflict between macOS and iOS build locations.
Update to latest SPIRV-Cross version.
2019-03-28 11:58:05 -04:00
Bill Hollings
9536538035
Merge pull request #547 from HansKristian-Work/vkcmdfillbuffer-offset-crash
Fix wrong offset for vkCmdFillBuffer on VK_WHOLE_SIZE.
2019-03-27 22:46:55 -04:00
Bill Hollings
29f32a3e4c
Merge pull request #545 from cdavis5e/fix-private-buffer-views
Set options properly on a buffer view's MTLTextureDescriptor.
2019-03-27 22:44:57 -04:00