Cleanup: quiet undeclared variable warning

Also move view_ubo into G_draw.
This commit is contained in:
2019-02-23 18:31:45 +11:00
parent 7a5854f4ce
commit 9d309b7978
19 changed files with 28 additions and 17 deletions

View File

@@ -31,6 +31,8 @@
#include "eevee_private.h"
#include "eevee_engine.h" /* own include */
#define EEVEE_ENGINE "BLENDER_EEVEE"
/* *********** FUNCTIONS *********** */

View File

@@ -28,13 +28,14 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "ED_screen.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "GPU_viewport.h"
#include "external_engine.h" /* own include */
/* Shaders */
#define EXTERNAL_ENGINE "BLENDER_EXTERNAL"
@@ -197,7 +198,7 @@ static void external_engine_free(void)
static const DrawEngineDataSize external_data_size = DRW_VIEWPORT_DATA_SIZE(EXTERNAL_Data);
DrawEngineType draw_engine_external_type = {
static DrawEngineType draw_engine_external_type = {
NULL, NULL,
N_("External"),
&external_data_size,

View File

@@ -47,6 +47,8 @@
#include "draw_common.h"
#include "draw_manager_text.h"
#include "draw_mode_engines.h"
/* ********************************* Lists ************************************** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines

View File

@@ -212,6 +212,8 @@ struct DRW_Global {
struct GPUTexture *ramp;
struct GPUTexture *weight_ramp;
struct GPUUniformBuffer *view_ubo;
};
extern struct DRW_Global G_draw;

View File

@@ -96,8 +96,6 @@ DRWManager DST = {NULL};
static ListBase DRW_engines = {NULL, NULL};
extern struct GPUUniformBuffer *view_ubo; /* draw_manager_exec.c */
static void drw_state_prepare_clean_for_draw(DRWManager *dst)
{
memset(dst, 0x0, offsetof(DRWManager, gl_context));
@@ -647,8 +645,8 @@ static void drw_viewport_var_init(void)
DST.RST.bound_ubo_slots = MEM_callocN(sizeof(char) * GPU_max_ubo_binds(), "Bound Ubo Slots");
}
if (view_ubo == NULL) {
view_ubo = DRW_uniformbuffer_create(sizeof(ViewUboStorage), NULL);
if (G_draw.view_ubo == NULL) {
G_draw.view_ubo = DRW_uniformbuffer_create(sizeof(ViewUboStorage), NULL);
}
DST.override_mat = 0;
@@ -2572,7 +2570,6 @@ void DRW_engines_register(void)
}
}
extern struct GPUVertFormat *g_pos_format; /* draw_shgroup.c */
void DRW_engines_free(void)
{
DRW_opengl_context_enable();
@@ -2596,7 +2593,7 @@ void DRW_engines_free(void)
}
DRW_UBO_FREE_SAFE(G_draw.block_ubo);
DRW_UBO_FREE_SAFE(view_ubo);
DRW_UBO_FREE_SAFE(G_draw.view_ubo);
DRW_TEXTURE_FREE_SAFE(G_draw.ramp);
DRW_TEXTURE_FREE_SAFE(G_draw.weight_ramp);
MEM_SAFE_FREE(g_pos_format);

View File

@@ -427,4 +427,6 @@ void drw_debug_init(void);
void drw_batch_cache_generate_requested(struct Object *ob);
extern struct GPUVertFormat *g_pos_format;
#endif /* __DRAW_MANAGER_H__ */

View File

@@ -41,8 +41,6 @@
struct GPUVertFormat *g_pos_format = NULL;
extern struct GPUUniformBuffer *view_ubo; /* draw_manager_exec.c */
/* -------------------------------------------------------------------- */
/** \name Uniform Buffer Object (DRW_uniformbuffer)
* \{ */
@@ -670,7 +668,7 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
int view_ubo_location = GPU_shader_get_uniform_block(shader, "viewBlock");
if (view_ubo_location != -1) {
drw_shgroup_uniform_create_ex(shgroup, view_ubo_location, DRW_UNIFORM_BLOCK_PERSIST, view_ubo, 0, 1);
drw_shgroup_uniform_create_ex(shgroup, view_ubo_location, DRW_UNIFORM_BLOCK_PERSIST, G_draw.view_ubo, 0, 1);
}
else {
/* Only here to support builtin shaders. This should not be used by engines. */

View File

@@ -45,8 +45,6 @@ void DRW_select_load_id(uint id)
#define DEBUG_UBO_BINDING
struct GPUUniformBuffer *view_ubo;
/* -------------------------------------------------------------------- */
/** \name Draw State (DRW_state)
* \{ */
@@ -1294,7 +1292,7 @@ static void drw_update_view(void)
DST.state_cache_id++;
DST.dirty_mat = false;
DRW_uniformbuffer_update(view_ubo, &DST.view_data);
DRW_uniformbuffer_update(G_draw.view_ubo, &DST.view_data);
/* Catch integer wrap around. */
if (UNLIKELY(DST.state_cache_id == 0)) {

View File

@@ -27,6 +27,7 @@
#include "DNA_view3d_types.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
/* *********** LISTS *********** */
typedef struct EDIT_ARMATURE_PassList {

View File

@@ -32,7 +32,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
/* If needed, contains all global/Theme colors
* Add needed theme colors / values to DRW_globals_update() and update UBO

View File

@@ -29,6 +29,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
extern char datatoc_common_globals_lib_glsl[];

View File

@@ -32,7 +32,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.

View File

@@ -33,6 +33,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.

View File

@@ -34,6 +34,8 @@
#include "GPU_shader.h"
#include "DRW_render.h"
#include "draw_mode_engines.h"
#ifdef __APPLE__
#define USE_GEOM_SHADER_WORKAROUND 1
#else

View File

@@ -32,7 +32,7 @@
#include "GPU_texture.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
#include "DNA_mesh_types.h"

View File

@@ -26,6 +26,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
#include "DNA_mesh_types.h"
#include "DNA_view3d_types.h"

View File

@@ -30,6 +30,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
#include "ED_particle.h"

View File

@@ -31,6 +31,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.

View File

@@ -35,6 +35,7 @@
#include "GPU_shader.h"
#include "draw_common.h"
#include "draw_mode_engines.h"
extern char datatoc_sculpt_mask_vert_glsl[];
extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];