mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
wg_engine: sync up to update the engine work to webgpu_native v22
Only minor changes required Keeped compatibility with emsdk issue: https://github.com/thorvg/thorvg/issues/2909
This commit is contained in:
parent
bcfbc55af2
commit
c77b6ec8db
2 changed files with 20 additions and 16 deletions
|
@ -156,16 +156,15 @@ void WgCompositor::beginRenderPass(WGPUCommandEncoder commandEncoder, WgRenderSt
|
||||||
.depthLoadOp = WGPULoadOp_Clear, .depthStoreOp = WGPUStoreOp_Discard, .depthClearValue = 1.0f,
|
.depthLoadOp = WGPULoadOp_Clear, .depthStoreOp = WGPUStoreOp_Discard, .depthClearValue = 1.0f,
|
||||||
.stencilLoadOp = WGPULoadOp_Clear, .stencilStoreOp = WGPUStoreOp_Discard, .stencilClearValue = 0
|
.stencilLoadOp = WGPULoadOp_Clear, .stencilStoreOp = WGPUStoreOp_Discard, .stencilClearValue = 0
|
||||||
};
|
};
|
||||||
//WGPURenderPassDepthStencilAttachment depthStencilAttachment{ .view = texViewStencil, .depthClearValue = 1.0f, .stencilLoadOp = WGPULoadOp_Clear, .stencilStoreOp = WGPUStoreOp_Discard };
|
const WGPURenderPassColorAttachment colorAttachment{
|
||||||
WGPURenderPassColorAttachment colorAttachment{};
|
.view = target->texViewMS,
|
||||||
colorAttachment.view = target->texViewMS,
|
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
|
||||||
colorAttachment.loadOp = clear ? WGPULoadOp_Clear : WGPULoadOp_Load,
|
.resolveTarget = target->texView,
|
||||||
colorAttachment.storeOp = WGPUStoreOp_Store;
|
.loadOp = clear ? WGPULoadOp_Clear : WGPULoadOp_Load,
|
||||||
colorAttachment.resolveTarget = target->texView;
|
.storeOp = WGPUStoreOp_Store,
|
||||||
colorAttachment.clearValue = clearColor;
|
.clearValue = clearColor
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
colorAttachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
|
};
|
||||||
#endif
|
|
||||||
WGPURenderPassDescriptor renderPassDesc{ .colorAttachmentCount = 1, .colorAttachments = &colorAttachment, .depthStencilAttachment = &depthStencilAttachment };
|
WGPURenderPassDescriptor renderPassDesc{ .colorAttachmentCount = 1, .colorAttachments = &colorAttachment, .depthStencilAttachment = &depthStencilAttachment };
|
||||||
renderPassEncoder = wgpuCommandEncoderBeginRenderPass(commandEncoder, &renderPassDesc);
|
renderPassEncoder = wgpuCommandEncoderBeginRenderPass(commandEncoder, &renderPassDesc);
|
||||||
assert(renderPassEncoder);
|
assert(renderPassEncoder);
|
||||||
|
@ -273,10 +272,12 @@ void WgCompositor::blit(WgContext& context, WGPUCommandEncoder encoder, WgRender
|
||||||
.depthLoadOp = WGPULoadOp_Load, .depthStoreOp = WGPUStoreOp_Discard,
|
.depthLoadOp = WGPULoadOp_Load, .depthStoreOp = WGPUStoreOp_Discard,
|
||||||
.stencilLoadOp = WGPULoadOp_Load, .stencilStoreOp = WGPUStoreOp_Discard
|
.stencilLoadOp = WGPULoadOp_Load, .stencilStoreOp = WGPUStoreOp_Discard
|
||||||
};
|
};
|
||||||
WGPURenderPassColorAttachment colorAttachment { .view = dstView, .loadOp = WGPULoadOp_Load, .storeOp = WGPUStoreOp_Store };
|
const WGPURenderPassColorAttachment colorAttachment {
|
||||||
#ifdef __EMSCRIPTEN__
|
.view = dstView,
|
||||||
colorAttachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
|
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
|
||||||
#endif
|
.loadOp = WGPULoadOp_Load,
|
||||||
|
.storeOp = WGPUStoreOp_Store,
|
||||||
|
};
|
||||||
const WGPURenderPassDescriptor renderPassDesc{ .colorAttachmentCount = 1, .colorAttachments = &colorAttachment, .depthStencilAttachment = &depthStencilAttachment };
|
const WGPURenderPassDescriptor renderPassDesc{ .colorAttachmentCount = 1, .colorAttachments = &colorAttachment, .depthStencilAttachment = &depthStencilAttachment };
|
||||||
WGPURenderPassEncoder renderPass = wgpuCommandEncoderBeginRenderPass(encoder, &renderPassDesc);
|
WGPURenderPassEncoder renderPass = wgpuCommandEncoderBeginRenderPass(encoder, &renderPassDesc);
|
||||||
wgpuRenderPassEncoderSetBindGroup(renderPass, 0, src->bindGroupTexure, 0, nullptr);
|
wgpuRenderPassEncoderSetBindGroup(renderPass, 0, src->bindGroupTexure, 0, nullptr);
|
||||||
|
|
|
@ -116,8 +116,11 @@ bool WgRenderer::surfaceConfigure(WGPUSurface surface, WgContext& context, uint3
|
||||||
#endif
|
#endif
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
.presentMode = WGPUPresentMode_Fifo,
|
.presentMode = WGPUPresentMode_Fifo
|
||||||
|
#elif __linux__
|
||||||
|
#else
|
||||||
|
.presentMode = WGPUPresentMode_Immediate
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
wgpuSurfaceConfigure(surface, &surfaceConfiguration);
|
wgpuSurfaceConfigure(surface, &surfaceConfiguration);
|
||||||
|
|
Loading…
Add table
Reference in a new issue