1188 Commits

Author SHA1 Message Date
Chip Davis
7771b00bee Support the VK_EXT_texel_buffer_alignment extension.
This extension lets implementations report separate limits for uniform
and storage texel buffers, as well as whether or not the required
alignment is only a single texel of the buffer view's format.

This information is available in Metal, but only through an API query.
We must query the required alignment for every buffer view format we
support.

Update Vulkan-Headers to pull in support for this new extension.
2019-07-16 14:51:45 -05:00
Chip Davis
eb330056e6 Advertise the VK_AMD_shader_image_load_store_lod extension.
iOS only for now. Metal textures on Mac don't support non-zero `lod` in
the `write()` method.
2019-07-16 14:48:58 -05:00
Bill Hollings
fe3b2fbd5f
Merge pull request #666 from cdavis5e/swapchain-colorspace
Support the VK_EXT_swapchain_colorspace extension.
2019-07-16 15:37:06 -04:00
Bill Hollings
0a138c6115 Cube demo use staging buffers on macOS because host-coherent texture memory unavailable. 2019-07-16 13:02:37 -04:00
Chip Davis
dc16c3cc22 MVKBuffer: Correct _mtlBytesPerRow value for the native texture buffer case. 2019-07-16 11:58:06 -05:00
Chip Davis
8c3d30b12b Support the VK_EXT_swapchain_colorspace extension.
Only some of the color spaces provided by this extension are supported.
macOS 10.12 supports a few more. macOS 10.14 (at least, according to the
*10.15* SDK) supports even more. (But that needs a change to the
Metal-3.0 branch.)

I've chosen to group by color space. That way, programs will find the
all the supported formats early on. Programs that are interested in
the color space can keep looking.
2019-07-16 10:14:28 -05:00
Bill Hollings
ab643baa5b Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-16 11:09:05 -04:00
Bill Hollings
8a1d7f4f81
Merge pull request #668 from cdavis5e/native-texture-buffer
Use native texture buffers when available.
2019-07-16 10:15:02 -04:00
Bill Hollings
861bc91e43
Merge pull request #667 from cdavis5e/ubo-std-layout
Support the VK_KHR_uniform_buffer_standard_layout extension.
2019-07-16 10:09:42 -04:00
Chip Davis
47082fd4c3 Use native texture buffers when available.
These were added in Metal 2.1.
2019-07-16 00:02:46 -05:00
Chip Davis
a2533116b3 Support the VK_KHR_uniform_buffer_standard_layout extension.
This happens to fall out of the way structure layouts are handled in
SPIRV-Cross.
2019-07-16 00:01:48 -05:00
Bill Hollings
1f9db2ac69
Merge pull request #665 from cdavis5e/shader-stencil-export
Advertise the VK_EXT_shader_stencil_export extension.
2019-07-15 19:10:22 -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
Chip Davis
fc13aec2af Advertise the VK_EXT_shader_stencil_export extension.
This is supported by Mac GPU Family 2 starting on macOS 10.14, and Apple
GPU Family 5 starting on iOS 12.

Supporting this is a bit tricky. Because only some devices support this
extension, we now have to keep track of supported device extensions per
device.
2019-07-15 12:12:39 -05:00
Bill Hollings
53b6ced8b3
Merge pull request #663 from billhollings/master
Fix memory leak in debug marker and debug utils labelling.
2019-07-15 11:27:11 -04:00
Bill Hollings
8bcfef228b Fix memory leak in debug marker and debug utils labelling. 2019-07-15 10:17:55 -04:00
Bill Hollings
251e5200c4
Merge pull request #662 from billhollings/master
Multiple fixes to image clear and texture memory (CTS)
2019-07-13 00:42:32 -04:00
Bill Hollings
8cbc951cc3 Texture memory requirements don't use shared storage on macOS.
MVKBuffer getMemoryRequirements() ensure texel buffers don't use shared memory.
MVKImage getMemoryRequirements() ensure textures don't use shared memory.
MVKBufferView set MTLTexture storageMode & cpuCacheMode directly from MTLBuffer.
2019-07-12 17:00:18 -04:00
Bill Hollings
608028a291 MVKDeviceMemory keep MTLResourceOptions aligned with MTLStorageMode & MTLCPUCacheMode. 2019-07-12 15:20:05 -04:00
Bill Hollings
f01434ebb1 MVKCmdClearImage return error if texture is not renderable. 2019-07-12 14:40:23 -04:00
Bill Hollings
11c96c4d03
Merge pull request #660 from billhollings/master
Move push constant binding to vkCmdBindPipeline() from vkCmdBindDescriptorSet().
2019-07-10 18:31:23 -04:00
Bill Hollings
f46575df60 Move push constant binding to vkCmdBindPipeline() from vkCmdBindDescriptorSet(). 2019-07-10 17:53:44 -04:00
Bill Hollings
9c635d23e7
Merge pull request #659 from billhollings/master
MVKCmdBlitImage clear _mvkImageBlitRenders vector on reuse.
2019-07-10 11:23:32 -04:00
Bill Hollings
04c7e4e8f0 MVKCmdBlitImage clear _mvkImageBlitRenders vector on reuse. 2019-07-10 10:46:48 -04:00
Bill Hollings
79f4c41905
Merge pull request #656 from billhollings/master
Multiple fixes to image copy, BLIT, and resolve (CTS)
2019-07-09 22:58:13 -04:00
Bill Hollings
d926424bfe MVKCmdResolveImage support textures of different sizes. 2019-07-09 17:56:10 -04:00
Bill Hollings
e35426d4c3 MVKCmdBlitImage support multisample textures.
MVKCmdCopyImage track src & dest sample counts.
MVKRPSKeyBlitImg track dest sample count.
2019-07-09 17:16:42 -04:00
Bill Hollings
5289d10746 MVKCmdBlitImage support blit between different texture formats.
MVKRPSKeyBlitImg track both src and dst texture formats.
MVKCmdCopyImage fix copyable comparison.
2019-07-09 15:45:16 -04:00
Bill Hollings
4915b1ec0c Allow MVKCmdBlitImage to use texture view and image->buffer->image copying
from parent MVKCmdCopyImage class.

Refactor MVKCmdCopyImage & MVKCmdBlitImage to hold corresponding Vulkan structs.
MVKCommandResourceFactory::getBlitFragFunction() only pass srcSlice.
2019-07-09 10:14:42 -04:00
Bill Hollings
5b7038b21d vkCmdCopyImage() adjust dest extent when copying from compressed to uncompressed images.
Add MVKImage::getIsCompressed().
MVKPhysicalDevice::getImageFormatProperties() optimize use of mvkFormatTypeFromVkFormat().
2019-07-08 22:28:33 -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
423944d01e Rename mvkAreFlagsEnabled() & mvkAreOnlyAnyFlagsEnabled()
functions for consistency with similar functions.
2019-07-04 16:08:12 -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
46bea62230
Merge pull request #654 from billhollings/master
Support VK_EXT_metal_surface extension.
2019-07-03 23:53:41 -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
4115d8ad3e
Merge pull request #652 from billhollings/master
Fix race condition between swapchain image destruction and presentation completion callback
2019-06-30 18:18:01 -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
a5cefa5c98
Merge pull request #650 from billhollings/master
For shaders created directly from MSL, set function name from VkPipelineShaderStageCreateInfo::pName
2019-06-30 12:14:31 -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
17496c30df
Merge pull request #648 from billhollings/master
Add additional performance and call tracing options.
2019-06-24 16:58:23 -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
e6afb1fedb Add MTLCommandBuffer completion timing performance tracking option.
Add MVKPerformanceStatistics::MVKQueuePerformance::mtlCommandBufferCompletion.
Increment VK_MVK_MOLTENVK_SPEC_VERSION to 21.
2019-06-20 17:31:19 -04:00
Bill Hollings
7331535c2b
Merge pull request #646 from billhollings/master
Quick fixes for pipeline cache lookups.
2019-06-20 07:50:10 -04:00
Bill Hollings
11ca15edaa Quick fixes for pipeline cache lookups.
SPIRVToMSLConverterOptions should really be refactored into two separate config and results structs.
2019-06-19 16:23:50 -04:00
Bill Hollings
80b2068bac
Merge pull request #643 from billhollings/Metal-3.0
Sync Metal-3.0 with master
2019-06-16 15:17:23 -04:00