node: Support sparse vertex buffer layouts
Bug: dawn:1000 Change-Id: I616369acdf5c9d883da8d0da292aa1b3f4a77250 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112021 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
89b2e10eac
commit
63a67a7218
|
@ -1148,9 +1148,25 @@ bool Converter::Convert(wgpu::VertexBufferLayout& out, const interop::GPUVertexB
|
||||||
|
|
||||||
bool Converter::Convert(wgpu::VertexState& out, const interop::GPUVertexState& in) {
|
bool Converter::Convert(wgpu::VertexState& out, const interop::GPUVertexState& in) {
|
||||||
out = {};
|
out = {};
|
||||||
return Convert(out.module, in.module) && Convert(out.buffers, out.bufferCount, in.buffers) &&
|
wgpu::VertexBufferLayout* outBuffers = nullptr;
|
||||||
Convert(out.entryPoint, in.entryPoint) &&
|
if (!Convert(out.module, in.module) || //
|
||||||
Convert(out.constants, out.constantCount, in.constants);
|
!Convert(outBuffers, out.bufferCount, in.buffers) || //
|
||||||
|
!Convert(out.entryPoint, in.entryPoint) || //
|
||||||
|
!Convert(out.constants, out.constantCount, in.constants)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch up the unused vertex buffer layouts to use wgpu::VertexStepMode::VertexBufferNotUsed.
|
||||||
|
// The converter for optional value will have put the default value of wgpu::VertexBufferLayout
|
||||||
|
// that has wgpu::VertexStepMode::Vertex.
|
||||||
|
out.buffers = outBuffers;
|
||||||
|
for (size_t i = 0; i < in.buffers.size(); i++) {
|
||||||
|
if (!in.buffers[i].has_value()) {
|
||||||
|
outBuffers[i].stepMode = wgpu::VertexStepMode::VertexBufferNotUsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Converter::Convert(wgpu::VertexStepMode& out, const interop::GPUVertexStepMode& in) {
|
bool Converter::Convert(wgpu::VertexStepMode& out, const interop::GPUVertexStepMode& in) {
|
||||||
|
|
Loading…
Reference in New Issue