299 Commits

Author SHA1 Message Date
Bill Hollings
23b3837d1e
Merge pull request #365 from cdavis5e/lock-set-texture
MVKImage: Take lock when setting the MTLTexture manually.
2018-12-04 22:26:51 +01:00
Bill Hollings
1aec2cf5e9
Merge pull request #363 from cdavis5e/2dms-array-image
Add support for 2D multisample array textures.
2018-12-04 22:11:05 +01:00
Bill Hollings
44cf6c3bf1
Merge pull request #362 from cdavis5e/relaxed-block-layout
Advertise the VK_KHR_relaxed_block_layout extension.
2018-12-04 22:08:51 +01:00
Bill Hollings
1b99ba03ab
Merge pull request #361 from cdavis5e/khr-maintenance3
Support the VK_KHR_maintenance3 extension.
2018-12-04 22:07:16 +01:00
Stefan Dösinger
fe09f01cbe MVKImage: Take lock when setting the MTLTexture manually. 2018-12-04 13:26:11 -06:00
Chip Davis
374741a989 Add support for 2D multisample array textures.
Requires Metal 2.1 on Mac. Not supported at all on iOS.

I'm split as to whether or not to have
`mvkMTLTextureTypeFromVkImageType()` return
`MTLTextureType2DMultisampleArray`.
2018-12-04 13:13:49 -06:00
Chip Davis
2b929c36ae Advertise the VK_KHR_relaxed_block_layout extension.
The recent updates to SPIRV-Cross should enable us to support this.
2018-12-04 13:12:16 -06:00
Chip Davis
08f9da1157 Support the VK_KHR_maintenance3 extension.
This is necessary to support the `VK_EXT_descriptor_indexing` extension.
It's also one step closer to Vulkan 1.1.
2018-12-04 13:10:02 -06:00
Chip Davis
bdbe5c71f8 Advertise the VK_KHR_storage_buffer_storage_class extension.
SPIRV-Cross already handles this. This extension was promoted to core in
Vulkan 1.1, and is a requirement for multiple other extensions, some of
which were also promoted to core in 1.1.
2018-12-04 13:07:51 -06:00
Bill Hollings
60b5a34faf Change internal use of <MoltenVK/hdr.h> to "hdr.h" to add header path flexibility.
API-Samples demo use headers from MoltenVK framework.
Cube demo remove reference to framework to include MoltenVK API headers.
2018-11-23 16:58:50 +01:00
Bill Hollings
2f131a7a85 Ensure imageview & sampler descriptor bindings have empty sampler & imageview values,
respectively, to avoid error when releasing them on descriptor binding destruction.
2018-11-15 21:38:02 +01:00
Bill Hollings
d99984e064 Align MoltenVK with Vulkan SDK 1.1.92.
Update to latest dependency libraries for Vulkan SDK 1.1.92.
Generate Hologram demo dispatch files in fetchDependencies and remove them from git.
Update MoltenVK version to 1.0.27.
Update What's New document.
2018-11-15 17:40:15 +01:00
Bill Hollings
ac087a1e55 Remove MVKSignalable class as redundant to MVKRefCountedDeviceObject. 2018-11-13 20:27:30 +01:00
Bill Hollings
946cdd0d45
Merge pull request #329 from cdavis5e/destroyed-resource-descset
Remove destroyed resources from descriptor sets.
2018-11-09 10:27:49 -05:00
Chip Davis
97b3c568c1 Forbid compressed formats on non-2D images.
Also forbid them on multisampled images.
2018-11-08 15:32:52 -06:00
Chip Davis
154107a0dc Revert "Sink MVKRefCountedDeviceObject into MVKBaseDeviceObject."
This reverts commit b34cc2fa821e1ba9b2e13abf5bdc18b099ed4a83. Doing this
makes anything derived from `MVKBaseDeviceObject` non-copyable.
2018-11-07 15:45:15 -06:00
Chip Davis
b34cc2fa82 Sink MVKRefCountedDeviceObject into MVKBaseDeviceObject.
Now every non-dispatchable device-owned object can be reference-counted,
and thus live beyond destruction by the client.
2018-11-07 12:49:48 -06:00
Bill Hollings
9517c58dbd
Merge pull request #340 from billhollings/master
MoltenVK 1.0.26
2018-11-06 18:33:51 -05:00
Bill Hollings
697cd55e85
Merge pull request #338 from cdavis5e/attrib-divisor-zero
MVKPipeline: Set the stepRate to 0 when the attribute divisor is 0.
2018-11-06 17:45:20 -05:00
Chip Davis
325c9f5555 Add a memory type for memoryless storage on iOS.
This exposes `MTLStorageTypeMemoryless` on iOS as lazily allocated
device-private memory. The semantics of lazily allocated memory are
exactly those of memoryless storage: namely, it can only be used with
images, and only those used as transient attachments. This enables
Vulkan clients to take advantage of this new storage mode starting on
iOS 10.
2018-11-06 15:39:16 -06:00
Chip Davis
56b70090b2 MVKPipeline: Set the stepRate to 0 when the attribute divisor is 0.
Otherwise, Metal asserts.
2018-11-06 15:34:03 -06:00
Bill Hollings
759bb6df5c Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-11-06 16:03:55 -05:00
Bill Hollings
38160b3eb3 MoltenVK 1.0.26.
Fixes to create_dylib.sh to cleanup bitcode and architecture support.
Update to latest SPIRV-Cross version.
Update MoltenVK version to 1.0.26.
Update Xcode projects to Xcode 10.1.
Update What's New document.
2018-11-06 16:01:36 -05:00
Bill Hollings
8a807b7c47
Merge pull request #336 from cdavis5e/no-optimal-shared-mac
MVKImage: Don't say shared memory is allowed on Mac.
2018-11-06 15:48:35 -05:00
Chip Davis
56096fb8be Don't leak resource objects after replacing them in a descriptor. 2018-11-06 01:14:10 -06:00
Chip Davis
01f2751a8b Move shader resources over to MVKRefCountedDeviceObject.
As a result, we can gut all the rest of the code I wrote.
2018-11-06 00:36:27 -06:00
Chip Davis
00bb47ef44 Factor out the reference-counting code from MVKSignalable.
Put it into a base class, MVKRefCountedDeviceObject. The intent is that
MVKImageView, MVKSampler, MVKBuffer, and MVKBufferView will all derive
from this and get reference-counting semantics, which will reduce all
the horrible duplication of code from the original change, and fix the
race condition as well.
2018-11-06 00:07:53 -06:00
Chip Davis
b4aef20c04 Remove destroyed resources from descriptor sets.
According to the Vulkan spec:

  "Entries that are not used by a pipeline can have uninitialized
   descriptors or _descriptors of resources that have been destroyed_,
   and executing a draw or dispatch with such a descriptor set bound
   does not cause undefined behavior." [emphasis added]

But, in the current implementation, if a resource is destroyed, and a
descriptor set to which it was bound is subsequently bound to a
pipeline, then the now-freed object for the destroyed resource will be
passed to Metal, which almost always results in a segfault. To avoid
this, resources now keep track of descriptors to which they are bound,
and tell them to forget the resources when they are destroyed.
Conversely, if a descriptor set is destroyed before its bound resources,
the resources must now not notify the destroyed set. In this case, the
descriptor binding now tells the resource to forget the descriptor.

There is a race condition present if two threads attempt to destroy a
descriptor set and a resource at the same time. I've tried to mitigate
this with locking, but it won't help in the case where the resource
destruction happens first--the descriptor set will subsequently attempt
to modify a freed object. I don't know how to fix this.
2018-11-06 00:07:53 -06:00
Chip Davis
9c9b207b0a MVKImage: Don't say shared memory is allowed on Mac.
It isn't. Unfortunately, we have to say it is allowed for linear images,
per the Vulkan spec.
2018-11-05 16:16:02 -06:00
Bill Hollings
1d64dae0cc
Merge pull request #326 from DiegoAce/master
Force Bitcode When Building
2018-11-05 17:14:57 -05:00
Bill Hollings
976aa8cd47
Merge pull request #335 from ryandesign/script-cleanup
create_dylib.sh cleanup
2018-11-05 16:58:32 -05:00
Bill Hollings
6e1c10e03a
Merge pull request #333 from spadix0/fix-memorytypes-order
Fix memoryTypes order on macOS to match spec
2018-11-05 16:44:15 -05:00
Bill Hollings
e8ca167d5e
Merge pull request #332 from cdavis5e/3d-2d-image-view-checks
MVKImageView: Perform the usage check if we're mapping a subset of a 3D image.
2018-11-05 16:16:18 -05:00
Bill Hollings
3cd21a40d1
Merge pull request #331 from cdavis5e/all-unused-attachments
MVKPipeline: Also create a dummy attachment if all attachments are unused.
2018-11-05 16:13:24 -05:00
Ryan Schmidt
7354f8ddcd Use the -arch flag(s) specified by Xcode 2018-11-05 06:57:19 -06:00
Ryan Schmidt
82cf1328f2 Use the C++ library specified by Xcode.
It's almost certainly libc++ but it doesn't hurt to specify it.
2018-11-05 06:57:19 -06:00
Ryan Schmidt
b25e207c3b Don't manually link with -lSystem
The compiler adds the system library automatically.
2018-11-05 06:57:19 -06:00
Ryan Schmidt
d367bc7109 Use clang++ not clang to link C++ code
When using a C++ compiler it's unnecessary to specify -lc++ because
that's done automatically.
2018-11-05 06:57:06 -06:00
spadix0
de28fe1a9c Fix memoryTypes order on macOS to match spec
Fixes #314
2018-11-01 14:22:05 -07:00
Chip Davis
bbd6f18f66 MVKImageView: Perform the usage check if we're mapping a subset of a 3D image.
If only some of the 3D image is selected by the view, then we would skip
the usage checks after printing the warning about using a subset.
2018-11-01 10:04:12 -05:00
Chip Davis
32238634ba MVKPipeline: Also create a dummy attachment if all attachments are unused.
Some clients (DXVK primarily) always set all eight color attachments,
even if they are unused. Metal will treat them as though they weren't
specified at all. If none are used, then Metal won't know how big to
make the render area, and the pipeline will fail validation. We have to
treat this case the same as if no attachments were given.
2018-11-01 10:01:32 -05:00
Chip Davis
c9f42d5a94 MVKDeviceMemory: Relax memory requirements for linear images.
Allow linear images to use host-coherent memory. But map its internal
storage mode to `MTLStorageModeManaged`, so we know that we need to keep
it in sync manually.
2018-11-01 09:58:48 -05:00
DiegoAce
b91882cfc8 Force Bitcode When Building
Enabling bitcode in Xcode only adds the -fembed-bitcode-marker flag, which doesn't actually create bitcode. The Archive action transforms that flag to -fembed-bitcode which actually creates the bitcode. Adding the User-Defined Setting BITCODE_GENERATION_MODE=bitcode forces bitcode to be created without archiving.
2018-10-31 16:44:59 -05:00
Bill Hollings
a670412cf8 Fix Travis build and rename MVKPipelineLayout::getMaxTextureIndex() to getTextureCount(). 2018-10-31 13:28:42 -04:00
Bill Hollings
403cedf0c8 Add README placeholder files for empty template directories. 2018-10-31 00:18:25 -04:00
Bill Hollings
025259426c Refactor the build environment.
Support creation of static library and build framework and dynamic library from it.
Add Makefile to better support command line or script building integration.
Update demos to each use one of framework, static library, and dynamic library.
Refactor and rename the build scripts.
Refactor and rename the Xcode Schemes.
Update build and runtime documentation.
Update What's New document.
2018-10-30 23:16:12 -04:00
Bill Hollings
480d5b239a Support polygonMode VK_POLYGON_MODE_POINT.
Support MTLPrimitiveTopologyClass on iOS in addition to macOS.
2018-10-24 17:06:19 -04:00
Bill Hollings
ac61f9185f vkCreateInstance returns VK_ERROR_INCOMPATIBLE_DRIVER if Metal not available. 2018-10-22 17:21:55 -04:00
Bill Hollings
af0c1a08f1 Update shader caching for compatibility with texture swizzling.
MVKPipelineLayout set auxiliary buffer MSL index relative to already-calculated
push constant buffer MSL index.
MVKPipeline destructor release auxiliary buffer MTLBuffer instance.
Nudge MVK_VERSION_PATCH.
2018-10-17 16:57:21 -07:00
Bill Hollings
6c0ab0f4c2
Merge pull request #304 from cdavis5e/wolf2-packed-pixels
Correct MTLPixelFormats for a couple of formats.
2018-10-16 14:55:44 -04:00