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
922bb6b3
Commit
922bb6b3
authored
Jan 05, 2019
by
Laszlo Agocs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a way to query texture (2D) limits
parent
43d7e48f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
84 additions
and
6 deletions
+84
-6
examples/rhi/triquadcube/triquadcube.cpp
examples/rhi/triquadcube/triquadcube.cpp
+6
-0
src/rhi/qrhi.cpp
src/rhi/qrhi.cpp
+5
-0
src/rhi/qrhi.h
src/rhi/qrhi.h
+6
-0
src/rhi/qrhi_p.h
src/rhi/qrhi_p.h
+2
-1
src/rhi/qrhid3d11.cpp
src/rhi/qrhid3d11.cpp
+14
-1
src/rhi/qrhid3d11_p.h
src/rhi/qrhid3d11_p.h
+1
-0
src/rhi/qrhigles2.cpp
src/rhi/qrhigles2.cpp
+16
-1
src/rhi/qrhigles2_p.h
src/rhi/qrhigles2_p.h
+2
-0
src/rhi/qrhimetal.mm
src/rhi/qrhimetal.mm
+14
-1
src/rhi/qrhimetal_p.h
src/rhi/qrhimetal_p.h
+1
-0
src/rhi/qrhivulkan.cpp
src/rhi/qrhivulkan.cpp
+14
-1
src/rhi/qrhivulkan_p.h
src/rhi/qrhivulkan_p.h
+1
-0
todo.txt
todo.txt
+2
-1
No files found.
examples/rhi/triquadcube/triquadcube.cpp
View file @
922bb6b3
...
...
@@ -142,6 +142,12 @@ void Window::customInit()
// Put the gpu mem allocator statistics to the profiling stream after doing
// all the init. (where applicable)
m_r
->
profiler
()
->
addVMemAllocatorStats
();
// Check some features/limits.
qDebug
(
"isFeatureSupported(MultisampleTexture): %d"
,
m_r
->
isFeatureSupported
(
QRhi
::
MultisampleTexture
));
qDebug
(
"isFeatureSupported(MultisampleRenderBuffer): %d"
,
m_r
->
isFeatureSupported
(
QRhi
::
MultisampleRenderBuffer
));
qDebug
(
"Min 2D texture width/height: %d"
,
m_r
->
resourceSizeLimit
(
QRhi
::
TextureSizeMin
));
qDebug
(
"Max 2D texture width/height: %d"
,
m_r
->
resourceSizeLimit
(
QRhi
::
TextureSizeMax
));
}
void
Window
::
customRelease
()
...
...
src/rhi/qrhi.cpp
View file @
922bb6b3
...
...
@@ -694,6 +694,11 @@ bool QRhi::isFeatureSupported(QRhi::Feature feature) const
return
d
->
isFeatureSupported
(
feature
);
}
int
QRhi
::
resourceSizeLimit
(
ResourceSizeLimit
limit
)
const
{
return
d
->
resourceSizeLimit
(
limit
);
}
const
QRhiNativeHandles
*
QRhi
::
nativeHandles
()
{
return
d
->
nativeHandles
();
...
...
src/rhi/qrhi.h
View file @
922bb6b3
...
...
@@ -1116,6 +1116,11 @@ public:
MultisampleRenderBuffer
};
enum
ResourceSizeLimit
{
TextureSizeMin
=
1
,
TextureSizeMax
};
~
QRhi
();
static
QRhi
*
create
(
Implementation
impl
,
QRhiInitParams
*
params
,
Flags
flags
=
Flags
());
...
...
@@ -1255,6 +1260,7 @@ public:
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
=
QRhiTexture
::
Flags
())
const
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
;
int
resourceSizeLimit
(
ResourceSizeLimit
limit
)
const
;
// Returns a ptr to a QRhi<backend>NativeHandles struct.
// Ownership of the native objects is not transfered.
...
...
src/rhi/qrhi_p.h
View file @
922bb6b3
...
...
@@ -132,7 +132,8 @@ public:
virtual
bool
isYUpInFramebuffer
()
const
=
0
;
virtual
QMatrix4x4
clipSpaceCorrMatrix
()
const
=
0
;
virtual
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
=
0
;
virtual
bool
isFeatureSupported
(
QRhi
::
Feature
)
const
=
0
;
virtual
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
=
0
;
virtual
int
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
=
0
;
virtual
const
QRhiNativeHandles
*
nativeHandles
()
=
0
;
virtual
void
sendVMemStatsToProfiler
();
...
...
src/rhi/qrhid3d11.cpp
View file @
922bb6b3
...
...
@@ -267,6 +267,19 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
}
}
int
QRhiD3D11
::
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
{
switch
(
limit
)
{
case
QRhi
::
TextureSizeMin
:
return
1
;
case
QRhi
::
TextureSizeMax
:
return
D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION
;
default:
Q_UNREACHABLE
();
return
0
;
}
}
const
QRhiNativeHandles
*
QRhiD3D11
::
nativeHandles
()
{
return
&
nativeHandlesStruct
;
...
...
@@ -1655,7 +1668,7 @@ bool QD3D11Texture::prepareBuild(QSize *adjustedSize)
if
(
tex
)
release
();
const
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
6
,
16
)
:
m_pixelSize
;
const
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
,
1
)
:
m_pixelSize
;
const
bool
isDepth
=
isDepthTextureFormat
(
m_format
);
const
bool
isCube
=
m_flags
.
testFlag
(
CubeMap
);
const
bool
hasMipMaps
=
m_flags
.
testFlag
(
MipMapped
);
...
...
src/rhi/qrhid3d11_p.h
View file @
922bb6b3
...
...
@@ -502,6 +502,7 @@ public:
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
int
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
override
;
const
QRhiNativeHandles
*
nativeHandles
()
override
;
void
enqueueResourceUpdates
(
QRhiCommandBuffer
*
cb
,
QRhiResourceUpdateBatch
*
resourceUpdates
);
...
...
src/rhi/qrhigles2.cpp
View file @
922bb6b3
...
...
@@ -117,6 +117,8 @@ bool QRhiGles2::create(QRhi::Flags flags)
caps
.
msaaRenderBuffer
=
f
->
hasOpenGLExtension
(
QOpenGLExtensions
::
FramebufferMultisample
)
&&
f
->
hasOpenGLExtension
(
QOpenGLExtensions
::
FramebufferBlit
);
f
->
glGetIntegerv
(
GL_MAX_TEXTURE_SIZE
,
&
caps
.
maxTextureSize
);
nativeHandlesStruct
.
context
=
ctx
;
return
true
;
...
...
@@ -267,6 +269,19 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
}
}
int
QRhiGles2
::
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
{
switch
(
limit
)
{
case
QRhi
::
TextureSizeMin
:
return
1
;
case
QRhi
::
TextureSizeMax
:
return
caps
.
maxTextureSize
;
default:
Q_UNREACHABLE
();
return
0
;
}
}
const
QRhiNativeHandles
*
QRhiGles2
::
nativeHandles
()
{
return
&
nativeHandlesStruct
;
...
...
@@ -1666,7 +1681,7 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
if
(
!
rhiD
->
ensureContext
())
return
false
;
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
6
,
16
)
:
m_pixelSize
;
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
,
1
)
:
m_pixelSize
;
if
(
!
rhiD
->
f
->
hasOpenGLFeature
(
QOpenGLFunctions
::
NPOTTextures
)
&&
(
!
isPowerOfTwo
(
size
.
width
())
||
!
isPowerOfTwo
(
size
.
height
())))
{
...
...
src/rhi/qrhigles2_p.h
View file @
922bb6b3
...
...
@@ -511,6 +511,7 @@ public:
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
int
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
override
;
const
QRhiNativeHandles
*
nativeHandles
()
override
;
bool
ensureContext
(
QSurface
*
surface
=
nullptr
)
const
;
...
...
@@ -529,6 +530,7 @@ public:
// Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
// the same as multisample textures!
bool
msaaRenderBuffer
=
false
;
int
maxTextureSize
=
2048
;
}
caps
;
bool
inFrame
=
false
;
int
finishedFrameCount
=
0
;
...
...
src/rhi/qrhimetal.mm
View file @
922bb6b3
...
...
@@ -342,6 +342,19 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
}
}
int
QRhiMetal
::
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
{
switch
(
limit
)
{
case
QRhi
::
TextureSizeMin
:
return
1
;
case
QRhi
::
TextureSizeMax
:
return
16384
;
// ###
default:
Q_UNREACHABLE
();
return
0
;
}
}
const
QRhiNativeHandles
*
QRhiMetal
::
nativeHandles
()
{
return
&
nativeHandlesStruct
;
...
...
@@ -1549,7 +1562,7 @@ bool QMetalTexture::prepareBuild(QSize *adjustedSize)
if
(
d
->
tex
)
release
();
const
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
6
,
16
)
:
m_pixelSize
;
const
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
,
1
)
:
m_pixelSize
;
const
bool
isCube
=
m_flags
.
testFlag
(
CubeMap
);
const
bool
hasMipMaps
=
m_flags
.
testFlag
(
MipMapped
);
...
...
src/rhi/qrhimetal_p.h
View file @
922bb6b3
...
...
@@ -326,6 +326,7 @@ public:
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
int
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
override
;
const
QRhiNativeHandles
*
nativeHandles
()
override
;
void
executeDeferredReleases
(
bool
forced
=
false
);
...
...
src/rhi/qrhivulkan.cpp
View file @
922bb6b3
...
...
@@ -2641,6 +2641,19 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
}
}
int
QRhiVulkan
::
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
{
switch
(
limit
)
{
case
QRhi
::
TextureSizeMin
:
return
1
;
case
QRhi
::
TextureSizeMax
:
return
physDevProperties
.
limits
.
maxImageDimension2D
;
default:
Q_UNREACHABLE
();
return
0
;
}
}
const
QRhiNativeHandles
*
QRhiVulkan
::
nativeHandles
()
{
return
&
nativeHandlesStruct
;
...
...
@@ -3462,7 +3475,7 @@ bool QVkTexture::prepareBuild(QSize *adjustedSize)
return
false
;
}
const
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
6
,
16
)
:
m_pixelSize
;
const
QSize
size
=
m_pixelSize
.
isEmpty
()
?
QSize
(
1
,
1
)
:
m_pixelSize
;
const
bool
isCube
=
m_flags
.
testFlag
(
CubeMap
);
const
bool
hasMipMaps
=
m_flags
.
testFlag
(
MipMapped
);
...
...
src/rhi/qrhivulkan_p.h
View file @
922bb6b3
...
...
@@ -397,6 +397,7 @@ public:
QMatrix4x4
clipSpaceCorrMatrix
()
const
override
;
bool
isTextureFormatSupported
(
QRhiTexture
::
Format
format
,
QRhiTexture
::
Flags
flags
)
const
override
;
bool
isFeatureSupported
(
QRhi
::
Feature
feature
)
const
override
;
int
resourceSizeLimit
(
QRhi
::
ResourceSizeLimit
limit
)
const
override
;
const
QRhiNativeHandles
*
nativeHandles
()
override
;
void
sendVMemStatsToProfiler
()
override
;
...
...
todo.txt
View file @
922bb6b3
...
...
@@ -2,8 +2,8 @@ prof report api (fed by a cbor stream)
vk, gl: tex and other prof
vk, gl: debug: object names
vk, gl: debug: markers (begin, end, msg)
mtl: max texture size
prof: report rb buf
max texture size stuff
multiwindow_threaded should demo pulling out the device and importing to another rhi
mtl: reduce set*
advanced blend modes
...
...
@@ -53,6 +53,7 @@ dxc for d3d as an alternative to fxc?
hlsl -> dxc -> spirv -> spirv-cross hmmm...
+++ done
max texture size stuff
d3d: tex and other prof
plainqwindow examples should be reorganized into one (using examplefw)
d3d: debug markers, object names
...
...
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