mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
wg_engine: fix scene blending
In a case of scenes without masking white clear color used, instead of black color Issue https://github.com/thorvg/thorvg/issues/2592 Issue https://github.com/thorvg/thorvg/issues/2921
This commit is contained in:
parent
2ad6753680
commit
52356b023d
3 changed files with 6 additions and 3 deletions
|
@ -88,7 +88,7 @@ RenderRegion WgCompositor::shrinkRenderRegion(RenderRegion& rect)
|
|||
}
|
||||
|
||||
|
||||
void WgCompositor::beginRenderPass(WGPUCommandEncoder commandEncoder, WgRenderStorage* target, bool clear)
|
||||
void WgCompositor::beginRenderPass(WGPUCommandEncoder commandEncoder, WgRenderStorage* target, bool clear, WGPUColor clearColor)
|
||||
{
|
||||
assert(commandEncoder);
|
||||
assert(target);
|
||||
|
@ -105,6 +105,7 @@ void WgCompositor::beginRenderPass(WGPUCommandEncoder commandEncoder, WgRenderSt
|
|||
colorAttachment.loadOp = clear ? WGPULoadOp_Clear : WGPULoadOp_Load,
|
||||
colorAttachment.storeOp = WGPUStoreOp_Store;
|
||||
colorAttachment.resolveTarget = target->texView;
|
||||
colorAttachment.clearValue = clearColor;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
colorAttachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
|
||||
#endif
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
void release(WgContext& context);
|
||||
|
||||
// render passes workflow
|
||||
void beginRenderPass(WGPUCommandEncoder encoder, WgRenderStorage* target, bool clear);
|
||||
void beginRenderPass(WGPUCommandEncoder encoder, WgRenderStorage* target, bool clear, WGPUColor clearColor = { 0.0, 0.0, 0.0, 0.0 });
|
||||
void endRenderPass();
|
||||
|
||||
// render shapes, images and scenes
|
||||
|
|
|
@ -368,7 +368,9 @@ bool WgRenderer::beginComposite(RenderCompositor* cmp, MaskMethod method, uint8_
|
|||
WgRenderStorage* storage = mRenderStoragePool.allocate(mContext);
|
||||
mRenderStorageStack.push(storage);
|
||||
// begin newly added render pass
|
||||
mCompositor.beginRenderPass(mCommandEncoder, mRenderStorageStack.last(), true);
|
||||
WGPUColor color{};
|
||||
if ((method == MaskMethod::None) && (opacity != 255)) color = { 1.0, 1.0, 1.0, 0.0 };
|
||||
mCompositor.beginRenderPass(mCommandEncoder, mRenderStorageStack.last(), true, color);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue