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
4c13d723
Commit
4c13d723
authored
Nov 23, 2018
by
Laszlo Agocs
Browse files
Add begin/endOffscreen in the api
only implemented for Vulkan for now
parent
31c51fa0
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/rhi/qrhi.cpp
View file @
4c13d723
...
...
@@ -415,6 +415,16 @@ QRhi::FrameOpResult QRhi::endFrame(QRhiSwapChain *swapChain)
return
d
->
endFrame
(
swapChain
);
}
QRhi
::
FrameOpResult
QRhi
::
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
{
return
d
->
beginOffscreenFrame
(
cb
);
}
QRhi
::
FrameOpResult
QRhi
::
endAndWaitOffscreenFrame
()
{
return
d
->
endAndWaitOffscreenFrame
();
}
void
QRhi
::
beginPass
(
QRhiRenderTarget
*
rt
,
QRhiCommandBuffer
*
cb
,
const
QRhiColorClearValue
&
colorClearValue
,
...
...
src/rhi/qrhi.h
View file @
4c13d723
...
...
@@ -967,6 +967,22 @@ public:
FrameOpResult
beginFrame
(
QRhiSwapChain
*
swapChain
);
FrameOpResult
endFrame
(
QRhiSwapChain
*
swapChain
);
/*
Rendering without a swapchain is possible as well. This is synchronous in
the sense that end will wait for completion of the submitted commands.
The typical use case is to use it in completely offscreen applications,
e.g. to generate image sequences by rendering and reading back without
ever showing a window.
QRhiCommandBuffer *cb; // not owned
beginOffscreenFrame(&cb);
// ... the usual, set up a QRhiTextureRenderTarget, beginPass-endPass, etc.
endAndWaitOffscreenFrame();
// unlike a normal begin-end, the commands, including any readbacks
// have completed at this point
*/
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
);
FrameOpResult
endAndWaitOffscreenFrame
();
// Returns an instance to which updates can be queued. Batch instances are
// pooled and never owned by the application. An instance is returned to
// the pool after a beginPass() processes it or when it is "canceled" by
...
...
src/rhi/qrhi_p.h
View file @
4c13d723
...
...
@@ -83,6 +83,8 @@ public:
virtual
QRhiSwapChain
*
createSwapChain
()
=
0
;
virtual
QRhi
::
FrameOpResult
beginFrame
(
QRhiSwapChain
*
swapChain
)
=
0
;
virtual
QRhi
::
FrameOpResult
endFrame
(
QRhiSwapChain
*
swapChain
)
=
0
;
virtual
QRhi
::
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
=
0
;
virtual
QRhi
::
FrameOpResult
endAndWaitOffscreenFrame
()
=
0
;
virtual
void
beginPass
(
QRhiRenderTarget
*
rt
,
QRhiCommandBuffer
*
cb
,
...
...
src/rhi/qrhid3d11.cpp
View file @
4c13d723
...
...
@@ -497,6 +497,17 @@ QRhi::FrameOpResult QRhiD3D11::endFrame(QRhiSwapChain *swapChain)
return
QRhi
::
FrameOpSuccess
;
}
QRhi
::
FrameOpResult
QRhiD3D11
::
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
{
Q_UNUSED
(
cb
);
return
QRhi
::
FrameOpError
;
}
QRhi
::
FrameOpResult
QRhiD3D11
::
endAndWaitOffscreenFrame
()
{
return
QRhi
::
FrameOpError
;
}
static
inline
bool
isCompressedFormat
(
QRhiTexture
::
Format
format
)
{
return
format
>=
QRhiTexture
::
BC1
&&
format
<=
QRhiTexture
::
BC7
;
...
...
src/rhi/qrhid3d11_p.h
View file @
4c13d723
...
...
@@ -374,6 +374,8 @@ public:
QRhiSwapChain
*
createSwapChain
()
override
;
QRhi
::
FrameOpResult
beginFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
endFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
override
;
QRhi
::
FrameOpResult
endAndWaitOffscreenFrame
()
override
;
void
beginPass
(
QRhiRenderTarget
*
rt
,
QRhiCommandBuffer
*
cb
,
...
...
src/rhi/qrhigles2.cpp
View file @
4c13d723
...
...
@@ -399,6 +399,17 @@ QRhi::FrameOpResult QRhiGles2::endFrame(QRhiSwapChain *swapChain)
return
QRhi
::
FrameOpSuccess
;
}
QRhi
::
FrameOpResult
QRhiGles2
::
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
{
Q_UNUSED
(
cb
);
return
QRhi
::
FrameOpError
;
}
QRhi
::
FrameOpResult
QRhiGles2
::
endAndWaitOffscreenFrame
()
{
return
QRhi
::
FrameOpError
;
}
void
QRhiGles2
::
commitResourceUpdates
(
QRhiResourceUpdateBatch
*
resourceUpdates
)
{
QRhiResourceUpdateBatchPrivate
*
ud
=
QRhiResourceUpdateBatchPrivate
::
get
(
resourceUpdates
);
...
...
src/rhi/qrhigles2_p.h
View file @
4c13d723
...
...
@@ -332,6 +332,8 @@ public:
QRhiSwapChain
*
createSwapChain
()
override
;
QRhi
::
FrameOpResult
beginFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
endFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
override
;
QRhi
::
FrameOpResult
endAndWaitOffscreenFrame
()
override
;
void
beginPass
(
QRhiRenderTarget
*
rt
,
QRhiCommandBuffer
*
cb
,
...
...
src/rhi/qrhimetal.mm
View file @
4c13d723
...
...
@@ -557,6 +557,17 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain)
return
QRhi
::
FrameOpSuccess
;
}
QRhi
::
FrameOpResult
QRhiMetal
::
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
{
Q_UNUSED
(
cb
);
return
QRhi
::
FrameOpError
;
}
QRhi
::
FrameOpResult
QRhiMetal
::
endAndWaitOffscreenFrame
()
{
return
QRhi
::
FrameOpError
;
}
MTLRenderPassDescriptor
*
QRhiMetalData
::
createDefaultRenderPass
(
bool
hasDepthStencil
,
const
QRhiColorClearValue
&
colorClearValue
,
const
QRhiDepthStencilClearValue
&
depthStencilClearValue
)
...
...
src/rhi/qrhimetal_p.h
View file @
4c13d723
...
...
@@ -263,6 +263,8 @@ public:
QRhiSwapChain
*
createSwapChain
()
override
;
QRhi
::
FrameOpResult
beginFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
endFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
override
;
QRhi
::
FrameOpResult
endAndWaitOffscreenFrame
()
override
;
void
beginPass
(
QRhiRenderTarget
*
rt
,
QRhiCommandBuffer
*
cb
,
...
...
src/rhi/qrhivulkan_p.h
View file @
4c13d723
...
...
@@ -325,6 +325,8 @@ public:
QRhiSwapChain
*
createSwapChain
()
override
;
QRhi
::
FrameOpResult
beginFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
endFrame
(
QRhiSwapChain
*
swapChain
)
override
;
QRhi
::
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
)
override
;
QRhi
::
FrameOpResult
endAndWaitOffscreenFrame
()
override
;
void
beginPass
(
QRhiRenderTarget
*
rt
,
QRhiCommandBuffer
*
cb
,
...
...
@@ -392,8 +394,6 @@ public:
QRhi
::
FrameOpResult
endWrapperFrame
(
QRhiSwapChain
*
swapChain
);
QRhi
::
FrameOpResult
beginNonWrapperFrame
(
QRhiSwapChain
*
swapChain
);
QRhi
::
FrameOpResult
endNonWrapperFrame
(
QRhiSwapChain
*
swapChain
);
QRhi
::
FrameOpResult
beginOffscreenFrame
(
QRhiCommandBuffer
**
cb
);
QRhi
::
FrameOpResult
endAndWaitOffscreenFrame
();
void
prepareNewFrame
(
QRhiCommandBuffer
*
cb
);
void
finishFrame
();
void
commitResourceUpdates
(
QRhiCommandBuffer
*
cb
,
QRhiResourceUpdateBatch
*
resourceUpdates
);
...
...
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