Rename mvkGetMVKConfiguration() to mvkConfig() for brevity.
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
index 6085875..60d4e46 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
@@ -240,7 +240,7 @@
portabilityFeatures->events = true;
portabilityFeatures->imageViewFormatReinterpretation = true;
portabilityFeatures->imageViewFormatSwizzle = (_metalFeatures.nativeTextureSwizzle ||
- mvkGetMVKConfiguration()->fullImageViewSwizzle);
+ mvkConfig()->fullImageViewSwizzle);
portabilityFeatures->imageView2DOn3DImage = false;
portabilityFeatures->multisampleArrayImage = _metalFeatures.multisampleArrayTextures;
portabilityFeatures->mutableComparisonSamplers = _metalFeatures.depthSampleCompare;
@@ -560,7 +560,7 @@
case VK_IMAGE_TYPE_1D:
maxExt.height = 1;
maxExt.depth = 1;
- if (!mvkGetMVKConfiguration()->texture1DAs2D) {
+ if (!mvkConfig()->texture1DAs2D) {
maxExt.width = pLimits->maxImageDimension1D;
maxLevels = 1;
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
@@ -1018,7 +1018,7 @@
MVKArrayRef<MVKQueueFamily*> MVKPhysicalDevice::getQueueFamilies() {
if (_queueFamilies.empty()) {
VkQueueFamilyProperties qfProps;
- bool specialize = mvkGetMVKConfiguration()->specializedQueueFamilies;
+ bool specialize = mvkConfig()->specializedQueueFamilies;
uint32_t qfIdx = 0;
qfProps.queueCount = kMVKQueueCountPerQueueFamily;
@@ -1147,7 +1147,7 @@
void MVKPhysicalDevice::initProperties() {
mvkClear(&_properties); // Start with everything cleared
- _properties.apiVersion = mvkGetMVKConfiguration()->apiVersionToAdvertise;
+ _properties.apiVersion = mvkConfig()->apiVersionToAdvertise;
_properties.driverVersion = MVK_VERSION;
initGPUInfoProperties();
@@ -1227,7 +1227,7 @@
if ( mvkOSVersionIsAtLeast(13.0) ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
- _metalFeatures.placementHeaps = mvkGetMVKConfiguration()->useMTLHeap;
+ _metalFeatures.placementHeaps = mvkConfig()->useMTLHeap;
_metalFeatures.nativeTextureSwizzle = true;
if (supportsMTLGPUFamily(Apple3)) {
_metalFeatures.native3DCompressedTextures = true;
@@ -1318,7 +1318,7 @@
if ( mvkOSVersionIsAtLeast(13.0) ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
- _metalFeatures.placementHeaps = mvkGetMVKConfiguration()->useMTLHeap;
+ _metalFeatures.placementHeaps = mvkConfig()->useMTLHeap;
_metalFeatures.nativeTextureSwizzle = true;
if (supportsMTLGPUFamily(Apple3)) {
_metalFeatures.native3DCompressedTextures = true;
@@ -1415,7 +1415,7 @@
}
if (supportsMTLGPUFamily(Mac2)) {
_metalFeatures.nativeTextureSwizzle = true;
- _metalFeatures.placementHeaps = mvkGetMVKConfiguration()->useMTLHeap;
+ _metalFeatures.placementHeaps = mvkConfig()->useMTLHeap;
_metalFeatures.renderWithoutAttachments = true;
}
}
@@ -3099,7 +3099,7 @@
// MTLCreateSystemDefaultDevice function, and if that GPU is the same as the
// selected GPU, update the MTLDevice instance used by the MVKPhysicalDevice.
id<MTLDevice> mtlDevice = _physicalDevice->getMTLDevice();
- if (mvkGetMVKConfiguration()->switchSystemGPU && !(mtlDevice.isLowPower || mtlDevice.isHeadless) ) {
+ if (mvkConfig()->switchSystemGPU && !(mtlDevice.isLowPower || mtlDevice.isHeadless) ) {
id<MTLDevice> sysMTLDevice = MTLCreateSystemDefaultDevice();
if (mvkGetRegistryID(sysMTLDevice) == mvkGetRegistryID(mtlDevice)) {
_physicalDevice->replaceMTLDevice(sysMTLDevice);
@@ -3335,7 +3335,7 @@
MVKDescriptorPool* MVKDevice::createDescriptorPool(const VkDescriptorPoolCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator) {
- return new MVKDescriptorPool(this, pCreateInfo, mvkGetMVKConfiguration()->preallocateDescriptors);
+ return new MVKDescriptorPool(this, pCreateInfo, mvkConfig()->preallocateDescriptors);
}
void MVKDevice::destroyDescriptorPool(MVKDescriptorPool* mvkDP,
@@ -3381,7 +3381,7 @@
MVKCommandPool* MVKDevice::createCommandPool(const VkCommandPoolCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator) {
- return new MVKCommandPool(this, pCreateInfo, mvkGetMVKConfiguration()->useCommandPooling);
+ return new MVKCommandPool(this, pCreateInfo, mvkConfig()->useCommandPooling);
}
void MVKDevice::destroyCommandPool(MVKCommandPool* mvkCmdPool,
@@ -3657,7 +3657,7 @@
MTLCompileOptions* MVKDevice::getMTLCompileOptions(bool useFastMath, bool preserveInvariance) {
MTLCompileOptions* mtlCompOpt = [MTLCompileOptions new];
mtlCompOpt.languageVersion = _pMetalFeatures->mslVersionEnum;
- mtlCompOpt.fastMathEnabled = useFastMath && mvkGetMVKConfiguration()->fastMathEnabled;
+ mtlCompOpt.fastMathEnabled = useFastMath && mvkConfig()->fastMathEnabled;
#if MVK_XCODE_12
if ([mtlCompOpt respondsToSelector: @selector(setPreserveInvariance:)]) {
[mtlCompOpt setPreserveInvariance: preserveInvariance];
@@ -3668,7 +3668,7 @@
// Can't use prefilled Metal command buffers if any of the resource descriptors can be updated after binding.
bool MVKDevice::shouldPrefillMTLCommandBuffers() {
- return (mvkGetMVKConfiguration()->prefillMetalCommandBuffers &&
+ return (mvkConfig()->prefillMetalCommandBuffers &&
!(_enabledDescriptorIndexingFeatures.descriptorBindingUniformBufferUpdateAfterBind ||
_enabledDescriptorIndexingFeatures.descriptorBindingSampledImageUpdateAfterBind ||
_enabledDescriptorIndexingFeatures.descriptorBindingStorageImageUpdateAfterBind ||
@@ -3680,7 +3680,7 @@
void MVKDevice::startAutoGPUCapture(MVKConfigAutoGPUCaptureScope autoGPUCaptureScope, id mtlCaptureObject) {
- if (_isCurrentlyAutoGPUCapturing || (mvkGetMVKConfiguration()->autoGPUCaptureScope != autoGPUCaptureScope)) { return; }
+ if (_isCurrentlyAutoGPUCapturing || (mvkConfig()->autoGPUCaptureScope != autoGPUCaptureScope)) { return; }
_isCurrentlyAutoGPUCapturing = true;
@@ -3692,7 +3692,7 @@
captureDesc.captureObject = mtlCaptureObject;
captureDesc.destination = MTLCaptureDestinationDeveloperTools;
- const char* filePath = mvkGetMVKConfiguration()->autoGPUCaptureOutputFilepath;
+ const char* filePath = mvkConfig()->autoGPUCaptureOutputFilepath;
if (strlen(filePath)) {
if ([captureMgr respondsToSelector: @selector(supportsDestination:)] &&
[captureMgr supportsDestination: MTLCaptureDestinationGPUTraceDocument] ) {
@@ -3728,7 +3728,7 @@
}
void MVKDevice::stopAutoGPUCapture(MVKConfigAutoGPUCaptureScope autoGPUCaptureScope) {
- if (_isCurrentlyAutoGPUCapturing && mvkGetMVKConfiguration()->autoGPUCaptureScope == autoGPUCaptureScope) {
+ if (_isCurrentlyAutoGPUCapturing && mvkConfig()->autoGPUCaptureScope == autoGPUCaptureScope) {
[[MTLCaptureManager sharedCaptureManager] stopCapture];
_isCurrentlyAutoGPUCapturing = false;
}
@@ -3787,8 +3787,8 @@
void MVKDevice::initPerformanceTracking() {
- _isPerformanceTracking = mvkGetMVKConfiguration()->performanceTracking;
- _logActivityPerformanceInline = mvkGetMVKConfiguration()->logActivityPerformanceInline;
+ _isPerformanceTracking = mvkConfig()->performanceTracking;
+ _logActivityPerformanceInline = mvkConfig()->logActivityPerformanceInline;
MVKPerformanceTracker initPerf;
initPerf.count = 0;
@@ -3839,8 +3839,8 @@
_pMemoryProperties = &_physicalDevice->_memoryProperties;
// Indicate whether semaphores should use a MTLFence or MTLEvent if they are available.
- _useMTLFenceForSemaphores = _pMetalFeatures->fences && mvkGetMVKConfiguration()->semaphoreUseMTLFence;
- _useMTLEventForSemaphores = _pMetalFeatures->events && mvkGetMVKConfiguration()->semaphoreUseMTLEvent;
+ _useMTLFenceForSemaphores = _pMetalFeatures->fences && mvkConfig()->semaphoreUseMTLFence;
+ _useMTLEventForSemaphores = _pMetalFeatures->events && mvkConfig()->semaphoreUseMTLEvent;
MVKLogInfo("Using %s for Vulkan semaphores.", _useMTLFenceForSemaphores ? "MTLFence" : (_useMTLEventForSemaphores ? "MTLEvent" : "emulation"));
}
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
index d72d8a8..c2785f4 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
@@ -983,7 +983,7 @@
if (validSamples == VK_SAMPLE_COUNT_1_BIT) { return validSamples; }
// Don't use getImageType() because it hasn't been set yet.
- if ( !((pCreateInfo->imageType == VK_IMAGE_TYPE_2D) || ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && mvkGetMVKConfiguration()->texture1DAs2D)) ) {
+ if ( !((pCreateInfo->imageType == VK_IMAGE_TYPE_2D) || ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && mvkConfig()->texture1DAs2D)) ) {
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, multisampling can only be used with a 2D image type. Setting sample count to 1."));
validSamples = VK_SAMPLE_COUNT_1_BIT;
}
@@ -1476,7 +1476,7 @@
_imageView->_usage,
_imageView,
_device->_pMetalFeatures->nativeTextureSwizzle,
- mvkGetMVKConfiguration()->fullImageViewSwizzle,
+ mvkConfig()->fullImageViewSwizzle,
_mtlPixFmt,
useSwizzle));
_packedSwizzle = (useSwizzle) ? mvkPackSwizzle(pCreateInfo->components) : 0;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.h b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.h
index 813e2c3..434f44f 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.h
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.h
@@ -49,7 +49,7 @@
bool isEnabled(uint32_t enabledVersion, const MVKExtensionList& extList) {
return ((isCore() && MVK_VULKAN_API_VERSION_CONFORM(enabledVersion) >= apiVersion) ||
(extList.isEnabled(ext1Name) || extList.isEnabled(ext2Name) ||
- !mvkIsAnyFlagEnabled(mvkGetMVKConfiguration()->advertiseExtensions,
+ !mvkIsAnyFlagEnabled(mvkConfig()->advertiseExtensions,
MVK_CONFIG_ADVERTISE_EXTENSIONS_ALL)));
}
} MVKEntryPoint;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm
index fdc72a2..c206921 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm
@@ -292,7 +292,7 @@
#if MVK_MACOS
NSArray* rawMTLDevs = [MTLCopyAllDevices() autorelease];
if (rawMTLDevs) {
- bool forceLowPower = mvkGetMVKConfiguration()->forceLowPowerGPU;
+ bool forceLowPower = mvkConfig()->forceLowPowerGPU;
// Populate the array of appropriate MTLDevices
for (id<MTLDevice> md in rawMTLDevs) {
@@ -684,7 +684,7 @@
MVKExtensionList allExtns(this, true);
MVKLogInfo("MoltenVK version %s, supporting Vulkan version %s.\n\tThe following %d Vulkan extensions are supported:%s",
mvkGetMoltenVKVersionString(MVK_VERSION).c_str(),
- mvkGetVulkanVersionString(mvkGetMVKConfiguration()->apiVersionToAdvertise).c_str(),
+ mvkGetVulkanVersionString(mvkConfig()->apiVersionToAdvertise).c_str(),
allExtns.getEnabledCount(),
allExtns.enabledNamesString("\n\t\t", true).c_str());
}
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
index 43c90a8..792d768 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
@@ -174,7 +174,7 @@
MVKVulkanAPIDeviceObject(device),
_pipelineCache(pipelineCache),
_pushConstantsMTLResourceIndexes(layout->getPushConstantBindings()),
- _fullImageViewSwizzle(mvkGetMVKConfiguration()->fullImageViewSwizzle) {}
+ _fullImageViewSwizzle(mvkConfig()->fullImageViewSwizzle) {}
#pragma mark -
@@ -1472,11 +1472,11 @@
}
}
- shaderContext.options.mslOptions.texture_1D_as_2D = mvkGetMVKConfiguration()->texture1DAs2D;
+ shaderContext.options.mslOptions.texture_1D_as_2D = mvkConfig()->texture1DAs2D;
shaderContext.options.mslOptions.enable_point_size_builtin = isRenderingPoints(pCreateInfo) || reflectData.pointMode;
shaderContext.options.mslOptions.enable_frag_depth_builtin = pixFmts->isDepthFormat(mtlDSFormat);
shaderContext.options.mslOptions.enable_frag_stencil_ref_builtin = pixFmts->isStencilFormat(mtlDSFormat);
- shaderContext.options.shouldFlipVertexY = mvkGetMVKConfiguration()->shaderConversionFlipVertexY;
+ shaderContext.options.shouldFlipVertexY = mvkConfig()->shaderConversionFlipVertexY;
shaderContext.options.mslOptions.swizzle_texture_samples = _fullImageViewSwizzle && !getDevice()->_pMetalFeatures->nativeTextureSwizzle;
shaderContext.options.mslOptions.tess_domain_origin_lower_left = pTessDomainOriginState && pTessDomainOriginState->domainOrigin == VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT;
shaderContext.options.mslOptions.multiview = mvkRendPass->isMultiview();
@@ -1689,7 +1689,7 @@
shaderContext.options.mslOptions.swizzle_texture_samples = _fullImageViewSwizzle && !getDevice()->_pMetalFeatures->nativeTextureSwizzle;
shaderContext.options.mslOptions.texture_buffer_native = _device->_pMetalFeatures->textureBuffers;
shaderContext.options.mslOptions.dispatch_base = _allowsDispatchBase;
- shaderContext.options.mslOptions.texture_1D_as_2D = mvkGetMVKConfiguration()->texture1DAs2D;
+ shaderContext.options.mslOptions.texture_1D_as_2D = mvkConfig()->texture1DAs2D;
shaderContext.options.mslOptions.fixed_subgroup_size = mvkIsAnyFlagEnabled(pSS->flags, VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT) ? 0 : _device->_pMetalFeatures->maxSubgroupSize;
#if MVK_MACOS
shaderContext.options.mslOptions.emulate_subgroups = !_device->_pMetalFeatures->simdPermute;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKQueryPool.mm b/MoltenVK/MoltenVK/GPUObjects/MVKQueryPool.mm
index db18657..351e321 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKQueryPool.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKQueryPool.mm
@@ -330,7 +330,7 @@
MVKOcclusionQueryPool::MVKOcclusionQueryPool(MVKDevice* device,
const VkQueryPoolCreateInfo* pCreateInfo) : MVKQueryPool(device, pCreateInfo, 1) {
- if (mvkGetMVKConfiguration()->supportLargeQueryPools) {
+ if (mvkConfig()->supportLargeQueryPools) {
_queryIndexOffset = 0;
// Ensure we don't overflow the maximum number of queries
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKQueue.mm b/MoltenVK/MoltenVK/GPUObjects/MVKQueue.mm
index 7e549b3..9801203 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKQueue.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKQueue.mm
@@ -38,7 +38,7 @@
id<MTLCommandQueue> mtlQ = _mtlQueues[queueIndex];
if ( !mtlQ ) {
@autoreleasepool { // Catch any autoreleased objects created during MTLCommandQueue creation
- uint32_t maxCmdBuffs = mvkGetMVKConfiguration()->maxActiveMetalCommandBuffersPerQueue;
+ uint32_t maxCmdBuffs = mvkConfig()->maxActiveMetalCommandBuffersPerQueue;
mtlQ = [_physicalDevice->getMTLDevice() newCommandQueueWithMaxCommandBufferCount: maxCmdBuffs]; // retained
_mtlQueues[queueIndex] = mtlQ;
}
@@ -150,7 +150,7 @@
if ([_mtlQueue respondsToSelector: @selector(commandBufferWithDescriptor:)]) {
MTLCommandBufferDescriptor* mtlCmdBuffDesc = [MTLCommandBufferDescriptor new]; // temp retain
mtlCmdBuffDesc.retainedReferences = retainRefs;
- if (mvkGetMVKConfiguration()->debugMode) {
+ if (mvkConfig()->debugMode) {
mtlCmdBuffDesc.errorOptions |= MTLCommandBufferErrorOptionEncoderExecutionStatus;
}
id<MTLCommandBuffer> cmdBuff = [_mtlQueue commandBufferWithDescriptor: mtlCmdBuffDesc];
@@ -192,7 +192,7 @@
void MVKQueue::initExecQueue() {
_execQueue = nil;
- if ( !mvkGetMVKConfiguration()->synchronousQueueSubmits ) {
+ if ( !mvkConfig()->synchronousQueueSubmits ) {
// Determine the dispatch queue priority
dispatch_qos_class_t dqQOS = MVK_DISPATCH_QUEUE_QOS_CLASS;
int dqPriority = (1.0 - _priority) * QOS_MIN_RELATIVE_PRIORITY;
@@ -214,7 +214,7 @@
void MVKQueue::initGPUCaptureScopes() {
_submissionCaptureScope = new MVKGPUCaptureScope(this);
- const MVKConfiguration* pMVKConfig = mvkGetMVKConfiguration();
+ const MVKConfiguration* pMVKConfig = mvkConfig();
if (_queueFamily->getIndex() == pMVKConfig->defaultGPUCaptureScopeQueueFamilyIndex &&
_index == pMVKConfig->defaultGPUCaptureScopeQueueIndex) {
@@ -340,7 +340,7 @@
break;
}
#if MVK_XCODE_12
- if (mvkGetMVKConfiguration()->debugMode) {
+ if (mvkConfig()->debugMode) {
if (&MTLCommandBufferEncoderInfoErrorKey != nullptr) {
if (NSArray<id<MTLCommandBufferEncoderInfo>>* mtlEncInfo = mtlCB.error.userInfo[MTLCommandBufferEncoderInfoErrorKey]) {
MVKLogInfo("Encoders for %p \"%s\":", mtlCB, mtlCB.label ? mtlCB.label.UTF8String : "");
@@ -359,7 +359,7 @@
#endif
}
#if MVK_XCODE_12
- if (mvkGetMVKConfiguration()->debugMode) {
+ if (mvkConfig()->debugMode) {
bool isFirstMsg = true;
for (id<MTLFunctionLog> log in mtlCB.logs) {
if (isFirstMsg) {
@@ -473,7 +473,7 @@
}
void MVKQueuePresentSurfaceSubmission::stopAutoGPUCapture() {
- const MVKConfiguration* pMVKConfig = mvkGetMVKConfiguration();
+ const MVKConfiguration* pMVKConfig = mvkConfig();
if (_queue->_queueFamily->getIndex() == pMVKConfig->defaultGPUCaptureScopeQueueFamilyIndex &&
_queue->_index == pMVKConfig->defaultGPUCaptureScopeQueueIndex) {
_queue->getDevice()->stopAutoGPUCapture(MVK_CONFIG_AUTO_GPU_CAPTURE_SCOPE_FRAME);
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKShaderModule.mm b/MoltenVK/MoltenVK/GPUObjects/MVKShaderModule.mm
index 30e8c1b..dead568 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKShaderModule.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKShaderModule.mm
@@ -273,7 +273,7 @@
}
bool MVKShaderModule::convert(SPIRVToMSLConversionConfiguration* pContext) {
- bool shouldLogCode = mvkGetMVKConfiguration()->debugMode;
+ bool shouldLogCode = mvkConfig()->debugMode;
bool shouldLogEstimatedGLSL = shouldLogCode;
// If the SPIR-V converter does not have any code, but the GLSL converter does,
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm b/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
index a472342..6f834a8 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
@@ -123,7 +123,7 @@
// If the product has not been fully licensed, renders the watermark image to the surface.
void MVKSwapchain::renderWatermark(id<MTLTexture> mtlTexture, id<MTLCommandBuffer> mtlCmdBuff) {
- if (mvkGetMVKConfiguration()->displayWatermark) {
+ if (mvkConfig()->displayWatermark) {
if ( !_licenseWatermark ) {
_licenseWatermark = new MVKWatermarkRandom(getMTLDevice(),
__watermarkTextureContent,
@@ -144,7 +144,7 @@
// Calculates and remembers the time interval between frames.
void MVKSwapchain::markFrameInterval() {
- if ( !(mvkGetMVKConfiguration()->performanceTracking || _licenseWatermark) ) { return; }
+ if ( !(mvkConfig()->performanceTracking || _licenseWatermark) ) { return; }
uint64_t prevFrameTime = _lastFrameTime;
_lastFrameTime = mvkGetTimestamp();
@@ -153,7 +153,7 @@
_device->addActivityPerformance(_device->_performanceStatistics.queue.frameInterval, prevFrameTime, _lastFrameTime);
- uint32_t perfLogCntLimit = mvkGetMVKConfiguration()->performanceLoggingFrameCount;
+ uint32_t perfLogCntLimit = mvkConfig()->performanceLoggingFrameCount;
if ((perfLogCntLimit > 0) && (++_currentPerfLogFrameCount >= perfLogCntLimit)) {
_currentPerfLogFrameCount = 0;
MVKLogInfo("Performance statistics reporting every: %d frames, avg FPS: %.2f, elapsed time: %.3f seconds:",
@@ -271,7 +271,7 @@
_mtlLayer.pixelFormat = getPixelFormats()->getMTLPixelFormat(pCreateInfo->imageFormat);
_mtlLayer.maximumDrawableCountMVK = imgCnt;
_mtlLayer.displaySyncEnabledMVK = (pCreateInfo->presentMode != VK_PRESENT_MODE_IMMEDIATE_KHR);
- _mtlLayer.magnificationFilter = mvkGetMVKConfiguration()->swapchainMagFilterUseNearest ? kCAFilterNearest : kCAFilterLinear;
+ _mtlLayer.magnificationFilter = mvkConfig()->swapchainMagFilterUseNearest ? kCAFilterNearest : kCAFilterLinear;
_mtlLayer.framebufferOnly = !mvkIsAnyFlagEnabled(pCreateInfo->imageUsage, (VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_TRANSFER_DST_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT |
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm b/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm
index c9d26e1..ddfc6ff 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm
@@ -521,7 +521,7 @@
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ @autoreleasepool { block(); } });
// Limit timeout to avoid overflow since wait_for() uses wait_until()
- chrono::nanoseconds nanoTimeout(min(mvkGetMVKConfiguration()->metalCompileTimeout, kMVKUndefinedLargeUInt64));
+ chrono::nanoseconds nanoTimeout(min(mvkConfig()->metalCompileTimeout, kMVKUndefinedLargeUInt64));
_blocker.wait_for(lock, nanoTimeout, [this]{ return _isCompileDone; });
if ( !_isCompileDone ) {
diff --git a/MoltenVK/MoltenVK/Layers/MVKExtensions.mm b/MoltenVK/MoltenVK/Layers/MVKExtensions.mm
index 832c000..1e866f1 100644
--- a/MoltenVK/MoltenVK/Layers/MVKExtensions.mm
+++ b/MoltenVK/MoltenVK/Layers/MVKExtensions.mm
@@ -51,7 +51,7 @@
// If the config indicates that not all supported extensions should be advertised,
// only advertise those supported extensions that have been specifically configured.
- auto advExtns = mvkGetMVKConfiguration()->advertiseExtensions;
+ auto advExtns = mvkConfig()->advertiseExtensions;
if ( !mvkIsAnyFlagEnabled(advExtns, MVK_CONFIG_ADVERTISE_EXTENSIONS_ALL) ) {
if (mvkIsAnyFlagEnabled(advExtns, MVK_CONFIG_ADVERTISE_EXTENSIONS_MOLTENVK)) {
MVK_EXTENSION_MIN_OS(MVK_MOLTENVK, 10.11, 8.0)
diff --git a/MoltenVK/MoltenVK/Layers/MVKLayers.mm b/MoltenVK/MoltenVK/Layers/MVKLayers.mm
index ddbc790..8a26260 100644
--- a/MoltenVK/MoltenVK/Layers/MVKLayers.mm
+++ b/MoltenVK/MoltenVK/Layers/MVKLayers.mm
@@ -45,7 +45,7 @@
strcpy(_layerProperties.layerName, "MoltenVK");
mvkClear(_layerProperties.description, VK_MAX_DESCRIPTION_SIZE);
strcpy(_layerProperties.description, "MoltenVK driver layer");
- _layerProperties.specVersion = mvkGetMVKConfiguration()->apiVersionToAdvertise;
+ _layerProperties.specVersion = mvkConfig()->apiVersionToAdvertise;
_layerProperties.implementationVersion = MVK_VERSION;
((MVKExtensionList*)&_supportedInstanceExtensions)->disableAllButEnabledInstanceExtensions();
diff --git a/MoltenVK/MoltenVK/Utility/MVKBaseObject.mm b/MoltenVK/MoltenVK/Utility/MVKBaseObject.mm
index 8d52b74..1337573 100644
--- a/MoltenVK/MoltenVK/Utility/MVKBaseObject.mm
+++ b/MoltenVK/MoltenVK/Utility/MVKBaseObject.mm
@@ -79,7 +79,7 @@
MVKVulkanAPIObject* mvkAPIObj = mvkObj ? mvkObj->getVulkanAPIObject() : nullptr;
MVKInstance* mvkInst = mvkAPIObj ? mvkAPIObj->getInstance() : nullptr;
bool hasDebugCallbacks = mvkInst && mvkInst->hasDebugCallbacks();
- bool shouldLog = (aslLvl < (mvkGetMVKConfiguration()->logLevel << 2));
+ bool shouldLog = (aslLvl < (mvkConfig()->logLevel << 2));
// Fail fast to avoid further unnecessary processing.
if ( !(shouldLog || hasDebugCallbacks) ) { return; }
diff --git a/MoltenVK/MoltenVK/Utility/MVKEnvironment.cpp b/MoltenVK/MoltenVK/Utility/MVKEnvironment.cpp
index 86fbaa4..840cd7d 100644
--- a/MoltenVK/MoltenVK/Utility/MVKEnvironment.cpp
+++ b/MoltenVK/MoltenVK/Utility/MVKEnvironment.cpp
@@ -61,7 +61,7 @@
MVK_SET_FROM_ENV_OR_BUILD_INT32 (evCfg.apiVersionToAdvertise, MVK_CONFIG_API_VERSION_TO_ADVERTISE);
MVK_SET_FROM_ENV_OR_BUILD_INT32 (evCfg.advertiseExtensions, MVK_CONFIG_ADVERTISE_EXTENSIONS);
- mvkSetMVKConfiguration(&evCfg);
+ mvkSetConfig(&evCfg);
}
static MVKConfiguration _mvkConfig;
@@ -70,7 +70,7 @@
// Returns the MoltenVK config, lazily initializing it if necessary.
// We initialize lazily instead of in a library constructor function to
// ensure the NSProcessInfo environment is available when called upon.
-const MVKConfiguration* mvkGetMVKConfiguration() {
+const MVKConfiguration* mvkConfig() {
if ( !_mvkConfigInitialized ) {
mvkInitConfigFromEnvVars();
}
@@ -80,7 +80,7 @@
// Sets config content, and updates any content that needs baking, including copying the contents
// of strings from the incoming MVKConfiguration member to a corresponding std::string, and then
// repointing the MVKConfiguration member to the contents of the std::string.
-void mvkSetMVKConfiguration(MVKConfiguration* pMVKConfig) {
+void mvkSetConfig(MVKConfiguration* pMVKConfig) {
_mvkConfig = *pMVKConfig;
// Ensure the API version is supported, and add the VK_HEADER_VERSION.
diff --git a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
index 5a7e67a..b41bdd1 100644
--- a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
+++ b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
@@ -76,10 +76,10 @@
#pragma mark Global Configuration
/** Global function to access MoltenVK configuration info. */
-const MVKConfiguration* mvkGetMVKConfiguration();
+const MVKConfiguration* mvkConfig();
/** Global function to update MoltenVK configuration info. */
-void mvkSetMVKConfiguration(MVKConfiguration* pMVKConfig);
+void mvkSetConfig(MVKConfiguration* pMVKConfig);
/** Flip the vertex coordinate in shaders. Enabled by default. */
#ifndef MVK_CONFIG_SHADER_CONVERSION_FLIP_VERTEX_Y
diff --git a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
index 3545d6a..1a9751c 100644
--- a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
+++ b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
@@ -144,7 +144,7 @@
bool isMultisample) {
switch (vkImageType) {
case VK_IMAGE_TYPE_3D: return MTLTextureType3D;
- case VK_IMAGE_TYPE_1D: return (mvkGetMVKConfiguration()->texture1DAs2D
+ case VK_IMAGE_TYPE_1D: return (mvkConfig()->texture1DAs2D
? mvkMTLTextureTypeFromVkImageType(VK_IMAGE_TYPE_2D, arraySize, isMultisample)
: (arraySize > 1 ? MTLTextureType1DArray : MTLTextureType1D));
case VK_IMAGE_TYPE_2D:
@@ -176,8 +176,8 @@
case VK_IMAGE_VIEW_TYPE_3D: return MTLTextureType3D;
case VK_IMAGE_VIEW_TYPE_CUBE: return MTLTextureTypeCube;
case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY: return MTLTextureTypeCubeArray;
- case VK_IMAGE_VIEW_TYPE_1D: return mvkGetMVKConfiguration()->texture1DAs2D ? mvkMTLTextureTypeFromVkImageViewType(VK_IMAGE_VIEW_TYPE_2D, isMultisample) : MTLTextureType1D;
- case VK_IMAGE_VIEW_TYPE_1D_ARRAY: return mvkGetMVKConfiguration()->texture1DAs2D ? mvkMTLTextureTypeFromVkImageViewType(VK_IMAGE_VIEW_TYPE_2D_ARRAY, isMultisample) : MTLTextureType1DArray;
+ case VK_IMAGE_VIEW_TYPE_1D: return mvkConfig()->texture1DAs2D ? mvkMTLTextureTypeFromVkImageViewType(VK_IMAGE_VIEW_TYPE_2D, isMultisample) : MTLTextureType1D;
+ case VK_IMAGE_VIEW_TYPE_1D_ARRAY: return mvkConfig()->texture1DAs2D ? mvkMTLTextureTypeFromVkImageViewType(VK_IMAGE_VIEW_TYPE_2D_ARRAY, isMultisample) : MTLTextureType1DArray;
case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
#if MVK_MACOS
diff --git a/MoltenVK/MoltenVK/Vulkan/vk_mvk_moltenvk.mm b/MoltenVK/MoltenVK/Vulkan/vk_mvk_moltenvk.mm
index aedcbc1..7de9788 100644
--- a/MoltenVK/MoltenVK/Vulkan/vk_mvk_moltenvk.mm
+++ b/MoltenVK/MoltenVK/Vulkan/vk_mvk_moltenvk.mm
@@ -53,7 +53,7 @@
MVKConfiguration* pConfiguration,
size_t* pConfigurationSize) {
- return mvkCopy(pConfiguration, mvkGetMVKConfiguration(), pConfigurationSize);
+ return mvkCopy(pConfiguration, mvkConfig(), pConfigurationSize);
}
MVK_PUBLIC_SYMBOL VkResult vkSetMoltenVKConfigurationMVK(
@@ -62,9 +62,9 @@
size_t* pConfigurationSize) {
// Start with current config, in case incoming is not fully copied
- MVKConfiguration mvkConfig = *mvkGetMVKConfiguration();
- VkResult rslt = mvkCopy(&mvkConfig, pConfiguration, pConfigurationSize);
- mvkSetMVKConfiguration(&mvkConfig);
+ MVKConfiguration mvkCfg = *mvkConfig();
+ VkResult rslt = mvkCopy(&mvkCfg, pConfiguration, pConfigurationSize);
+ mvkSetConfig(&mvkCfg);
return rslt;
}
@@ -99,7 +99,7 @@
len = mvkVer.copy(pMoltenVersionStringBuffer, moltenVersionStringBufferLength - 1);
pMoltenVersionStringBuffer[len] = 0; // terminator
- string vkVer = mvkGetVulkanVersionString(mvkGetMVKConfiguration()->apiVersionToAdvertise);
+ string vkVer = mvkGetVulkanVersionString(mvkConfig()->apiVersionToAdvertise);
len = vkVer.copy(pVulkanVersionStringBuffer, vulkanVersionStringBufferLength - 1);
pVulkanVersionStringBuffer[len] = 0; // terminator
}
diff --git a/MoltenVK/MoltenVK/Vulkan/vulkan.mm b/MoltenVK/MoltenVK/Vulkan/vulkan.mm
index 8f62420..014ae8a 100644
--- a/MoltenVK/MoltenVK/Vulkan/vulkan.mm
+++ b/MoltenVK/MoltenVK/Vulkan/vulkan.mm
@@ -50,7 +50,7 @@
// Optionally log start of function calls to stderr
static inline uint64_t MVKTraceVulkanCallStartImpl(const char* funcName) {
- MVKConfigTraceVulkanCalls traceLvl = mvkGetMVKConfiguration()->traceVulkanCalls;
+ MVKConfigTraceVulkanCalls traceLvl = mvkConfig()->traceVulkanCalls;
if (traceLvl == MVK_CONFIG_TRACE_VULKAN_CALLS_NONE ||
traceLvl > MVK_CONFIG_TRACE_VULKAN_CALLS_DURATION) { return 0; }
@@ -72,7 +72,7 @@
// Optionally log end of function calls and timings to stderr
static inline void MVKTraceVulkanCallEndImpl(const char* funcName, uint64_t startTime) {
- switch(mvkGetMVKConfiguration()->traceVulkanCalls) {
+ switch(mvkConfig()->traceVulkanCalls) {
case MVK_CONFIG_TRACE_VULKAN_CALLS_DURATION:
fprintf(stderr, "[mvk-trace] } %s [%.4f ms]\n", funcName, mvkGetElapsedMilliseconds(startTime));
break;
@@ -1908,7 +1908,7 @@
uint32_t* pApiVersion) {
MVKTraceVulkanCallStart();
- *pApiVersion = mvkGetMVKConfiguration()->apiVersionToAdvertise;
+ *pApiVersion = mvkConfig()->apiVersionToAdvertise;
MVKTraceVulkanCallEnd();
return VK_SUCCESS;
}