Merge pull request #1179 from js6i/no_fast_math
Config: Added setting for fastMathEnabled Metal Compiler option.
This commit is contained in:
commit
b8f044eaaf
@ -558,6 +558,19 @@ typedef struct {
|
||||
*/
|
||||
uint32_t defaultGPUCaptureScopeQueueIndex;
|
||||
|
||||
/**
|
||||
* Corresponds to the fastMathEnabled property of MTLCompileOptions.
|
||||
* Setting it may cause the Metal Compiler to optimize floating point operations
|
||||
* in ways that may violate the IEEE 754 standard.
|
||||
*
|
||||
* Must be changed before creating a VkDevice, for the change to take effect.
|
||||
*
|
||||
* The initial value or this parameter is set by the
|
||||
* MVK_CONFIG_FAST_MATH_ENABLED
|
||||
* runtime environment variable or MoltenVK compile-time build setting.
|
||||
* If neither is set, the value of this parameter defaults to false.
|
||||
*/
|
||||
VkBool32 fastMathEnabled;
|
||||
} MVKConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -4086,6 +4086,7 @@ void MVKDevice::reservePrivateData(const VkDeviceCreateInfo* pCreateInfo) {
|
||||
void MVKDevice::initMTLCompileOptions() {
|
||||
_mtlCompileOptions = [MTLCompileOptions new]; // retained
|
||||
_mtlCompileOptions.languageVersion = _pMetalFeatures->mslVersionEnum;
|
||||
_mtlCompileOptions.fastMathEnabled = _pMVKConfig->fastMathEnabled;
|
||||
}
|
||||
|
||||
MVKDevice::~MVKDevice() {
|
||||
|
@ -710,6 +710,7 @@ void MVKInstance::initConfig() {
|
||||
MVK_SET_FROM_ENV_OR_BUILD_BOOL( _mvkConfig.fullImageViewSwizzle, MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE);
|
||||
MVK_SET_FROM_ENV_OR_BUILD_BOOL( _mvkConfig.defaultGPUCaptureScopeQueueFamilyIndex, MVK_CONFIG_DEFAULT_GPU_CAPTURE_SCOPE_QUEUE_FAMILY_INDEX);
|
||||
MVK_SET_FROM_ENV_OR_BUILD_BOOL( _mvkConfig.defaultGPUCaptureScopeQueueIndex, MVK_CONFIG_DEFAULT_GPU_CAPTURE_SCOPE_QUEUE_INDEX);
|
||||
MVK_SET_FROM_ENV_OR_BUILD_BOOL( _mvkConfig.fastMathEnabled, MVK_CONFIG_FAST_MATH_ENABLED);
|
||||
|
||||
MVK_SET_FROM_ENV_OR_BUILD_INT32(_autoGPUCaptureScope, MVK_CONFIG_AUTO_GPU_CAPTURE_SCOPE);
|
||||
MVK_SET_FROM_ENV_OR_BUILD_STRING(_autoGPUCaptureOutputFile, MVK_CONFIG_AUTO_GPU_CAPTURE_OUTPUT_FILE);
|
||||
|
@ -138,6 +138,11 @@
|
||||
# define MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE 0
|
||||
#endif
|
||||
|
||||
/** Set the fastMathEnabled Metal Compiler option. Disabled by default. */
|
||||
#ifndef MVK_CONFIG_FAST_MATH_ENABLED
|
||||
# define MVK_CONFIG_FAST_MATH_ENABLED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The index of the queue family whose presentation submissions will
|
||||
* be used as the default GPU Capture Scope during debugging in Xcode.
|
||||
|
Loading…
x
Reference in New Issue
Block a user