diff --git a/src/renderer/wg_engine/tvgWgCommon.cpp b/src/renderer/wg_engine/tvgWgCommon.cpp index 2bb493a6..a56a56a0 100644 --- a/src/renderer/wg_engine/tvgWgCommon.cpp +++ b/src/renderer/wg_engine/tvgWgCommon.cpp @@ -85,7 +85,6 @@ bool WgContext::allocateTexture(WGPUTexture& texture, uint32_t width, uint32_t h const WGPUTextureDataLayout textureDataLayout{ .bytesPerRow = 4 * width, .rowsPerImage = height }; const WGPUExtent3D writeSize{ .width = width, .height = height, .depthOrArrayLayers = 1 }; wgpuQueueWriteTexture(queue, &imageCopyTexture, data, 4 * width * height, &textureDataLayout, &writeSize); - wgpuQueueSubmit(queue, 0, nullptr); } else { releaseTexture(texture); texture = createTexture(width, height, format); @@ -94,7 +93,6 @@ bool WgContext::allocateTexture(WGPUTexture& texture, uint32_t width, uint32_t h const WGPUTextureDataLayout textureDataLayout{ .bytesPerRow = 4 * width, .rowsPerImage = height }; const WGPUExtent3D writeSize{ .width = width, .height = height, .depthOrArrayLayers = 1 }; wgpuQueueWriteTexture(queue, &imageCopyTexture, data, 4 * width * height, &textureDataLayout, &writeSize); - wgpuQueueSubmit(queue, 0, nullptr); return true; } return false; @@ -287,6 +285,12 @@ void WgContext::releaseCommandEncoder(WGPUCommandEncoder& commandEncoder) } +void WgContext::submit() +{ + wgpuQueueSubmit(queue, 0, nullptr); +} + + bool WgContext::invalid() { return !instance || !device; diff --git a/src/renderer/wg_engine/tvgWgCommon.h b/src/renderer/wg_engine/tvgWgCommon.h index b0831170..16825ca6 100644 --- a/src/renderer/wg_engine/tvgWgCommon.h +++ b/src/renderer/wg_engine/tvgWgCommon.h @@ -73,6 +73,7 @@ struct WgContext { void submitCommandEncoder(WGPUCommandEncoder encoder); void releaseCommandEncoder(WGPUCommandEncoder& encoder); + void submit(); bool invalid(); }; diff --git a/src/renderer/wg_engine/tvgWgCompositor.cpp b/src/renderer/wg_engine/tvgWgCompositor.cpp index f07be669..e3cf7e06 100644 --- a/src/renderer/wg_engine/tvgWgCompositor.cpp +++ b/src/renderer/wg_engine/tvgWgCompositor.cpp @@ -201,6 +201,7 @@ void WgCompositor::flush(WgContext& context) stageBufferGeometry.append(&meshDataBlit); stageBufferGeometry.flush(context); stageBufferPaint.flush(context); + context.submit(); }