608 Commits

Author SHA1 Message Date
Dan Ginsburg
b808d59743 Fix Dota 2 bug with vsync toggling not working (https://github.com/ValveSoftware/Dota-2-Vulkan/issues/257). Vsync would be disabled on first swapchain creation, but not re-enabled if swapchain mode switched from IMMEDIATE -> FIFO or back from FIFO -> IMMEDIATE. 2018-06-12 09:00:12 -04:00
Bill Hollings
85dae9e978 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-06-12 08:59:51 -04:00
danginsburg
f5a3b9072f Update to latest SPIRV-Cross to fix MSL compilation failures on macOS 10.14 Mojave Beta (KhronosGroup/SPIRV-Cross#603). Fixes Dota 2 on Mojave.
Also update MoltenVK to 1.0.11 so that VkPipelineCache UUID changes and shaders get regenerated by applications.
2018-06-12 08:24:56 -04:00
Bill Hollings
96d680a4e0 Avoid fragment shader tracking interacting with vertex attributes.
Restrict allowed linear tiling features for pixel formats.
Fix bad logic when testing allowed linear tiling usage.
Update MoltenVK to 1.0.11.
2018-06-06 21:14:09 -04:00
Bill Hollings
67f659c064 Fix copying 4-byte 32-bit depth/stencil formats between buffers and textures. 2018-06-05 17:24:05 -04:00
Bill Hollings
c2324a574f Avoid Metal validation error on MTLBuffer.contents access from private storage. 2018-06-04 20:04:33 -04:00
Bill Hollings
0c854c508d Support using Metal texel buffer for linear images to increase host coherency.
MVKDeviceMemory track MVKImages and MVKBuffers separately.
Per Vulkan spec, restrict linear images to 2D, non-array, single mipmap.
Use texel buffer if possible for texture on coherent device memory.
Only flush MVKImages (not MVKBuffers) when device memory mapped.
Do not flush texel buffer images.
2018-06-04 19:15:32 -04:00
Bill Hollings
7693ebe313 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-06-01 12:49:16 -04:00
Dan Ginsburg
5ce2fc82ff Fix vsync not being enabled in IMMEDIATE present mode. MVK_MACOS was not being defined. 2018-06-01 10:23:27 -04:00
Bill Hollings
958f56fb85 Support mapping and filling device memory before binding an image to it.
MVKDeviceMemory uses a single memory allocation, which may be an MTLBuffer or host memory.
Image populates MTLTexture when bound to host accessible device memory.
Update MoltenVK version to 1.0.10.
2018-05-30 21:21:18 -04:00
Bill Hollings
c833cc544d Replace dependency on Vulkan-LoaderAndValidationLayers with Vulkan-Headers and Vulkan-Tools.
Update to latest versions of Vulkan-Headers, SPIRV-Cross, glslang, Vulkan-Tools, and VulkanSamples.
2018-05-28 08:33:46 -04:00
Bill Hollings
442dd2d1a3 vkGetPhysicalDeviceImageFormatProperties returns
VK_ERROR_FORMAT_NOT_SUPPORTED if the format is not supported.
Default value of MVKDeviceConfiguration::metalCompileTimeout set to infinite.
2018-05-22 14:24:34 -04:00
Bill Hollings
9e5e1ee8ba
Merge pull request #161 from mellinoe/fix-depthstencil-clear
Fix an issue where the depth format in MVKCmdClearImage was not getting set correctly.
2018-05-22 11:18:10 -04:00
Bill Hollings
acf2a6efe9 Synchronization and threading fixes.
Move surface access to UI components to main thread.
Fix deadlock possibility between MVKFence and MVKFenceSitter.
Fix handling of locking on deferred-destruction objects.
Update MoltenVK version to 1.0.9.
2018-05-22 10:30:53 -04:00
Eric Mellino
8985ab9131 Fix an issue where the depth format in MVKCmdClearImage was not getting set correctly. 2018-05-19 22:14:27 -07:00
Bill Hollings
f7dc8c3970 Allow queue processing to be optionally handled on the submitting (render) thread.
Add MVKDeviceConfiguration::synchronousQueueSubmits configuration setting.
Update to latest SPRIV-Cross version to fix atomic_compare issue.
Update MoltenVK version to 1.0.8.
2018-05-19 20:35:02 -04:00
Bill Hollings
40cdcbba5c Remove mutex locks on MVKDescriptorPool.
Update docs to indicate support for Vulkan 1.0, instead of 1.1.
2018-05-14 15:48:27 -04:00
Bill Hollings
ba5008d866 Add Metal library, function and pipeline compilation timeout limits.
Add MVKDeviceConfiguration::metalCompileTimeout config setting.
Limit Metal compilation timeouts to 125 ms by default in Release mode.
Invoke Metal library, function specialization, and pipeline compilations
asynchronously with completion handlers. Abort after timeout expires.
Set default value of MVKDeviceConfiguration::supportLargeQueryPools to true,
to support large Query Pools by default.
Access vertexDescriptor in MTLRenderPipelineDescriptor only if needed.
Update MoltenVK version to 1.0.7.
2018-05-14 10:53:27 -04:00
Bill Hollings
3ec46c2811 Handle null pointers in vkDestroy...() functions. 2018-05-07 20:10:43 -04:00
Bill Hollings
397b6ba22a Create copies of MVKShaderLibraries when merging pipeline caches.
Handle NULLs when freeing command buffers.
Replace delete with call to destroy() for all MVK objects.
2018-05-07 15:50:09 -04:00
Bill Hollings
08c5d8eaa7 Handle multiple MVKResources mapped to the same region of a single MVKDeviceMemory. 2018-05-07 13:31:34 -04:00
Bill Hollings
64bdbd995a Cache MTLCommandQueues for reuse to handle long delays in creating new VkDevices and VkQueues.
Move MVKQueueFamily to MVKPhysicalDevice. Cache MTLCommandQueues in MVKQueueFamily
and assign to MVKQueues as they are created.
Refactor performance tracking. Replace vkGetShaderCompilationPerformanceMVK()
with vkGetPerformanceStatisticsMVK() and associated structures.
Add MTLCommandQueue access performance tracker.
Update MoltenVK version to v1.0.6.
2018-05-06 23:28:21 -04:00
Bill Hollings
84f92e0d0e Fix merge conflicts and missing OSX files from class extension file refactoring. 2018-05-04 13:02:07 -04:00
Bill Hollings
f857011ec1 Add features to support Vulkan CTS.
Dynamically create frag shaders for clearning attachments and images.
Dynamically create frag shaders for blitting scaled images.
MVKGraphicsPipeline don't create MTLRenderPipelineState if vertex function conversion fails.
MVKComputePipeline don't create MTLComputePipelineState if compute function conversion fails.
Handle SPIRV-Cross errors thrown during SPIR-V parsing in compiler construction.
Set undefined property limits to large, but not max, values to avoid casting issues in app.
Mark multiDrawIndirect features as available.
Update to latest SPIRV-Cross version.
Update to MoltenVK version 1.0.5.
2018-05-04 12:11:19 -04:00
Chris Dalton
871a39a4ed Support VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
Makes sure this flag gets set on pixel formats for which Metal supports
filtering.

Fixes #147
2018-05-02 12:59:49 -06:00
Chris Dalton
54f0b23d4a Separate "pixel" and "buffer" features in MVK_MAKE_FMT_STRUCT
This will allow us to vary these feature flags independently.

Helps to fix #147
2018-05-02 12:59:49 -06:00
Chris Dalton
2f0c9f6c04 Initialize invalid MVKFormatDescs with MVK_FMT_NO_FEATS
As the feature flags get more complicated, it will be better to just
leave these blank rather than guess what the flags might be if/when
Metal supports their corresponding configs in the future.

Helps to fix #147
2018-05-02 12:59:49 -06:00
Hanton Yang
723fa9650d Separate categories from MVKOSExtensions.
MTLTextureDescriptor+MoltenVK
MTLSamplerDescriptor+MoltenVK
CAMetalLayer+MoltenVK
2018-04-27 23:04:28 +08:00
Bill Hollings
72f1efa674 Don't use CAMetalLayer displaySyncEnabled property if it is not available.
Update version to 1.0.4.
2018-04-22 23:16:52 -04:00
Bill Hollings
a80a85f82f MVKCmdClearAttachments & MVKCmdClearImage support multisampled attachments and images. 2018-04-19 18:36:00 -04:00
Bill Hollings
164680b686 Support depth clip mode only from MTLFeatureSet_iOS_GPUFamily2_v4 onwards. 2018-04-18 20:48:34 -04:00
Bill Hollings
bb2188c083 Add support for VK_PRESENT_MODE_IMMEDIATE_KHR swapchain presentation mode. 2018-04-18 20:16:45 -04:00
Bill Hollings
9b871d0280 Update to latest LunarG/VulkanSamples and update MoltenVK version to 1.0.3. 2018-04-18 11:06:47 -04:00
Bill Hollings
793f3fdaf3 Add workaround for apps that use one semaphore for all swapchain images.
Support deferred secondary signaling of semaphore & fence acquired while image is free.
Add MVKBaseObject::destroy() function to support customization of object destruction.
Support deferred destruction of MVKSemaphore & MVKFence instances.
2018-04-14 20:12:33 -04:00
Bill Hollings
9fe7e3659a Clean up reference to SDK in dylib build script. 2018-04-09 17:42:51 -04:00
Bill Hollings
796cf7e417 MVKImage::getArrayLayers() reports only layer count and excludes depth. 2018-04-09 16:22:43 -04:00
Bill Hollings
c08e22e097 vkCmdCopyBufferToImage() & vkCmdCopyImageToBuffer() support a VkBuffer
that is bound to an offseted position in a VkDeviceMemory.
2018-04-09 14:26:02 -04:00
Bill Hollings
d58da3a3c8 Queue and device wait idle handled by internal fence instead of semaphore.
Merge handling of timed and infinite synchronizations.
2018-04-05 23:32:35 -04:00
Bill Hollings
9fddb15a53 Round up row and layer byte counts when copying compressed
images with sizes that are not integer multiples of block size.
2018-04-03 17:01:53 -04:00
Bill Hollings
3c6b3ae210 vkCmdClearAttachments() don't attempt to clear non-existing depth & stencil attachments. 2018-03-30 18:28:26 -04:00
Bill Hollings
e4d00447f9 Always clamp scissors to render area to avoid Metal validation error. 2018-03-30 16:44:49 -04:00
Bill Hollings
04849f9f63 Present using command buffer by default.
Update version to 1.0.2.
2018-03-30 16:15:22 -04:00
Bill Hollings
20c98e5e46 Add support for caching converted MSL shader code offline from pipeline cache
via vkGetPipelineCacheData(), vkCreatePipelineCache() & vkMergePipelineCaches().

Add the cereal serialization framework as a dependency.
Update documentation. Update project settings to Xcode 9.3.
2018-03-30 12:13:50 -04:00
Bill Hollings
c45b47183e Shader libraries cached in MVKPipelineCache instead of MVKShaderModule. 2018-03-22 23:52:12 -04:00
Bill Hollings
fd7521dc7b VkPhysicalDeviceProperties::pipelineCacheUUID value derived
from MoltenVK version and highest supported Metal feature set.
2018-03-21 10:17:41 -04:00
Bill Hollings
8fbbaba11f Add option for per-frame performance logging via un-commentable logging code. 2018-03-19 11:44:12 -04:00
Bill Hollings
afebc3fe08 Support SPIR-V containing multiple entry points.
Include name and stage when matching shaders contexts for pipelines.
Avoid deprecated SPIRV-Cross members.
Update to latest SPIRV-Cross version.
2018-03-19 10:58:46 -04:00
Bill Hollings
c77ad3a383 Remove folder symlinks and update MoltenVK version to 1.0.1.
Remove duplicate build of SPIRV-Tools in fetchDependencies.
Remove folder symlinks from Externals and MoltenVKShaderCompiler folders.
Update header search paths to reference External folders directly.
Update External/README.md documentation.
Update MoltenVK version to 1.0.1 to reflect new build instructions.
Minor update to performance logging.
2018-03-18 18:41:19 -04:00
Bill Hollings
a911b63247 Fix memory issues.
Wrap each queue submission in a dedicated @autoreleasepool.
Fix memory leak during creation of global format mappings.
2018-03-15 18:46:56 -04:00
Bill Hollings
9ba039c6d6 Derive vkCmdCopyBuffer() alignment requirement at runtime.
Add MVKPhysicalDeviceMetalFeatures::mtlCopyBufferAlignment.
Set MTLComputeCommandEncoder label based on Vulkan command type.
Add MVKCommandUse::kMVKCommandUseDispatch.
2018-03-14 10:13:19 -04:00