Files
test/source/blender/gpu/dummy/dummy_vertex_buffer.hh
Hans Goudey fe76d8c946 Refactor: Remove unnecessary C wrappers for vertex and index buffers
Now that all relevant code is C++, the indirection from the C struct
`GPUVertBuf` to the C++ `blender::gpu::VertBuf` class just adds
complexity and necessitates a wrapper API, making more cleanups like
use of RAII or other C++ types more difficult.

This commit replaces the C wrapper structs with direct use of the
vertex and index buffer base classes. In C++ we can choose which parts
of a class are private, so we don't risk exposing too many
implementation details here.

Pull Request: https://projects.blender.org/blender/blender/pulls/119825
2024-03-24 16:38:30 +01:00

39 lines
886 B
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#pragma once
namespace blender::gpu {
class DummyVertexBuffer : public VertBuf {
public:
void bind_as_ssbo(uint /*binding*/) override {}
void bind_as_texture(uint /*binding*/) override {}
void wrap_handle(uint64_t /*handle*/) override {}
void update_sub(uint /*start*/, uint /*len*/, const void * /*data*/) override {}
void read(void * /*data*/) const override {}
protected:
void acquire_data() override
{
MEM_SAFE_FREE(data);
data = (uchar *)MEM_mallocN(sizeof(uchar) * this->size_alloc_get(), __func__);
}
void resize_data() override {}
void release_data() override
{
MEM_SAFE_FREE(data);
}
void upload_data() override {}
void duplicate_data(VertBuf * /*dst*/) override {}
};
} // namespace blender::gpu