RHI: Take advantage of Apple GPU specific features when available
Change-Id: Ie59405bd8cf235086f7e9a675270ed25beb8aedc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 4cf30d8c1b351d9d1f495913493250d8fc3e51e1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
38263bab26
commit
a1e6c79cd4
@ -402,12 +402,16 @@ bool QRhiMetal::create(QRhi::Flags flags)
|
|||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
caps.maxTextureSize = 16384;
|
caps.maxTextureSize = 16384;
|
||||||
caps.baseVertexAndInstance = true;
|
caps.baseVertexAndInstance = true;
|
||||||
|
if (@available(macOS 10.15, *))
|
||||||
|
caps.isAppleGPU = [d->dev supportsFamily:MTLGPUFamilyApple7];
|
||||||
|
caps.maxThreadGroupSize = 1024;
|
||||||
#elif defined(Q_OS_TVOS)
|
#elif defined(Q_OS_TVOS)
|
||||||
if ([d->dev supportsFeatureSet: MTLFeatureSet(30003)]) // MTLFeatureSet_tvOS_GPUFamily2_v1
|
if ([d->dev supportsFeatureSet: MTLFeatureSet(30003)]) // MTLFeatureSet_tvOS_GPUFamily2_v1
|
||||||
caps.maxTextureSize = 16384;
|
caps.maxTextureSize = 16384;
|
||||||
else
|
else
|
||||||
caps.maxTextureSize = 8192;
|
caps.maxTextureSize = 8192;
|
||||||
caps.baseVertexAndInstance = false;
|
caps.baseVertexAndInstance = false;
|
||||||
|
caps.isAppleGPU = true;
|
||||||
#elif defined(Q_OS_IOS)
|
#elif defined(Q_OS_IOS)
|
||||||
// welcome to feature set hell
|
// welcome to feature set hell
|
||||||
if ([d->dev supportsFeatureSet: MTLFeatureSet(16)] // MTLFeatureSet_iOS_GPUFamily5_v1
|
if ([d->dev supportsFeatureSet: MTLFeatureSet(16)] // MTLFeatureSet_iOS_GPUFamily5_v1
|
||||||
@ -425,6 +429,11 @@ bool QRhiMetal::create(QRhi::Flags flags)
|
|||||||
caps.maxTextureSize = 4096;
|
caps.maxTextureSize = 4096;
|
||||||
caps.baseVertexAndInstance = false;
|
caps.baseVertexAndInstance = false;
|
||||||
}
|
}
|
||||||
|
caps.isAppleGPU = true;
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
if ([d->dev supportsFamily:MTLGPUFamilyApple4])
|
||||||
|
caps.maxThreadGroupSize = 1024;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
caps.supportedSampleCounts = { 1 };
|
caps.supportedSampleCounts = { 1 };
|
||||||
@ -524,15 +533,31 @@ bool QRhiMetal::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
|
|||||||
{
|
{
|
||||||
Q_UNUSED(flags);
|
Q_UNUSED(flags);
|
||||||
|
|
||||||
|
bool supportsFamilyMac2 = false; // needed for BC* formats
|
||||||
|
bool supportsFamilyApple3 = false;
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
supportsFamilyMac2 = true;
|
||||||
|
if (caps.isAppleGPU)
|
||||||
|
supportsFamilyApple3 = true;
|
||||||
|
#else
|
||||||
|
supportsFamilyApple3 = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// BC5 is not available for any Apple hardare
|
||||||
|
if (format == QRhiTexture::BC5)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!supportsFamilyApple3) {
|
||||||
if (format >= QRhiTexture::ETC2_RGB8 && format <= QRhiTexture::ETC2_RGBA8)
|
if (format >= QRhiTexture::ETC2_RGB8 && format <= QRhiTexture::ETC2_RGBA8)
|
||||||
return false;
|
return false;
|
||||||
if (format >= QRhiTexture::ASTC_4x4 && format <= QRhiTexture::ASTC_12x12)
|
if (format >= QRhiTexture::ASTC_4x4 && format <= QRhiTexture::ASTC_12x12)
|
||||||
return false;
|
return false;
|
||||||
#else
|
}
|
||||||
|
|
||||||
|
if (!supportsFamilyMac2)
|
||||||
if (format >= QRhiTexture::BC1 && format <= QRhiTexture::BC7)
|
if (format >= QRhiTexture::BC1 && format <= QRhiTexture::BC7)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -638,11 +663,7 @@ int QRhiMetal::resourceLimit(QRhi::ResourceLimit limit) const
|
|||||||
case QRhi::MaxThreadGroupY:
|
case QRhi::MaxThreadGroupY:
|
||||||
Q_FALLTHROUGH();
|
Q_FALLTHROUGH();
|
||||||
case QRhi::MaxThreadGroupZ:
|
case QRhi::MaxThreadGroupZ:
|
||||||
#if defined(Q_OS_MACOS)
|
return caps.maxThreadGroupSize;
|
||||||
return 1024;
|
|
||||||
#else
|
|
||||||
return 512;
|
|
||||||
#endif
|
|
||||||
case QRhi::TextureArraySizeMax:
|
case QRhi::TextureArraySizeMax:
|
||||||
return 2048;
|
return 2048;
|
||||||
case QRhi::MaxUniformBufferRange:
|
case QRhi::MaxUniformBufferRange:
|
||||||
@ -2319,8 +2340,10 @@ bool QMetalBuffer::create()
|
|||||||
|
|
||||||
d->managed = false;
|
d->managed = false;
|
||||||
MTLResourceOptions opts = MTLResourceStorageModeShared;
|
MTLResourceOptions opts = MTLResourceStorageModeShared;
|
||||||
|
|
||||||
|
QRHI_RES_RHI(QRhiMetal);
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (m_type != Dynamic) {
|
if (!rhiD->caps.isAppleGPU && m_type != Dynamic) {
|
||||||
opts = MTLResourceStorageModeManaged;
|
opts = MTLResourceStorageModeManaged;
|
||||||
d->managed = true;
|
d->managed = true;
|
||||||
}
|
}
|
||||||
@ -2332,7 +2355,6 @@ bool QMetalBuffer::create()
|
|||||||
// same buffer is still in flight.
|
// same buffer is still in flight.
|
||||||
d->slotted = !m_usage.testFlag(QRhiBuffer::StorageBuffer); // except for SSBOs written in the shader
|
d->slotted = !m_usage.testFlag(QRhiBuffer::StorageBuffer); // except for SSBOs written in the shader
|
||||||
|
|
||||||
QRHI_RES_RHI(QRhiMetal);
|
|
||||||
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
|
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
|
||||||
if (i == 0 || d->slotted) {
|
if (i == 0 || d->slotted) {
|
||||||
d->buf[i] = [rhiD->d->dev newBufferWithLength: roundedSize options: opts];
|
d->buf[i] = [rhiD->d->dev newBufferWithLength: roundedSize options: opts];
|
||||||
@ -2395,11 +2417,12 @@ void QMetalBuffer::endFullDynamicBufferUpdateForCurrentFrame()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags, const QRhiMetalData *d)
|
static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags, const QRhiMetal *d)
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
Q_UNUSED(d);
|
Q_UNUSED(d);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const bool srgb = flags.testFlag(QRhiTexture::sRGB);
|
const bool srgb = flags.testFlag(QRhiTexture::sRGB);
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case QRhiTexture::RGBA8:
|
case QRhiTexture::RGBA8:
|
||||||
@ -2441,9 +2464,9 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
|||||||
case QRhiTexture::D16:
|
case QRhiTexture::D16:
|
||||||
return MTLPixelFormatDepth16Unorm;
|
return MTLPixelFormatDepth16Unorm;
|
||||||
case QRhiTexture::D24:
|
case QRhiTexture::D24:
|
||||||
return [d->dev isDepth24Stencil8PixelFormatSupported] ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float;
|
return [d->d->dev isDepth24Stencil8PixelFormatSupported] ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float;
|
||||||
case QRhiTexture::D24S8:
|
case QRhiTexture::D24S8:
|
||||||
return [d->dev isDepth24Stencil8PixelFormatSupported] ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
|
return [d->d->dev isDepth24Stencil8PixelFormatSupported] ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
|
||||||
#else
|
#else
|
||||||
case QRhiTexture::D16:
|
case QRhiTexture::D16:
|
||||||
return MTLPixelFormatDepth32Float;
|
return MTLPixelFormatDepth32Float;
|
||||||
@ -2466,7 +2489,7 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
|||||||
return MTLPixelFormatBC4_RUnorm;
|
return MTLPixelFormatBC4_RUnorm;
|
||||||
case QRhiTexture::BC5:
|
case QRhiTexture::BC5:
|
||||||
qWarning("QRhiMetal does not support BC5");
|
qWarning("QRhiMetal does not support BC5");
|
||||||
return MTLPixelFormatRGBA8Unorm;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::BC6H:
|
case QRhiTexture::BC6H:
|
||||||
return MTLPixelFormatBC6H_RGBUfloat;
|
return MTLPixelFormatBC6H_RGBUfloat;
|
||||||
case QRhiTexture::BC7:
|
case QRhiTexture::BC7:
|
||||||
@ -2480,7 +2503,7 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
|||||||
case QRhiTexture::BC6H:
|
case QRhiTexture::BC6H:
|
||||||
case QRhiTexture::BC7:
|
case QRhiTexture::BC7:
|
||||||
qWarning("QRhiMetal: BCx compression not supported on this platform");
|
qWarning("QRhiMetal: BCx compression not supported on this platform");
|
||||||
return MTLPixelFormatRGBA8Unorm;
|
return MTLPixelFormatInvalid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
@ -2521,32 +2544,129 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
|||||||
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
||||||
#else
|
#else
|
||||||
case QRhiTexture::ETC2_RGB8:
|
case QRhiTexture::ETC2_RGB8:
|
||||||
case QRhiTexture::ETC2_RGB8A1:
|
if (d->caps.isAppleGPU) {
|
||||||
case QRhiTexture::ETC2_RGBA8:
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatETC2_RGB8_sRGB : MTLPixelFormatETC2_RGB8;
|
||||||
|
}
|
||||||
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
||||||
return MTLPixelFormatRGBA8Unorm;
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ETC2_RGB8A1:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatETC2_RGB8A1_sRGB : MTLPixelFormatETC2_RGB8A1;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ETC2_RGBA8:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatEAC_RGBA8_sRGB : MTLPixelFormatEAC_RGBA8;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_4x4:
|
case QRhiTexture::ASTC_4x4:
|
||||||
case QRhiTexture::ASTC_5x4:
|
if (d->caps.isAppleGPU) {
|
||||||
case QRhiTexture::ASTC_5x5:
|
if (@available(macOS 11.0, *))
|
||||||
case QRhiTexture::ASTC_6x5:
|
return srgb ? MTLPixelFormatASTC_4x4_sRGB : MTLPixelFormatASTC_4x4_LDR;
|
||||||
case QRhiTexture::ASTC_6x6:
|
}
|
||||||
case QRhiTexture::ASTC_8x5:
|
|
||||||
case QRhiTexture::ASTC_8x6:
|
|
||||||
case QRhiTexture::ASTC_8x8:
|
|
||||||
case QRhiTexture::ASTC_10x5:
|
|
||||||
case QRhiTexture::ASTC_10x6:
|
|
||||||
case QRhiTexture::ASTC_10x8:
|
|
||||||
case QRhiTexture::ASTC_10x10:
|
|
||||||
case QRhiTexture::ASTC_12x10:
|
|
||||||
case QRhiTexture::ASTC_12x12:
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatRGBA8Unorm;
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_5x4:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_5x4_sRGB : MTLPixelFormatASTC_5x4_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_5x5:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_5x5_sRGB : MTLPixelFormatASTC_5x5_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_6x5:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_6x5_sRGB : MTLPixelFormatASTC_6x5_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_6x6:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_6x6_sRGB : MTLPixelFormatASTC_6x6_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_8x5:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_8x5_sRGB : MTLPixelFormatASTC_8x5_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_8x6:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_8x6_sRGB : MTLPixelFormatASTC_8x6_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_8x8:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_8x8_sRGB : MTLPixelFormatASTC_8x8_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_10x5:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_10x5_sRGB : MTLPixelFormatASTC_10x5_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_10x6:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_10x6_sRGB : MTLPixelFormatASTC_10x6_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_10x8:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_10x8_sRGB : MTLPixelFormatASTC_10x8_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_10x10:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_10x10_sRGB : MTLPixelFormatASTC_10x10_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_12x10:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
|
case QRhiTexture::ASTC_12x12:
|
||||||
|
if (d->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *))
|
||||||
|
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
||||||
|
}
|
||||||
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
|
return MTLPixelFormatInvalid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
return MTLPixelFormatRGBA8Unorm;
|
return MTLPixelFormatInvalid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2606,9 +2726,18 @@ bool QMetalRenderBuffer::create()
|
|||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case DepthStencil:
|
case DepthStencil:
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
if (rhiD->caps.isAppleGPU) {
|
||||||
|
if (@available(macOS 11.0, *)) {
|
||||||
|
desc.storageMode = MTLStorageModeMemoryless;
|
||||||
|
d->format = MTLPixelFormatDepth32Float_Stencil8;
|
||||||
|
} else {
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
desc.storageMode = MTLStorageModePrivate;
|
desc.storageMode = MTLStorageModePrivate;
|
||||||
d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
|
d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
|
||||||
? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
|
? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
desc.storageMode = MTLStorageModeMemoryless;
|
desc.storageMode = MTLStorageModeMemoryless;
|
||||||
d->format = MTLPixelFormatDepth32Float_Stencil8;
|
d->format = MTLPixelFormatDepth32Float_Stencil8;
|
||||||
@ -2618,7 +2747,7 @@ bool QMetalRenderBuffer::create()
|
|||||||
case Color:
|
case Color:
|
||||||
desc.storageMode = MTLStorageModePrivate;
|
desc.storageMode = MTLStorageModePrivate;
|
||||||
if (m_backingFormatHint != QRhiTexture::UnknownFormat)
|
if (m_backingFormatHint != QRhiTexture::UnknownFormat)
|
||||||
d->format = toMetalTextureFormat(m_backingFormatHint, {}, rhiD->d);
|
d->format = toMetalTextureFormat(m_backingFormatHint, {}, rhiD);
|
||||||
else
|
else
|
||||||
d->format = MTLPixelFormatRGBA8Unorm;
|
d->format = MTLPixelFormatRGBA8Unorm;
|
||||||
desc.pixelFormat = d->format;
|
desc.pixelFormat = d->format;
|
||||||
@ -2707,7 +2836,7 @@ bool QMetalTexture::prepareCreate(QSize *adjustedSize)
|
|||||||
const bool hasMipMaps = m_flags.testFlag(MipMapped);
|
const bool hasMipMaps = m_flags.testFlag(MipMapped);
|
||||||
|
|
||||||
QRHI_RES_RHI(QRhiMetal);
|
QRHI_RES_RHI(QRhiMetal);
|
||||||
d->format = toMetalTextureFormat(m_format, m_flags, rhiD->d);
|
d->format = toMetalTextureFormat(m_format, m_flags, rhiD);
|
||||||
mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
|
mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
|
||||||
samples = rhiD->effectiveSampleCount(m_sampleCount);
|
samples = rhiD->effectiveSampleCount(m_sampleCount);
|
||||||
if (samples > 1) {
|
if (samples > 1) {
|
||||||
@ -3741,7 +3870,7 @@ bool QMetalGraphicsPipeline::create()
|
|||||||
// validation blows up otherwise.
|
// validation blows up otherwise.
|
||||||
MTLPixelFormat fmt = MTLPixelFormat(rpD->dsFormat);
|
MTLPixelFormat fmt = MTLPixelFormat(rpD->dsFormat);
|
||||||
rpDesc.depthAttachmentPixelFormat = fmt;
|
rpDesc.depthAttachmentPixelFormat = fmt;
|
||||||
#ifdef Q_OS_MACOS
|
#if defined(Q_OS_MACOS)
|
||||||
if (fmt != MTLPixelFormatDepth16Unorm && fmt != MTLPixelFormatDepth32Float)
|
if (fmt != MTLPixelFormatDepth16Unorm && fmt != MTLPixelFormatDepth32Float)
|
||||||
#else
|
#else
|
||||||
if (fmt != MTLPixelFormatDepth32Float)
|
if (fmt != MTLPixelFormatDepth32Float)
|
||||||
|
@ -454,6 +454,8 @@ public:
|
|||||||
int maxTextureSize = 4096;
|
int maxTextureSize = 4096;
|
||||||
bool baseVertexAndInstance = true;
|
bool baseVertexAndInstance = true;
|
||||||
QVector<int> supportedSampleCounts;
|
QVector<int> supportedSampleCounts;
|
||||||
|
bool isAppleGPU = false;
|
||||||
|
int maxThreadGroupSize = 512;
|
||||||
} caps;
|
} caps;
|
||||||
|
|
||||||
QRhiMetalData *d = nullptr;
|
QRhiMetalData *d = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user