Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtrhi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Laszlo Agocs
qtrhi
Commits
72450e45
Commit
72450e45
authored
Feb 13, 2019
by
Laszlo Agocs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add isYUpInNDC()
Complements isYUpInFramebuffer().
parent
064fc28a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
56 additions
and
8 deletions
+56
-8
src/rhi/qrhi.cpp
src/rhi/qrhi.cpp
+23
-7
src/rhi/qrhi.h
src/rhi/qrhi.h
+1
-0
src/rhi/qrhi_p.h
src/rhi/qrhi_p.h
+1
-0
src/rhi/qrhid3d11.cpp
src/rhi/qrhid3d11.cpp
+5
-0
src/rhi/qrhid3d11_p.h
src/rhi/qrhid3d11_p.h
+1
-0
src/rhi/qrhigles2.cpp
src/rhi/qrhigles2.cpp
+5
-0
src/rhi/qrhigles2_p.h
src/rhi/qrhigles2_p.h
+1
-0
src/rhi/qrhimetal.mm
src/rhi/qrhimetal.mm
+5
-0
src/rhi/qrhimetal_p.h
src/rhi/qrhimetal_p.h
+1
-0
src/rhi/qrhinull.cpp
src/rhi/qrhinull.cpp
+5
-0
src/rhi/qrhinull_p.h
src/rhi/qrhinull_p.h
+1
-0
src/rhi/qrhivulkan.cpp
src/rhi/qrhivulkan.cpp
+6
-1
src/rhi/qrhivulkan_p.h
src/rhi/qrhivulkan_p.h
+1
-0
No files found.
src/rhi/qrhi.cpp
View file @
72450e45
...
...
@@ -3900,7 +3900,8 @@ QSize QRhi::sizeForMipLevel(int mipLevel, const QSize &baseLevelSize) const
}
/*!
\return \c true if the underlying graphics API has Y up in the framebuffer.
\return \c true if the underlying graphics API has the Y axis pointing up
in framebuffers and images.
In practice this is \c true for OpenGL only.
*/
...
...
@@ -3910,12 +3911,27 @@ bool QRhi::isYUpInFramebuffer() const
}
/*!
\return a matrix that can be used allow applications keep using
OpenGL-targeted vertex data and projection matrices (for example, the ones
generated by QMatrix4x4::perspective()) regardless of the backed. Once
\c{this_matrix * mvp} is used instead of just \c mvp, vertex data with Y up
and viewports with depth range 0 - 1 can be used without considering what
backend and so graphics API is going to be used at run time.
\return \c true if the underlying graphics API has the Y axis pointing up
in its normalized device coordinate system.
In practice this is \c false for Vulkan only.
\note clipSpaceCorrMatrix() includes the corresponding adjustment (to make
Y point up) in its returned matrix.
*/
bool
QRhi
::
isYUpInNDC
()
const
{
return
d
->
isYUpInNDC
();
}
/*!
\return a matrix that can be used to allow applications keep using
OpenGL-targeted vertex data and perspective projection matrices (such as,
the ones generated by QMatrix4x4::perspective()), regardless of the
backend. Once \c{this_matrix * mvp} is used instead of just \c mvp, vertex
data with Y up and viewports with depth range 0 - 1 can be used without
considering what backend and so graphics API is going to be used at run
time.
See
\l{https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/}{this
...
...
src/rhi/qrhi.h
View file @
72450e45
...
...
@@ -1283,6 +1283,7 @@ public:
QSize
sizeForMipLevel
(
int
mipLevel
,
const
QSize
&
baseLevelSize
)
const
;
bool
isYUpInFramebuffer
()
const
;
bool
isYUpInNDC
()
const
;
QMatrix4x4
clipSpaceCorrMatrix
()
const
;
...
...
src/rhi/qrhi_p.h
View file @
72450e45
...
...
@@ -131,6 +131,7 @@ public:
virtual
QVector
<
int
>
supportedSampleCounts
()
const
=
0
;
virtual
int
ubufAlignment
()
const
=
0
;
virtual
bool
isYUpInFramebuffer
()
const
=
0
;
virtual
bool
isYUpInNDC
()
const
=
0
;
virtual
QMatrix4x4
clipSpaceCorrMatrix
()
const
=
0
;
virtual
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
=
0
;
virtual
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
=
0
;
...
...
src/rhi/qrhid3d11.cpp
View file @
72450e45
...
...
@@ -344,6 +344,11 @@ bool QRhiD3D11::isYUpInFramebuffer() const
return
false
;
}
bool
QRhiD3D11
::
isYUpInNDC
()
const
{
return
true
;
}
QMatrix4x4
QRhiD3D11
::
clipSpaceCorrMatrix
()
const
{
// Like with Vulkan, but Y is already good.
...
...
src/rhi/qrhid3d11_p.h
View file @
72450e45
...
...
@@ -520,6 +520,7 @@ public:
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
bool
isYUpInNDC
()
const
override
;
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
...
...
src/rhi/qrhigles2.cpp
View file @
72450e45
...
...
@@ -414,6 +414,11 @@ bool QRhiGles2::isYUpInFramebuffer() const
return
true
;
}
bool
QRhiGles2
::
isYUpInNDC
()
const
{
return
true
;
}
QMatrix4x4
QRhiGles2
::
clipSpaceCorrMatrix
()
const
{
return
QMatrix4x4
();
// identity
...
...
src/rhi/qrhigles2_p.h
View file @
72450e45
...
...
@@ -514,6 +514,7 @@ public:
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
bool
isYUpInNDC
()
const
override
;
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
...
...
src/rhi/qrhimetal.mm
View file @
72450e45
...
...
@@ -455,6 +455,11 @@ bool QRhiMetal::isYUpInFramebuffer() const
return
false
;
}
bool
QRhiMetal
::
isYUpInNDC
()
const
{
return
true
;
}
QMatrix4x4
QRhiMetal
::
clipSpaceCorrMatrix
()
const
{
// depth range 0..1
...
...
src/rhi/qrhimetal_p.h
View file @
72450e45
...
...
@@ -346,6 +346,7 @@ public:
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
bool
isYUpInNDC
()
const
override
;
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
...
...
src/rhi/qrhinull.cpp
View file @
72450e45
...
...
@@ -110,6 +110,11 @@ bool QRhiNull::isYUpInFramebuffer() const
return
true
;
}
bool
QRhiNull
::
isYUpInNDC
()
const
{
return
true
;
}
QMatrix4x4
QRhiNull
::
clipSpaceCorrMatrix
()
const
{
return
QMatrix4x4
();
// identity
...
...
src/rhi/qrhinull_p.h
View file @
72450e45
...
...
@@ -233,6 +233,7 @@ public:
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
bool
isYUpInNDC
()
const
override
;
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
...
...
src/rhi/qrhivulkan.cpp
View file @
72450e45
...
...
@@ -2963,9 +2963,14 @@ bool QRhiVulkan::isYUpInFramebuffer() const
return
false
;
}
bool
QRhiVulkan
::
isYUpInNDC
()
const
{
return
false
;
}
QMatrix4x4
QRhiVulkan
::
clipSpaceCorrMatrix
()
const
{
// See
e.g.
https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/
// See https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/
static
QMatrix4x4
m
;
if
(
m
.
isIdentity
())
{
...
...
src/rhi/qrhivulkan_p.h
View file @
72450e45
...
...
@@ -418,6 +418,7 @@ public:
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
bool
isYUpInNDC
()
const
override
;
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
...
...
Write
Preview
Markdown
is supported
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