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
c3e718a0
Commit
c3e718a0
authored
Dec 03, 2018
by
Laszlo Agocs
Browse files
Unify tex and rt apis
hints -> flags for rt, add sampleCount for tex
parent
8394ef03
Changes
19
Hide whitespace changes
Inline
Side-by-side
examples/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp
View file @
c3e718a0
...
...
@@ -82,7 +82,7 @@ void Window::customInit()
d
.
compressedData
=
loadBC1
(
QLatin1String
(
":/qt256_bc1_9mips.dds"
),
&
imageSize
);
qDebug
()
<<
d
.
compressedData
.
count
()
<<
imageSize
<<
m_r
->
mipLevelsForSize
(
imageSize
);
d
.
tex
=
m_r
->
newTexture
(
QRhiTexture
::
BC1
,
imageSize
,
QRhiTexture
::
MipMapped
);
d
.
tex
=
m_r
->
newTexture
(
QRhiTexture
::
BC1
,
imageSize
,
1
,
QRhiTexture
::
MipMapped
);
d
.
tex
->
build
();
d
.
sampler
=
m_r
->
newSampler
(
QRhiSampler
::
Linear
,
QRhiSampler
::
Linear
,
QRhiSampler
::
Linear
,
...
...
examples/rhi/offscreen_d3d11/main.cpp
View file @
c3e718a0
...
...
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
return
1
;
}
QRhiTexture
*
tex
=
r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
1280
,
720
),
QRhiTexture
::
RenderTarget
|
QRhiTexture
::
UsedAsTransferSource
);
QRhiTexture
*
tex
=
r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
1280
,
720
),
1
,
QRhiTexture
::
RenderTarget
|
QRhiTexture
::
UsedAsTransferSource
);
tex
->
build
();
QRhiTextureRenderTarget
*
rt
=
r
->
newTextureRenderTarget
({
tex
});
QRhiRenderPassDescriptor
*
rp
=
rt
->
newCompatibleRenderPassDescriptor
();
...
...
examples/rhi/offscreen_gles2/main.cpp
View file @
c3e718a0
...
...
@@ -96,7 +96,7 @@ int main(int argc, char **argv)
return
1
;
}
QRhiTexture
*
tex
=
r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
1280
,
720
),
QRhiTexture
::
RenderTarget
|
QRhiTexture
::
UsedAsTransferSource
);
QRhiTexture
*
tex
=
r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
1280
,
720
),
1
,
QRhiTexture
::
RenderTarget
|
QRhiTexture
::
UsedAsTransferSource
);
tex
->
build
();
QRhiTextureRenderTarget
*
rt
=
r
->
newTextureRenderTarget
({
tex
});
QRhiRenderPassDescriptor
*
rp
=
rt
->
newCompatibleRenderPassDescriptor
();
...
...
examples/rhi/offscreen_vulkan/main.cpp
View file @
c3e718a0
...
...
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
return
1
;
}
QRhiTexture
*
tex
=
r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
1280
,
720
),
QRhiTexture
::
RenderTarget
|
QRhiTexture
::
UsedAsTransferSource
);
QRhiTexture
*
tex
=
r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
1280
,
720
),
1
,
QRhiTexture
::
RenderTarget
|
QRhiTexture
::
UsedAsTransferSource
);
tex
->
build
();
QRhiTextureRenderTarget
*
rt
=
r
->
newTextureRenderTarget
({
tex
});
QRhiRenderPassDescriptor
*
rp
=
rt
->
newCompatibleRenderPassDescriptor
();
...
...
examples/rhi/shared/texturedcuberenderer.cpp
View file @
c3e718a0
...
...
@@ -78,7 +78,7 @@ void TexturedCubeRenderer::initResources(QRhiRenderPassDescriptor *rp)
QRhiTexture
::
Flags
texFlags
=
0
;
if
(
MIPMAP
)
texFlags
|=
QRhiTexture
::
MipMapped
;
m_tex
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
m_image
.
width
(),
m_image
.
height
()),
texFlags
);
m_tex
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
QSize
(
m_image
.
width
(),
m_image
.
height
()),
1
,
texFlags
);
m_tex
->
build
();
m_sampler
=
m_r
->
newSampler
(
QRhiSampler
::
Linear
,
QRhiSampler
::
Linear
,
MIPMAP
?
QRhiSampler
::
Linear
:
QRhiSampler
::
None
,
...
...
examples/rhi/shared/triangleoncuberenderer.cpp
View file @
c3e718a0
...
...
@@ -87,11 +87,11 @@ void TriangleOnCubeRenderer::initResources(QRhiRenderPassDescriptor *rp)
m_image
=
m_image
.
mirrored
();
// just cause we'll flip texcoord Y when y up so accomodate our static background image as well
}
m_tex
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
OFFSCREEN_SIZE
,
QRhiTexture
::
RenderTarget
);
m_tex
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
OFFSCREEN_SIZE
,
1
,
QRhiTexture
::
RenderTarget
);
m_tex
->
build
();
if
(
MRT
)
{
m_tex2
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
OFFSCREEN_SIZE
,
QRhiTexture
::
RenderTarget
);
m_tex2
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
OFFSCREEN_SIZE
,
1
,
QRhiTexture
::
RenderTarget
);
m_tex2
->
build
();
}
...
...
@@ -143,7 +143,7 @@ void TriangleOnCubeRenderer::initResources(QRhiRenderPassDescriptor *rp)
if
(
DEPTH_TEXTURE
)
{
m_offscreenTriangle
.
setDepthWrite
(
true
);
m_depthTex
=
m_r
->
newTexture
(
QRhiTexture
::
D32
,
OFFSCREEN_SIZE
,
QRhiTexture
::
RenderTarget
);
m_depthTex
=
m_r
->
newTexture
(
QRhiTexture
::
D32
,
OFFSCREEN_SIZE
,
1
,
QRhiTexture
::
RenderTarget
);
m_depthTex
->
build
();
}
...
...
examples/rhi/texuploads/texuploads.cpp
View file @
c3e718a0
...
...
@@ -77,7 +77,7 @@ void Window::customInit()
d
.
ubuf
->
build
();
QImage
baseImage
(
QLatin1String
(
":/qt256.png"
));
d
.
tex
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
baseImage
.
size
(),
QRhiTexture
::
UsedAsTransferSource
);
d
.
tex
=
m_r
->
newTexture
(
QRhiTexture
::
RGBA8
,
baseImage
.
size
(),
1
,
QRhiTexture
::
UsedAsTransferSource
);
d
.
tex
->
build
();
// As an alternative to what some of the other examples do, prepare an
...
...
src/rhi/qrhi.cpp
View file @
c3e718a0
...
...
@@ -72,15 +72,16 @@ QRhiBuffer::QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, i
}
QRhiRenderBuffer
::
QRhiRenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type_
,
const
QSize
&
pixelSize_
,
int
sampleCount_
,
Hints
hint
s_
)
int
sampleCount_
,
Flags
flag
s_
)
:
QRhiResource
(
rhi
),
m_type
(
type_
),
m_pixelSize
(
pixelSize_
),
m_sampleCount
(
sampleCount_
),
m_
hints
(
hint
s_
)
m_type
(
type_
),
m_pixelSize
(
pixelSize_
),
m_sampleCount
(
sampleCount_
),
m_
flags
(
flag
s_
)
{
}
QRhiTexture
::
QRhiTexture
(
QRhiImplementation
*
rhi
,
Format
format_
,
const
QSize
&
pixelSize_
,
Flags
flags_
)
QRhiTexture
::
QRhiTexture
(
QRhiImplementation
*
rhi
,
Format
format_
,
const
QSize
&
pixelSize_
,
int
sampleCount_
,
Flags
flags_
)
:
QRhiResource
(
rhi
),
m_format
(
format_
),
m_pixelSize
(
pixelSize_
),
m_flags
(
flags_
)
m_format
(
format_
),
m_pixelSize
(
pixelSize_
),
m_sampleCount
(
sampleCount_
),
m_flags
(
flags_
)
{
}
...
...
@@ -632,16 +633,17 @@ QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type,
QRhiRenderBuffer
*
QRhi
::
newRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
QRhiRenderBuffer
::
Flags
flag
s
)
{
return
d
->
createRenderBuffer
(
type
,
pixelSize
,
sampleCount
,
hint
s
);
return
d
->
createRenderBuffer
(
type
,
pixelSize
,
sampleCount
,
flag
s
);
}
QRhiTexture
*
QRhi
::
newTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
{
return
d
->
createTexture
(
format
,
pixelSize
,
flags
);
return
d
->
createTexture
(
format
,
pixelSize
,
sampleCount
,
flags
);
}
QRhiSampler
*
QRhi
::
newSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
...
...
src/rhi/qrhi.h
View file @
c3e718a0
...
...
@@ -387,10 +387,10 @@ public:
DepthStencil
};
enum
Hint
{
enum
Flag
{
ToBeUsedWithSwapChainOnly
=
1
<<
0
// use implicit winsys buffers, don't create anything (GL)
};
Q_DECLARE_FLAGS
(
Hints
,
Hint
)
Q_DECLARE_FLAGS
(
Flags
,
Flag
)
Type
type
()
const
{
return
m_type
;
}
void
setType
(
Type
t
)
{
m_type
=
t
;
}
...
...
@@ -401,22 +401,22 @@ public:
int
sampleCount
()
const
{
return
m_sampleCount
;
}
void
setSampleCount
(
int
s
)
{
m_sampleCount
=
s
;
}
Hints
hint
s
()
const
{
return
m_
hint
s
;
}
void
set
Hints
(
Hint
s
h
)
{
m_
hint
s
=
h
;
}
Flags
flag
s
()
const
{
return
m_
flag
s
;
}
void
set
Flags
(
Flag
s
h
)
{
m_
flag
s
=
h
;
}
virtual
bool
build
()
=
0
;
protected:
QRhiRenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type_
,
const
QSize
&
pixelSize_
,
int
sampleCount_
,
Hints
hint
s_
);
int
sampleCount_
,
Flags
flag
s_
);
Type
m_type
;
QSize
m_pixelSize
;
int
m_sampleCount
;
Hints
m_hint
s
;
Flags
m_flag
s
;
void
*
m_reserved
;
};
Q_DECLARE_OPERATORS_FOR_FLAGS
(
QRhiRenderBuffer
::
Hint
s
)
Q_DECLARE_OPERATORS_FOR_FLAGS
(
QRhiRenderBuffer
::
Flag
s
)
class
Q_RHI_EXPORT
QRhiTexture
:
public
QRhiResource
{
...
...
@@ -427,7 +427,7 @@ public:
CubeMap
=
1
<<
2
,
MipMapped
=
1
<<
3
,
sRGB
=
1
<<
4
,
UsedAsTransferSource
=
1
<<
5
UsedAsTransferSource
=
1
<<
5
// will (also) be used as the source of a readback or copy
};
Q_DECLARE_FLAGS
(
Flags
,
Flag
)
...
...
@@ -479,13 +479,18 @@ public:
Flags
flags
()
const
{
return
m_flags
;
}
void
setFlags
(
Flags
f
)
{
m_flags
=
f
;
}
int
sampleCount
()
const
{
return
m_sampleCount
;
}
void
setSampleCount
(
int
s
)
{
m_sampleCount
=
s
;
}
virtual
bool
build
()
=
0
;
protected:
QRhiTexture
(
QRhiImplementation
*
rhi
,
Format
format_
,
const
QSize
&
pixelSize_
,
Flags
flags_
);
QRhiTexture
(
QRhiImplementation
*
rhi
,
Format
format_
,
const
QSize
&
pixelSize_
,
int
sampleCount_
,
Flags
flags_
);
Format
m_format
;
QSize
m_pixelSize
;
Flags
m_flags
;
int
m_sampleCount
;
void
*
m_reserved
;
};
...
...
@@ -1064,15 +1069,16 @@ public:
// To be used for depth-stencil when no access is needed afterwards.
// Transient image, backed by lazily allocated memory (on Vulkan at least,
// ideal for tiled GPUs). May also be a dummy internally depending on the
// backend and the
hint
s (OpenGL, where the winsys interface provides the
// backend and the
flag
s (OpenGL, where the winsys interface provides the
// depth-stencil buffer via the window surface).
QRhiRenderBuffer
*
newRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
=
1
,
QRhiRenderBuffer
::
Hints
hint
s
=
QRhiRenderBuffer
::
Hint
s
());
QRhiRenderBuffer
::
Flags
flag
s
=
QRhiRenderBuffer
::
Flag
s
());
QRhiTexture
*
newTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
=
1
,
QRhiTexture
::
Flags
flags
=
QRhiTexture
::
Flags
());
QRhiSampler
*
newSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
...
...
src/rhi/qrhi_p.h
View file @
c3e718a0
...
...
@@ -69,9 +69,10 @@ public:
virtual
QRhiRenderBuffer
*
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
=
0
;
QRhiRenderBuffer
::
Flags
flag
s
)
=
0
;
virtual
QRhiTexture
*
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
=
0
;
virtual
QRhiSampler
*
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
QRhiSampler
::
Filter
mipmapMode
,
...
...
src/rhi/qrhid3d11.cpp
View file @
c3e718a0
...
...
@@ -242,14 +242,15 @@ bool QRhiD3D11::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
}
QRhiRenderBuffer
*
QRhiD3D11
::
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
{
return
new
QD3D11RenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
hint
s
);
return
new
QD3D11RenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
flag
s
);
}
QRhiTexture
*
QRhiD3D11
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
QRhiTexture
::
Flags
flags
)
QRhiTexture
*
QRhiD3D11
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
{
return
new
QD3D11Texture
(
this
,
format
,
pixelSize
,
flags
);
return
new
QD3D11Texture
(
this
,
format
,
pixelSize
,
sampleCount
,
flags
);
}
QRhiSampler
*
QRhiD3D11
::
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
...
...
@@ -1268,8 +1269,8 @@ bool QD3D11Buffer::build()
}
QD3D11RenderBuffer
::
QD3D11RenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
hint
s
)
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
flag
s
)
{
}
...
...
@@ -1325,8 +1326,9 @@ bool QD3D11RenderBuffer::build()
return
false
;
}
QD3D11Texture
::
QD3D11Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
flags
)
QD3D11Texture
::
QD3D11Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
sampleCount
,
flags
)
{
}
...
...
src/rhi/qrhid3d11_p.h
View file @
c3e718a0
...
...
@@ -67,7 +67,7 @@ struct QD3D11Buffer : public QRhiBuffer
struct
QD3D11RenderBuffer
:
public
QRhiRenderBuffer
{
QD3D11RenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
);
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
);
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -78,7 +78,8 @@ struct QD3D11RenderBuffer : public QRhiRenderBuffer
struct
QD3D11Texture
:
public
QRhiTexture
{
QD3D11Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
);
QD3D11Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
);
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -382,9 +383,10 @@ public:
QRhiRenderBuffer
*
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
override
;
QRhiRenderBuffer
::
Flags
flag
s
)
override
;
QRhiTexture
*
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
override
;
QRhiSampler
*
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
QRhiSampler
::
Filter
mipmapMode
,
...
...
src/rhi/qrhigles2.cpp
View file @
c3e718a0
...
...
@@ -251,14 +251,15 @@ bool QRhiGles2::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
}
QRhiRenderBuffer
*
QRhiGles2
::
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
{
return
new
QGles2RenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
hint
s
);
return
new
QGles2RenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
flag
s
);
}
QRhiTexture
*
QRhiGles2
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
QRhiTexture
::
Flags
flags
)
QRhiTexture
*
QRhiGles2
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
{
return
new
QGles2Texture
(
this
,
format
,
pixelSize
,
flags
);
return
new
QGles2Texture
(
this
,
format
,
pixelSize
,
sampleCount
,
flags
);
}
QRhiSampler
*
QRhiGles2
::
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
...
...
@@ -1350,8 +1351,8 @@ bool QGles2Buffer::build()
}
QGles2RenderBuffer
::
QGles2RenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
hint
s
)
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
flag
s
)
{
}
...
...
@@ -1378,7 +1379,7 @@ bool QGles2RenderBuffer::build()
if
(
renderbuffer
)
release
();
if
(
m_
hint
s
.
testFlag
(
ToBeUsedWithSwapChainOnly
))
if
(
m_
flag
s
.
testFlag
(
ToBeUsedWithSwapChainOnly
))
return
true
;
if
(
!
rhiD
->
ensureContext
())
...
...
@@ -1399,8 +1400,9 @@ bool QGles2RenderBuffer::build()
return
true
;
}
QGles2Texture
::
QGles2Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
flags
)
QGles2Texture
::
QGles2Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
sampleCount
,
flags
)
{
}
...
...
src/rhi/qrhigles2_p.h
View file @
c3e718a0
...
...
@@ -72,7 +72,7 @@ struct QGles2Buffer : public QRhiBuffer
struct
QGles2RenderBuffer
:
public
QRhiRenderBuffer
{
QGles2RenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
);
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
);
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -82,7 +82,8 @@ struct QGles2RenderBuffer : public QRhiRenderBuffer
struct
QGles2Texture
:
public
QRhiTexture
{
QGles2Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
);
QGles2Texture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
);
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -347,9 +348,10 @@ public:
QRhiRenderBuffer
*
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
override
;
QRhiRenderBuffer
::
Flags
flag
s
)
override
;
QRhiTexture
*
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
override
;
QRhiSampler
*
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
QRhiSampler
::
Filter
mipmapMode
,
...
...
src/rhi/qrhimetal.mm
View file @
c3e718a0
...
...
@@ -265,14 +265,15 @@ bool QRhiMetal::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
}
QRhiRenderBuffer
*
QRhiMetal
::
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
{
return
new
QMetalRenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
hint
s
);
return
new
QMetalRenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
flag
s
);
}
QRhiTexture
*
QRhiMetal
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
QRhiTexture
::
Flags
flags
)
QRhiTexture
*
QRhiMetal
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
{
return
new
QMetalTexture
(
this
,
format
,
pixelSize
,
flags
);
return
new
QMetalTexture
(
this
,
format
,
pixelSize
,
sampleCount
,
flags
);
}
QRhiSampler
*
QRhiMetal
::
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
...
...
@@ -882,8 +883,8 @@ bool QMetalBuffer::build()
}
QMetalRenderBuffer
::
QMetalRenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
hint
s
),
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
flag
s
),
d
(
new
QMetalRenderBufferData
)
{
}
...
...
@@ -938,8 +939,9 @@ bool QMetalRenderBuffer::build()
return
true
;
}
QMetalTexture
::
QMetalTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
flags
),
QMetalTexture
::
QMetalTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
sampleCount
,
flags
),
d
(
new
QMetalTextureData
)
{
for
(
int
i
=
0
;
i
<
QMTL_FRAMES_IN_FLIGHT
;
++
i
)
...
...
src/rhi/qrhimetal_p.h
View file @
c3e718a0
...
...
@@ -71,7 +71,7 @@ struct QMetalRenderBufferData;
struct
QMetalRenderBuffer
:
public
QRhiRenderBuffer
{
QMetalRenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
);
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
);
~
QMetalRenderBuffer
();
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -86,7 +86,8 @@ struct QMetalTextureData;
struct
QMetalTexture
:
public
QRhiTexture
{
QMetalTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
);
QMetalTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
);
~
QMetalTexture
();
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -249,9 +250,10 @@ public:
QRhiRenderBuffer
*
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
override
;
QRhiRenderBuffer
::
Flags
flag
s
)
override
;
QRhiTexture
*
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
override
;
QRhiSampler
*
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
QRhiSampler
::
Filter
mipmapMode
,
...
...
src/rhi/qrhivulkan.cpp
View file @
c3e718a0
...
...
@@ -2427,14 +2427,15 @@ bool QRhiVulkan::isTextureFormatSupported(QRhiTexture::Format format, QRhiTextur
}
QRhiRenderBuffer
*
QRhiVulkan
::
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
int
sampleCount
,
QRhiRenderBuffer
::
Flags
flag
s
)
{
return
new
QVkRenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
hint
s
);
return
new
QVkRenderBuffer
(
this
,
type
,
pixelSize
,
sampleCount
,
flag
s
);
}
QRhiTexture
*
QRhiVulkan
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
QRhiTexture
::
Flags
flags
)
QRhiTexture
*
QRhiVulkan
::
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
{
return
new
QVkTexture
(
this
,
format
,
pixelSize
,
flags
);
return
new
QVkTexture
(
this
,
format
,
pixelSize
,
sampleCount
,
flags
);
}
QRhiSampler
*
QRhiVulkan
::
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
...
...
@@ -3058,8 +3059,8 @@ bool QVkBuffer::build()
}
QVkRenderBuffer
::
QVkRenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Hints
hint
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
hint
s
)
int
sampleCount
,
Flags
flag
s
)
:
QRhiRenderBuffer
(
rhi
,
type
,
pixelSize
,
sampleCount
,
flag
s
)
{
}
...
...
@@ -3114,8 +3115,9 @@ bool QVkRenderBuffer::build()
return
true
;
}
QVkTexture
::
QVkTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
flags
)
QVkTexture
::
QVkTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
)
:
QRhiTexture
(
rhi
,
format
,
pixelSize
,
sampleCount
,
flags
)
{
for
(
int
i
=
0
;
i
<
QVK_FRAMES_IN_FLIGHT
;
++
i
)
{
stagingBuffers
[
i
]
=
VK_NULL_HANDLE
;
...
...
src/rhi/qrhivulkan_p.h
View file @
c3e718a0
...
...
@@ -79,7 +79,7 @@ struct QVkBuffer : public QRhiBuffer
struct
QVkRenderBuffer
:
public
QRhiRenderBuffer
{
QVkRenderBuffer
(
QRhiImplementation
*
rhi
,
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Hints
hint
s
);
int
sampleCount
,
Flags
flag
s
);
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -92,7 +92,8 @@ struct QVkRenderBuffer : public QRhiRenderBuffer
struct
QVkTexture
:
public
QRhiTexture
{
QVkTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
Flags
flags
);
QVkTexture
(
QRhiImplementation
*
rhi
,
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
Flags
flags
);
void
release
()
override
;
bool
build
()
override
;
...
...
@@ -312,9 +313,10 @@ public:
QRhiRenderBuffer
*
createRenderBuffer
(
QRhiRenderBuffer
::
Type
type
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiRenderBuffer
::
Hints
hint
s
)
override
;
QRhiRenderBuffer
::
Flags
flag
s
)
override
;
QRhiTexture
*
createTexture
(
QRhiTexture
::
Format
format
,
const
QSize
&
pixelSize
,
int
sampleCount
,
QRhiTexture
::
Flags
flags
)
override
;
QRhiSampler
*
createSampler
(
QRhiSampler
::
Filter
magFilter
,
QRhiSampler
::
Filter
minFilter
,
QRhiSampler
::
Filter
mipmapMode
,
...
...
todo.txt
View file @
c3e718a0
...
...
@@ -3,35 +3,43 @@ mtl: texcopy
mtl: rhi without a window, offscreen frame
mtl: readback (tex, backbuffer)
mtl: compressed textures
gl, mtl: srgb (tex, swapchain buf)
multi window? (multi swapchain) -> trouble
vk: rendering hangs sometimes when minimize and back on some systems?
mtl: cubemaps
mtl: targeting cubemap faces
mtl: cbuffers, textures, samplers set should be batched too
mtl: msaa (onscreen)
mtl: srgb (tex, swapchain buf)
test cubemap
test cubemap face as target
face cubemap readback? (test vk/d3d, impl for gl)
cbuffer alignment rules - some things fail to translate (to hlsl e.g. with structs), which is fine but how to mitigate
resource import/export, what's the co-op story?
what does image copy do for compressed formats?
does reading back an msaa swapchain buffer work?
face cubemap readback? (test vk/d3d, impl for gl/mtl)
msaa offscreen (msaa texture. no readback.)
resolveimage (color and ds, only to resolve samples)
gl: tex size stuff (npot etc.)
gl: tex formats (texture, readback)
gl: srgb
mipmap generation?
advanced blend modes
resource import/export, what's the interop story
multi window? (multi swapchain) -> trouble
vk: rendering hangs sometimes when minimize and back on some systems?
mtl: cbuffers, textures, samplers set should be batched too
cbuffer alignment rules - some things fail to translate (to hlsl e.g. with structs), which is fine but how to mitigate
what does image copy do for compressed formats?
does reading back an msaa swapchain buffer work?
figure sg out for minimizing viewport/scissor cmds
vk: test FrameOpDeviceLost somehow
d3d device loss?
more what-if-resource-rebuilt cases
anisotropic
gl: more ubuf types
gl: reduce state, reduce texparam
gl: tex size stuff (npot etc.)
gl: tex formats (texture, readback)
more QImage->tex formats
d3d, gl, mtl: cache shader sources?
advanced blend modes?
resize to 0 width or height fails (vk)
gl: ubuf structs, arrays
gl: target QOpenGLWindow/Widget?
...
...
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