Files
test/source/blender/gpu/vulkan/vk_index_buffer.hh
Jeroen Bakker 83a2904d1a Vulkan: IndexBuffer as Subrange
Add support for index buffers as subrange. When an index buffer
is a subrange it should bind the source buffer and use the index start
as an offset in the buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/107871
2023-05-12 12:12:43 +02:00

47 lines
875 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2022 Blender Foundation */
/** \file
* \ingroup gpu
*/
#pragma once
#include "gpu_index_buffer_private.hh"
#include "vk_buffer.hh"
namespace blender::gpu {
class VKIndexBuffer : public IndexBuf {
VKBuffer buffer_;
public:
void upload_data() override;
void bind_as_ssbo(uint binding) override;
void bind(VKContext &context);
void read(uint32_t *data) const override;
void update_sub(uint start, uint len, const void *data) override;
VkBuffer vk_handle() const
{
return buffer_.vk_handle();
}
private:
void strip_restart_indices() override;
void allocate();
void ensure_updated();
VKBufferWithOffset buffer_with_offset();
};
static inline VKIndexBuffer *unwrap(IndexBuf *index_buffer)
{
return static_cast<VKIndexBuffer *>(index_buffer);
}
} // namespace blender::gpu