Repository: google/filament
File: filament/backend/src/webgpu/WebGPUHandles.h (C/C++)

Code before:
    AttributeArray attributes;
};

struct WGPUVertexBuffer : public HwVertexBuffer {
    WGPUVertexBuffer(uint32_t vextexCount, uint32_t bufferCount, Handle<WGPUVertexBufferInfo> vbih);
    void setBuffer(WGPUBufferObject* bufferObject, uint32_t index);

    Handle<WGPUVertexBufferInfo> vbih;
    utils::FixedCapacityVector<wgpu::Buffer> mBuffers;
};

struct WGPUIndexBuffer : public HwIndexBuffer {
    WGPUIndexBuffer(BufferUsage usage, uint8_t elementSize, uint32_t indexCount);

    wgpu::Buffer buffer;
};

struct WGPUBufferObject : HwBufferObject {
    WGPUBufferObject(BufferObjectBinding bindingType, uint32_t byteCount);

    wgpu::Buffer mBuffer;
    const BufferObjectBinding mBindingType;
};

class WGPUTexture : public HwTexture {
public:
    WGPUTexture(SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples,
            uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage) noexcept;

    // constructors for creating texture views
    WGPUTexture(WGPUTexture const* src, uint8_t baseLevel, uint8_t levelCount) noexcept;

    wgpu::Texture texture = nullptr;
};

class WGPURenderTarget : public HwRenderTarget {
public:
    class Attachment {
    public:
        friend class WGPURenderTarget;

        Attachment() = default;
        Attachment(WGPUTexture* gpuTexture, uint8_t level = 0, uint16_t layer = 0)
            : level(level),
              layer(layer),
              texture(gpuTexture->texture),
              mWGPUTexture(gpuTexture) {}

        uint8_t level = 0;
        uint16_t layer = 0;


Review comment (suggestion):
Do you mean for this to be a `struct`? For instance, we have a public `texture` member in it, instead of a private `mTexture` field.

Code after:
struct WGPUVertexBufferInfo : public HwVertexBufferInfo {
    WGPUVertexBufferInfo(uint8_t bufferCount, uint8_t attributeCount,
            AttributeArray const& attributes)
        : HwVertexBufferInfo(bufferCount, attributeCount),
          attributes(attributes) {}
    AttributeArray attributes;
};

// TODO: Currently WGPUVertexBuffer is not used by WebGPU for useful task.
// Update the struct when used by WebGPU driver.
struct WGPUVertexBuffer : public HwVertexBuffer {
    WGPUVertexBuffer(uint32_t vextexCount, uint32_t bufferCount, Handle<WGPUVertexBufferInfo> vbih);
    void setBuffer(WGPUBufferObject* bufferObject, uint32_t index);

    Handle<WGPUVertexBufferInfo> vbih;
    utils::FixedCapacityVector<wgpu::Buffer> buffers;
};

// TODO: Currently WGPUIndexBuffer is not used by WebGPU for useful task.
// Update the struct when used by WebGPU driver.
struct WGPUIndexBuffer : public HwIndexBuffer {
    WGPUIndexBuffer(BufferUsage usage, uint8_t elementSize, uint32_t indexCount);

    wgpu::Buffer buffer;
};

// TODO: Currently WGPUVertexBufferInfo is not used by WebGPU for useful task.
// Update the struct when used by WebGPU driver.
struct WGPUBufferObject : HwBufferObject {
    WGPUBufferObject(BufferObjectBinding bindingType, uint32_t byteCount);

    wgpu::Buffer buffer;
    const BufferObjectBinding bufferObjectBinding;
};

// TODO: Currently WGPUTexture is not used by WebGPU for useful task.
// Update the struct when used by WebGPU driver.
struct WGPUTexture : public HwTexture {
    WGPUTexture(SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples,
            uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage) noexcept;

    // constructors for creating texture views
    WGPUTexture(WGPUTexture const* src, uint8_t baseLevel, uint8_t levelCount) noexcept;

    wgpu::Texture texture = nullptr;
};

// TODO: Currently WGPURenderTarget is not used by WebGPU for useful task.
// Update the struct when used by WebGPU driver.
struct WGPURenderTarget : public HwRenderTarget {
    class Attachment {