244 Commits

Author SHA1 Message Date
Bill Hollings
2f468db9a2 Updates for SDK 1.1.114 release.
Update to latest external dependency libraries.
Rename components of VK_INTEL_shader_integer_functions2 to match 1.1.114 Vulkan spec.
Update What's New document.
2019-07-23 14:29:32 -04:00
Bill Hollings
1a9b0cba51 Fix crash when binding descriptor set to layout that has been destroyed and recreated.
Remove the descriptor set pool associated with a MVKDescriptorSetLayout when the layout
is destroyed. MVKDescriptorPool and MVKDescriptorSetLayout track each other to tell the
other when it has been destroyed.
2019-07-22 15:53:59 -04:00
Bill Hollings
6cc4b484db Return error when MVKImage created as 1D attachment. 2019-07-19 19:25:54 -04:00
Bill Hollings
a1fb3b106e Fix issue with push constants used across multiple draw calls not being applied.
Ensure MVKPushConstantsCommandEncoderState stays dirty until it actually makes changes.
2019-07-19 13:32:50 -04:00
Bill Hollings
d1a6b5a40d Remove exposure to leakable instances of NSString, NSArray & NSDictionary.
Reduce creation of autoreleased instances of NSString, NSArray & NSDictionary.
Ensure remaining are covered by deliberate autorelease pools.
2019-07-15 18:59:52 -04:00
Bill Hollings
35d40a83b0 vkCmdCopyImage() support copying between compressed and uncompressed formats. 2019-07-05 19:39:52 -04:00
Bill Hollings
5e0214d3e1 MVKCmdBufferImageCopy don't supply bytes per image if not array texture.
MVKRPSKeyBlitImg::isArrayType() include multisample array type.
Clean up formatting in texture type functions in mvk_datatypes.mm.
2019-07-05 11:21:23 -04:00
Bill Hollings
c593cebce5 MVKCmdCopyImage validate that formats are compatible for copying.
MVKCmdBlitImage use same validation to use direct copy when possible.
2019-07-04 19:19:11 -04:00
Bill Hollings
74e38659aa Set Metal texture usage to allow texture copy via view.
MVKCmdCopyImage uses texture view if formats different. Enable
MTLTextureUsagePixelFormatView for VK_IMAGE_USAGE_TRANSFER_SRC_BIT.
Refactor mvkMTLTextureUsageFromVkImageUsageFlags() to clarify Metal usages
and enable views on depth-stencil attachments by default.
2019-07-04 15:50:12 -04:00
Bill Hollings
aa6a10570a Support VK_EXT_metal_surface extension.
Modify demo apps to pass OS layer instead of view.
2019-07-03 20:23:43 -04:00
Bill Hollings
8df685a9dc Fix race condition between swapchain image destruction and presentation completion callback.
Retain MVKSwapchainImage before passing to MTLCommandBuffer completion handler.
Redesign MVKVulkanAPIObject retain/release functionality using atomic ref count
instead of mutex locks, to simplify design and improve performance.
2019-06-30 17:28:52 -04:00
Bill Hollings
fb4dd158d0 Document each function in vk_mvk_moltenvk.h to indicate they cannot be used
with objects retrieved through the Vulkan SDK Loader and Layers framework.
2019-06-30 11:16:08 -04:00
Bill Hollings
7c71263f98 Add note in MoltenVK_Runtime_UserGuide.md that the functions in vk_mvk_moltenvk.h cannot
be used with objects retrieved through the Vulkan SDK Loader and Layers framework.
2019-06-29 19:55:07 -04:00
Bill Hollings
1b4124d4aa For shaders created directly from MSL, set function name from
VkPipelineShaderStageCreateInfo::pName.
2019-06-29 19:18:32 -04:00
Bill Hollings
84ea825ea3 Separate SPIRVToMSLConverterContext into input config and output results.
Refactor SPIRVToMSLConverterContext into distinct SPIRVToMSLConversionConfiguration
and SPIRVToMSLConversionResults for conversion input and output, respectively.
Update to latest SPIRV-Cross version.
Update What's New document.
2019-06-29 18:01:07 -04:00
Bill Hollings
a0f0c78b34 Expand MVK_CONFIG_TRACE_VULKAN_CALLS to optionally log Vulkan call timings.
Update What's New document.
2019-06-21 22:56:13 -04:00
Bill Hollings
ef8de08ff1 Skip SPIRV-Tools build in Travis.
Add fetchDependencies option to skip building SPIRV-Tools and use a template of pre-generated headers.
Modify .travis.yml to use this.
2019-06-16 12:00:22 -04:00
Bill Hollings
64d7e07243 Support immutable depth compare samplers as constexpr samplers hardcoded in MSL.
On iOS GPU family 2 and earlier:
  - Allow immutable samplers to be passed to SPIRV-Cross in a format
    they can be output as hardcoded constexpr samplers in MSL.
  - Validate depth compare samplers are only used as immutable.

MVKMVKPipelineLayout & MVKDescriptorSetLayout can take null MVKCommandEncoder
to perform a validation pass when binding or pushing.
Reduce redundancy by combining SPIRVToMSLConverterContext structs
with compatible SPIRV-Cross structs.
Update MoltenVK version to 1.0.36.
2019-06-15 01:47:13 -04:00
Bill Hollings
bf8c7f8bb8 Updates for SDK 1.1.108 release.
Update to latest external dependency libraries.
MVKDescriptorSetLayoutBinding allow binding of null MVKBuffer.
Update What's New document.
2019-06-13 17:11:44 -04:00
Bill Hollings
907c85a54c Guard against missing Metal pipeline states when pipeline compilation fails.
MVKPipeline records whether Metal pipelines are successfully compiled.
Pipeline and draw commands check for valid Metal pipeline state before encoding.
Compute compilation operations can have custom names.
Name Tessellation control stage compute compiler for logging.
2019-06-06 18:27:43 -04:00
Bill Hollings
673788cba8 VkSemaphore optionally uses MTLEvent, if available and
MVK_ALLOW_METAL_EVENTS environment variable is enabled.
2019-06-05 11:23:46 -04:00
Bill Hollings
3e069c4a78 Add support for the VK_EXT_debug_utils extension.
Dispatch messenger callbacks on any reported message or error.
Add MVKDebugUtilsMessenger class.
Add MVKVulkanAPIObject::getVkObjectType() function and override in all Vulkan API objects.
MVKDevice::getMTLPixelFormatFromVkFormat() take base object for reporting.
2019-05-29 17:26:50 -04:00
Bill Hollings
fbf2af58a0 Fixes and consolidation of external library header references.
All external library header references consistently include framework references.
Cleanup references to external library headers that are no longer required.
Simplify and consolidate external library header paths in Xcode projects.
Add MVK_EXCLUDE_SPIRV_TOOLS build option to avoid use of SPIRV-Tools library.
Remove all other references to headers within SPIRV-Tools library.
2019-05-28 17:19:43 -04:00
Bill Hollings
8d9fa6bbd5 Add support for VK_EXT_debug_marker extension.
Move MVKVulkanAPIObject to its own .h/mm files.
Add MVKCmdDebug.h/mm files.
Change extension on MVKExtensions.cpp and MVKBaseObject.cpp to .mm.
Remove unused command use in MVKQueue submit() and waitIdle() functions.
MVKCommandPool constructor use default isPooling value in MVKCommandTypePool constructors.
MVKSwapchainImage pass image index in constructor.
2019-05-25 16:23:05 -04:00
Bill Hollings
b773e7aaab Fix sporadic crash on vkDestroySwapchainKHR().
MVKSwapchain & MVKSurface init _layerObserver to nil.
2019-05-20 16:13:52 -04:00
Bill Hollings
2da855a6bc Clear attachments using layered rendering only if framebuffer is layered.
Consolidate testing of subpass layered rendering.
Add MVKCommandEncoder _isUsingLayeredRendering member variable.
Track layered rendering enabled in MVKRPSKeyClearAtt.
Rename MVKRPSKeyClearAtt::enable() and ::isEnabled() functions.
Add MVKRPSKeyClearAtt::reset() function.
Consolidate viewport, scissor & attachment limits.
MVKImage add validation for layered rendering when used as attachment.
2019-05-15 22:40:47 -04:00
Bill Hollings
a52b984a31 Fixes to Metal renderpass layered rendering settings.
Only set MTLRenderPassDescriptor layered rendering properties if layered rendering
is supported and the framebuffer really has multiple layers.
MVKCmdClearImage don't set renderTargetArrayLength, since layers are cleared individually.
Update highest available MTLFeatureSets for use in pipelineCacheUUID.
2019-05-15 15:08:17 -04:00
Bill Hollings
1da02b6d73 Fix crash with multisample layered rendering on older macOS devices.
Add MVKPhysicalDeviceMetalFeatures::multisampleLayeredRendering feature.
MVKCmdClearAttachments shader don't include [[render_target_array_index]] if multisample
and multisampleLayeredRendering is false.
Refactor validation of VkImageCreateInfo when creating an MVKImage.
Validate MVKImage multisample layered array attachments require multisampleLayeredRendering.
2019-05-14 14:22:14 -04:00
Bill Hollings
c3aaf976ae Add support for the VK_NV_glsl_shader extension.
Support runtime shader compilation from GLSL.
Return VK_ERROR_INVALID_SHADER_NV on shader and pipeline compilation errors.
Add MVKShaderCompilationPerformance::glslToSPRIV to track GLSL conversion performance.
Rename MoltenVKGLSLToSPIRVConverter MVKShaderStage enum to MVKGLSLConversionShaderStage
to avoid naming conflicts with MoltenVK MVKShaderStage enum.
Hologram demo load SPIR-V directly instead of using GLSL through either
MoltenVKGLSLToSPIRVConverter or VK_NV_glsl_shader extension.
Update to latest version of VulkanSamples that supports MVKGLSLConversionShaderStage.
2019-05-10 12:21:03 -04:00
Bill Hollings
04cf30a0b5 Update to latest version of SPIRV-Cross. 2019-05-08 17:19:24 -04:00
Bill Hollings
173d8cc5f3 Add support for the VK_EXT_debug_report extension.
Add MVKDebugReportCallback class.
Add MVKVulkanAPIObject class as base class of classes exposed in Vulkan API.
Remove MVKRefCountedDeviceObject class and move ref-counting to MVKVulkanAPIObject.
Rename MVKDispatchableObject class to MVKDispatchableVulkanAPIObject.
Introduce multiple inheritance mixin classes into class hierarchy.
Add MVKBaseObject::getVulkanAPIObject() function to find Vulkan API object
controlling any subobject that needs to report something.
MVKCommandResourceFactory functions pass in calling object for reporting.
Add MVKBaseObject::reportMessage() & reportError() functions.
Replace mvkNotifyErrorWithText() static function with reportError()
instance function to allow access to debug reporting.
Redefine MVKLog*() functions to call reportError() instance method.
Delete MVKLogging.cpp.
Remove MVKLogging.h from MoltenVKShaderConverter project.
Add mvk_datatypes.hpp to redirect errors in mvk_datatypes.h functions to debug
reporting. Use mvk_datatypes.hpp internally for all references to these functions.
Convert several static methods to instance methods.
Refactor platform defines in MVKSurface.h.
Explicitly count MVKExtensionList extension count to avoid relying on struct size.
Remove MVKCommandBuffer::recordResult() and use setConfigurationResult().
Change log indication of error in logs from [***MoltenVK ERROR***] to [mvk-error],
for consistency with other log level indications.
Update MoltenVK version to 1.0.35.
2019-05-01 22:27:03 -04:00
Bill Hollings
c2bb18e264 Update What's New document. 2019-04-18 18:38:11 -04:00
Bill Hollings
62f374bf7e Allow building external dependency libraries in Debug mode.
Add ExternalDependencies (Debug) scheme to ExternalDependencies Xcode project.
Add --debug option to fetchDependencies script.
Support Release, Debug & Latest directories in External/build directory.
Enable DEPLOYMENT_POSTPROCESSING build setting when compiling
SPIRV-Tools to avoid warning spam when building dylibs.
Disable visibility warnings when building MoltenVKShaderConverter
in Release mode from external libraries built in Debug mode.
Always use -Xlinker -w option when creating dylibs to disable visibility warnings.
2019-04-18 15:08:39 -04: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
Bill Hollings
189a41e8d2 Update dependency libraries for SDK 1.1.106. 2019-04-11 17:52:50 -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
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
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
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
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
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
b3240794fc Fix PVRTC texture content loading via memory mapping.
MoltenVK_Runtime_UserGuide.md: Add limitation explanation
about loading PVRTC using host-visible memory only.
Update What's New document.
2019-03-26 13:31:26 -04:00
Bill Hollings
91f78b6bea Add support for tracking device features enabled during vkCreateDevice().
Enable device features based on content of pCreateDeviceInfo.
Validate requested features are available and return  if not.
Support returning error from vkCreateDevice(), vkFlushMappedMemoryRanges()
and vkInvalidateMappedMemoryRanges().
Update What's New Document.
2019-03-25 19:58:36 -04:00
Bill Hollings
0ac1edbac0 Project build enhancements, and MoltenVKShaderConverter
tool now validates converted MSL with a test compilation.

Project build scripts now build dylib and framework in separate build directories
to enable MoltenVKShaderConverter to link to static library instead of dynamic library.
Final Package structure remains the same.
In Debug build, copy dylib dSYM files to Package.
Package/Latest directory now links relative to local Debug or Release directory.
Add install option to Makefile.
MoltenVKShaderConverter tool now validates converted MSL with a test compilation.
Clean up various MSL conversion and compilation error logging.
MVKCommandResourceFactory wrap Metal library compile with autorelease pool.
Build ExternalDependencies with same symbol hiding as MoltenVK to suppress visibility warnings.
Update What's New document.
2019-03-22 19:36:21 -04:00
Bill Hollings
bdaf306233 Update VK_KHR_swapchain and VK_KHR_get_surface_capabilities2 extensions.
Add support for VK_KHR_get_surface_capabilities2 extension.
Implement newer VK_KHR_swapchain extension functions.
Fix when the following functions return VK_INCOMPLETE:
    vkGetPhysicalDeviceSurfaceFormatsKHR()
    vkGetSwapchainImagesKHR()
    vkEnumeratePhysicalDevices()
    vkEnumerateInstanceLayerProperties()
    vkGetPhysicalDeviceQueueFamilyProperties()
CTS: Pass supported *.macos.surface.* and *.macos.swapchain.* tests.
Update What's New document.
2019-03-21 08:53:18 -04:00
Bill Hollings
614ac65933 Add correct function entry point handling.
Add MVKEntryPoint struct to track entry points as
instance vs device, and core vs enabled extensions.
Add stubs for newer VK_KHR_swapchain functions.
Pass CTS dEQP-VK.api.version_check.entry_points.
Update What's New document.
2019-03-19 16:43:04 -04:00
Bill Hollings
a2b1e04e8d Update to latest SPIRV-Cross version.
Adapt to API changes resulting from the introduction of the SPIRV-Cross C API.
Update What's New document.
2019-03-15 20:25:55 -04:00
Bill Hollings
e13444e305 Allow zero offset and stride combo in VkVertexInputBindingDescription.
Also fix memory overrun if no VB found with same binding as a VA.
2019-03-14 17:50:20 -04:00
Bill Hollings
3b1e53002e Increase shader float constant accuracy beyond 6 digits of precision. 2019-03-06 08:58:27 -05:00