Hash :
37dd8e92
Author :
Date :
2024-09-20T17:49:11
WebGPU: Stream client arrays Add support for vertex attributes and index data without buffer backings. Stream the data to buffers at draw time. Bug: angleproject:368602384 Change-Id: I697b7882cdebf0dfab08fcffabd2d36048920547 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5878137 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@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 58 59 60 61
//
// 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,
GLsizei instanceCount,
gl::DrawElementsType drawElementsTypeOrInvalid,
const void *indices,
GLint baseVertex,
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> mStreamingArrayBuffers;
gl::AttribArray<webgpu::BufferHelper *> mCurrentArrayBuffers;
webgpu::BufferHelper mStreamingIndexBuffer;
webgpu::BufferHelper *mCurrentIndexBuffer = nullptr;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_WGPU_VERTEXARRAYWGPU_H_