1431 Commits

Author SHA1 Message Date
Michael(LAI)
2fec79c9a0
Runtime check maximumFramesPerSecond 2020-05-27 11:34:04 +08:00
Bill Hollings
59879144f5
Merge pull request #885 from Michael-Lfx/patch3
Fix typo.
2020-05-26 12:01:07 -04:00
Bill Hollings
d394651e47
Merge pull request #884 from Michael-Lfx/patch2
Fix typo.
2020-05-26 12:00:50 -04:00
Bill Hollings
2ce44a5e3d
Merge pull request #883 from Michael-Lfx/master
Fix typo.
2020-05-26 12:00:29 -04:00
michael
a33f6ea55c Fix typo. 2020-05-26 21:05:17 +08:00
michael
7448fe5b60 Fix typo. 2020-05-26 19:20:21 +08:00
Michael(LAI)
7523dc77a0
Fix typo. 2020-05-26 16:38:57 +08:00
Bill Hollings
e2ef10b977
Merge pull request #882 from billhollings/master
Add MVKSmallVector as a more memory efficient substitute of MVKVector, and use throughout MoltenVK.
2020-05-25 12:15:31 -04:00
Bill Hollings
a859a0624a Merge from upstream. 2020-05-25 10:18:11 -04:00
Bill Hollings
12d1a778f9 Optimize MVKQueueCommandBufferSubmission command buffer vector pre-allocation.
Add MVKQueueFullCommandBufferSubmission template class of to support MVKSmallVector
allocations of varying size based on command buffer count and keep allocs on the stack.
MVKQueueCommandBufferSubmission optimize wait and signal vector preallocations.
Clean up vector preallocation in MVKDescriptorSet and MVKDescriptorTypePreallocation.
2020-05-25 10:03:11 -04:00
Bill Hollings
9de94149ac MVKSmallVector maximize pre-allocation elements count to fill any space created by
the alignment of MVKSmallVector itself, to maximize the use of the preallocated memory.
2020-05-24 12:43:03 -04:00
Bill Hollings
c5075595cf Replace use of std::vector with MVKSmallVector in descriptor sets. 2020-05-23 19:10:23 -04:00
Bill Hollings
0e92b3277c Use of MVKSmallVector between MVKPipeline and SPIRVReflection.
Make SPIRVReflection global functions inline and templated.
Remove SPIRVReflection.cpp.
Allow MVKSmallVector to be sorted by supporting
random access from MVKSmallVector::iterator.
2020-05-23 17:13:28 -04:00
Bill Hollings
3bbef9b3e3 Replace use of MVKVector with MVKSmallVector in remaining MoltenVK code.
Fix rare build issues with mvk_smallvector_allocator,
in move constructor, and use of MAX() macro.
2020-05-23 14:21:21 -04:00
Bill Hollings
0989d2221e Replace use of MVKVector with MVKSmallVector in MVKCommandEncoder. 2020-05-22 21:28:10 -04:00
Bill Hollings
3fccb5ad6e Consolidate tracking of resource bindings in MVKResourcesCommandEncoderState subclasses.
Redefine MVKGraphicsResourcesCommandEncoderState::ShaderStage
as MVKResourcesCommandEncoderState::ResourceBindings.
Add ResourceBindings::reset() function.
MVKComputeResourcesCommandEncoderState replace discrete member variables
with a single ResourceBindings member variable.
Rename MVKGraphicsResourcesCommandEncoderState::_shaderStage
member variable to _shaderStageResourceBindings.
In stage iterations, replace < kMVKShaderStageCompute with <= kMVKShaderStageFragment.
2020-05-22 19:47:17 -04:00
Bill Hollings
9685f5d00a Support Xcode 11.5. 2020-05-22 18:48:29 -04:00
Bill Hollings
a6deef8df9 Use MVKSmallVector in command encoder states.
MVKResourcesCommandEncoderState functions use MVKArrayRef to pass fixed content,
and template functions to pass various dynamic vector types.
2020-05-22 18:39:43 -04:00
Bill Hollings
2e91df7b21 Use MVKSmallVector for pipeline stages.
Remove getStages() from MVKPipeline and MVKComputePipeline,
as it applies only to graphics pipelines.
2020-05-22 11:49:14 -04:00
Bill Hollings
b65e4ba5bb
Merge pull request #881 from danginsburg/display_timing
Add support for VK_GOOGLE_display_timing.  Some notes:
2020-05-22 10:05:43 -04:00
danginsburg
20bf6d8b8e Check @available for MTLDrawable addPresentedHandler/presentedTime. See if it fixes CI failure. 2020-05-21 15:23:54 -04:00
danginsburg
d9da5c746e Fix compile warning and forgetting to use a constant in previous change 2020-05-21 14:13:20 -04:00
danginsburg
027b66ef5c Add support for VK_GOOGLE_display_timing. Some notes:
* vkGetRefreshCycleDurationGOOGLE is implemented for iOS using UIScreen maximumFramesPerSecond.  I did not implement it for macOS (just hard-coded to 60).  It looks like doing it will require using CGDisplayModeGetRefreshRate
* vkGetPastPresentationTimingGOOGLE fills in the actualPresentationTime, but Metal does not provide the earlierPresentTime or the presentMargin as far as I can tell so earliestPresentTime is set to actualPresentTime and presentMargin is zero.
* Tested mostly on iOS - confirmed with Metal System Trace that desiredPresentTime works properly aligning the presentation correctly with vsync.
2020-05-21 12:00:50 -04:00
Bill Hollings
67dd89b66a Use MVKSmallVector in all MVKCommand subclasses to reduce memory footprints of
commands, and pass MVKArrayRef between MVKCommand subclasses and encoder states.
2020-05-19 17:34:26 -04:00
Bill Hollings
94e392cb37 Add MVKSmallVector as a more memory efficient substitute of MVKVector.
Replicate MVKVector.h and MVKVectorAllocator.h into MVKSmallVector.h and
MVKSmallVectorAllocator.h, and collapse class hierarchies.
Add MVKArrayRef struct to allow the contents of MVKSmallVector and MVKVector
to be passed between functions consistently.
Add contents() function to MVKVector to return MVKArrayRef.
2020-05-19 17:24:01 -04:00
Bill Hollings
e8c231eb45
Merge pull request #878 from billhollings/master
Reduce memory requirements for commands.
2020-05-13 22:03:24 -04:00
Bill Hollings
d8b3578604 MVKCmdCopyImage and MVKCmdBlitImage remove MVKCommandUse member variable.
MVKCmdCopyImage and MVKCmdBlitImage move passing MVKCommandUse
from setContent() to second encode() function.
MVKCmdPipelineBarrier reorder member variables.
2020-05-13 21:22:09 -04:00
Bill Hollings
ac1889534c Reduce memory requirements in MVKCmdTransfer.h/mm.
MVKCmdCopyImage, MVKCmdBlitImage, MVKCmdResolveImage generate derivative
arrays inline during encoding instead of holding as member variables.
Separate MVKCmdBlitImage from MVKCmdCopyImage and derive from MVKCommand instead.
2020-05-13 20:43:26 -04:00
Bill Hollings
5f1ea16808 Reduce memory requirements for vkCmdClearAttachments().
MVKCmdClearAttachments create vertices array inline.
Add MVKCmdClearAttachments subclasses MVKCmdClearSingleAttachment
and MVKCmdClearMultiAttachments.
2020-05-12 20:25:43 -04:00
Bill Hollings
85798f1259 Reduce memory requirements for commands in MVKCmdTransfer.h/mm.
Convert to template classes MVKCmdCopyImage, MVKCmdBlitImage, MVKCmdResolveImage,
MVKCmdCopyBuffer, MVKCmdBufferImageCopy, MVKCmdClearAttachments, MVKCmdClearImage.
Add MVKAddCmdFrom3Thresholds and MVK_CMD_TYPE_POOLS_FROM_3_THRESHOLDS()
macros to support 3 template thresholds.
Add MVKCmdClearImage subclasses MVKCmdClearColorImage and MVKCmdClearDepthStencilImage.
MVKCmdClearAttachments consolidate clear value arrays.
Reorder member variables in commands to avoid internal memory gaps.
Set enum MVKCommandUse type to uint8_t.
2020-05-12 17:32:19 -04:00
Bill Hollings
69ad593752
Merge pull request #876 from js6i/master
Mark computePipelineState as dirty when destroying mtlComputeEncoder
2020-05-12 15:41:32 -04:00
Jan Sikorski
46a63afa84 Fix logic in MVKBuffer::getMTLBufferOffset() 2020-05-12 17:29:00 +02:00
Jan Sikorski
3542439cca Mark compute state trackers as dirty when destroying mtlComputeEncoder 2020-05-12 17:28:52 +02:00
Bill Hollings
8f34c5af93 Reduce memory requirements for MVKCmdPushConstants and MVKCmdPushDescriptorSet.
MVKCmdPushConstants convert to a template class based on push constant size.
MVKCmdPushDescriptorSet reduce count of pre-allocated VkWriteDescriptorSets,
in recognition that numerous dynamic allocations necessarily happen anyway.
Cleanup member variable order in commands to avoid internal memory gaps.
2020-05-11 20:52:26 -04:00
Bill Hollings
4ba93c16a5 Reduce memory requirements for vkCmdBindDescriptorSets.
Split MVKCmdBindDescriptorSetsStatic into separate subclasses,
depending on use of dynamic offsets, and make them template classes
based on descriptor set count.
2020-05-11 18:01:40 -04:00
Bill Hollings
7e692f76c2 Reduce memory requirements for MVKCmdBindPipeline.
Split MVKCmdBindPipeline into separate graphics and compute subclasses
to remove need to hold bind point.
2020-05-11 10:46:59 -04:00
Bill Hollings
fe9a5f7fe6 Reduce memory requirements for event commands.
Convert MVKCmdWaitEvents to template class based on number of events.
Add separate MVKCmdSetEvent and MVKCmdResetEvent classes.
2020-05-10 15:59:29 -04:00
Bill Hollings
d0564c16af Reduce memory requirements for vkCmdPipelineBarrier().
Add MVKPipelineBarrier struct to consolidate barrier specs, reduce
memory use in each, and standardize barrier info into one collection.
MVKCmdPipelineBarrier uses templated collection sizes.
Add mvkPrintSizeOf() macro to simplify printing type sizes.
2020-05-09 10:24:45 -04:00
Bill Hollings
d443b131e0 Reduce memory requirements for resource bindings.
Use uint16_t instead of uint32_t for Metal resource indexes in binding structures.
MVKIndexMTLBufferBinding::mtlIndexType track MTLIndexType as uint8_t.
2020-05-08 11:34:11 -04:00
Bill Hollings
a6801e97f2
Merge pull request #874 from js6i/master
Malloc redoBuff in reportMessage to prevent stack overflow
2020-05-08 10:06:26 -04:00
Jan Sikorski
effa0c2ae3 Malloc redoBuff in reportMessage to prevent stack overflow 2020-05-08 11:08:25 +02:00
Bill Hollings
40d0427d31 Reduce memory requirements for commands in MVKCmdDraw.h/mm.
Convert MVKCmdBindVertexBuffers to template class.
Add MVKAddCmdFromTwoThresholds() macro in vulkan.mm.
Add MVK_CMD_TYPE_POOLS_FROM_TWO_THRESHOLDS() macro in MVKCommandTypePools.def.
Add second threshold to MVKCmdBeginRenderPass.
2020-05-08 00:51:35 -04:00
Bill Hollings
8813aff12c Reduce memory requirements for commands in MVKCmdRenderPass.h/mm.
MVKCmdBeginRenderPass don't hold VkRenderPassBeginInfo.
Convert MVKCmdBeginRenderPass and MVKCmdExecuteCommands to template classes.
MVKCommandBuffer::recordBeginRenderPass() pass MVKLoadStoreOverrideMixin
instead of MVKCmdBeginRenderPass.
MVKCommandBuffer::recordEndRenderPass() pass nothing.
Add MVKAddCmdFromThreshold() macro in vulkan.mm.
Add MVK_CMD_TYPE_POOLS_FROM_THRESHOLD() macro in MVKCommandTypePools.def.
2020-05-07 15:51:15 -04:00
Bill Hollings
7452c9316f Remove requirement for dedicated memory for external MTLBuffers. 2020-05-07 11:56:54 -04:00
Bill Hollings
1a1c1250b4 Remove abortive returns from calls in vulkan.mm to allow tracing to complete.
Move null tests on destroy calls from vulkan.mm to MVKDevice and MVKInstance.
Don't bother testing for null when spec says a param must not be null.
Invert remaining null tests so they don't abort.
2020-05-07 11:12:54 -04:00
Bill Hollings
5fe0b91fc7
Merge pull request #872 from billhollings/master
Add support for VK_KHR_external_memory extension.
2020-05-06 21:40:50 -04:00
Bill Hollings
9c033ec92c Cleanup MVKResource::bindDeviceMemory2() calls.
Remove MVKResource::bindDeviceMemory2() and MVKBindDeviceMemoryInfo struct.
Add separate MVKBuffer::bindDeviceMemory2() and MVKImage::bindDeviceMemory2()
functions with distinct params, and delegate to MVKResource::bindDeviceMemory().
2020-05-06 21:01:11 -04:00
Bill Hollings
d343fed52e Add support for VK_KHR_external_memory extension.
Functions and functionality supported, but don't currently do anything
until Metal-friendly enumerations added to VkExternalMemoryHandleTypeFlagBits.
Updated What's New document.
2020-05-06 19:43:21 -04:00
Bill Hollings
2b3cf6f395 Standardize design pattern for enumerations of Vulkan struct pNext chains.
Consistently use for-loops, VkBaseInStructure and VkBaseOutStructure.
Remove redundant MVKVkAPIStructHeader structure.
Remove unnecessary null tests on incoming Vulkan struct pointers.
2020-05-06 11:15:50 -04:00
Bill Hollings
efde388cbd Add support for VK_KHR_external_memory_capabilities extension.
Capability functions and functionality supported, but don't currently do anything
until Metal-friendly enumerations added to VkExternalMemoryHandleTypeFlagBits.
Rename MVKPhysicalDevice::getPhysicalDeviceMemoryProperties() to
getMemoryProperties() for consistency.
Updated What's New document.
2020-05-05 18:12:17 -04:00