rhi: Add R16F and R32F
Can be relevant for Qt Quick 3D shadows, where the shadow map is R16F. Task-number: QTBUG-81268 Change-Id: Ic33e100929e133d1cbe0b062a15697c82536f62a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
e4d0187edc
commit
e8199a5c4d
@ -3939,6 +3939,12 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
|
||||
case QRhiTexture::RGBA32F:
|
||||
bpc = 16;
|
||||
break;
|
||||
case QRhiTexture::R16F:
|
||||
bpc = 2;
|
||||
break;
|
||||
case QRhiTexture::R32F:
|
||||
bpc = 4;
|
||||
break;
|
||||
|
||||
case QRhiTexture::D16:
|
||||
bpc = 2;
|
||||
|
@ -728,6 +728,8 @@ public:
|
||||
|
||||
RGBA16F,
|
||||
RGBA32F,
|
||||
R16F,
|
||||
R32F,
|
||||
|
||||
D16,
|
||||
D32F,
|
||||
|
@ -1102,6 +1102,10 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
|
||||
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case QRhiTexture::RGBA32F:
|
||||
return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
case QRhiTexture::R16F:
|
||||
return DXGI_FORMAT_R16_FLOAT;
|
||||
case QRhiTexture::R32F:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
|
||||
case QRhiTexture::D16:
|
||||
return DXGI_FORMAT_R16_TYPELESS;
|
||||
|
@ -165,6 +165,14 @@ QT_BEGIN_NAMESPACE
|
||||
#define GL_RGBA16F 0x881A
|
||||
#endif
|
||||
|
||||
#ifndef GL_R16F
|
||||
#define GL_R16F 0x822D
|
||||
#endif
|
||||
|
||||
#ifndef GL_R32F
|
||||
#define GL_R32F 0x822E
|
||||
#endif
|
||||
|
||||
#ifndef GL_HALF_FLOAT
|
||||
#define GL_HALF_FLOAT 0x140B
|
||||
#endif
|
||||
@ -697,6 +705,10 @@ bool QRhiGles2::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
|
||||
case QRhiTexture::RGBA32F:
|
||||
return caps.floatFormats;
|
||||
|
||||
case QRhiTexture::R16F:
|
||||
case QRhiTexture::R32F:
|
||||
return caps.floatFormats;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -3384,6 +3396,18 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
|
||||
glformat = GL_RGBA;
|
||||
gltype = GL_FLOAT;
|
||||
break;
|
||||
case QRhiTexture::R16F:
|
||||
glintformat = GL_R16F;
|
||||
glsizedintformat = glintformat;
|
||||
glformat = GL_RED;
|
||||
gltype = GL_HALF_FLOAT;
|
||||
break;
|
||||
case QRhiTexture::R32F:
|
||||
glintformat = GL_R32F;
|
||||
glsizedintformat = glintformat;
|
||||
glformat = GL_RED;
|
||||
gltype = GL_FLOAT;
|
||||
break;
|
||||
case QRhiTexture::D16:
|
||||
glintformat = GL_DEPTH_COMPONENT16;
|
||||
glsizedintformat = glintformat;
|
||||
|
@ -2320,6 +2320,10 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
||||
return MTLPixelFormatRGBA16Float;
|
||||
case QRhiTexture::RGBA32F:
|
||||
return MTLPixelFormatRGBA32Float;
|
||||
case QRhiTexture::R16F:
|
||||
return MTLPixelFormatR16Float;
|
||||
case QRhiTexture::R32F:
|
||||
return MTLPixelFormatR32Float;
|
||||
|
||||
case QRhiTexture::D16:
|
||||
#ifdef Q_OS_MACOS
|
||||
|
@ -767,6 +767,10 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
|
||||
return VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||
case QRhiTexture::RGBA32F:
|
||||
return VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
case QRhiTexture::R16F:
|
||||
return VK_FORMAT_R16_SFLOAT;
|
||||
case QRhiTexture::R32F:
|
||||
return VK_FORMAT_R32_SFLOAT;
|
||||
|
||||
case QRhiTexture::D16:
|
||||
return VK_FORMAT_D16_UNORM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user