Add QRhiTexture::RG16 format
Those are needed to handle 16bit YUV formats in Qt Multimedia. Change-Id: I39c67bf4fcf558487b7819ea38e578f99c12a3ed Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
0baa26638d
commit
df54a5d087
@ -2378,6 +2378,8 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
|
|||||||
|
|
||||||
\value R16 One component, unsigned normalized 16 bit.
|
\value R16 One component, unsigned normalized 16 bit.
|
||||||
|
|
||||||
|
\value RG16 Two component, unsigned normalized 16 bit.
|
||||||
|
|
||||||
\value RED_OR_ALPHA8 Either same as R8, or is a similar format with the component swizzled to alpha,
|
\value RED_OR_ALPHA8 Either same as R8, or is a similar format with the component swizzled to alpha,
|
||||||
depending on \l{QRhi::RedOrAlpha8IsRed}{RedOrAlpha8IsRed}.
|
depending on \l{QRhi::RedOrAlpha8IsRed}{RedOrAlpha8IsRed}.
|
||||||
|
|
||||||
@ -4533,6 +4535,9 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
|
|||||||
case QRhiTexture::R16:
|
case QRhiTexture::R16:
|
||||||
bpc = 2;
|
bpc = 2;
|
||||||
break;
|
break;
|
||||||
|
case QRhiTexture::RG16:
|
||||||
|
bpc = 4;
|
||||||
|
break;
|
||||||
case QRhiTexture::RED_OR_ALPHA8:
|
case QRhiTexture::RED_OR_ALPHA8:
|
||||||
bpc = 1;
|
bpc = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -765,6 +765,7 @@ public:
|
|||||||
R8,
|
R8,
|
||||||
RG8,
|
RG8,
|
||||||
R16,
|
R16,
|
||||||
|
RG16,
|
||||||
RED_OR_ALPHA8,
|
RED_OR_ALPHA8,
|
||||||
|
|
||||||
RGBA16F,
|
RGBA16F,
|
||||||
|
@ -1214,6 +1214,8 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
|
|||||||
return DXGI_FORMAT_R8G8_UNORM;
|
return DXGI_FORMAT_R8G8_UNORM;
|
||||||
case QRhiTexture::R16:
|
case QRhiTexture::R16:
|
||||||
return DXGI_FORMAT_R16_UNORM;
|
return DXGI_FORMAT_R16_UNORM;
|
||||||
|
case QRhiTexture::RG16:
|
||||||
|
return DXGI_FORMAT_R16G16_UNORM;
|
||||||
case QRhiTexture::RED_OR_ALPHA8:
|
case QRhiTexture::RED_OR_ALPHA8:
|
||||||
return DXGI_FORMAT_R8_UNORM;
|
return DXGI_FORMAT_R8_UNORM;
|
||||||
|
|
||||||
@ -1300,6 +1302,8 @@ static inline QRhiTexture::Format colorTextureFormatFromDxgiFormat(DXGI_FORMAT f
|
|||||||
return QRhiTexture::RG8;
|
return QRhiTexture::RG8;
|
||||||
case DXGI_FORMAT_R16_UNORM:
|
case DXGI_FORMAT_R16_UNORM:
|
||||||
return QRhiTexture::R16;
|
return QRhiTexture::R16;
|
||||||
|
case DXGI_FORMAT_R16G16_UNORM:
|
||||||
|
return QRhiTexture::RG16;
|
||||||
default: // this cannot assert, must warn and return unknown
|
default: // this cannot assert, must warn and return unknown
|
||||||
qWarning("DXGI_FORMAT %d is not a recognized uncompressed color format", format);
|
qWarning("DXGI_FORMAT %d is not a recognized uncompressed color format", format);
|
||||||
break;
|
break;
|
||||||
|
@ -160,6 +160,10 @@ QT_BEGIN_NAMESPACE
|
|||||||
#define GL_R16 0x822A
|
#define GL_R16 0x822A
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL_RG16
|
||||||
|
#define GL_RG16 0x822C
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef GL_RED
|
#ifndef GL_RED
|
||||||
#define GL_RED 0x1903
|
#define GL_RED 0x1903
|
||||||
#endif
|
#endif
|
||||||
@ -822,6 +826,12 @@ static inline void toGlTextureFormat(QRhiTexture::Format format, const QRhiGles2
|
|||||||
*glformat = GL_RED;
|
*glformat = GL_RED;
|
||||||
*gltype = GL_UNSIGNED_SHORT;
|
*gltype = GL_UNSIGNED_SHORT;
|
||||||
break;
|
break;
|
||||||
|
case QRhiTexture::RG16:
|
||||||
|
*glintformat = GL_RG16;
|
||||||
|
*glsizedintformat = *glintformat;
|
||||||
|
*glformat = GL_RG;
|
||||||
|
*gltype = GL_UNSIGNED_SHORT;
|
||||||
|
break;
|
||||||
case QRhiTexture::R8:
|
case QRhiTexture::R8:
|
||||||
*glintformat = GL_R8;
|
*glintformat = GL_R8;
|
||||||
*glsizedintformat = *glintformat;
|
*glsizedintformat = *glintformat;
|
||||||
@ -926,6 +936,9 @@ bool QRhiGles2::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
|
|||||||
case QRhiTexture::R16:
|
case QRhiTexture::R16:
|
||||||
return caps.r16Format;
|
return caps.r16Format;
|
||||||
|
|
||||||
|
case QRhiTexture::RG16:
|
||||||
|
return caps.r16Format;
|
||||||
|
|
||||||
case QRhiTexture::RGBA16F:
|
case QRhiTexture::RGBA16F:
|
||||||
case QRhiTexture::RGBA32F:
|
case QRhiTexture::RGBA32F:
|
||||||
return caps.floatFormats;
|
return caps.floatFormats;
|
||||||
|
@ -2348,6 +2348,8 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
|||||||
#endif
|
#endif
|
||||||
case QRhiTexture::R16:
|
case QRhiTexture::R16:
|
||||||
return MTLPixelFormatR16Unorm;
|
return MTLPixelFormatR16Unorm;
|
||||||
|
case QRhiTexture::RG16:
|
||||||
|
return MTLPixelFormatRG16Unorm;
|
||||||
case QRhiTexture::RED_OR_ALPHA8:
|
case QRhiTexture::RED_OR_ALPHA8:
|
||||||
return MTLPixelFormatR8Unorm;
|
return MTLPixelFormatR8Unorm;
|
||||||
|
|
||||||
|
@ -886,6 +886,8 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
|
|||||||
return srgb ? VK_FORMAT_R8G8_SRGB : VK_FORMAT_R8G8_UNORM;
|
return srgb ? VK_FORMAT_R8G8_SRGB : VK_FORMAT_R8G8_UNORM;
|
||||||
case QRhiTexture::R16:
|
case QRhiTexture::R16:
|
||||||
return VK_FORMAT_R16_UNORM;
|
return VK_FORMAT_R16_UNORM;
|
||||||
|
case QRhiTexture::RG16:
|
||||||
|
return VK_FORMAT_R16G16_UNORM;
|
||||||
case QRhiTexture::RED_OR_ALPHA8:
|
case QRhiTexture::RED_OR_ALPHA8:
|
||||||
return VK_FORMAT_R8_UNORM;
|
return VK_FORMAT_R8_UNORM;
|
||||||
|
|
||||||
@ -993,6 +995,8 @@ static inline QRhiTexture::Format colorTextureFormatFromVkFormat(VkFormat format
|
|||||||
return QRhiTexture::RG8;
|
return QRhiTexture::RG8;
|
||||||
case VK_FORMAT_R16_UNORM:
|
case VK_FORMAT_R16_UNORM:
|
||||||
return QRhiTexture::R16;
|
return QRhiTexture::R16;
|
||||||
|
case VK_FORMAT_R16G16_UNORM:
|
||||||
|
return QRhiTexture::RG16;
|
||||||
default: // this cannot assert, must warn and return unknown
|
default: // this cannot assert, must warn and return unknown
|
||||||
qWarning("VkFormat %d is not a recognized uncompressed color format", format);
|
qWarning("VkFormat %d is not a recognized uncompressed color format", format);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user