Hash :
0b610712
Author :
Date :
2024-09-20T12:00:17
WebGPU: Sync index buffers, add indexed draw calls Bug: angleproject:368600230 Change-Id: Ibf1c4921635b525b7650e70ce7dc939e2bad2ebb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5828229 Reviewed-by: Liza Burakova <liza@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
//
// Copyright 2024 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// VertexArrayWgpu.h:
// Defines the class interface for VertexArrayWgpu, implementing VertexArrayImpl.
//
#ifndef LIBANGLE_RENDERER_WGPU_VERTEXARRAYWGPU_H_
#define LIBANGLE_RENDERER_WGPU_VERTEXARRAYWGPU_H_
#include "libANGLE/renderer/VertexArrayImpl.h"
#include "libANGLE/renderer/wgpu/BufferWgpu.h"
#include "libANGLE/renderer/wgpu/wgpu_pipeline_state.h"
namespace rx
{
class VertexArrayWgpu : public VertexArrayImpl
{
public:
VertexArrayWgpu(const gl::VertexArrayState &data);
angle::Result syncState(const gl::Context *context,
const gl::VertexArray::DirtyBits &dirtyBits,
gl::VertexArray::DirtyAttribBitsArray *attribBits,
gl::VertexArray::DirtyBindingBitsArray *bindingBits) override;
webgpu::BufferHelper *getVertexBuffer(size_t slot) const { return mCurrentArrayBuffers[slot]; }
webgpu::BufferHelper *getIndexBuffer() const { return mCurrentIndexBuffer; }
angle::Result syncClientArrays(const gl::Context *context,
const gl::AttributesMask &activeAttributesMask,
GLint first,
GLsizei count,
gl::DrawElementsType drawElementsTypeOrInvalid,
const void *indices,
GLsizei instanceCount,
bool primitiveRestartEnabled,
const void **adjustedIndicesPtr);
private:
angle::Result syncDirtyAttrib(ContextWgpu *contextWgpu,
const gl::VertexAttribute &attrib,
const gl::VertexBinding &binding,
size_t attribIndex);
angle::Result syncDirtyElementArrayBuffer(ContextWgpu *contextWgpu);
gl::AttribArray<webgpu::PackedVertexAttribute> mCurrentAttribs;
gl::AttribArray<webgpu::BufferHelper *> mCurrentArrayBuffers;
webgpu::BufferHelper *mCurrentIndexBuffer = nullptr;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_WGPU_VERTEXARRAYWGPU_H_