Merge pull request #1149 from cdavis5e/ios-3d-compressed
MVKPhysicalDevice: Enable 3D compressed textures on iOS/tvOS.
This commit is contained in:
commit
3b71eb0b2a
@ -607,7 +607,7 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
|
|||||||
if (mvkFmt == kMVKFormatDepthStencil ||
|
if (mvkFmt == kMVKFormatDepthStencil ||
|
||||||
isChromaSubsampled
|
isChromaSubsampled
|
||||||
#if MVK_IOS_OR_TVOS
|
#if MVK_IOS_OR_TVOS
|
||||||
|| mvkFmt == kMVKFormatCompressed
|
|| (mvkFmt == kMVKFormatCompressed && !_metalFeatures.native3DCompressedTextures)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||||
@ -617,6 +617,24 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
|
|||||||
if ((mvkFmt == kMVKFormatCompressed) && !mvkCanDecodeFormat(format) && !_metalFeatures.native3DCompressedTextures) {
|
if ((mvkFmt == kMVKFormatCompressed) && !mvkCanDecodeFormat(format) && !_metalFeatures.native3DCompressedTextures) {
|
||||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if MVK_IOS_OR_TVOS || MVK_MACOS_APPLE_SILICON
|
||||||
|
// ETC2 and EAC formats aren't supported for 3D textures.
|
||||||
|
switch (format) {
|
||||||
|
case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
|
||||||
|
case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
|
||||||
|
case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
|
||||||
|
case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
|
||||||
|
case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
|
||||||
|
case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
|
||||||
|
case VK_FORMAT_EAC_R11_UNORM_BLOCK:
|
||||||
|
case VK_FORMAT_EAC_R11_SNORM_BLOCK:
|
||||||
|
case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
|
||||||
|
case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
|
||||||
|
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
maxExt.width = pLimits->maxImageDimension3D;
|
maxExt.width = pLimits->maxImageDimension3D;
|
||||||
maxExt.height = pLimits->maxImageDimension3D;
|
maxExt.height = pLimits->maxImageDimension3D;
|
||||||
@ -1179,6 +1197,9 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
|||||||
if ( mvkOSVersionIsAtLeast(13.0) ) {
|
if ( mvkOSVersionIsAtLeast(13.0) ) {
|
||||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
|
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
|
||||||
_metalFeatures.placementHeaps = useMTLHeaps;
|
_metalFeatures.placementHeaps = useMTLHeaps;
|
||||||
|
if (supportsMTLGPUFamily(Apple3)) {
|
||||||
|
_metalFeatures.native3DCompressedTextures = true;
|
||||||
|
}
|
||||||
if (supportsMTLGPUFamily(Apple4)) {
|
if (supportsMTLGPUFamily(Apple4)) {
|
||||||
_metalFeatures.nativeTextureSwizzle = true;
|
_metalFeatures.nativeTextureSwizzle = true;
|
||||||
}
|
}
|
||||||
@ -1265,6 +1286,9 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
|||||||
if ( mvkOSVersionIsAtLeast(13.0) ) {
|
if ( mvkOSVersionIsAtLeast(13.0) ) {
|
||||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
|
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
|
||||||
_metalFeatures.placementHeaps = useMTLHeaps;
|
_metalFeatures.placementHeaps = useMTLHeaps;
|
||||||
|
if (supportsMTLGPUFamily(Apple3)) {
|
||||||
|
_metalFeatures.native3DCompressedTextures = true;
|
||||||
|
}
|
||||||
if (supportsMTLGPUFamily(Apple4)) {
|
if (supportsMTLGPUFamily(Apple4)) {
|
||||||
_metalFeatures.nativeTextureSwizzle = true;
|
_metalFeatures.nativeTextureSwizzle = true;
|
||||||
}
|
}
|
||||||
|
@ -1017,21 +1017,6 @@ void MVKImage::validateConfig(const VkImageCreateInfo* pCreateInfo, bool isAttac
|
|||||||
bool isCompressed = pixFmts->getFormatType(pCreateInfo->format) == kMVKFormatCompressed;
|
bool isCompressed = pixFmts->getFormatType(pCreateInfo->format) == kMVKFormatCompressed;
|
||||||
bool isChromaSubsampled = pixFmts->getChromaSubsamplingPlaneCount(pCreateInfo->format) > 0;
|
bool isChromaSubsampled = pixFmts->getChromaSubsamplingPlaneCount(pCreateInfo->format) > 0;
|
||||||
|
|
||||||
#if MVK_IOS_OR_TVOS
|
|
||||||
if (isCompressed && !is2D) {
|
|
||||||
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, compressed formats may only be used with 2D images."));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if MVK_MACOS
|
|
||||||
if (isCompressed && !is2D) {
|
|
||||||
if (getImageType() != VK_IMAGE_TYPE_3D) {
|
|
||||||
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, compressed formats may only be used with 2D or 3D images."));
|
|
||||||
} else if (!_device->_pMetalFeatures->native3DCompressedTextures && !mvkCanDecodeFormat(pCreateInfo->format)) {
|
|
||||||
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, the %s compressed format may only be used with 2D images.", getPixelFormats()->getName(pCreateInfo->format)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (isChromaSubsampled && !is2D) {
|
if (isChromaSubsampled && !is2D) {
|
||||||
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, chroma subsampled formats may only be used with 2D images."));
|
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, chroma subsampled formats may only be used with 2D images."));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user