Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laszlo Agocs
qtrhi
Commits
e03929b8
Commit
e03929b8
authored
Mar 12, 2019
by
Laszlo Agocs
Browse files
Add the rgba float tex formats
These may be used by Q3DS for HDR images (IBL).
parent
28b47897
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/rhi/qrhi.cpp
View file @
e03929b8
...
...
@@ -1811,6 +1811,12 @@ QRhiRenderBuffer::QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QS
Regardless of the return value, calling release() is always safe.
*/
/*!
\fn QRhiTexture::Format QRhiRenderBuffer::backingFormat() const
\internal
*/
/*!
\class QRhiTexture
\inmodule QtRhi
...
...
@@ -1873,6 +1879,10 @@ QRhiRenderBuffer::QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QS
\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}.
\value RGBA16F Four components, 16-bit float per component.
\value RGBA32F Four components, 32-bit float per component.
\value D16 16-bit depth (normalized unsigned integer)
\value D32 32-bit depth (32-bit float)
...
...
@@ -3222,6 +3232,16 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
case
QRhiTexture
::
R16
:
bpc
=
2
;
break
;
case
QRhiTexture
::
RED_OR_ALPHA8
:
bpc
=
1
;
break
;
case
QRhiTexture
::
RGBA16F
:
bpc
=
8
;
break
;
case
QRhiTexture
::
RGBA32F
:
bpc
=
16
;
break
;
case
QRhiTexture
::
D16
:
bpc
=
2
;
...
...
src/rhi/qrhi.h
View file @
e03929b8
...
...
@@ -643,6 +643,9 @@ public:
R16
,
RED_OR_ALPHA8
,
RGBA16F
,
RGBA32F
,
D16
,
D32
,
...
...
src/rhi/qrhid3d11.cpp
View file @
e03929b8
...
...
@@ -868,6 +868,11 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
case
QRhiTexture
::
RED_OR_ALPHA8
:
return
DXGI_FORMAT_R8_UNORM
;
case
QRhiTexture
::
RGBA16F
:
return
DXGI_FORMAT_R16G16B16A16_FLOAT
;
case
QRhiTexture
::
RGBA32F
:
return
DXGI_FORMAT_R32G32B32A32_FLOAT
;
case
QRhiTexture
::
D16
:
return
DXGI_FORMAT_R16_TYPELESS
;
case
QRhiTexture
::
D32
:
...
...
src/rhi/qrhigles2.cpp
View file @
e03929b8
...
...
@@ -172,6 +172,14 @@ QT_BEGIN_NAMESPACE
#define GL_RED 0x1903
#endif
#ifndef GL_RGBA32F
#define GL_RGBA32F 0x8814
#endif
#ifndef GL_RGBA16F
#define GL_RGBA16F 0x881A
#endif
#ifndef GL_PRIMITIVE_RESTART_FIXED_INDEX
#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
#endif
...
...
@@ -310,6 +318,8 @@ bool QRhiGles2::create(QRhi::Flags flags)
caps
.
r8Format
=
f
->
hasOpenGLFeature
(
QOpenGLFunctions
::
TextureRGFormats
);
caps
.
r16Format
=
f
->
hasOpenGLExtension
(
QOpenGLExtensions
::
Sized16Formats
);
caps
.
floatFormats
=
actualFormat
.
version
()
>=
qMakePair
(
3
,
0
);
caps
.
srgbCapableDefaultFramebuffer
=
f
->
hasOpenGLExtension
(
QOpenGLExtensions
::
SRGBFrameBuffer
);
nativeHandlesStruct
.
context
=
ctx
;
...
...
@@ -468,6 +478,11 @@ bool QRhiGles2::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
case
QRhiTexture
::
R16
:
return
caps
.
r16Format
;
case
QRhiTexture
::
RGBA16F
:
Q_FALLTHROUGH
();
case
QRhiTexture
::
RGBA32F
:
return
caps
.
floatFormats
;
default:
break
;
}
...
...
@@ -2045,6 +2060,14 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
glintformat
=
GL_ALPHA
;
glformat
=
GL_ALPHA
;
break
;
case
QRhiTexture
::
RGBA16F
:
glintformat
=
GL_RGBA16F
;
glformat
=
GL_RGBA
;
break
;
case
QRhiTexture
::
RGBA32F
:
glintformat
=
GL_RGBA32F
;
glformat
=
GL_RGBA
;
break
;
default:
Q_UNREACHABLE
();
glintformat
=
GL_RGBA
;
...
...
src/rhi/qrhigles2_p.h
View file @
e03929b8
...
...
@@ -557,6 +557,7 @@ public:
bgraInternalFormat
(
false
),
r8Format
(
false
),
r16Format
(
false
),
floatFormats
(
false
),
srgbCapableDefaultFramebuffer
(
false
)
{
}
int
maxTextureSize
;
...
...
@@ -570,6 +571,7 @@ public:
uint
bgraInternalFormat
:
1
;
uint
r8Format
:
1
;
uint
r16Format
:
1
;
uint
floatFormats
:
1
;
uint
srgbCapableDefaultFramebuffer
:
1
;
}
caps
;
bool
inFrame
=
false
;
...
...
src/rhi/qrhimetal.mm
View file @
e03929b8
...
...
@@ -1844,6 +1844,11 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
case
QRhiTexture
::
RED_OR_ALPHA8
:
return
MTLPixelFormatR8Unorm
;
case
QRhiTexture
::
RGBA16F
:
return
MTLPixelFormatRGBA16Float
;
case
QRhiTexture
::
RGBA32F
:
return
MTLPixelFormatRGBA32Float
;
case
QRhiTexture
::
D16
:
return
MTLPixelFormatDepth16Unorm
;
case
QRhiTexture
::
D32
:
...
...
src/rhi/qrhivulkan.cpp
View file @
e03929b8
...
...
@@ -644,6 +644,11 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
case
QRhiTexture
::
RED_OR_ALPHA8
:
return
VK_FORMAT_R8_UNORM
;
case
QRhiTexture
::
RGBA16F
:
return
VK_FORMAT_R16G16B16A16_SFLOAT
;
case
QRhiTexture
::
RGBA32F
:
return
VK_FORMAT_R32G32B32A32_SFLOAT
;
case
QRhiTexture
::
D16
:
return
VK_FORMAT_D16_UNORM
;
case
QRhiTexture
::
D32
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment