Merge pull request #1243 from billhollings/config-strings

Test for null string on MVKConfiguration copy.
This commit is contained in:
Bill Hollings 2021-02-08 07:14:08 -05:00 committed by GitHub
commit 84c6095fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -32,7 +32,7 @@ Released TBD
- `Makefile` and `fetchDependencies` support `xcpretty` (if available)
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to `30`.
- Update copyright notices to year 2021.
- Update Xcode build settings check to _Xcode 12.3_.
- Update Xcode build settings check to _Xcode 12.4_.

View File

@ -59,7 +59,7 @@ static void mvkInitConfig() {
MVK_SET_FROM_ENV_OR_BUILD_BOOL (_mvkConfig.texture1DAs2D, MVK_CONFIG_TEXTURE_1D_AS_2D);
MVK_SET_FROM_ENV_OR_BUILD_BOOL (_mvkConfig.preallocateDescriptors, MVK_CONFIG_PREALLOCATE_DESCRIPTORS);
MVK_SET_FROM_ENV_OR_BUILD_BOOL (_mvkConfig.useCommandPooling, MVK_CONFIG_USE_COMMAND_POOLING);
MVK_SET_FROM_ENV_OR_BUILD_BOOL (_mvkConfig.useMTLHeap, MVK_CONFIG_USE_MTLHEAP);
MVK_SET_FROM_ENV_OR_BUILD_BOOL (_mvkConfig.useMTLHeap, MVK_CONFIG_USE_MTLHEAP);
}
// Returns the MoltenVK config, lazily initializing it if necessary.
@ -77,6 +77,8 @@ const MVKConfiguration* mvkGetMVKConfiguration() {
// and then repointing the MVKConfiguration member to the contents of the std::string.
void mvkSetMVKConfiguration(MVKConfiguration* pMVKConfig) {
_mvkConfig = *pMVKConfig;
_autoGPUCaptureOutputFile = _mvkConfig.autoGPUCaptureOutputFilepath;
if (_mvkConfig.autoGPUCaptureOutputFilepath) {
_autoGPUCaptureOutputFile = _mvkConfig.autoGPUCaptureOutputFilepath;
}
_mvkConfig.autoGPUCaptureOutputFilepath = (char*)_autoGPUCaptureOutputFile.c_str();
}

View File

@ -61,7 +61,7 @@ MVK_PUBLIC_SYMBOL VkResult vkSetMoltenVKConfigurationMVK(
const MVKConfiguration* pConfiguration,
size_t* pConfigurationSize) {
MVKConfiguration mvkConfig;
MVKConfiguration mvkConfig = {}; // Ensure initialized in case not fully copied
VkResult rslt = mvkCopy(&mvkConfig, pConfiguration, pConfigurationSize);
mvkSetMVKConfiguration(&mvkConfig);
return rslt;