Blender V5.3
vk_batch.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "vk_index_buffer.hh"
12#include "vk_storage_buffer.hh"
14#include "vk_vertex_buffer.hh"
15
16#include "GPU_batch.hh"
17
18namespace blender::gpu {
19class VKBatch : public Batch {
20 public:
21 void draw(int vertex_first, int vertex_count, int instance_first, int instance_count) override;
22 void draw_indirect(StorageBuf *indirect_buf, intptr_t offset) override;
23 void multi_draw_indirect(StorageBuf *indirect_buf,
24 int count,
25 intptr_t offset,
26 intptr_t stride) override;
27 void multi_draw_indirect(const VKStorageBuffer &indirect_buf,
28 int count,
29 intptr_t offset,
30 intptr_t stride);
31
33 void ensure_data_uploaded() const;
34
37
38 private:
45 const VKVertexAttributeObject &get_vertex_attribute_object(VKContext &context);
46
48};
49
50inline VKBatch *unwrap(Batch *batch)
51{
52 return static_cast<VKBatch *>(batch);
53}
54
56{
57 return unwrap(verts_(index));
58}
59
61{
62 return unwrap(unwrap(elem_()));
63}
64
65} // namespace blender::gpu
void draw_indirect(StorageBuf *indirect_buf, intptr_t offset) override
Definition vk_batch.cc:84
VKVertexBuffer * vertex_buffer_get(int index) const
Definition vk_batch.hh:55
void ensure_data_uploaded() const
Ensure that the index and vertex buffers are uploaded.
Definition vk_batch.cc:21
void multi_draw_indirect(StorageBuf *indirect_buf, int count, intptr_t offset, intptr_t stride) override
Definition vk_batch.cc:89
VKIndexBuffer * index_buffer_get() const
Definition vk_batch.hh:60
Cache of VKVertexAttributeObjects keyed by VKShaderInterface.
static Context * unwrap(GPUContext *ctx)
BLI_INLINE MTLTexture * unwrap(Texture *tex)
_W64 int intptr_t
Definition BKE_text.h:119