2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2016 by Mike Erwin. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup gpu
|
2018-07-17 14:46:44 +02:00
|
|
|
*
|
2018-07-18 00:12:21 +02:00
|
|
|
* GPU geometry batch
|
2018-07-17 14:46:44 +02:00
|
|
|
* Contains VAOs + VBOs + Shader representing a drawable entity.
|
|
|
|
|
*/
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
#pragma once
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2018-07-17 21:11:23 +02:00
|
|
|
#include "GPU_batch.h"
|
|
|
|
|
#include "GPU_context.h"
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2020-09-06 02:46:51 +02:00
|
|
|
#include "gpu_index_buffer_private.hh"
|
2020-09-06 23:45:51 +02:00
|
|
|
#include "gpu_vertex_buffer_private.hh"
|
2020-09-06 02:46:51 +02:00
|
|
|
|
2020-08-10 11:41:22 +02:00
|
|
|
namespace blender {
|
|
|
|
|
namespace gpu {
|
|
|
|
|
|
2020-08-21 14:14:56 +02:00
|
|
|
/**
|
|
|
|
|
* Base class which is then specialized for each implementation (GL, VK, ...).
|
2021-01-04 12:00:18 +11:00
|
|
|
*
|
|
|
|
|
* \note Extends #GPUBatch as we still needs to expose some of the internals to the outside C code.
|
|
|
|
|
*/
|
2020-08-10 11:41:22 +02:00
|
|
|
class Batch : public GPUBatch {
|
|
|
|
|
public:
|
2021-04-08 11:07:12 +02:00
|
|
|
virtual ~Batch() = default;
|
2020-08-10 11:41:22 +02:00
|
|
|
|
|
|
|
|
virtual void draw(int v_first, int v_count, int i_first, int i_count) = 0;
|
2022-08-30 21:57:39 +02:00
|
|
|
virtual void draw_indirect(GPUStorageBuf *indirect_buf, intptr_t offset) = 0;
|
|
|
|
|
virtual void multi_draw_indirect(GPUStorageBuf *indirect_buf,
|
|
|
|
|
int count,
|
|
|
|
|
intptr_t offset,
|
|
|
|
|
intptr_t stride) = 0;
|
2020-09-06 02:46:51 +02:00
|
|
|
|
|
|
|
|
/* Convenience casts. */
|
2022-01-05 21:44:03 -05:00
|
|
|
IndexBuf *elem_() const
|
2020-09-06 02:46:51 +02:00
|
|
|
{
|
|
|
|
|
return unwrap(elem);
|
2020-09-06 23:45:51 +02:00
|
|
|
}
|
|
|
|
|
VertBuf *verts_(const int index) const
|
|
|
|
|
{
|
|
|
|
|
return unwrap(verts[index]);
|
|
|
|
|
}
|
|
|
|
|
VertBuf *inst_(const int index) const
|
|
|
|
|
{
|
|
|
|
|
return unwrap(inst[index]);
|
|
|
|
|
}
|
2020-08-10 11:41:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace gpu
|
|
|
|
|
} // namespace blender
|