Cleanup: Miscellaneous cleanups to newly C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/119824
This commit is contained in:
parent
a099061feb
commit
5cd1237594
|
@ -1210,7 +1210,7 @@ class Framebuffer : NonCopyable {
|
|||
GPUAttachment color7 = GPU_ATTACHMENT_NONE,
|
||||
GPUAttachment color8 = GPU_ATTACHMENT_NONE)
|
||||
{
|
||||
if (fb_ == NULL) {
|
||||
if (fb_ == nullptr) {
|
||||
fb_ = GPU_framebuffer_create(name_);
|
||||
}
|
||||
GPUAttachment config[] = {
|
||||
|
@ -1223,7 +1223,7 @@ class Framebuffer : NonCopyable {
|
|||
*/
|
||||
void ensure(int2 target_size)
|
||||
{
|
||||
if (fb_ == NULL) {
|
||||
if (fb_ == nullptr) {
|
||||
fb_ = GPU_framebuffer_create(name_);
|
||||
}
|
||||
GPU_framebuffer_default_size(fb_, UNPACK2(target_size));
|
||||
|
|
|
@ -99,9 +99,10 @@ typedef char DRWViewportEmptyList;
|
|||
/* Unused members must be either pass list or 'char *' when not used. */
|
||||
#define DRW_VIEWPORT_DATA_SIZE(ty) \
|
||||
{ \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->fbl)), DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->txl)), \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->psl)), \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->stl)), \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->fbl)), \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->txl)), \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->psl)), \
|
||||
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->stl)), \
|
||||
}
|
||||
|
||||
struct DrawEngineDataSize {
|
||||
|
@ -241,17 +242,17 @@ void DRW_texture_generate_mipmaps(GPUTexture *tex);
|
|||
void DRW_texture_free(GPUTexture *tex);
|
||||
#define DRW_TEXTURE_FREE_SAFE(tex) \
|
||||
do { \
|
||||
if (tex != NULL) { \
|
||||
if (tex != nullptr) { \
|
||||
DRW_texture_free(tex); \
|
||||
tex = NULL; \
|
||||
tex = nullptr; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DRW_UBO_FREE_SAFE(ubo) \
|
||||
do { \
|
||||
if (ubo != NULL) { \
|
||||
if (ubo != nullptr) { \
|
||||
GPU_uniformbuf_free(ubo); \
|
||||
ubo = NULL; \
|
||||
ubo = nullptr; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -315,9 +316,9 @@ void DRW_shader_queue_optimize_material(GPUMaterial *mat);
|
|||
void DRW_shader_free(GPUShader *shader);
|
||||
#define DRW_SHADER_FREE_SAFE(shader) \
|
||||
do { \
|
||||
if (shader != NULL) { \
|
||||
if (shader != nullptr) { \
|
||||
DRW_shader_free(shader); \
|
||||
shader = NULL; \
|
||||
shader = nullptr; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -345,9 +346,9 @@ char *DRW_shader_library_create_shader_string(const DRWShaderLibrary *lib,
|
|||
void DRW_shader_library_free(DRWShaderLibrary *lib);
|
||||
#define DRW_SHADER_LIB_FREE_SAFE(lib) \
|
||||
do { \
|
||||
if (lib != NULL) { \
|
||||
if (lib != nullptr) { \
|
||||
DRW_shader_library_free(lib); \
|
||||
lib = NULL; \
|
||||
lib = nullptr; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -368,7 +369,7 @@ GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttrFormat att
|
|||
int arraysize);
|
||||
#define DRW_shgroup_instance_format(format, ...) \
|
||||
do { \
|
||||
if (format == NULL) { \
|
||||
if (format == nullptr) { \
|
||||
DRWInstanceAttrFormat drw_format[] = __VA_ARGS__; \
|
||||
format = DRW_shgroup_instance_format_array( \
|
||||
drw_format, (sizeof(drw_format) / sizeof(DRWInstanceAttrFormat))); \
|
||||
|
@ -397,27 +398,27 @@ void DRW_shgroup_call_ex(DRWShadingGroup *shgroup,
|
|||
void *user_data);
|
||||
|
||||
/**
|
||||
* If ob is NULL, unit model-matrix is assumed and culling is bypassed.
|
||||
* If ob is nullptr, unit model-matrix is assumed and culling is bypassed.
|
||||
*/
|
||||
#define DRW_shgroup_call(shgroup, geom, ob) \
|
||||
DRW_shgroup_call_ex(shgroup, ob, NULL, geom, false, NULL)
|
||||
DRW_shgroup_call_ex(shgroup, ob, nullptr, geom, false, nullptr)
|
||||
|
||||
/**
|
||||
* Same as #DRW_shgroup_call but override the `obmat`. Not culled.
|
||||
*/
|
||||
#define DRW_shgroup_call_obmat(shgroup, geom, obmat) \
|
||||
DRW_shgroup_call_ex(shgroup, NULL, obmat, geom, false, NULL)
|
||||
DRW_shgroup_call_ex(shgroup, nullptr, obmat, geom, false, nullptr)
|
||||
|
||||
/* TODO(fclem): remove this when we have #DRWView */
|
||||
/* user_data is used by #DRWCallVisibilityFn defined in #DRWView. */
|
||||
#define DRW_shgroup_call_with_callback(shgroup, geom, ob, user_data) \
|
||||
DRW_shgroup_call_ex(shgroup, ob, NULL, geom, false, user_data)
|
||||
DRW_shgroup_call_ex(shgroup, ob, nullptr, geom, false, user_data)
|
||||
|
||||
/**
|
||||
* Same as #DRW_shgroup_call but bypass culling even if ob is not NULL.
|
||||
* Same as #DRW_shgroup_call but bypass culling even if ob is not nullptr.
|
||||
*/
|
||||
#define DRW_shgroup_call_no_cull(shgroup, geom, ob) \
|
||||
DRW_shgroup_call_ex(shgroup, ob, NULL, geom, true, NULL)
|
||||
DRW_shgroup_call_ex(shgroup, ob, nullptr, geom, true, nullptr)
|
||||
|
||||
void DRW_shgroup_call_range(
|
||||
DRWShadingGroup *shgroup, const Object *ob, GPUBatch *geom, uint v_sta, uint v_num);
|
||||
|
@ -743,7 +744,7 @@ const DRWView *DRW_view_get_active();
|
|||
*/
|
||||
void DRW_view_clip_planes_set(DRWView *view, float (*planes)[4], int plane_len);
|
||||
|
||||
/* For all getters, if view is NULL, default view is assumed. */
|
||||
/* For all getters, if view is nullptr, default view is assumed. */
|
||||
|
||||
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse);
|
||||
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse);
|
||||
|
@ -861,7 +862,7 @@ DrawData *DRW_drawdata_ensure(ID *id,
|
|||
DrawDataInitCb init_cb,
|
||||
DrawDataFreeCb free_cb);
|
||||
/**
|
||||
* Return NULL if not a dupli or a pointer of pointer to the engine data.
|
||||
* Return nullptr if not a dupli or a pointer of pointer to the engine data.
|
||||
*/
|
||||
void **DRW_duplidata_get(void *vedata);
|
||||
|
||||
|
@ -987,7 +988,7 @@ struct DRWContextState {
|
|||
eGPUShaderConfig sh_cfg;
|
||||
|
||||
/** Last resort (some functions take this as an arg so we can't easily avoid).
|
||||
* May be NULL when used for selection or depth buffer. */
|
||||
* May be nullptr when used for selection or depth buffer. */
|
||||
const bContext *evil_C;
|
||||
|
||||
/* ---- */
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
struct GPUTexture;
|
||||
struct GPUViewport;
|
||||
|
||||
/**
|
||||
* Draw texture to frame-buffer without any color transforms.
|
||||
*/
|
||||
void DRW_transform_none(struct GPUTexture *tex);
|
||||
void DRW_viewport_colormanagement_set(struct GPUViewport *viewport);
|
||||
void DRW_transform_none(GPUTexture *tex);
|
||||
void DRW_viewport_colormanagement_set(GPUViewport *viewport);
|
||||
|
|
|
@ -37,7 +37,7 @@ DRW_Global G_draw{};
|
|||
static bool weight_ramp_custom = false;
|
||||
static ColorBand weight_ramp_copy;
|
||||
|
||||
static GPUTexture *DRW_create_weight_colorramp_texture(void);
|
||||
static GPUTexture *DRW_create_weight_colorramp_texture();
|
||||
|
||||
void DRW_globals_update()
|
||||
{
|
||||
|
|
|
@ -11,8 +11,11 @@
|
|||
#include "draw_common_shader_shared.hh"
|
||||
|
||||
struct DRWShadingGroup;
|
||||
struct DRWView;
|
||||
struct FluidModifierData;
|
||||
struct GPUMaterial;
|
||||
struct GPUUniformBuf;
|
||||
struct GPUVertBuf;
|
||||
struct ModifierData;
|
||||
struct Object;
|
||||
struct ParticleSystem;
|
||||
|
@ -27,22 +30,22 @@ struct CurvesUniformBufPool;
|
|||
/* Keep in sync with globalsBlock in shaders */
|
||||
BLI_STATIC_ASSERT_ALIGN(GlobalsUboStorage, 16)
|
||||
|
||||
void DRW_globals_update(void);
|
||||
void DRW_globals_free(void);
|
||||
void DRW_globals_update();
|
||||
void DRW_globals_free();
|
||||
|
||||
struct DRWView *DRW_view_create_with_zoffset(const struct DRWView *parent_view,
|
||||
const struct RegionView3D *rv3d,
|
||||
float offset);
|
||||
DRWView *DRW_view_create_with_zoffset(const DRWView *parent_view,
|
||||
const RegionView3D *rv3d,
|
||||
float offset);
|
||||
|
||||
/**
|
||||
* Get the wire color theme_id of an object based on its state
|
||||
* \a r_color is a way to get a pointer to the static color var associated
|
||||
*/
|
||||
int DRW_object_wire_theme_get(struct Object *ob, struct ViewLayer *view_layer, float **r_color);
|
||||
int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color);
|
||||
float *DRW_color_background_blend_get(int theme_id);
|
||||
|
||||
bool DRW_object_is_flat(struct Object *ob, int *r_axis);
|
||||
bool DRW_object_axis_orthogonal_to_view(struct Object *ob, int axis);
|
||||
bool DRW_object_is_flat(Object *ob, int *r_axis);
|
||||
bool DRW_object_axis_orthogonal_to_view(Object *ob, int axis);
|
||||
|
||||
/* draw_hair.cc */
|
||||
|
||||
|
@ -50,26 +53,24 @@ bool DRW_object_axis_orthogonal_to_view(struct Object *ob, int axis);
|
|||
* This creates a shading group with display hairs.
|
||||
* The draw call is already added by this function, just add additional uniforms.
|
||||
*/
|
||||
struct DRWShadingGroup *DRW_shgroup_hair_create_sub(struct Object *object,
|
||||
struct ParticleSystem *psys,
|
||||
struct ModifierData *md,
|
||||
struct DRWShadingGroup *shgrp,
|
||||
struct GPUMaterial *gpu_material);
|
||||
DRWShadingGroup *DRW_shgroup_hair_create_sub(Object *object,
|
||||
ParticleSystem *psys,
|
||||
ModifierData *md,
|
||||
DRWShadingGroup *shgrp,
|
||||
GPUMaterial *gpu_material);
|
||||
|
||||
/**
|
||||
* \note Only valid after #DRW_hair_update().
|
||||
*/
|
||||
struct GPUVertBuf *DRW_hair_pos_buffer_get(struct Object *object,
|
||||
struct ParticleSystem *psys,
|
||||
struct ModifierData *md);
|
||||
void DRW_hair_duplimat_get(struct Object *object,
|
||||
struct ParticleSystem *psys,
|
||||
struct ModifierData *md,
|
||||
GPUVertBuf *DRW_hair_pos_buffer_get(Object *object, ParticleSystem *psys, ModifierData *md);
|
||||
void DRW_hair_duplimat_get(Object *object,
|
||||
ParticleSystem *psys,
|
||||
ModifierData *md,
|
||||
float (*dupli_mat)[4]);
|
||||
|
||||
void DRW_hair_init(void);
|
||||
void DRW_hair_update(void);
|
||||
void DRW_hair_free(void);
|
||||
void DRW_hair_init();
|
||||
void DRW_hair_update();
|
||||
void DRW_hair_free();
|
||||
|
||||
/* draw_curves.cc */
|
||||
|
||||
|
@ -78,24 +79,24 @@ namespace blender::draw {
|
|||
/**
|
||||
* \note Only valid after #DRW_curves_update().
|
||||
*/
|
||||
struct GPUVertBuf *DRW_curves_pos_buffer_get(struct Object *object);
|
||||
GPUVertBuf *DRW_curves_pos_buffer_get(Object *object);
|
||||
|
||||
struct DRWShadingGroup *DRW_shgroup_curves_create_sub(struct Object *object,
|
||||
struct DRWShadingGroup *shgrp,
|
||||
struct GPUMaterial *gpu_material);
|
||||
DRWShadingGroup *DRW_shgroup_curves_create_sub(Object *object,
|
||||
DRWShadingGroup *shgrp,
|
||||
GPUMaterial *gpu_material);
|
||||
|
||||
void DRW_curves_init(struct DRWData *drw_data);
|
||||
void DRW_curves_init(DRWData *drw_data);
|
||||
void DRW_curves_ubos_pool_free(CurvesUniformBufPool *pool);
|
||||
void DRW_curves_update(void);
|
||||
void DRW_curves_free(void);
|
||||
void DRW_curves_update();
|
||||
void DRW_curves_free();
|
||||
|
||||
/* draw_pointcloud.cc */
|
||||
|
||||
struct DRWShadingGroup *DRW_shgroup_pointcloud_create_sub(struct Object *object,
|
||||
struct DRWShadingGroup *shgrp_parent,
|
||||
struct GPUMaterial *gpu_material);
|
||||
void DRW_pointcloud_init(void);
|
||||
void DRW_pointcloud_free(void);
|
||||
DRWShadingGroup *DRW_shgroup_pointcloud_create_sub(Object *object,
|
||||
DRWShadingGroup *shgrp_parent,
|
||||
GPUMaterial *gpu_material);
|
||||
void DRW_pointcloud_init();
|
||||
void DRW_pointcloud_free();
|
||||
|
||||
} // namespace blender::draw
|
||||
|
||||
|
@ -106,28 +107,28 @@ void DRW_pointcloud_free(void);
|
|||
* No draw call is added so the caller can decide how to use the data.
|
||||
* \return nullptr if there is nothing to draw.
|
||||
*/
|
||||
struct DRWShadingGroup *DRW_shgroup_volume_create_sub(struct Scene *scene,
|
||||
struct Object *ob,
|
||||
struct DRWShadingGroup *shgrp,
|
||||
struct GPUMaterial *gpu_material);
|
||||
DRWShadingGroup *DRW_shgroup_volume_create_sub(Scene *scene,
|
||||
Object *ob,
|
||||
DRWShadingGroup *shgrp,
|
||||
GPUMaterial *gpu_material);
|
||||
|
||||
void DRW_volume_init(struct DRWData *drw_data);
|
||||
void DRW_volume_init(DRWData *drw_data);
|
||||
void DRW_volume_ubos_pool_free(void *pool);
|
||||
void DRW_volume_free(void);
|
||||
void DRW_volume_free();
|
||||
|
||||
/* `draw_fluid.cc` */
|
||||
|
||||
/* Fluid simulation. */
|
||||
void DRW_smoke_ensure(struct FluidModifierData *fmd, int highres);
|
||||
void DRW_smoke_ensure_coba_field(struct FluidModifierData *fmd);
|
||||
void DRW_smoke_ensure_velocity(struct FluidModifierData *fmd);
|
||||
void DRW_fluid_ensure_flags(struct FluidModifierData *fmd);
|
||||
void DRW_fluid_ensure_range_field(struct FluidModifierData *fmd);
|
||||
void DRW_smoke_ensure(FluidModifierData *fmd, int highres);
|
||||
void DRW_smoke_ensure_coba_field(FluidModifierData *fmd);
|
||||
void DRW_smoke_ensure_velocity(FluidModifierData *fmd);
|
||||
void DRW_fluid_ensure_flags(FluidModifierData *fmd);
|
||||
void DRW_fluid_ensure_range_field(FluidModifierData *fmd);
|
||||
|
||||
void DRW_smoke_free(struct FluidModifierData *fmd);
|
||||
void DRW_smoke_free(FluidModifierData *fmd);
|
||||
|
||||
void DRW_smoke_init(struct DRWData *drw_data);
|
||||
void DRW_smoke_exit(struct DRWData *drw_data);
|
||||
void DRW_smoke_init(DRWData *drw_data);
|
||||
void DRW_smoke_exit(DRWData *drw_data);
|
||||
|
||||
/* `draw_common.cc` */
|
||||
|
||||
|
@ -137,12 +138,12 @@ struct DRW_Global {
|
|||
* Not needed for constant color. */
|
||||
GlobalsUboStorage block;
|
||||
/** Define "globalsBlock" uniform for 'block'. */
|
||||
struct GPUUniformBuf *block_ubo;
|
||||
GPUUniformBuf *block_ubo;
|
||||
|
||||
struct GPUTexture *ramp;
|
||||
struct GPUTexture *weight_ramp;
|
||||
GPUTexture *ramp;
|
||||
GPUTexture *weight_ramp;
|
||||
|
||||
struct GPUUniformBuf *view_ubo;
|
||||
struct GPUUniformBuf *clipping_ubo;
|
||||
GPUUniformBuf *view_ubo;
|
||||
GPUUniformBuf *clipping_ubo;
|
||||
};
|
||||
extern struct DRW_Global G_draw;
|
||||
extern DRW_Global G_draw;
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
typedef struct DRWDebugModule DRWDebugModule;
|
||||
struct DRWDebugModule;
|
||||
|
||||
struct BoundBox;
|
||||
|
||||
void DRW_debug_modelmat_reset(void);
|
||||
void DRW_debug_modelmat_reset();
|
||||
void DRW_debug_modelmat(const float modelmat[4][4]);
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,17 +13,17 @@
|
|||
#define MAX_THICKRES 2 /* see eHairType */
|
||||
#define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */
|
||||
|
||||
typedef enum ParticleRefineShader {
|
||||
enum ParticleRefineShader {
|
||||
PART_REFINE_CATMULL_ROM = 0,
|
||||
PART_REFINE_MAX_SHADER,
|
||||
} ParticleRefineShader;
|
||||
};
|
||||
|
||||
struct ModifierData;
|
||||
struct Object;
|
||||
struct ParticleHairCache;
|
||||
struct ParticleSystem;
|
||||
|
||||
typedef struct ParticleHairFinalCache {
|
||||
struct ParticleHairFinalCache {
|
||||
/* Output of the subdivision stage: vertex buff sized to subdiv level. */
|
||||
GPUVertBuf *proc_buf;
|
||||
|
||||
|
@ -31,9 +31,9 @@ typedef struct ParticleHairFinalCache {
|
|||
GPUBatch *proc_hairs[MAX_THICKRES];
|
||||
|
||||
int strands_res; /* points per hair, at least 2 */
|
||||
} ParticleHairFinalCache;
|
||||
};
|
||||
|
||||
typedef struct ParticleHairCache {
|
||||
struct ParticleHairCache {
|
||||
GPUVertBuf *pos;
|
||||
GPUIndexBuf *indices;
|
||||
GPUBatch *hairs;
|
||||
|
@ -65,18 +65,18 @@ typedef struct ParticleHairCache {
|
|||
int strands_len;
|
||||
int elems_len;
|
||||
int point_len;
|
||||
} ParticleHairCache;
|
||||
};
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
/**
|
||||
* Ensure all textures and buffers needed for GPU accelerated drawing.
|
||||
*/
|
||||
bool particles_ensure_procedural_data(struct Object *object,
|
||||
struct ParticleSystem *psys,
|
||||
struct ModifierData *md,
|
||||
struct ParticleHairCache **r_hair_cache,
|
||||
struct GPUMaterial *gpu_material,
|
||||
bool particles_ensure_procedural_data(Object *object,
|
||||
ParticleSystem *psys,
|
||||
ModifierData *md,
|
||||
ParticleHairCache **r_hair_cache,
|
||||
GPUMaterial *gpu_material,
|
||||
int subdiv,
|
||||
int thickness_res);
|
||||
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
|
||||
struct GHash;
|
||||
struct GPUUniformAttrList;
|
||||
|
||||
typedef struct DRWInstanceData DRWInstanceData;
|
||||
typedef struct DRWInstanceDataList DRWInstanceDataList;
|
||||
typedef struct DRWSparseUniformBuf DRWSparseUniformBuf;
|
||||
struct DRWInstanceData;
|
||||
struct DRWInstanceDataList;
|
||||
struct DRWSparseUniformBuf;
|
||||
|
||||
/**
|
||||
* Return a pointer to the next instance data space.
|
||||
|
@ -89,11 +88,11 @@ void DRW_sparse_uniform_buffer_free(DRWSparseUniformBuf *buffer);
|
|||
*/
|
||||
bool DRW_sparse_uniform_buffer_is_empty(DRWSparseUniformBuf *buffer);
|
||||
/**
|
||||
* Bind the UBO for the given chunk, if present. A NULL buffer pointer is handled as empty.
|
||||
* Bind the UBO for the given chunk, if present. A nullptr buffer pointer is handled as empty.
|
||||
*/
|
||||
void DRW_sparse_uniform_buffer_bind(DRWSparseUniformBuf *buffer, int chunk, int location);
|
||||
/**
|
||||
* Unbind the UBO for the given chunk, if present. A NULL buffer pointer is handled as empty.
|
||||
* Unbind the UBO for the given chunk, if present. A nullptr buffer pointer is handled as empty.
|
||||
*/
|
||||
void DRW_sparse_uniform_buffer_unbind(DRWSparseUniformBuf *buffer, int chunk);
|
||||
/**
|
||||
|
@ -103,8 +102,7 @@ void *DRW_sparse_uniform_buffer_ensure_item(DRWSparseUniformBuf *buffer, int chu
|
|||
|
||||
/* Uniform attribute UBO management. */
|
||||
|
||||
struct GHash *DRW_uniform_attrs_pool_new(void);
|
||||
void DRW_uniform_attrs_pool_flush_all(struct GHash *table);
|
||||
void DRW_uniform_attrs_pool_clear_all(struct GHash *table);
|
||||
struct DRWSparseUniformBuf *DRW_uniform_attrs_pool_find_ubo(struct GHash *table,
|
||||
const struct GPUUniformAttrList *key);
|
||||
GHash *DRW_uniform_attrs_pool_new();
|
||||
void DRW_uniform_attrs_pool_flush_all(GHash *table);
|
||||
void DRW_uniform_attrs_pool_clear_all(GHash *table);
|
||||
DRWSparseUniformBuf *DRW_uniform_attrs_pool_find_ubo(GHash *table, const GPUUniformAttrList *key);
|
||||
|
|
|
@ -30,11 +30,16 @@
|
|||
#include "draw_instance_data.hh"
|
||||
#include "draw_shader_shared.hh"
|
||||
|
||||
struct DRWTexturePool;
|
||||
struct DRWUniformChunk;
|
||||
struct DupliObject;
|
||||
struct Object;
|
||||
namespace blender::draw {
|
||||
struct CurvesUniformBufPool;
|
||||
}
|
||||
struct DRW_Attributes;
|
||||
struct DRW_MeshCDMask;
|
||||
} // namespace blender::draw
|
||||
struct GPUMaterial;
|
||||
|
||||
/** Use draw manager to call GPU_select, see: #DRW_draw_select_loop */
|
||||
#define USE_GPU_SELECT
|
||||
|
@ -78,9 +83,9 @@ struct CurvesUniformBufPool;
|
|||
|
||||
#else /* USE_PROFILE */
|
||||
|
||||
# define PROFILE_START(time_start) ((void)0)
|
||||
# define PROFILE_END_ACCUM(time_accum, time_start) ((void)0)
|
||||
# define PROFILE_END_UPDATE(time_update, time_start) ((void)0)
|
||||
# define PROFILE_START(time_start) (() 0)
|
||||
# define PROFILE_END_ACCUM(time_accum, time_start) (() 0)
|
||||
# define PROFILE_END_UPDATE(time_update, time_start) (() 0)
|
||||
|
||||
#endif /* USE_PROFILE */
|
||||
|
||||
|
@ -106,14 +111,14 @@ typedef struct DRWRegisteredDrawEngine {
|
|||
* > DRWUniform
|
||||
*/
|
||||
|
||||
typedef struct DRWCullingState {
|
||||
struct DRWCullingState {
|
||||
uint32_t mask;
|
||||
/* Culling: Using Bounding Sphere for now for faster culling.
|
||||
* Not ideal for planes. Could be extended. */
|
||||
BoundSphere bsphere;
|
||||
/* Grrr only used by EEVEE. */
|
||||
void *user_data;
|
||||
} DRWCullingState;
|
||||
};
|
||||
|
||||
/* Minimum max UBO size is 64KiB. We take the largest
|
||||
* UBO struct and alloc the max number.
|
||||
|
@ -162,7 +167,7 @@ BLI_INLINE void DRW_handle_negative_scale_enable(DRWResourceHandle *handle)
|
|||
*handle |= 0x80000000;
|
||||
}
|
||||
|
||||
BLI_INLINE void *DRW_memblock_elem_from_handle(struct BLI_memblock *memblock,
|
||||
BLI_INLINE void *DRW_memblock_elem_from_handle(BLI_memblock *memblock,
|
||||
const DRWResourceHandle *handle)
|
||||
{
|
||||
int elem = DRW_handle_id_get(handle);
|
||||
|
@ -170,19 +175,19 @@ BLI_INLINE void *DRW_memblock_elem_from_handle(struct BLI_memblock *memblock,
|
|||
return BLI_memblock_elem_get(memblock, chunk, elem);
|
||||
}
|
||||
|
||||
typedef struct DRWObjectMatrix {
|
||||
struct DRWObjectMatrix {
|
||||
float model[4][4];
|
||||
float modelinverse[4][4];
|
||||
} DRWObjectMatrix;
|
||||
};
|
||||
|
||||
typedef struct DRWObjectInfos {
|
||||
struct DRWObjectInfos {
|
||||
float orcotexfac[2][4];
|
||||
float ob_color[4];
|
||||
float ob_index;
|
||||
float pad; /*UNUSED*/
|
||||
float ob_random;
|
||||
float ob_flag; /* Sign is negative scaling. */
|
||||
} DRWObjectInfos;
|
||||
};
|
||||
|
||||
BLI_STATIC_ASSERT_ALIGN(DRWObjectMatrix, 16)
|
||||
BLI_STATIC_ASSERT_ALIGN(DRWObjectInfos, 16)
|
||||
|
@ -212,88 +217,88 @@ typedef enum {
|
|||
|
||||
#define DRW_MAX_DRAW_CMD_TYPE DRW_CMD_DRAW_INDIRECT
|
||||
|
||||
typedef struct DRWCommandDraw {
|
||||
struct DRWCommandDraw {
|
||||
GPUBatch *batch;
|
||||
DRWResourceHandle handle;
|
||||
} DRWCommandDraw;
|
||||
};
|
||||
|
||||
/* Assume DRWResourceHandle to be 0. */
|
||||
typedef struct DRWCommandDrawRange {
|
||||
struct DRWCommandDrawRange {
|
||||
GPUBatch *batch;
|
||||
DRWResourceHandle handle;
|
||||
uint vert_first;
|
||||
uint vert_count;
|
||||
} DRWCommandDrawRange;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandDrawInstance {
|
||||
struct DRWCommandDrawInstance {
|
||||
GPUBatch *batch;
|
||||
DRWResourceHandle handle;
|
||||
uint inst_count;
|
||||
uint use_attrs; /* bool */
|
||||
} DRWCommandDrawInstance;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandDrawInstanceRange {
|
||||
struct DRWCommandDrawInstanceRange {
|
||||
GPUBatch *batch;
|
||||
DRWResourceHandle handle;
|
||||
uint inst_first;
|
||||
uint inst_count;
|
||||
} DRWCommandDrawInstanceRange;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandDrawIndirect {
|
||||
struct DRWCommandDrawIndirect {
|
||||
GPUBatch *batch;
|
||||
DRWResourceHandle handle;
|
||||
GPUStorageBuf *indirect_buf;
|
||||
} DRWCommandDrawIndirect;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandCompute {
|
||||
struct DRWCommandCompute {
|
||||
int groups_x_len;
|
||||
int groups_y_len;
|
||||
int groups_z_len;
|
||||
} DRWCommandCompute;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandComputeRef {
|
||||
struct DRWCommandComputeRef {
|
||||
int *groups_ref;
|
||||
} DRWCommandComputeRef;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandComputeIndirect {
|
||||
struct DRWCommandComputeIndirect {
|
||||
GPUStorageBuf *indirect_buf;
|
||||
} DRWCommandComputeIndirect;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandBarrier {
|
||||
struct DRWCommandBarrier {
|
||||
eGPUBarrier type;
|
||||
} DRWCommandBarrier;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandDrawProcedural {
|
||||
struct DRWCommandDrawProcedural {
|
||||
GPUBatch *batch;
|
||||
DRWResourceHandle handle;
|
||||
uint vert_count;
|
||||
} DRWCommandDrawProcedural;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandSetMutableState {
|
||||
struct DRWCommandSetMutableState {
|
||||
/** State changes (or'd or and'd with the pass's state) */
|
||||
DRWState enable;
|
||||
DRWState disable;
|
||||
} DRWCommandSetMutableState;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandSetStencil {
|
||||
struct DRWCommandSetStencil {
|
||||
uint write_mask;
|
||||
uint comp_mask;
|
||||
uint ref;
|
||||
} DRWCommandSetStencil;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandSetSelectID {
|
||||
struct DRWCommandSetSelectID {
|
||||
GPUVertBuf *select_buf;
|
||||
uint select_id;
|
||||
} DRWCommandSetSelectID;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandClear {
|
||||
struct DRWCommandClear {
|
||||
eGPUFrameBufferBits clear_channels;
|
||||
uchar r, g, b, a; /* [0..1] for each channels. Normalized. */
|
||||
float depth; /* [0..1] for depth. Normalized. */
|
||||
uchar stencil; /* Stencil value [0..255] */
|
||||
} DRWCommandClear;
|
||||
};
|
||||
|
||||
typedef union DRWCommand {
|
||||
union DRWCommand {
|
||||
DRWCommandDraw draw;
|
||||
DRWCommandDrawRange range;
|
||||
DRWCommandDrawInstance instance;
|
||||
|
@ -308,7 +313,7 @@ typedef union DRWCommand {
|
|||
DRWCommandSetStencil stencil;
|
||||
DRWCommandSetSelectID select_id;
|
||||
DRWCommandClear clear;
|
||||
} DRWCommand;
|
||||
};
|
||||
|
||||
/** Used for aggregating calls into #GPUVertBuf's. */
|
||||
struct DRWCallBuffer {
|
||||
|
@ -395,8 +400,8 @@ struct DRWUniform {
|
|||
struct DRWShadingGroup {
|
||||
DRWShadingGroup *next;
|
||||
|
||||
GPUShader *shader; /* Shader to bind */
|
||||
struct DRWUniformChunk *uniforms; /* Uniforms pointers */
|
||||
GPUShader *shader; /* Shader to bind */
|
||||
DRWUniformChunk *uniforms; /* Uniforms pointers */
|
||||
|
||||
struct {
|
||||
/* Chunks of draw calls. */
|
||||
|
@ -456,8 +461,8 @@ struct DRWView {
|
|||
float4x4 persinv;
|
||||
ViewMatrices storage;
|
||||
|
||||
/** Parent view if this is a sub view. NULL otherwise. */
|
||||
struct DRWView *parent;
|
||||
/** Parent view if this is a sub view. nullptr otherwise. */
|
||||
DRWView *parent;
|
||||
|
||||
float4 clip_planes[6];
|
||||
|
||||
|
@ -492,15 +497,15 @@ BLI_STATIC_ASSERT_ALIGN(DRWView, 16);
|
|||
* for each item.
|
||||
* \{ */
|
||||
|
||||
typedef struct DRWUniformChunk {
|
||||
struct DRWUniformChunk *next; /* single-linked list */
|
||||
struct DRWUniformChunk {
|
||||
DRWUniformChunk *next; /* single-linked list */
|
||||
uint32_t uniform_len;
|
||||
uint32_t uniform_used;
|
||||
DRWUniform uniforms[10];
|
||||
} DRWUniformChunk;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandChunk {
|
||||
struct DRWCommandChunk *next;
|
||||
struct DRWCommandChunk {
|
||||
DRWCommandChunk *next;
|
||||
uint32_t command_len;
|
||||
uint32_t command_used;
|
||||
/* 4bits for each command. */
|
||||
|
@ -508,17 +513,17 @@ typedef struct DRWCommandChunk {
|
|||
/* -- 64 bytes aligned -- */
|
||||
DRWCommand commands[96];
|
||||
/* -- 64 bytes aligned -- */
|
||||
} DRWCommandChunk;
|
||||
};
|
||||
|
||||
typedef struct DRWCommandSmallChunk {
|
||||
struct DRWCommandChunk *next;
|
||||
struct DRWCommandSmallChunk {
|
||||
DRWCommandChunk *next;
|
||||
uint32_t command_len;
|
||||
uint32_t command_used;
|
||||
/* 4bits for each command. */
|
||||
/* TODO: reduce size of command_type. */
|
||||
uint64_t command_type[6];
|
||||
DRWCommand commands[6];
|
||||
} DRWCommandSmallChunk;
|
||||
};
|
||||
|
||||
/* Only true for 64-bit platforms. */
|
||||
#ifdef __LP64__
|
||||
|
@ -532,28 +537,28 @@ BLI_STATIC_ASSERT_ALIGN(DRWCommandChunk, 16);
|
|||
* \{ */
|
||||
|
||||
/** Contains memory pools information. */
|
||||
typedef struct DRWData {
|
||||
struct DRWData {
|
||||
/** Instance data. */
|
||||
DRWInstanceDataList *idatalist;
|
||||
/** Memory-pools for draw-calls. */
|
||||
struct BLI_memblock *commands;
|
||||
struct BLI_memblock *commands_small;
|
||||
struct BLI_memblock *callbuffers;
|
||||
struct BLI_memblock *obmats;
|
||||
struct BLI_memblock *obinfos;
|
||||
struct BLI_memblock *cullstates;
|
||||
struct BLI_memblock *shgroups;
|
||||
struct BLI_memblock *uniforms;
|
||||
struct BLI_memblock *views;
|
||||
struct BLI_memblock *passes;
|
||||
struct BLI_memblock *images;
|
||||
struct GPUUniformBuf **matrices_ubo;
|
||||
struct GPUUniformBuf **obinfos_ubo;
|
||||
struct GHash *obattrs_ubo_pool;
|
||||
struct GHash *vlattrs_name_cache;
|
||||
struct ListBase vlattrs_name_list;
|
||||
struct LayerAttribute *vlattrs_buf;
|
||||
struct GPUUniformBuf *vlattrs_ubo;
|
||||
BLI_memblock *commands;
|
||||
BLI_memblock *commands_small;
|
||||
BLI_memblock *callbuffers;
|
||||
BLI_memblock *obmats;
|
||||
BLI_memblock *obinfos;
|
||||
BLI_memblock *cullstates;
|
||||
BLI_memblock *shgroups;
|
||||
BLI_memblock *uniforms;
|
||||
BLI_memblock *views;
|
||||
BLI_memblock *passes;
|
||||
BLI_memblock *images;
|
||||
GPUUniformBuf **matrices_ubo;
|
||||
GPUUniformBuf **obinfos_ubo;
|
||||
GHash *obattrs_ubo_pool;
|
||||
GHash *vlattrs_name_cache;
|
||||
ListBase vlattrs_name_list;
|
||||
LayerAttribute *vlattrs_buf;
|
||||
GPUUniformBuf *vlattrs_ubo;
|
||||
bool vlattrs_ubo_ready;
|
||||
uint ubo_len;
|
||||
/** Per draw-call volume object data. */
|
||||
|
@ -564,12 +569,12 @@ typedef struct DRWData {
|
|||
* Texture pool to reuse temp texture across engines.
|
||||
* TODO(@fclem): The pool could be shared even between view-ports.
|
||||
*/
|
||||
struct DRWTexturePool *texture_pool;
|
||||
DRWTexturePool *texture_pool;
|
||||
/** Per stereo view data. Contains engine data and default frame-buffers. */
|
||||
struct DRWViewData *view_data[2];
|
||||
DRWViewData *view_data[2];
|
||||
/** Per draw-call curves object data. */
|
||||
blender::draw::CurvesUniformBufPool *curves_ubos;
|
||||
} DRWData;
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -577,22 +582,22 @@ typedef struct DRWData {
|
|||
/** \name Draw Manager
|
||||
* \{ */
|
||||
|
||||
typedef struct DupliKey {
|
||||
struct Object *ob;
|
||||
struct ID *ob_data;
|
||||
} DupliKey;
|
||||
struct DupliKey {
|
||||
Object *ob;
|
||||
ID *ob_data;
|
||||
};
|
||||
|
||||
#define DST_MAX_SLOTS 64 /* Cannot be changed without modifying RST.bound_tex_slots */
|
||||
#define MAX_CLIP_PLANES 6 /* GL_MAX_CLIP_PLANES is at least 6 */
|
||||
#define STENCIL_UNDEFINED 256
|
||||
#define DRW_DRAWLIST_LEN 256
|
||||
typedef struct DRWManager {
|
||||
struct DRWManager {
|
||||
/* TODO: clean up this struct a bit. */
|
||||
/* Cache generation */
|
||||
/* TODO(@fclem): Rename to data. */
|
||||
DRWData *vmempool;
|
||||
/** Active view data structure for one of the 2 stereo view. Not related to DRWView. */
|
||||
struct DRWViewData *view_data_active;
|
||||
DRWViewData *view_data_active;
|
||||
/* State of the object being evaluated if already allocated. */
|
||||
DRWResourceHandle ob_handle;
|
||||
/** True if current DST.ob_state has its matching DRWObjectInfos init. */
|
||||
|
@ -603,15 +608,15 @@ typedef struct DRWManager {
|
|||
DRWResourceHandle pass_handle;
|
||||
|
||||
/** Dupli object that corresponds to the current object. */
|
||||
struct DupliObject *dupli_source;
|
||||
DupliObject *dupli_source;
|
||||
/** Object that created the dupli-list the current object is part of. */
|
||||
struct Object *dupli_parent;
|
||||
Object *dupli_parent;
|
||||
/** Object referenced by the current dupli object. */
|
||||
struct Object *dupli_origin;
|
||||
Object *dupli_origin;
|
||||
/** Object-data referenced by the current dupli object. */
|
||||
struct ID *dupli_origin_data;
|
||||
ID *dupli_origin_data;
|
||||
/** Hash-map: #DupliKey -> void pointer for each enabled engine. */
|
||||
struct GHash *dupli_ghash;
|
||||
GHash *dupli_ghash;
|
||||
/** TODO(@fclem): try to remove usage of this. */
|
||||
DRWInstanceData *object_instance_data[MAX_INSTANCE_DATA_SIZE];
|
||||
/* Dupli data for the current dupli for each enabled engine. */
|
||||
|
@ -627,7 +632,7 @@ typedef struct DRWManager {
|
|||
|
||||
/* Per viewport */
|
||||
GPUViewport *viewport;
|
||||
struct GPUFrameBuffer *default_framebuffer;
|
||||
GPUFrameBuffer *default_framebuffer;
|
||||
float size[2];
|
||||
float inv_size[2];
|
||||
float pixsize;
|
||||
|
@ -646,7 +651,7 @@ typedef struct DRWManager {
|
|||
DRWContextState draw_ctx;
|
||||
|
||||
/* Convenience pointer to text_store owned by the viewport */
|
||||
struct DRWTextStore **text_store_p;
|
||||
DRWTextStore **text_store_p;
|
||||
|
||||
bool buffer_finish_called; /* Avoid bad usage of DRW_render_instance_buffer_finish */
|
||||
|
||||
|
@ -662,9 +667,9 @@ typedef struct DRWManager {
|
|||
uint select_id;
|
||||
#endif
|
||||
|
||||
struct TaskGraph *task_graph;
|
||||
TaskGraph *task_graph;
|
||||
/* Contains list of objects that needs to be extracted from other objects. */
|
||||
struct GSet *delayed_extraction;
|
||||
GSet *delayed_extraction;
|
||||
|
||||
/* ---------- Nothing after this point is cleared after use ----------- */
|
||||
|
||||
|
@ -679,7 +684,7 @@ typedef struct DRWManager {
|
|||
GPUDrawList *draw_list;
|
||||
|
||||
DRWDebugModule *debug;
|
||||
} DRWManager;
|
||||
};
|
||||
|
||||
extern DRWManager DST; /* TODO: get rid of this and allow multi-threaded rendering. */
|
||||
|
||||
|
@ -695,16 +700,16 @@ void *drw_viewport_engine_data_ensure(void *engine_type);
|
|||
|
||||
void drw_state_set(DRWState state);
|
||||
|
||||
void drw_debug_draw(void);
|
||||
void drw_debug_init(void);
|
||||
void drw_debug_draw();
|
||||
void drw_debug_init();
|
||||
void drw_debug_module_free(DRWDebugModule *module);
|
||||
GPUStorageBuf *drw_debug_gpu_draw_buf_get(void);
|
||||
GPUStorageBuf *drw_debug_gpu_print_buf_get(void);
|
||||
GPUStorageBuf *drw_debug_gpu_draw_buf_get();
|
||||
GPUStorageBuf *drw_debug_gpu_print_buf_get();
|
||||
|
||||
eDRWCommandType command_type_get(const uint64_t *command_type_bits, int index);
|
||||
|
||||
void drw_batch_cache_validate(Object *ob);
|
||||
void drw_batch_cache_generate_requested(struct Object *ob);
|
||||
void drw_batch_cache_generate_requested(Object *ob);
|
||||
|
||||
/**
|
||||
* \warning Only evaluated mesh data is handled by this delayed generation.
|
||||
|
@ -715,19 +720,19 @@ void drw_batch_cache_generate_requested_evaluated_mesh_or_curve(Object *ob);
|
|||
void drw_resource_buffer_finish(DRWData *vmempool);
|
||||
|
||||
/* Procedural Drawing */
|
||||
GPUBatch *drw_cache_procedural_points_get(void);
|
||||
GPUBatch *drw_cache_procedural_lines_get(void);
|
||||
GPUBatch *drw_cache_procedural_triangles_get(void);
|
||||
GPUBatch *drw_cache_procedural_triangle_strips_get(void);
|
||||
GPUBatch *drw_cache_procedural_points_get();
|
||||
GPUBatch *drw_cache_procedural_lines_get();
|
||||
GPUBatch *drw_cache_procedural_triangles_get();
|
||||
GPUBatch *drw_cache_procedural_triangle_strips_get();
|
||||
|
||||
void drw_uniform_attrs_pool_update(struct GHash *table,
|
||||
const struct GPUUniformAttrList *key,
|
||||
void drw_uniform_attrs_pool_update(GHash *table,
|
||||
const GPUUniformAttrList *key,
|
||||
DRWResourceHandle *handle,
|
||||
const struct Object *ob,
|
||||
const struct Object *dupli_parent,
|
||||
const struct DupliObject *dupli_source);
|
||||
const Object *ob,
|
||||
const Object *dupli_parent,
|
||||
const DupliObject *dupli_source);
|
||||
|
||||
GPUUniformBuf *drw_ensure_layer_attribute_buffer(void);
|
||||
GPUUniformBuf *drw_ensure_layer_attribute_buffer();
|
||||
|
||||
double *drw_engine_data_cache_time_get(GPUViewport *viewport);
|
||||
void *drw_engine_data_engine_data_create(GPUViewport *viewport, void *engine_type);
|
||||
|
@ -736,23 +741,18 @@ bool drw_engine_data_engines_data_validate(GPUViewport *viewport, void **engine_
|
|||
void drw_engine_data_cache_release(GPUViewport *viewport);
|
||||
void drw_engine_data_free(GPUViewport *viewport);
|
||||
|
||||
struct GPUMaterial;
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
struct DRW_Attributes;
|
||||
struct DRW_MeshCDMask;
|
||||
|
||||
void DRW_mesh_get_attributes(const struct Object *object,
|
||||
const struct Mesh *mesh,
|
||||
const struct GPUMaterial *const *gpumat_array,
|
||||
void DRW_mesh_get_attributes(const Object *object,
|
||||
const Mesh *mesh,
|
||||
const GPUMaterial *const *gpumat_array,
|
||||
int gpumat_array_len,
|
||||
DRW_Attributes *r_attrs,
|
||||
DRW_MeshCDMask *r_cd_needed);
|
||||
|
||||
} // namespace blender::draw
|
||||
|
||||
void DRW_manager_begin_sync(void);
|
||||
void DRW_manager_end_sync(void);
|
||||
void DRW_manager_begin_sync();
|
||||
void DRW_manager_end_sync();
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -9,22 +9,22 @@
|
|||
# include "GPU_shader_shared_utils.hh"
|
||||
# include "draw_defines.hh"
|
||||
|
||||
typedef struct ViewCullingData ViewCullingData;
|
||||
typedef struct ViewMatrices ViewMatrices;
|
||||
typedef struct ObjectMatrices ObjectMatrices;
|
||||
typedef struct ObjectInfos ObjectInfos;
|
||||
typedef struct ObjectBounds ObjectBounds;
|
||||
typedef struct VolumeInfos VolumeInfos;
|
||||
typedef struct CurvesInfos CurvesInfos;
|
||||
typedef struct ObjectAttribute ObjectAttribute;
|
||||
typedef struct LayerAttribute LayerAttribute;
|
||||
typedef struct DrawCommand DrawCommand;
|
||||
typedef struct DispatchCommand DispatchCommand;
|
||||
typedef struct DRWDebugPrintBuffer DRWDebugPrintBuffer;
|
||||
typedef struct DRWDebugVert DRWDebugVert;
|
||||
typedef struct DRWDebugDrawBuffer DRWDebugDrawBuffer;
|
||||
typedef struct FrustumCorners FrustumCorners;
|
||||
typedef struct FrustumPlanes FrustumPlanes;
|
||||
struct ViewCullingData;
|
||||
struct ViewMatrices;
|
||||
struct ObjectMatrices;
|
||||
struct ObjectInfos;
|
||||
struct ObjectBounds;
|
||||
struct VolumeInfos;
|
||||
struct CurvesInfos;
|
||||
struct ObjectAttribute;
|
||||
struct LayerAttribute;
|
||||
struct DrawCommand;
|
||||
struct DispatchCommand;
|
||||
struct DRWDebugPrintBuffer;
|
||||
struct DRWDebugVert;
|
||||
struct DRWDebugDrawBuffer;
|
||||
struct FrustumCorners;
|
||||
struct FrustumPlanes;
|
||||
|
||||
/* __cplusplus is true when compiling with MSL. */
|
||||
# if defined(__cplusplus) && !defined(GPU_SHADER)
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
#include "GPU_texture.hh"
|
||||
|
||||
typedef struct DRWTexturePool DRWTexturePool;
|
||||
struct DRWTexturePool;
|
||||
|
||||
DRWTexturePool *DRW_texture_pool_create(void);
|
||||
DRWTexturePool *DRW_texture_pool_create();
|
||||
void DRW_texture_pool_free(DRWTexturePool *pool);
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
void DRW_draw_region_info(void);
|
||||
void DRW_draw_cursor(void);
|
||||
void DRW_draw_cursor_2d(void);
|
||||
void DRW_draw_gizmo_3d(void);
|
||||
void DRW_draw_gizmo_2d(void);
|
||||
void DRW_draw_region_info();
|
||||
void DRW_draw_cursor();
|
||||
void DRW_draw_cursor_2d();
|
||||
void DRW_draw_gizmo_3d();
|
||||
void DRW_draw_gizmo_2d();
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#define GPU_INFO_SIZE 512 /* IMA_MAX_RENDER_TEXT_SIZE */
|
||||
|
||||
struct DRWPass;
|
||||
struct DRWTextStore;
|
||||
struct DRWRegisteredDrawEngine;
|
||||
struct DrawEngineType;
|
||||
struct GPUViewport;
|
||||
|
@ -20,26 +22,26 @@ struct GPUViewport;
|
|||
/* NOTE: these structs are only here for reading the actual lists from the engine.
|
||||
* The actual length of them is stored in a ViewportEngineData_Info.
|
||||
* The length of 1 is just here to avoid compiler warning. */
|
||||
typedef struct FramebufferList {
|
||||
struct GPUFrameBuffer *framebuffers[1];
|
||||
} FramebufferList;
|
||||
struct FramebufferList {
|
||||
GPUFrameBuffer *framebuffers[1];
|
||||
};
|
||||
|
||||
typedef struct TextureList {
|
||||
struct GPUTexture *textures[1];
|
||||
} TextureList;
|
||||
struct TextureList {
|
||||
GPUTexture *textures[1];
|
||||
};
|
||||
|
||||
typedef struct PassList {
|
||||
struct DRWPass *passes[1];
|
||||
} PassList;
|
||||
struct PassList {
|
||||
DRWPass *passes[1];
|
||||
};
|
||||
|
||||
/* Stores custom structs from the engine that have been MEM_(m/c)allocN'ed. */
|
||||
typedef struct StorageList {
|
||||
struct StorageList {
|
||||
void *storage[1];
|
||||
} StorageList;
|
||||
};
|
||||
|
||||
typedef struct ViewportEngineData {
|
||||
struct ViewportEngineData {
|
||||
/* Not owning pointer to the draw engine. */
|
||||
struct DRWRegisteredDrawEngine *engine_type;
|
||||
DRWRegisteredDrawEngine *engine_type;
|
||||
|
||||
FramebufferList *fbl;
|
||||
TextureList *txl;
|
||||
|
@ -54,39 +56,39 @@ typedef struct ViewportEngineData {
|
|||
char info[GPU_INFO_SIZE];
|
||||
|
||||
/* we may want to put this elsewhere */
|
||||
struct DRWTextStore *text_draw_cache;
|
||||
DRWTextStore *text_draw_cache;
|
||||
|
||||
/* Profiling data */
|
||||
double init_time;
|
||||
double render_time;
|
||||
double background_time;
|
||||
} ViewportEngineData;
|
||||
};
|
||||
|
||||
typedef struct ViewportEngineData_Info {
|
||||
struct ViewportEngineData_Info {
|
||||
int fbl_len;
|
||||
int txl_len;
|
||||
int psl_len;
|
||||
int stl_len;
|
||||
} ViewportEngineData_Info;
|
||||
};
|
||||
|
||||
/* Buffer and textures used by the viewport by default */
|
||||
typedef struct DefaultFramebufferList {
|
||||
struct GPUFrameBuffer *default_fb;
|
||||
struct GPUFrameBuffer *overlay_fb;
|
||||
struct GPUFrameBuffer *in_front_fb;
|
||||
struct GPUFrameBuffer *color_only_fb;
|
||||
struct GPUFrameBuffer *depth_only_fb;
|
||||
struct GPUFrameBuffer *overlay_only_fb;
|
||||
} DefaultFramebufferList;
|
||||
struct DefaultFramebufferList {
|
||||
GPUFrameBuffer *default_fb;
|
||||
GPUFrameBuffer *overlay_fb;
|
||||
GPUFrameBuffer *in_front_fb;
|
||||
GPUFrameBuffer *color_only_fb;
|
||||
GPUFrameBuffer *depth_only_fb;
|
||||
GPUFrameBuffer *overlay_only_fb;
|
||||
};
|
||||
|
||||
typedef struct DefaultTextureList {
|
||||
struct GPUTexture *color;
|
||||
struct GPUTexture *color_overlay;
|
||||
struct GPUTexture *depth;
|
||||
struct GPUTexture *depth_in_front;
|
||||
} DefaultTextureList;
|
||||
struct DefaultTextureList {
|
||||
GPUTexture *color;
|
||||
GPUTexture *color_overlay;
|
||||
GPUTexture *depth;
|
||||
GPUTexture *depth_in_front;
|
||||
};
|
||||
|
||||
typedef struct DRWViewData DRWViewData;
|
||||
struct DRWViewData;
|
||||
|
||||
/**
|
||||
* Creates a view data with all possible engines type for this view.
|
||||
|
@ -96,12 +98,11 @@ typedef struct DRWViewData DRWViewData;
|
|||
DRWViewData *DRW_view_data_create(ListBase *engine_types);
|
||||
void DRW_view_data_free(DRWViewData *view_data);
|
||||
|
||||
void DRW_view_data_default_lists_from_viewport(DRWViewData *view_data,
|
||||
struct GPUViewport *viewport);
|
||||
void DRW_view_data_default_lists_from_viewport(DRWViewData *view_data, GPUViewport *viewport);
|
||||
void DRW_view_data_texture_list_size_validate(DRWViewData *view_data, const int size[2]);
|
||||
ViewportEngineData *DRW_view_data_engine_data_get_ensure(DRWViewData *view_data,
|
||||
struct DrawEngineType *engine_type_);
|
||||
void DRW_view_data_use_engine(DRWViewData *view_data, struct DrawEngineType *engine_type);
|
||||
DrawEngineType *engine_type_);
|
||||
void DRW_view_data_use_engine(DRWViewData *view_data, DrawEngineType *engine_type);
|
||||
void DRW_view_data_reset(DRWViewData *view_data);
|
||||
void DRW_view_data_free_unused(DRWViewData *view_data);
|
||||
void DRW_view_data_engines_view_update(DRWViewData *view_data);
|
||||
|
@ -109,10 +110,10 @@ double *DRW_view_data_cache_time_get(DRWViewData *view_data);
|
|||
DefaultFramebufferList *DRW_view_data_default_framebuffer_list_get(DRWViewData *view_data);
|
||||
DefaultTextureList *DRW_view_data_default_texture_list_get(DRWViewData *view_data);
|
||||
|
||||
typedef struct DRWEngineIterator {
|
||||
struct DRWEngineIterator {
|
||||
int id, end;
|
||||
ViewportEngineData **engines;
|
||||
} DRWEngineIterator;
|
||||
};
|
||||
|
||||
/* Iterate over used engines of this view_data. */
|
||||
void DRW_view_data_enabled_engine_iter_begin(DRWEngineIterator *iterator, DRWViewData *view_data);
|
||||
|
@ -121,9 +122,9 @@ ViewportEngineData *DRW_view_data_enabled_engine_iter_step(DRWEngineIterator *it
|
|||
#define DRW_ENABLED_ENGINE_ITER(view_data_, engine_, data_) \
|
||||
DRWEngineIterator iterator; \
|
||||
ViewportEngineData *data_; \
|
||||
struct DrawEngineType *engine_; \
|
||||
DrawEngineType *engine_; \
|
||||
DRW_view_data_enabled_engine_iter_begin(&iterator, view_data_); \
|
||||
/* WATCH Comma operator trickery ahead! This tests engine_ == NULL. */ \
|
||||
/* WATCH Comma operator trickery ahead! This tests engine_ == nullptr. */ \
|
||||
while ((data_ = DRW_view_data_enabled_engine_iter_step(&iterator), \
|
||||
engine_ = (data_ != NULL) ? (struct DrawEngineType *)data_->engine_type->draw_engine : \
|
||||
NULL))
|
||||
engine_ = (data_ != nullptr) ? (DrawEngineType *)data_->engine_type->draw_engine : \
|
||||
nullptr))
|
||||
|
|
Loading…
Reference in New Issue