API: Add MVKPhysicalDeviceMetalFeatures::depthSampleCompare.

Set MTLSamplerDescriptor.compareFunction only if depthSampleCompare enabled.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 19.
This commit is contained in:
Bill Hollings 2019-04-02 00:40:57 -04:00
parent 6a77fc950a
commit 75a088dbe0
4 changed files with 17 additions and 5 deletions

View File

@ -25,6 +25,7 @@ Released TBD
- Add support for tracking device features enabled during `vkCreateDevice()`.
- Handle surface loss due to window moved between screens or a window style change.
- Allow zero offset and stride combo in `VkVertexInputBindingDescription`.
- API: Add MVKPhysicalDeviceMetalFeatures::depthSampleCompare.
- Fix conditions under which functions return `VK_INCOMPLETE`.
- Fix potential memory leak on synchronous command buffer submission.
- Increase shader float constant accuracy beyond 6 digits of precision.
@ -39,13 +40,15 @@ Released TBD
- Fixed crash within `MVKPushConstantsCommandEncoderState` when accessing absent
graphics pipeline during a compute stage.
- Renderpass width/height clamped to the `renderArea` includes offset, not just the extent.
- Set options properly on a buffer view's MTLTextureDescriptor.
- Set options properly on a buffer view's `MTLTextureDescriptor`.
- Don't set `MTLSamplerDescriptor.compareFunction` on devices that don't support it.
- Debug build mode includes `dSYM` file for each `dylib` file.
- Explicitly build dSYM files in `BUILT_PRODUCTS_DIR` to avoid conflict between
macOS and iOS build locations.
- `Makefile` supports `install` target to install `MoltenVK.framework`
into `/Library/Frameworks/`.
Support Xcode 10.2.
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to 19.
- Update to latest SPIRV-Cross version:
- MSL: Add support for Metal 2 indirect argument buffers.
- MSL: Add support for tessellation control & evaluation shaders.

View File

@ -55,7 +55,7 @@ typedef unsigned long MTLLanguageVersion;
#define MVK_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch))
#define MVK_VERSION MVK_MAKE_VERSION(MVK_VERSION_MAJOR, MVK_VERSION_MINOR, MVK_VERSION_PATCH)
#define VK_MVK_MOLTENVK_SPEC_VERSION 18
#define VK_MVK_MOLTENVK_SPEC_VERSION 19
#define VK_MVK_MOLTENVK_EXTENSION_NAME "VK_MVK_moltenvk"
/**
@ -515,6 +515,7 @@ typedef struct {
VkBool32 arrayOfTextures; /**< If true, arrays of textures is supported. */
VkBool32 arrayOfSamplers; /**< If true, arrays of texture samplers is supported. */
MTLLanguageVersion mslVersionEnum; /**< The version of the Metal Shading Language available on this device, as a Metal enumeration. */
VkBool32 depthSampleCompare; /**< If true, depth texture samplers support the comparison of the pixel value against a reference value. */
} MVKPhysicalDeviceMetalFeatures;
/**

View File

@ -742,6 +742,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
_metalFeatures.combinedStoreResolveAction = true;
_metalFeatures.mtlBufferAlignment = 16; // Min float4 alignment for typical vertex buffers. MTLBuffer may go down to 4 bytes for other data.
_metalFeatures.maxTextureDimension = (16 * KIBI);
_metalFeatures.depthSampleCompare = true;
}
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v2] ) {
@ -766,6 +767,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
_metalFeatures.baseVertexInstanceDrawing = true;
_metalFeatures.layeredRendering = true;
_metalFeatures.maxTextureDimension = (16 * KIBI);
_metalFeatures.depthSampleCompare = true;
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v2] ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion1_2;

View File

@ -993,9 +993,15 @@ MTLSamplerDescriptor* MVKSampler::getMTLSamplerDescriptor(const VkSamplerCreateI
? mvkClamp(pCreateInfo->maxAnisotropy, 1.0f, _device->_pProperties->limits.maxSamplerAnisotropy)
: 1);
mtlSampDesc.normalizedCoordinates = !pCreateInfo->unnormalizedCoordinates;
mtlSampDesc.compareFunctionMVK = (pCreateInfo->compareEnable
? mvkMTLCompareFunctionFromVkCompareOp(pCreateInfo->compareOp)
: MTLCompareFunctionNever);
if (pCreateInfo->compareEnable) {
if (_device->_pMetalFeatures->depthSampleCompare) {
mtlSampDesc.compareFunctionMVK = mvkMTLCompareFunctionFromVkCompareOp(pCreateInfo->compareOp);
} else {
setConfigurationResult(mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateSampler(): Depth texture samplers do not support the comparison of the pixel value against a reference value."));
}
}
#if MVK_MACOS
mtlSampDesc.borderColorMVK = mvkMTLSamplerBorderColorFromVkBorderColor(pCreateInfo->borderColor);
if (_device->getPhysicalDevice()->getMetalFeatures()->samplerClampToBorder) {