163 Commits

Author SHA1 Message Date
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
Bill Hollings
7df5a739d5
Merge pull request #93 from mikes-lunarg/mikes_getinstanceprocaddr_null
Fix vkGetInstanceProcAddr to work with 1.1 loader
2018-03-13 14:28:40 -04:00
Bill Hollings
ec4072115f
Merge pull request #99 from mellinoe/fix-vkCmdCopyBuffer
Fix vkCmdCopyBuffer when copying unaligned regions.
2018-03-13 14:20:19 -04:00
Eric Mellino
349ba44ac4 Fix vkCmdCopyBuffer when copying unaligned regions.
* Vulkan allows any valid copy regions to be used in this function.
  However, Metal's blit command encoder only allows copy offsets and
  sizes which are multiples of 4 bytes.
* Before this change, attempting to copy such a region would cause
  Metal validation errors to trigger.
* This adds logic to detect such copy regions and uses a special compute
  shader to perform a byte-by-byte copy from the source buffer to
  the destination buffer with the appropriate offsets.
* This new code path is only needed on macOS, because iOS does not share
  the same copy region restrictions.
2018-03-12 22:50:18 -07:00
Bill Hollings
00fda690ca Align versioning of external libraries with those used by LunarG SDK.
Load external library versions using script instead of Git submodules.
SPIRV-Cross, Vulkan-LoaderAndValidationLayers & VulkanSamples versions recorded in files.
glslang version determined by Vulkan-LoaderAndValidationLayers.
SPIRV-Tools & SPIRV-Headers versions loaded by glslang.
When MoltenVK is built as part of the LunarG SDK, use external libraries
sourced from parent Vulkan-LoaderAndValidationLayers.
Use Vulkan headers from Vulkan-LoaderAndValidationLayers.
No longer generate Vulkan specification.
Update documentation.
2018-03-12 10:02:13 -04:00
Mike Schuchardt
dc0679f612 Fix vkGetInstanceProcAddr to work with 1.1 loader
In order to determine the instance version, the 1.1 loader takes
advantage of the fact that a 1.0 ICD will return NULL for
vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion")
2018-03-09 14:26:30 -07:00
Bill Hollings
26967d4fa1 Update compile warnings originating from use of __printflike. 2018-03-01 20:07:37 -05:00
C.W. Betts
0c91b1e613 Add printf-like macros to MVKLogImpl and mvkNotifyErrorWithText.
This will make the compiler point out improper formatting of variadic functions.
2018-02-26 15:28:28 -07:00
Bill Hollings
e67cf9c0f2 Support null VkSubmitInfo on queue submit. 2018-02-25 15:52:09 -05:00
Bill Hollings
73ff9161e1 Support VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT on VkFormats
that are not supported as texture formats under Metal.
2018-02-25 11:49:58 -05:00
Bill Hollings
7e491e5c04 On command buffer submission, defer waiting on semaphores
until just before MTLCommandBuffer is committed.

Add presentWithCommandBuffer config option to choose how to present.
2018-02-25 01:05:08 -05:00
Bill Hollings
83027ca638 Update version to 1.0.0. 2018-02-24 19:59:58 -05:00
Bill Hollings
615d3f8e2a Consolidate timestamps and performance tracking.
Update to latest SPIRV-Cross.
2018-02-24 19:51:43 -05:00
Bill Hollings
a4e4222140 Populate VkPhysicalDeviceProperties vendorID, deviceID and pipelineCacheUUID.
Fix MVKShaderLibrary missing function prototype warning.
Update to latest SPIRV-Cross.
Update to latest Vulkan-Hpp.
Update to latest Vulkan-LoaderAndValidationLayers.
2018-02-21 14:24:21 -05:00
Maximilian Maldacker
e3741004b4 moved spe constant work group size reading at the end 2018-02-15 22:49:08 +01:00
Maximilian Maldacker
6eecd58ad2 added workgroupssize specialization constants 2018-02-15 19:00:24 +01:00
Bill Hollings
68b31e6361 Fix push constant data copying and update to latest SPIRV-Cross. 2018-02-14 13:52:53 -05:00
Bill Hollings
099b6de13e
Merge pull request #49 from mmaldacker/bugfix/push_constant_offset
push constant offset
2018-02-14 13:20:45 -05:00
Maximilian Maldacker
529b3d1e8e added missing break statements 2018-02-13 22:54:03 +01:00
Maximilian Maldacker
c6723a187b don't align push constant buffer (otherwise it'll overwrite other push constants) 2018-02-13 22:53:17 +01:00
Karl Schultz
c4ce08402d Disable watermark in debug builds 2018-02-13 12:47:18 -07:00
Bill Hollings
433632abc1
Merge pull request #42 from mmaldacker/bugfix/texture_synchronize
don't check if texture is coherent since it never is on macOS
2018-02-13 11:14:38 -05:00
Maximilian Maldacker
93e20e28d3 check if storage mode is not shared when checking if synchronize is needed 2018-02-13 12:39:26 +01:00
Maximilian Maldacker
dcb08d262c setup push constants for compute shaders 2018-02-08 21:36:42 +01:00
Maximilian Maldacker
c0355293c3 don't check if texture is coherent since it never is on macOS 2018-02-08 21:35:30 +01:00
Bill Hollings
5beaf7af01 Combine multiple VkCommandBuffers into a single MTLCommandBuffer. 2018-02-06 11:49:51 -05:00
Bill Hollings
6191d6731f
Merge pull request #38 from danginsburg/blit_image_fix
Fix vkCmdBlitImage between images of different sizes.
2018-02-01 16:59:53 -05:00
Dan Ginsburg
d834f4d4cd Fix vkCmdBlitImage between images of different sizes.
Fix typo that was setting the dstExtent from the source image.  This was
causing Desktop-Friendly fullscreen resolution not to render correctly
in Dota.
2018-02-01 14:55:56 -05:00
Bill Hollings
98b050e6e2 Update copyright dates to 2018. 2018-01-31 16:57:59 -05:00
Bill Hollings
13687d1a57 Updates to Metal resource locking.
MVKBufferView add lock when creating MTLTexture.
MVKDeviceMemory add lock when creating MTLBuffer during memory mapping.
MVKMTLBufferAllocator does not need to be threadsafe.
Cleanup syntax on other lock handling to add consistency.
2018-01-31 13:43:19 -05:00
Bill Hollings
a1b5ea5494
Merge pull request #35 from danginsburg/issue_34
Closes issue #34 - fix Metal validation error with a renderpass with …
2018-01-31 11:51:56 -05:00
Dan Ginsburg
a46855ecfd Closes issue #34 - fix Metal validation error with a renderpass with no depth attachment
If there is no depth attachment, Metal Validation will give the
following error: "validateDepthStencilState:3657: failed assertion
`MTLDepthStencilDescriptor sets depth test but MTLRenderPassDescriptor
has a nil depthAttachment texture'".  Fix by checking the current
subpass to see if there is a depth/stencil attachment, and if not use a
depth/stencil state with depth test always, depth write disabled, and no
stencil state.
2018-01-31 11:03:24 -05:00
Dan Ginsburg
640c989a20 Address feedback from pull request review
* Move mutex lock in MVKBuffer::getMTLBuffer() to be after checking
MVKDeviceMemory::getMTLBuffer() so we don't always lock in that case
* Fix comment I put in the wrong place in previous commit
2018-01-31 09:07:45 -05:00
Dan Ginsburg
6d50a88178 Fix intermittent corruption uploading textures in Dota 2.
The problem was that MVKBuffer::getMTLBuffer() was not thread-safe.  If
multiple threads called it at the same time, more than one underlying
_mtlBuffer would be created.  This could make the vkCmdCopyBufferToImage
copy from an unfilled buffer leaving the texture corrupted.  I also
added similar thread safety to MVKImage::getMTLTexture() and
MVKImageView::getMTLTexture() since they both looked like they would
have the same potential problem.
2018-01-30 12:28:14 -05:00
Bill Hollings
e8e75f480e Enhance viewport and scissor handling.
In debug mode, ensure scissors fit inside renderpass area to avoid Metal validation assertions.
Consolidate setting of viewport and scissors by pipeline and command.
2018-01-30 11:00:50 -05:00
Bill Hollings
856f5ebc36 Allow color attachment when clearing depth only. 2018-01-29 15:46:49 -05:00
Bill Hollings
c3ac62ecd7 GPU management.
Log which GPU is attached to a VkDevice.
Sort multiple GPU's to put higher-power GPU's at front of list.
Use pipelineStatisticsQuery feature to determine whether pipeline stats are available.
Update to latest SPIRV-Cross.
2018-01-29 11:57:14 -05:00
Dan Ginsburg
85f7a99523 Closes issue #7. Support DXT1 RGB texture compression. 2018-01-24 11:02:25 -05:00
Bill Hollings
b2644ad909 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-01-23 22:21:28 -05:00
Bill Hollings
67abb772f5
Merge pull request #26 from danginsburg/bind_image_memory_crash
Fix vkBindImageMemory crash when multiple simultaneous threads are bi…
2018-01-23 22:19:26 -05:00
Bill Hollings
89e1c92845 Retrieve heap size from MTLDevice on macOS and from free shared system memory on iOS. 2018-01-23 22:06:43 -05:00
Dan Ginsburg
9105bf58cd Use MTLDevice recommendedMaxWorkingSetSize to set the heap size rather than leaving it at 0 (on macOS). recommenededMaxWorkingSetSize does not exist on iOS so for iOS continue to leave it at 0 for now. 2018-01-23 15:16:07 -05:00
Dan Ginsburg
47952be008 Fix vkBindImageMemory crash when multiple simultaneous threads are binding to different offsets in the of the same VkDeviceMemory. The _resources vector inside of MVKDeviceMemory was not mutex protected which could cause it to become corrupted on simulaneous access. Add mutex protection. 2018-01-23 13:47:02 -05:00
Bill Hollings
89bd4b7413
Merge pull request #23 from danginsburg/issue_22_fix
Closes #22. Fix "Game Rendering Quality" slider and Pause (F9) in dota2
2018-01-18 13:17:09 -05:00
Bill Hollings
df48f0ff58
Merge pull request #20 from danginsburg/issue_19_fix
Closes issue #19.  The problem was that MVKRenderPass was ignoring VK…
2018-01-18 11:21:35 -05:00
Bill Hollings
22390372ce
Merge pull request #18 from danginsburg/image_view_attachment_bug
Closes issue #17.  Modify MVKImageView::populateMTLRenderPassAttachme…
2018-01-18 11:20:06 -05:00