Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Laszlo Agocs
qtrhi
Commits
75bda640
Commit
75bda640
authored
Nov 23, 2018
by
Laszlo Agocs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add readback api skeleton
not yet implemented
parent
525be680
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
57 additions
and
5 deletions
+57
-5
examples/rhi/offscreen_vulkan/main.cpp
examples/rhi/offscreen_vulkan/main.cpp
+6
-3
src/rhi/qrhi.cpp
src/rhi/qrhi.cpp
+5
-0
src/rhi/qrhi.h
src/rhi/qrhi.h
+12
-2
src/rhi/qrhi_p.h
src/rhi/qrhi_p.h
+2
-0
src/rhi/qrhid3d11.cpp
src/rhi/qrhid3d11.cpp
+6
-0
src/rhi/qrhid3d11_p.h
src/rhi/qrhid3d11_p.h
+2
-0
src/rhi/qrhigles2.cpp
src/rhi/qrhigles2.cpp
+6
-0
src/rhi/qrhigles2_p.h
src/rhi/qrhigles2_p.h
+2
-0
src/rhi/qrhimetal.mm
src/rhi/qrhimetal.mm
+6
-0
src/rhi/qrhimetal_p.h
src/rhi/qrhimetal_p.h
+2
-0
src/rhi/qrhivulkan.cpp
src/rhi/qrhivulkan.cpp
+6
-0
src/rhi/qrhivulkan_p.h
src/rhi/qrhivulkan_p.h
+2
-0
No files found.
examples/rhi/offscreen_vulkan/main.cpp
View file @
75bda640
...
...
@@ -94,9 +94,12 @@ int main(int argc, char **argv)
rt
->
setRenderPassDescriptor
(
rp
);
rt
->
build
();
QRhiCommandBuffer
*
cb
;
if
(
r
->
beginOffscreenFrame
(
&
cb
)
==
QRhi
::
FrameOpSuccess
)
{
qDebug
(
"Generating offscreen frame"
);
for
(
int
frame
=
0
;
frame
<
20
;
++
frame
)
{
QRhiCommandBuffer
*
cb
;
if
(
r
->
beginOffscreenFrame
(
&
cb
)
!=
QRhi
::
FrameOpSuccess
)
break
;
qDebug
(
"Generating offscreen frame %d"
,
frame
);
r
->
beginPass
(
rt
,
cb
,
{
0
,
1
,
0
,
1
},
{
1
,
0
},
nullptr
);
r
->
endPass
(
cb
);
...
...
src/rhi/qrhi.cpp
View file @
75bda640
...
...
@@ -487,6 +487,11 @@ void QRhi::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
d
->
drawIndexed
(
cb
,
indexCount
,
instanceCount
,
firstIndex
,
vertexOffset
,
firstInstance
);
}
void
QRhi
::
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
{
d
->
readback
(
cb
,
rb
);
}
QVector
<
int
>
QRhi
::
supportedSampleCounts
()
const
{
return
d
->
supportedSampleCounts
();
...
...
src/rhi/qrhi.h
View file @
75bda640
...
...
@@ -280,6 +280,13 @@ Q_DECLARE_TYPEINFO(QRhiTextureUploadDescription::Layer::MipLevel, Q_MOVABLE_TYPE
Q_DECLARE_TYPEINFO
(
QRhiTextureUploadDescription
::
Layer
,
Q_MOVABLE_TYPE
);
Q_DECLARE_TYPEINFO
(
QRhiTextureUploadDescription
,
Q_MOVABLE_TYPE
);
struct
Q_RHI_EXPORT
QRhiReadback
{
// ###
};
Q_DECLARE_TYPEINFO
(
QRhiReadback
,
Q_MOVABLE_TYPE
);
class
Q_RHI_EXPORT
QRhiResource
{
public:
...
...
@@ -976,9 +983,9 @@ public:
QRhiCommandBuffer *cb; // not owned
beginOffscreenFrame(&cb);
// ... the usual, set up a QRhiTextureRenderTarget, beginPass-endPass, etc.
readback(cb, someTexture, rb);
endAndWaitOffscreenFrame();
// unlike a normal begin-end, the commands, including any readbacks
// have completed at this point
// the results are available in rb
*/
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
);
FrameOpResult
endAndWaitOffscreenFrame
();
...
...
@@ -1030,6 +1037,9 @@ public:
quint32
instanceCount
=
1
,
quint32
firstIndex
=
0
,
qint32
vertexOffset
=
0
,
quint32
firstInstance
=
0
);
// Must only be called outside a begin-endPass section.
void
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
);
QVector
<
int
>
supportedSampleCounts
()
const
;
int
ubufAlignment
()
const
;
...
...
src/rhi/qrhi_p.h
View file @
75bda640
...
...
@@ -113,6 +113,8 @@ public:
quint32
instanceCount
,
quint32
firstIndex
,
qint32
vertexOffset
,
quint32
firstInstance
)
=
0
;
virtual
void
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
=
0
;
virtual
QVector
<
int
>
supportedSampleCounts
()
const
=
0
;
virtual
int
ubufAlignment
()
const
=
0
;
virtual
bool
isYUpInFramebuffer
()
const
=
0
;
...
...
src/rhi/qrhid3d11.cpp
View file @
75bda640
...
...
@@ -453,6 +453,12 @@ void QRhiD3D11::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
cbD
->
commands
.
append
(
cmd
);
}
void
QRhiD3D11
::
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
{
Q_UNUSED
(
cb
);
Q_UNUSED
(
rb
);
}
QRhi
::
FrameOpResult
QRhiD3D11
::
beginFrame
(
QRhiSwapChain
*
swapChain
)
{
Q_ASSERT
(
!
inFrame
);
...
...
src/rhi/qrhid3d11_p.h
View file @
75bda640
...
...
@@ -405,6 +405,8 @@ public:
quint32
instanceCount
,
quint32
firstIndex
,
qint32
vertexOffset
,
quint32
firstInstance
)
override
;
void
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
override
;
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
...
...
src/rhi/qrhigles2.cpp
View file @
75bda640
...
...
@@ -366,6 +366,12 @@ void QRhiGles2::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
cbD
->
commands
.
append
(
cmd
);
}
void
QRhiGles2
::
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
{
Q_UNUSED
(
cb
);
Q_UNUSED
(
rb
);
}
QRhi
::
FrameOpResult
QRhiGles2
::
beginFrame
(
QRhiSwapChain
*
swapChain
)
{
Q_ASSERT
(
!
inFrame
);
...
...
src/rhi/qrhigles2_p.h
View file @
75bda640
...
...
@@ -363,6 +363,8 @@ public:
quint32
instanceCount
,
quint32
firstIndex
,
qint32
vertexOffset
,
quint32
firstInstance
)
override
;
void
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
override
;
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
...
...
src/rhi/qrhimetal.mm
View file @
75bda640
...
...
@@ -496,6 +496,12 @@ void QRhiMetal::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
baseInstance:
firstInstance
];
}
void
QRhiMetal
::
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
{
Q_UNUSED
(
cb
);
Q_UNUSED
(
rb
);
}
QRhi
::
FrameOpResult
QRhiMetal
::
beginFrame
(
QRhiSwapChain
*
swapChain
)
{
Q_ASSERT
(
!
inFrame
);
...
...
src/rhi/qrhimetal_p.h
View file @
75bda640
...
...
@@ -294,6 +294,8 @@ public:
quint32
instanceCount
,
quint32
firstIndex
,
qint32
vertexOffset
,
quint32
firstInstance
)
override
;
void
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
override
;
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
const
override
;
...
...
src/rhi/qrhivulkan.cpp
View file @
75bda640
...
...
@@ -2315,6 +2315,12 @@ void QRhiVulkan::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
df
->
vkCmdDrawIndexed
(
QRHI_RES
(
QVkCommandBuffer
,
cb
)
->
cb
,
indexCount
,
instanceCount
,
firstIndex
,
vertexOffset
,
firstInstance
);
}
void
QRhiVulkan
::
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
{
Q_UNUSED
(
cb
);
Q_UNUSED
(
rb
);
}
static
inline
VkBufferUsageFlagBits
toVkBufferUsage
(
QRhiBuffer
::
UsageFlags
usage
)
{
int
u
=
0
;
...
...
src/rhi/qrhivulkan_p.h
View file @
75bda640
...
...
@@ -356,6 +356,8 @@ public:
quint32
instanceCount
,
quint32
firstIndex
,
qint32
vertexOffset
,
quint32
firstInstance
)
override
;
void
readback
(
QRhiCommandBuffer
*
cb
,
QRhiReadback
*
rb
)
override
;
QVector
<
int
>
supportedSampleCounts
()
const
override
;
int
ubufAlignment
()
const
override
;
bool
isYUpInFramebuffer
()
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