mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 20:14:37 +00:00
wg_engine: hotfix
- initialize stage buffers before drawing - confirm the surface size in sync stage Co-authored-by: Jinny You <jinny@lottiefiles.com>
This commit is contained in:
parent
fd1ef5f7ec
commit
85c1ec4281
3 changed files with 18 additions and 14 deletions
|
@ -39,6 +39,8 @@ void WgCompositor::initialize(WgContext& context, uint32_t width, uint32_t heigh
|
|||
resize(context, width, height);
|
||||
// composition and blend geometries
|
||||
meshDataBlit.blitBox();
|
||||
// force stage buffers initialization
|
||||
flush(context);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -111,11 +111,11 @@ public:
|
|||
void beginRenderPass(WGPUCommandEncoder encoder, WgRenderTarget* target, bool clear, WGPUColor clearColor = { 0.0, 0.0, 0.0, 0.0 });
|
||||
void endRenderPass();
|
||||
|
||||
// request shapes for drawing (staging)
|
||||
// stage data
|
||||
// stage buffers operations
|
||||
void reset(WgContext& context);
|
||||
void flush(WgContext& context);
|
||||
|
||||
// request shapes for drawing (staging)
|
||||
void requestShape(WgRenderDataShape* renderData);
|
||||
void requestImage(WgRenderDataPicture* renderData);
|
||||
|
||||
|
|
|
@ -341,22 +341,24 @@ bool WgRenderer::sync()
|
|||
// there is no external dest buffer
|
||||
if (!dstTexture) return false;
|
||||
|
||||
// get external dest buffer
|
||||
WGPUTextureView dstTextureView = mContext.createTextureView(dstTexture);
|
||||
// insure that surface and offscreen target have the same size
|
||||
if ((wgpuTextureGetWidth(dstTexture) == mRenderTargetRoot.width) &&
|
||||
(wgpuTextureGetHeight(dstTexture) == mRenderTargetRoot.height)) {
|
||||
// get external dest buffer
|
||||
WGPUTextureView dstTextureView = mContext.createTextureView(dstTexture);
|
||||
// create command encoder
|
||||
WGPUCommandEncoder commandEncoder = mContext.createCommandEncoder();
|
||||
// show root offscreen buffer
|
||||
mCompositor.blit(mContext, commandEncoder, &mRenderTargetRoot, dstTextureView);
|
||||
mContext.submitCommandEncoder(commandEncoder);
|
||||
mContext.releaseCommandEncoder(commandEncoder);
|
||||
// release dest buffer view
|
||||
mContext.releaseTextureView(dstTextureView);
|
||||
}
|
||||
|
||||
// create command encoder
|
||||
WGPUCommandEncoder commandEncoder = mContext.createCommandEncoder();
|
||||
// show root offscreen buffer
|
||||
mCompositor.blit(mContext, commandEncoder, &mRenderTargetRoot, dstTextureView);
|
||||
mContext.submitCommandEncoder(commandEncoder);
|
||||
mContext.releaseCommandEncoder(commandEncoder);
|
||||
|
||||
// release dest buffer view
|
||||
mContext.releaseTextureView(dstTextureView);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// render target handle
|
||||
bool WgRenderer::target(WGPUDevice device, WGPUInstance instance, void* target, uint32_t width, uint32_t height, int type)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue