Support some more features on iOS.
Dual-source blending is supported on all devices starting with iOS 11. Cube arrays are supported on A11. Layered rendering and multiple viewports are supported on A12.
This commit is contained in:
parent
519b594ae0
commit
ce9afc4745
@ -72,15 +72,11 @@ void MVKViewportCommandEncoderState::setViewports(const MVKVector<MTLViewport> &
|
||||
|
||||
void MVKViewportCommandEncoderState::encodeImpl() {
|
||||
MVKAssert(!_mtlViewports.empty(), "Must specify at least one viewport");
|
||||
#if MVK_MACOS
|
||||
if (_cmdEncoder->getDevice()->_pFeatures->multiViewport) {
|
||||
[_cmdEncoder->_mtlRenderEncoder setViewports: &_mtlViewports[0] count: _mtlViewports.size()];
|
||||
} else {
|
||||
[_cmdEncoder->_mtlRenderEncoder setViewport: _mtlViewports[0]];
|
||||
}
|
||||
#else
|
||||
[_cmdEncoder->_mtlRenderEncoder setViewport: _mtlViewports[0]];
|
||||
#endif
|
||||
}
|
||||
|
||||
void MVKViewportCommandEncoderState::resetImpl() {
|
||||
@ -117,15 +113,11 @@ void MVKScissorCommandEncoderState::encodeImpl() {
|
||||
std::for_each(clippedScissors.begin(), clippedScissors.end(), [this](MTLScissorRect& scissor) {
|
||||
scissor = _cmdEncoder->clipToRenderArea(scissor);
|
||||
});
|
||||
#if MVK_MACOS
|
||||
if (_cmdEncoder->getDevice()->_pFeatures->multiViewport) {
|
||||
[_cmdEncoder->_mtlRenderEncoder setScissorRects: &clippedScissors[0] count: clippedScissors.size()];
|
||||
} else {
|
||||
[_cmdEncoder->_mtlRenderEncoder setScissorRect: clippedScissors[0]];
|
||||
}
|
||||
#else
|
||||
[_cmdEncoder->_mtlRenderEncoder setScissorRect: clippedScissors[0]];
|
||||
#endif
|
||||
}
|
||||
|
||||
void MVKScissorCommandEncoderState::resetImpl() {
|
||||
|
@ -700,10 +700,19 @@ void MVKPhysicalDevice::initFeatures() {
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v2] ) {
|
||||
_features.shaderSampledImageArrayDynamicIndexing = true;
|
||||
_features.shaderStorageImageArrayDynamicIndexing = true;
|
||||
}
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v4] ) {
|
||||
_features.dualSrcBlend = true;
|
||||
}
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily2_v4] ) {
|
||||
_features.depthClamp = true;
|
||||
}
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily4_v1] ) {
|
||||
_features.imageCubeArray = true;
|
||||
}
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1] ) {
|
||||
_features.multiViewport = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MVK_MACOS
|
||||
@ -828,7 +837,15 @@ void MVKPhysicalDevice::initProperties() {
|
||||
_properties.limits.maxImageDimensionCube = _metalFeatures.maxTextureDimension;
|
||||
_properties.limits.maxFramebufferWidth = _metalFeatures.maxTextureDimension;
|
||||
_properties.limits.maxFramebufferHeight = _metalFeatures.maxTextureDimension;
|
||||
#if MVK_IOS
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1] ) {
|
||||
_properties.limits.maxFramebufferLayers = 256;
|
||||
} else {
|
||||
_properties.limits.maxFramebufferLayers = 1;
|
||||
}
|
||||
#else
|
||||
_properties.limits.maxFramebufferLayers = 256;
|
||||
#endif
|
||||
|
||||
_properties.limits.maxViewportDimensions[0] = _metalFeatures.maxTextureDimension;
|
||||
_properties.limits.maxViewportDimensions[1] = _metalFeatures.maxTextureDimension;
|
||||
@ -844,8 +861,13 @@ void MVKPhysicalDevice::initProperties() {
|
||||
} else {
|
||||
_properties.limits.maxViewports = 1;
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
#if MVK_IOS
|
||||
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1] ) {
|
||||
_properties.limits.maxViewports = 16;
|
||||
} else {
|
||||
_properties.limits.maxViewports = 1;
|
||||
}
|
||||
#endif
|
||||
_properties.limits.maxSamplerAnisotropy = 16;
|
||||
|
||||
|
@ -823,9 +823,7 @@ MVK_PUBLIC_SYMBOL MTLTextureType mvkMTLTextureTypeFromVkImageViewType(VkImageVie
|
||||
return MTLTextureType2DArray;
|
||||
case VK_IMAGE_VIEW_TYPE_3D: return MTLTextureType3D;
|
||||
case VK_IMAGE_VIEW_TYPE_CUBE: return MTLTextureTypeCube;
|
||||
#if MVK_MACOS
|
||||
case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY: return MTLTextureTypeCubeArray;
|
||||
#endif
|
||||
default: return MTLTextureType2D;
|
||||
}
|
||||
}
|
||||
@ -1031,19 +1029,10 @@ MVK_PUBLIC_SYMBOL MTLBlendFactor mvkMTLBlendFactorFromVkBlendFactor(VkBlendFacto
|
||||
case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA: return MTLBlendFactorOneMinusBlendAlpha;
|
||||
case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE: return MTLBlendFactorSourceAlphaSaturated;
|
||||
|
||||
#if MVK_IOS
|
||||
case VK_BLEND_FACTOR_SRC1_COLOR: return MTLBlendFactorSourceColor;
|
||||
case VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR: return MTLBlendFactorOneMinusSourceColor;
|
||||
case VK_BLEND_FACTOR_SRC1_ALPHA: return MTLBlendFactorSourceAlpha;
|
||||
case VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA: return MTLBlendFactorOneMinusSourceAlpha;
|
||||
#endif
|
||||
|
||||
#if MVK_MACOS
|
||||
case VK_BLEND_FACTOR_SRC1_COLOR: return MTLBlendFactorSource1Color;
|
||||
case VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR: return MTLBlendFactorOneMinusSource1Color;
|
||||
case VK_BLEND_FACTOR_SRC1_ALPHA: return MTLBlendFactorSource1Alpha;
|
||||
case VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA: return MTLBlendFactorOneMinusSource1Alpha;
|
||||
#endif
|
||||
|
||||
default: return MTLBlendFactorZero;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user