2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2011-09-09 11:55:38 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bpygpu
|
2011-09-09 11:55:38 +00:00
|
|
|
*/
|
2013-09-19 23:17:52 +00:00
|
|
|
|
2018-09-05 21:10:42 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2025-01-07 12:39:13 +01:00
|
|
|
#include <Python.h>
|
|
|
|
|
|
2018-09-05 21:10:42 -03:00
|
|
|
#include "BLI_compiler_attrs.h"
|
|
|
|
|
|
2024-03-26 03:06:25 +01:00
|
|
|
namespace blender::gpu {
|
|
|
|
|
class Batch;
|
|
|
|
|
}
|
2024-03-23 10:10:52 -04:00
|
|
|
|
2018-09-05 21:10:42 -03:00
|
|
|
#define USE_GPU_PY_REFERENCES
|
|
|
|
|
|
|
|
|
|
extern PyTypeObject BPyGPUBatch_Type;
|
|
|
|
|
|
|
|
|
|
#define BPyGPUBatch_Check(v) (Py_TYPE(v) == &BPyGPUBatch_Type)
|
2013-09-19 23:17:52 +00:00
|
|
|
|
2024-03-23 10:10:52 -04:00
|
|
|
struct BPyGPUBatch {
|
2019-05-03 18:09:04 +10:00
|
|
|
PyObject_VAR_HEAD
|
2021-04-01 11:15:47 +11:00
|
|
|
/* The batch is owned, we may support thin wrapped batches later. */
|
2024-03-26 03:06:25 +01:00
|
|
|
blender::gpu::Batch *batch;
|
2018-09-05 21:10:42 -03:00
|
|
|
#ifdef USE_GPU_PY_REFERENCES
|
2024-03-26 17:54:30 +11:00
|
|
|
/* Just to keep a user to prevent freeing buffers we're using. */
|
2018-09-05 21:10:42 -03:00
|
|
|
PyObject *references;
|
|
|
|
|
#endif
|
2024-03-23 10:10:52 -04:00
|
|
|
};
|
2011-09-09 11:55:38 +00:00
|
|
|
|
2024-03-26 03:06:25 +01:00
|
|
|
PyObject *BPyGPUBatch_CreatePyObject(blender::gpu::Batch *batch) ATTR_NONNULL(1);
|