Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-21 00:09:37 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-21 15:16:42 +0300
commit7edd8a7738481b3d4f0720a173dca2a1853996d6 (patch)
tree4b507b4535c0fbe84fc25a21ddf2db55476b1b9b /source/blender/draw
parent4f0a749489af9de9b2ec0b5768d6e10898885a17 (diff)
GPUUniformBuf: Rename struct and change API a bit
This follows the GPU module naming of other buffers. We pass name to distinguish each GPUUniformBuf in debug mode. Also remove DRW_uniform_buffer interface.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee/eevee_data.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c12
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c16
-rw-r--r--source/blender/draw/engines/eevee/eevee_lights.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_lookdev.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c57
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h30
-rw-r--r--source/blender/draw/engines/eevee/eevee_render.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_shadows.c10
-rw-r--r--source/blender/draw/engines/eevee/eevee_subsurface.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_data.c8
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c12
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.h6
-rw-r--r--source/blender/draw/engines/workbench/workbench_data.c18
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_cavity.c4
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_dof.c6
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h12
-rw-r--r--source/blender/draw/intern/DRW_render.h13
-rw-r--r--source/blender/draw/intern/draw_common.c5
-rw-r--r--source/blender/draw/intern/draw_common.h4
-rw-r--r--source/blender/draw/intern/draw_manager.c4
-rw-r--r--source/blender/draw/intern/draw_manager.h6
-rw-r--r--source/blender/draw/intern/draw_manager_data.c48
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c26
26 files changed, 146 insertions, 165 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c
index e18c43fc643..5c4ee015c86 100644
--- a/source/blender/draw/engines/eevee/eevee_data.c
+++ b/source/blender/draw/engines/eevee/eevee_data.c
@@ -254,7 +254,7 @@ EEVEE_ViewLayerData *EEVEE_view_layer_data_get(void)
static void eevee_view_layer_init(EEVEE_ViewLayerData *sldata)
{
- sldata->common_ubo = DRW_uniformbuffer_create(sizeof(sldata->common_data), NULL);
+ sldata->common_ubo = GPU_uniformbuf_create(sizeof(sldata->common_data));
}
EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure_ex(struct ViewLayer *view_layer)
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 72f008ea66a..6ab267ceb03 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -267,7 +267,7 @@ static void eevee_draw_scene(void *vedata)
/* Set ray type. */
sldata->common_data.ray_type = EEVEE_RAY_CAMERA;
sldata->common_data.ray_depth = 0.0f;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
GPU_framebuffer_bind(fbl->main_fb);
eGPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index a785d27c2db..088a08fb51a 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -942,7 +942,7 @@ static void eevee_lightbake_render_world_sample(void *ved, void *user_data)
sldata->common_data.ray_type = EEVEE_RAY_GLOSSY;
sldata->common_data.ray_depth = 1;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
EEVEE_lightbake_render_world(sldata, vedata, lbake->rt_fb);
EEVEE_lightbake_filter_glossy(sldata,
vedata,
@@ -956,7 +956,7 @@ static void eevee_lightbake_render_world_sample(void *ved, void *user_data)
sldata->common_data.ray_type = EEVEE_RAY_DIFFUSE;
sldata->common_data.ray_depth = 1;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
EEVEE_lightbake_render_world(sldata, vedata, lbake->rt_fb);
EEVEE_lightbake_filter_diffuse(sldata, vedata, lbake->rt_color, lbake->store_fb, 0, 1.0f);
@@ -1079,7 +1079,7 @@ static void eevee_lightbake_render_grid_sample(void *ved, void *user_data)
if (lbake->bounce_curr == 0) {
common_data->prb_num_render_grid = 0;
}
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
EEVEE_lightbake_render_scene(sldata, vedata, lbake->rt_fb, pos, prb->clipsta, prb->clipend);
@@ -1145,7 +1145,7 @@ static void eevee_lightbake_render_probe_sample(void *ved, void *user_data)
common_data->prb_num_render_cube = 0;
common_data->ray_type = EEVEE_RAY_GLOSSY;
common_data->ray_depth = 1;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
EEVEE_lightbake_render_scene(
sldata, vedata, lbake->rt_fb, eprobe->position, prb->clipsta, prb->clipend);
@@ -1430,7 +1430,7 @@ void EEVEE_lightbake_update_world_quick(EEVEE_ViewLayerData *sldata,
sldata->common_data.ray_type = EEVEE_RAY_GLOSSY;
sldata->common_data.ray_depth = 1;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
EEVEE_lightbake_render_world(sldata, vedata, lbake.rt_fb);
EEVEE_lightbake_filter_glossy(sldata,
vedata,
@@ -1444,7 +1444,7 @@ void EEVEE_lightbake_update_world_quick(EEVEE_ViewLayerData *sldata,
sldata->common_data.ray_type = EEVEE_RAY_DIFFUSE;
sldata->common_data.ray_depth = 1;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
EEVEE_lightbake_render_world(sldata, vedata, lbake.rt_fb);
EEVEE_lightbake_filter_diffuse(sldata, vedata, lbake.rt_color, lbake.store_fb, 0, 1.0f);
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 0f4a9dc79b6..63cc07c321e 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -39,6 +39,7 @@
#include "GPU_extensions.h"
#include "GPU_material.h"
#include "GPU_texture.h"
+#include "GPU_uniform_buffer.h"
#include "DEG_depsgraph_query.h"
@@ -203,10 +204,9 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
if (!sldata->probes) {
sldata->probes = MEM_callocN(sizeof(EEVEE_LightProbesInfo), "EEVEE_LightProbesInfo");
- sldata->probe_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_LightProbe) * MAX_PROBE, NULL);
- sldata->grid_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_LightGrid) * MAX_GRID, NULL);
- sldata->planar_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_PlanarReflection) * MAX_PLANAR,
- NULL);
+ sldata->probe_ubo = GPU_uniformbuf_create(sizeof(EEVEE_LightProbe) * MAX_PROBE);
+ sldata->grid_ubo = GPU_uniformbuf_create(sizeof(EEVEE_LightGrid) * MAX_GRID);
+ sldata->planar_ubo = GPU_uniformbuf_create(sizeof(EEVEE_PlanarReflection) * MAX_PLANAR);
}
common_data->prb_num_planar = 0;
@@ -724,8 +724,8 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
eevee_lightprobes_extract_from_cache(sldata->probes, light_cache);
- DRW_uniformbuffer_update(sldata->probe_ubo, &sldata->probes->probe_data);
- DRW_uniformbuffer_update(sldata->grid_ubo, &sldata->probes->grid_data);
+ GPU_uniformbuf_update(sldata->probe_ubo, &sldata->probes->probe_data);
+ GPU_uniformbuf_update(sldata->grid_ubo, &sldata->probes->grid_data);
/* For shading, save max level of the octahedron map */
sldata->common_data.prb_lod_cube_max = (float)light_cache->mips_len;
@@ -1241,7 +1241,7 @@ void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *v
common_data->ray_type = EEVEE_RAY_GLOSSY;
common_data->ray_depth = 1.0f;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
/* Rendering happens here! */
eevee_lightbake_render_scene_to_planars(sldata, vedata);
@@ -1249,7 +1249,7 @@ void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *v
/* Make sure no additional visibility check runs after this. */
pinfo->vis_data.collection = NULL;
- DRW_uniformbuffer_update(sldata->planar_ubo, &sldata->probes->planar_data);
+ GPU_uniformbuf_update(sldata->planar_ubo, &sldata->probes->planar_data);
/* Restore */
common_data->prb_num_planar = pinfo->num_planar;
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index c6e8bac0949..b7112c07cab 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -214,5 +214,5 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *UNUSED(v
sldata->common_data.la_num_light = linfo->num_light;
- DRW_uniformbuffer_update(sldata->light_ubo, &linfo->light_data);
+ GPU_uniformbuf_update(sldata->light_ubo, &linfo->light_data);
}
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index f79d90500bd..6253203bab6 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -275,7 +275,7 @@ void EEVEE_lookdev_draw(EEVEE_Data *vedata)
common->ao_dist = 0.0f;
common->ao_factor = 0.0f;
common->ao_settings = 0.0f;
- DRW_uniformbuffer_update(sldata->common_ubo, common);
+ GPU_uniformbuf_update(sldata->common_ubo, common);
/* override matrices */
float winmat[4][4], viewmat[4][4];
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index fb07208be47..b6e20416dfb 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -243,33 +243,34 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata,
{
/* Create RenderPass UBO */
if (sldata->renderpass_ubo.combined == NULL) {
- sldata->renderpass_ubo.combined = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){true, true, true, true, true, false, false});
-
- sldata->renderpass_ubo.diff_color = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){true, false, false, false, false, true, false});
-
- sldata->renderpass_ubo.diff_light = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){true, true, false, false, false, false, false});
-
- sldata->renderpass_ubo.spec_color = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){false, false, true, false, false, false, false});
-
- sldata->renderpass_ubo.spec_light = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){false, false, true, true, false, false, false});
-
- sldata->renderpass_ubo.emit = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){false, false, false, false, true, false, false});
-
- sldata->renderpass_ubo.environment = DRW_uniformbuffer_create(
- sizeof(EEVEE_RenderPassData),
- &(const EEVEE_RenderPassData){true, true, true, true, true, false, true});
+ EEVEE_RenderPassData data;
+ data = (EEVEE_RenderPassData){true, true, true, true, true, false, false};
+ sldata->renderpass_ubo.combined = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.combined");
+
+ data = (EEVEE_RenderPassData){true, false, false, false, false, true, false};
+ sldata->renderpass_ubo.diff_color = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.diff_color");
+
+ data = (EEVEE_RenderPassData){true, true, false, false, false, false, false};
+ sldata->renderpass_ubo.diff_light = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.diff_light");
+
+ data = (EEVEE_RenderPassData){false, false, true, false, false, false, false};
+ sldata->renderpass_ubo.spec_color = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.spec_color");
+
+ data = (EEVEE_RenderPassData){false, false, true, true, false, false, false};
+ sldata->renderpass_ubo.spec_light = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.spec_light");
+
+ data = (EEVEE_RenderPassData){false, false, false, false, true, false, false};
+ sldata->renderpass_ubo.emit = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.emit");
+
+ data = (EEVEE_RenderPassData){true, true, true, true, true, false, true};
+ sldata->renderpass_ubo.environment = GPU_uniformbuf_create_ex(
+ sizeof(data), &data, "renderpass_ubo.environment");
}
/* Used combined pass by default. */
@@ -962,7 +963,7 @@ static void material_renderpass_accumulate(EEVEE_FramebufferList *fbl,
DRWPass *renderpass,
EEVEE_PrivateData *pd,
GPUTexture *output_tx,
- struct GPUUniformBuffer *renderpass_option_ubo)
+ struct GPUUniformBuf *renderpass_option_ubo)
{
GPU_framebuffer_texture_attach(fbl->material_accum_fb, output_tx, 0, 0);
GPU_framebuffer_bind(fbl->material_accum_fb);
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 40d7676c38c..9cde9e871e5 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -818,9 +818,9 @@ typedef struct EEVEE_ViewLayerData {
/* Lights */
struct EEVEE_LightsInfo *lights;
- struct GPUUniformBuffer *light_ubo;
- struct GPUUniformBuffer *shadow_ubo;
- struct GPUUniformBuffer *shadow_samples_ubo;
+ struct GPUUniformBuf *light_ubo;
+ struct GPUUniformBuf *shadow_ubo;
+ struct GPUUniformBuf *shadow_samples_ubo;
struct GPUFrameBuffer *shadow_fb;
@@ -832,24 +832,24 @@ typedef struct EEVEE_ViewLayerData {
/* Probes */
struct EEVEE_LightProbesInfo *probes;
- struct GPUUniformBuffer *probe_ubo;
- struct GPUUniformBuffer *grid_ubo;
- struct GPUUniformBuffer *planar_ubo;
+ struct GPUUniformBuf *probe_ubo;
+ struct GPUUniformBuf *grid_ubo;
+ struct GPUUniformBuf *planar_ubo;
/* Material Render passes */
struct {
- struct GPUUniformBuffer *combined;
- struct GPUUniformBuffer *environment;
- struct GPUUniformBuffer *diff_color;
- struct GPUUniformBuffer *diff_light;
- struct GPUUniformBuffer *spec_color;
- struct GPUUniformBuffer *spec_light;
- struct GPUUniformBuffer *emit;
+ struct GPUUniformBuf *combined;
+ struct GPUUniformBuf *environment;
+ struct GPUUniformBuf *diff_color;
+ struct GPUUniformBuf *diff_light;
+ struct GPUUniformBuf *spec_color;
+ struct GPUUniformBuf *spec_light;
+ struct GPUUniformBuf *emit;
} renderpass_ubo;
/* Common Uniform Buffer */
struct EEVEE_CommonUniformBuffer common_data;
- struct GPUUniformBuffer *common_ubo;
+ struct GPUUniformBuf *common_ubo;
struct LightCache *fallback_lightcache;
@@ -953,7 +953,7 @@ typedef struct EEVEE_PrivateData {
GPUTexture *renderpass_col_input;
GPUTexture *renderpass_light_input;
/* Renderpass ubo reference used by material pass. */
- struct GPUUniformBuffer *renderpass_ubo;
+ struct GPUUniformBuf *renderpass_ubo;
/** For rendering shadows. */
struct DRWView *cube_views[6];
/** For rendering probes. */
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index 65a856c39e1..2351b06db98 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -574,7 +574,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
/* Set ray type. */
sldata->common_data.ray_type = EEVEE_RAY_CAMERA;
sldata->common_data.ray_depth = 0.0f;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
GPU_framebuffer_bind(fbl->main_fb);
GPU_framebuffer_clear_color_depth_stencil(fbl->main_fb, clear_col, clear_depth, clear_stencil);
diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c
index 71a4da9fcab..79d89ab620c 100644
--- a/source/blender/draw/engines/eevee/eevee_shadows.c
+++ b/source/blender/draw/engines/eevee/eevee_shadows.c
@@ -71,8 +71,8 @@ void EEVEE_shadows_init(EEVEE_ViewLayerData *sldata)
if (!sldata->lights) {
sldata->lights = MEM_callocN(sizeof(EEVEE_LightsInfo), "EEVEE_LightsInfo");
- sldata->light_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_Light) * MAX_LIGHT, NULL);
- sldata->shadow_ubo = DRW_uniformbuffer_create(shadow_ubo_size, NULL);
+ sldata->light_ubo = GPU_uniformbuf_create_ex(sizeof(EEVEE_Light) * MAX_LIGHT, NULL, "evLight");
+ sldata->shadow_ubo = GPU_uniformbuf_create_ex(shadow_ubo_size, NULL, "evShadow");
for (int i = 0; i < 2; i++) {
sldata->shcasters_buffers[i].bbox = MEM_callocN(
@@ -338,7 +338,7 @@ void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView
if (any_visible) {
sldata->common_data.ray_type = EEVEE_RAY_SHADOW;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
}
DRW_stats_group_start("Cube Shadow Maps");
@@ -361,11 +361,11 @@ void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView
DRW_view_set_active(view);
- DRW_uniformbuffer_update(sldata->shadow_ubo, &linfo->shadow_data); /* Update all data at once */
+ GPU_uniformbuf_update(sldata->shadow_ubo, &linfo->shadow_data); /* Update all data at once */
if (any_visible) {
sldata->common_data.ray_type = saved_ray_type;
- DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
+ GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
}
}
diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c
index 74fb7ac99b7..5daa6e7c622 100644
--- a/source/blender/draw/engines/eevee/eevee_subsurface.c
+++ b/source/blender/draw/engines/eevee/eevee_subsurface.c
@@ -212,7 +212,7 @@ void EEVEE_subsurface_add_pass(EEVEE_ViewLayerData *sldata,
GPUTexture **depth_src = GPU_depth_blitting_workaround() ? &effects->sss_stencil : &dtxl->depth;
struct GPUTexture *sss_tex_profile = NULL;
- struct GPUUniformBuffer *sss_profile = GPU_material_sss_profile_get(
+ struct GPUUniformBuf *sss_profile = GPU_material_sss_profile_get(
gpumat, stl->effects->sss_sample_count, &sss_tex_profile);
if (!sss_profile) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
index 51152475a06..7faf426c4e0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
@@ -30,7 +30,7 @@
#include "BLI_math_color.h"
#include "BLI_memblock.h"
-#include "GPU_uniformbuffer.h"
+#include "GPU_uniform_buffer.h"
#include "IMB_imbuf_types.h"
@@ -46,7 +46,7 @@ static GPENCIL_MaterialPool *gpencil_material_pool_add(GPENCIL_PrivateData *pd)
matpool->next = NULL;
matpool->used_count = 0;
if (matpool->ubo == NULL) {
- matpool->ubo = GPU_uniformbuffer_create(sizeof(matpool->mat_data), NULL, NULL);
+ matpool->ubo = GPU_uniformbuf_create(sizeof(matpool->mat_data));
}
pd->last_material_pool = matpool;
return matpool;
@@ -301,7 +301,7 @@ void gpencil_material_resources_get(GPENCIL_MaterialPool *first_pool,
int mat_id,
GPUTexture **r_tex_stroke,
GPUTexture **r_tex_fill,
- GPUUniformBuffer **r_ubo_mat)
+ GPUUniformBuf **r_ubo_mat)
{
GPENCIL_MaterialPool *matpool = first_pool;
int pool_id = mat_id / GP_MATERIAL_BUFFER_LEN;
@@ -331,7 +331,7 @@ GPENCIL_LightPool *gpencil_light_pool_add(GPENCIL_PrivateData *pd)
/* Tag light list end. */
lightpool->light_data[0].color[0] = -1.0;
if (lightpool->ubo == NULL) {
- lightpool->ubo = GPU_uniformbuffer_create(sizeof(lightpool->light_data), NULL, NULL);
+ lightpool->ubo = GPU_uniformbuf_create(sizeof(lightpool->light_data));
}
pd->last_light_pool = lightpool;
return lightpool;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 015e631dc14..491ddfbcc94 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -42,7 +42,7 @@
#include "DNA_view3d_types.h"
#include "GPU_texture.h"
-#include "GPU_uniformbuffer.h"
+#include "GPU_uniform_buffer.h"
#include "gpencil_engine.h"
@@ -345,8 +345,8 @@ typedef struct gpIterPopulateData {
GPENCIL_MaterialPool *matpool;
DRWShadingGroup *grp;
/* Last material UBO bound. Used to avoid uneeded buffer binding. */
- GPUUniformBuffer *ubo_mat;
- GPUUniformBuffer *ubo_lights;
+ GPUUniformBuf *ubo_mat;
+ GPUUniformBuf *ubo_lights;
/* Last texture bound. */
GPUTexture *tex_fill;
GPUTexture *tex_stroke;
@@ -501,7 +501,7 @@ static void gpencil_stroke_cache_populate(bGPDlayer *gpl,
return;
}
- GPUUniformBuffer *ubo_mat;
+ GPUUniformBuf *ubo_mat;
GPUTexture *tex_stroke, *tex_fill;
gpencil_material_resources_get(
iter->matpool, iter->mat_ofs + gps->mat_nr, &tex_stroke, &tex_fill, &ubo_mat);
@@ -654,13 +654,13 @@ void GPENCIL_cache_finish(void *ved)
BLI_memblock_iternew(pd->gp_material_pool, &iter);
GPENCIL_MaterialPool *pool;
while ((pool = (GPENCIL_MaterialPool *)BLI_memblock_iterstep(&iter))) {
- GPU_uniformbuffer_update(pool->ubo, pool->mat_data);
+ GPU_uniformbuf_update(pool->ubo, pool->mat_data);
}
BLI_memblock_iternew(pd->gp_light_pool, &iter);
GPENCIL_LightPool *lpool;
while ((lpool = (GPENCIL_LightPool *)BLI_memblock_iterstep(&iter))) {
- GPU_uniformbuffer_update(lpool->ubo, lpool->light_data);
+ GPU_uniformbuf_update(lpool->ubo, lpool->light_data);
}
/* Sort object by decreasing Z to avoid most of alpha ordering issues. */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index a406df530fc..34d4488d066 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -108,7 +108,7 @@ typedef struct GPENCIL_MaterialPool {
/* GPU representatin of materials. */
gpMaterial mat_data[GP_MATERIAL_BUFFER_LEN];
/* Matching ubo. */
- struct GPUUniformBuffer *ubo;
+ struct GPUUniformBuf *ubo;
/* Texture per material. NULL means none. */
struct GPUTexture *tex_fill[GP_MATERIAL_BUFFER_LEN];
struct GPUTexture *tex_stroke[GP_MATERIAL_BUFFER_LEN];
@@ -120,7 +120,7 @@ typedef struct GPENCIL_LightPool {
/* GPU representatin of materials. */
gpLight light_data[GPENCIL_LIGHT_BUFFER_LEN];
/* Matching ubo. */
- struct GPUUniformBuffer *ubo;
+ struct GPUUniformBuf *ubo;
/* Number of light in the pool. */
int light_used;
} GPENCIL_LightPool;
@@ -384,7 +384,7 @@ void gpencil_material_resources_get(GPENCIL_MaterialPool *first_pool,
int mat_id,
struct GPUTexture **r_tex_stroke,
struct GPUTexture **r_tex_fill,
- struct GPUUniformBuffer **r_ubo_mat);
+ struct GPUUniformBuf **r_ubo_mat);
void gpencil_light_ambient_add(GPENCIL_LightPool *lightpool, const float color[3]);
void gpencil_light_pool_populate(GPENCIL_LightPool *matpool, Object *ob);
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index 0d7f4ee660b..b6cfc019b8d 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -32,24 +32,24 @@
#include "UI_resources.h"
-#include "GPU_uniformbuffer.h"
+#include "GPU_uniform_buffer.h"
/* -------------------------------------------------------------------- */
/** \name World Data
* \{ */
-GPUUniformBuffer *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd)
+GPUUniformBuf *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd)
{
- struct GPUUniformBuffer **ubo = BLI_memblock_alloc(wpd->material_ubo);
+ struct GPUUniformBuf **ubo = BLI_memblock_alloc(wpd->material_ubo);
if (*ubo == NULL) {
- *ubo = GPU_uniformbuffer_create(sizeof(WORKBENCH_UBO_Material) * MAX_MATERIAL, NULL, NULL);
+ *ubo = GPU_uniformbuf_create(sizeof(WORKBENCH_UBO_Material) * MAX_MATERIAL);
}
return *ubo;
}
static void workbench_ubo_free(void *elem)
{
- GPUUniformBuffer **ubo = elem;
+ GPUUniformBuf **ubo = elem;
DRW_UBO_FREE_SAFE(*ubo);
}
@@ -78,7 +78,7 @@ static WORKBENCH_ViewLayerData *workbench_view_layer_data_ensure_ex(struct ViewL
size_t matbuf_size = sizeof(WORKBENCH_UBO_Material) * MAX_MATERIAL;
(*vldata)->material_ubo_data = BLI_memblock_create_ex(matbuf_size, matbuf_size * 2);
(*vldata)->material_ubo = BLI_memblock_create_ex(sizeof(void *), sizeof(void *) * 8);
- (*vldata)->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), NULL);
+ (*vldata)->world_ubo = GPU_uniformbuf_create_ex(sizeof(WORKBENCH_UBO_World), NULL, "wb_World");
}
return *vldata;
@@ -275,7 +275,7 @@ void workbench_update_world_ubo(WORKBENCH_PrivateData *wpd)
workbench_shadow_data_update(wpd, &wd);
workbench_cavity_data_update(wpd, &wd);
- DRW_uniformbuffer_update(wpd->world_ubo, &wd);
+ GPU_uniformbuf_update(wpd->world_ubo, &wd);
}
void workbench_update_material_ubos(WORKBENCH_PrivateData *UNUSED(wpd))
@@ -288,9 +288,9 @@ void workbench_update_material_ubos(WORKBENCH_PrivateData *UNUSED(wpd))
BLI_memblock_iternew(vldata->material_ubo_data, &iter_data);
WORKBENCH_UBO_Material *matchunk;
while ((matchunk = BLI_memblock_iterstep(&iter_data))) {
- GPUUniformBuffer **ubo = BLI_memblock_iterstep(&iter);
+ GPUUniformBuf **ubo = BLI_memblock_iterstep(&iter);
BLI_assert(*ubo != NULL);
- GPU_uniformbuffer_update(*ubo, matchunk);
+ GPU_uniformbuf_update(*ubo, matchunk);
}
BLI_memblock_clear(vldata->material_ubo, workbench_ubo_free);
diff --git a/source/blender/draw/engines/workbench/workbench_effect_cavity.c b/source/blender/draw/engines/workbench/workbench_effect_cavity.c
index 4a8db65c02e..c9ac6660445 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_cavity.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_cavity.c
@@ -139,8 +139,8 @@ void workbench_cavity_samples_ubo_ensure(WORKBENCH_PrivateData *wpd)
float *samples = create_disk_samples(cavity_sample_count_single_iteration, max_iter_count);
wpd->vldata->cavity_jitter_tx = create_jitter_texture(cavity_sample_count);
/* NOTE: Uniform buffer needs to always be filled to be valid. */
- wpd->vldata->cavity_sample_ubo = DRW_uniformbuffer_create(
- sizeof(float[4]) * CAVITY_MAX_SAMPLES, samples);
+ wpd->vldata->cavity_sample_ubo = GPU_uniformbuf_create_ex(
+ sizeof(float[4]) * CAVITY_MAX_SAMPLES, samples, "wb_CavitySamples");
wpd->vldata->cavity_sample_count = cavity_sample_count;
MEM_freeN(samples);
}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c
index 32f6a3392b5..abbca0988d4 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_dof.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c
@@ -74,7 +74,7 @@ static void square_to_circle(float x, float y, float *r, float *T)
#define KERNEL_RAD (3)
#define SAMP_LEN SQUARE_UNSAFE(KERNEL_RAD * 2 + 1)
-static void workbench_dof_setup_samples(struct GPUUniformBuffer **ubo,
+static void workbench_dof_setup_samples(struct GPUUniformBuf **ubo,
float **data,
float bokeh_sides,
float bokeh_rotation,
@@ -84,7 +84,7 @@ static void workbench_dof_setup_samples(struct GPUUniformBuffer **ubo,
*data = MEM_callocN(sizeof(float[4]) * SAMP_LEN, "workbench dof samples");
}
if (*ubo == NULL) {
- *ubo = DRW_uniformbuffer_create(sizeof(float[4]) * SAMP_LEN, NULL);
+ *ubo = GPU_uniformbuf_create(sizeof(float[4]) * SAMP_LEN);
}
float *samp = *data;
@@ -120,7 +120,7 @@ static void workbench_dof_setup_samples(struct GPUUniformBuffer **ubo,
}
}
- DRW_uniformbuffer_update(*ubo, *data);
+ GPU_uniformbuf_update(*ubo, *data);
}
void workbench_dof_engine_init(WORKBENCH_Data *vedata)
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index 538083b4beb..6aa794bda51 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -33,7 +33,7 @@
#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
-#include "GPU_uniformbuffer.h"
+#include "GPU_uniform_buffer.h"
#include "ED_uvedit.h"
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 4a6dadc32fd..12e573a02d0 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -238,7 +238,7 @@ typedef struct WORKBENCH_PrivateData {
/** Copy of context mode for faster access. */
eContextObjectMode ctx_mode;
/** Shorthand for wpd->vldata->world_ubo. */
- struct GPUUniformBuffer *world_ubo;
+ struct GPUUniformBuf *world_ubo;
/** Background color to clear the color buffer with. */
float background_color[4];
@@ -309,7 +309,7 @@ typedef struct WORKBENCH_PrivateData {
struct BLI_memblock *material_ubo_data;
/** Current material chunk being filled by workbench_material_setup_ex(). */
WORKBENCH_UBO_Material *material_ubo_data_curr;
- struct GPUUniformBuffer *material_ubo_curr;
+ struct GPUUniformBuf *material_ubo_curr;
/** Copy of txl->dummy_image_tx for faster access. */
struct GPUTexture *dummy_image_tx;
/** Total number of used material chunk. */
@@ -359,11 +359,11 @@ typedef struct WORKBENCH_ObjectData {
typedef struct WORKBENCH_ViewLayerData {
/** Depth of field sample location array.*/
- struct GPUUniformBuffer *dof_sample_ubo;
+ struct GPUUniformBuf *dof_sample_ubo;
/** All constant data used for a render loop.*/
- struct GPUUniformBuffer *world_ubo;
+ struct GPUUniformBuf *world_ubo;
/** Cavity sample location array.*/
- struct GPUUniformBuffer *cavity_sample_ubo;
+ struct GPUUniformBuf *cavity_sample_ubo;
/** Blue noise texture used to randomize the sampling of some effects.*/
struct GPUTexture *cavity_jitter_tx;
/** Materials ubos allocated in a memblock for easy bookeeping. */
@@ -490,7 +490,7 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
void workbench_private_data_init(WORKBENCH_PrivateData *wpd);
void workbench_update_world_ubo(WORKBENCH_PrivateData *wpd);
void workbench_update_material_ubos(WORKBENCH_PrivateData *wpd);
-struct GPUUniformBuffer *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd);
+struct GPUUniformBuf *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd);
/* workbench_volume.c */
void workbench_volume_engine_init(WORKBENCH_Data *vedata);
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 63625fae185..697f4f77601 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -48,6 +48,7 @@
#include "GPU_primitive.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
+#include "GPU_uniform_buffer.h"
#include "draw_cache.h"
#include "draw_common.h"
@@ -67,7 +68,7 @@ struct GPUFrameBuffer;
struct GPUMaterial;
struct GPUShader;
struct GPUTexture;
-struct GPUUniformBuffer;
+struct GPUUniformBuf;
struct Object;
struct ParticleSystem;
struct RenderEngineType;
@@ -184,14 +185,10 @@ void DRW_texture_free(struct GPUTexture *tex);
} \
} while (0)
-/* UBOs */
-struct GPUUniformBuffer *DRW_uniformbuffer_create(int size, const void *data);
-void DRW_uniformbuffer_update(struct GPUUniformBuffer *ubo, const void *data);
-void DRW_uniformbuffer_free(struct GPUUniformBuffer *ubo);
#define DRW_UBO_FREE_SAFE(ubo) \
do { \
if (ubo != NULL) { \
- DRW_uniformbuffer_free(ubo); \
+ GPU_uniformbuf_free(ubo); \
ubo = NULL; \
} \
} while (0)
@@ -516,10 +513,10 @@ void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup,
struct GPUTexture **tex);
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup,
const char *name,
- const struct GPUUniformBuffer *ubo);
+ const struct GPUUniformBuf *ubo);
void DRW_shgroup_uniform_block_ref(DRWShadingGroup *shgroup,
const char *name,
- struct GPUUniformBuffer **ubo);
+ struct GPUUniformBuf **ubo);
void DRW_shgroup_uniform_float(DRWShadingGroup *shgroup,
const char *name,
const float *value,
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index aac9af088de..f80b5bd71fd 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -214,10 +214,11 @@ void DRW_globals_update(void)
}
if (G_draw.block_ubo == NULL) {
- G_draw.block_ubo = DRW_uniformbuffer_create(sizeof(GlobalsUboStorage), gb);
+ G_draw.block_ubo = GPU_uniformbuf_create_ex(
+ sizeof(GlobalsUboStorage), gb, "GlobalsUboStorage");
}
- DRW_uniformbuffer_update(G_draw.block_ubo, gb);
+ GPU_uniformbuf_update(G_draw.block_ubo, gb);
if (!G_draw.ramp) {
ColorBand ramp = {0};
diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h
index d6402127e5e..645848e7fe0 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -205,11 +205,11 @@ struct DRW_Global {
* Not needed for constant color. */
GlobalsUboStorage block;
/** Define "globalsBlock" uniform for 'block'. */
- struct GPUUniformBuffer *block_ubo;
+ struct GPUUniformBuf *block_ubo;
struct GPUTexture *ramp;
struct GPUTexture *weight_ramp;
- struct GPUUniformBuffer *view_ubo;
+ struct GPUUniformBuf *view_ubo;
};
extern struct DRW_Global G_draw;
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index b515a83959e..5f3e981c92b 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -69,7 +69,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
-#include "GPU_uniformbuffer.h"
+#include "GPU_uniform_buffer.h"
#include "GPU_viewport.h"
#include "IMB_colormanagement.h"
@@ -600,7 +600,7 @@ static void drw_viewport_var_init(void)
}
if (G_draw.view_ubo == NULL) {
- G_draw.view_ubo = DRW_uniformbuffer_create(sizeof(DRWViewUboStorage), NULL);
+ G_draw.view_ubo = GPU_uniformbuf_create_ex(sizeof(DRWViewUboStorage), NULL, "G_draw.view_ubo");
}
if (DST.draw_list == NULL) {
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index d15a55e7bef..c0bcb0e679f 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -38,7 +38,7 @@
#include "GPU_drawlist.h"
#include "GPU_framebuffer.h"
#include "GPU_shader.h"
-#include "GPU_uniformbuffer.h"
+#include "GPU_uniform_buffer.h"
#include "GPU_viewport.h"
#include "draw_instance_data.h"
@@ -308,8 +308,8 @@ struct DRWUniform {
};
/* DRW_UNIFORM_BLOCK */
union {
- GPUUniformBuffer *block;
- GPUUniformBuffer **block_ref;
+ GPUUniformBuf *block;
+ GPUUniformBuf **block_ref;
};
/* DRW_UNIFORM_FLOAT_COPY */
float fvalue[4];
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index c12b4a96488..afea820b057 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -48,6 +48,7 @@
#include "GPU_buffers.h"
#include "GPU_material.h"
+#include "GPU_uniform_buffer.h"
#include "intern/gpu_codegen.h"
@@ -85,27 +86,12 @@ static void draw_call_sort(DRWCommand *array, DRWCommand *array_tmp, int array_l
memcpy(array, array_tmp, sizeof(*array) * array_len);
}
-GPUUniformBuffer *DRW_uniformbuffer_create(int size, const void *data)
-{
- return GPU_uniformbuffer_create(size, data, NULL);
-}
-
-void DRW_uniformbuffer_update(GPUUniformBuffer *ubo, const void *data)
-{
- GPU_uniformbuffer_update(ubo, data);
-}
-
-void DRW_uniformbuffer_free(GPUUniformBuffer *ubo)
-{
- GPU_uniformbuffer_free(ubo);
-}
-
void drw_resource_buffer_finish(ViewportMemoryPool *vmempool)
{
int chunk_id = DRW_handle_chunk_get(&DST.resource_handle);
int elem_id = DRW_handle_id_get(&DST.resource_handle);
int ubo_len = 1 + chunk_id - ((elem_id == 0) ? 1 : 0);
- size_t list_size = sizeof(GPUUniformBuffer *) * ubo_len;
+ size_t list_size = sizeof(GPUUniformBuf *) * ubo_len;
/* TODO find a better system. currently a lot of obinfos UBO are going to be unused
* if not rendering with Eevee. */
@@ -118,8 +104,8 @@ void drw_resource_buffer_finish(ViewportMemoryPool *vmempool)
/* Remove unnecessary buffers */
for (int i = ubo_len; i < vmempool->ubo_len; i++) {
- GPU_uniformbuffer_free(vmempool->matrices_ubo[i]);
- GPU_uniformbuffer_free(vmempool->obinfos_ubo[i]);
+ GPU_uniformbuf_free(vmempool->matrices_ubo[i]);
+ GPU_uniformbuf_free(vmempool->obinfos_ubo[i]);
}
if (ubo_len != vmempool->ubo_len) {
@@ -133,15 +119,13 @@ void drw_resource_buffer_finish(ViewportMemoryPool *vmempool)
void *data_obmat = BLI_memblock_elem_get(vmempool->obmats, i, 0);
void *data_infos = BLI_memblock_elem_get(vmempool->obinfos, i, 0);
if (vmempool->matrices_ubo[i] == NULL) {
- vmempool->matrices_ubo[i] = GPU_uniformbuffer_create(
- sizeof(DRWObjectMatrix) * DRW_RESOURCE_CHUNK_LEN, data_obmat, NULL);
- vmempool->obinfos_ubo[i] = GPU_uniformbuffer_create(
- sizeof(DRWObjectInfos) * DRW_RESOURCE_CHUNK_LEN, data_infos, NULL);
- }
- else {
- GPU_uniformbuffer_update(vmempool->matrices_ubo[i], data_obmat);
- GPU_uniformbuffer_update(vmempool->obinfos_ubo[i], data_infos);
+ vmempool->matrices_ubo[i] = GPU_uniformbuf_create(sizeof(DRWObjectMatrix) *
+ DRW_RESOURCE_CHUNK_LEN);
+ vmempool->obinfos_ubo[i] = GPU_uniformbuf_create(sizeof(DRWObjectInfos) *
+ DRW_RESOURCE_CHUNK_LEN);
}
+ GPU_uniformbuf_update(vmempool->matrices_ubo[i], data_obmat);
+ GPU_uniformbuf_update(vmempool->obinfos_ubo[i], data_infos);
}
/* Aligned alloc to avoid unaligned memcpy. */
@@ -210,10 +194,10 @@ static void drw_shgroup_uniform_create_ex(DRWShadingGroup *shgroup,
memcpy(uni->fvalue, value, sizeof(float) * length);
break;
case DRW_UNIFORM_BLOCK:
- uni->block = (GPUUniformBuffer *)value;
+ uni->block = (GPUUniformBuf *)value;
break;
case DRW_UNIFORM_BLOCK_REF:
- uni->block_ref = (GPUUniformBuffer **)value;
+ uni->block_ref = (GPUUniformBuf **)value;
break;
case DRW_UNIFORM_TEXTURE:
uni->texture = (GPUTexture *)value;
@@ -279,16 +263,14 @@ void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name,
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup,
const char *name,
- const GPUUniformBuffer *ubo)
+ const GPUUniformBuf *ubo)
{
BLI_assert(ubo != NULL);
int loc = GPU_shader_get_uniform_block_binding(shgroup->shader, name);
drw_shgroup_uniform_create_ex(shgroup, loc, DRW_UNIFORM_BLOCK, ubo, 0, 0, 1);
}
-void DRW_shgroup_uniform_block_ref(DRWShadingGroup *shgroup,
- const char *name,
- GPUUniformBuffer **ubo)
+void DRW_shgroup_uniform_block_ref(DRWShadingGroup *shgroup, const char *name, GPUUniformBuf **ubo)
{
BLI_assert(ubo != NULL);
int loc = GPU_shader_get_uniform_block_binding(shgroup->shader, name);
@@ -1327,7 +1309,7 @@ void DRW_shgroup_add_material_resources(DRWShadingGroup *grp, struct GPUMaterial
}
}
- GPUUniformBuffer *ubo = GPU_material_uniform_buffer_get(material);
+ GPUUniformBuf *ubo = GPU_material_uniform_buffer_get(material);
if (ubo != NULL) {
DRW_shgroup_uniform_block(grp, GPU_UBO_BLOCK_NAME, ubo);
}
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index 9902d3b0aeb..31d7cbaad40 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -296,7 +296,7 @@ void DRW_state_reset(void)
DRW_state_reset_ex(DRW_STATE_DEFAULT);
GPU_texture_unbind_all();
- GPU_uniformbuffer_unbind_all();
+ GPU_uniformbuf_unbind_all();
/* Should stay constant during the whole rendering. */
GPU_point_size(5);
@@ -648,18 +648,18 @@ static void draw_update_uniforms(DRWShadingGroup *shgroup,
GPU_texture_bind_ex(*uni->texture_ref, uni->sampler_state, uni->location, false);
break;
case DRW_UNIFORM_BLOCK:
- GPU_uniformbuffer_bind(uni->block, uni->location);
+ GPU_uniformbuf_bind(uni->block, uni->location);
break;
case DRW_UNIFORM_BLOCK_REF:
- GPU_uniformbuffer_bind(*uni->block_ref, uni->location);
+ GPU_uniformbuf_bind(*uni->block_ref, uni->location);
break;
case DRW_UNIFORM_BLOCK_OBMATS:
state->obmats_loc = uni->location;
- GPU_uniformbuffer_bind(DST.vmempool->matrices_ubo[0], uni->location);
+ GPU_uniformbuf_bind(DST.vmempool->matrices_ubo[0], uni->location);
break;
case DRW_UNIFORM_BLOCK_OBINFOS:
state->obinfos_loc = uni->location;
- GPU_uniformbuffer_bind(DST.vmempool->obinfos_ubo[0], uni->location);
+ GPU_uniformbuf_bind(DST.vmempool->obinfos_ubo[0], uni->location);
break;
case DRW_UNIFORM_RESOURCE_CHUNK:
state->chunkid_loc = uni->location;
@@ -769,12 +769,12 @@ static void draw_call_resource_bind(DRWCommandsState *state, const DRWResourceHa
GPU_shader_uniform_int(DST.shader, state->chunkid_loc, chunk);
}
if (state->obmats_loc != -1) {
- GPU_uniformbuffer_unbind(DST.vmempool->matrices_ubo[state->resource_chunk]);
- GPU_uniformbuffer_bind(DST.vmempool->matrices_ubo[chunk], state->obmats_loc);
+ GPU_uniformbuf_unbind(DST.vmempool->matrices_ubo[state->resource_chunk]);
+ GPU_uniformbuf_bind(DST.vmempool->matrices_ubo[chunk], state->obmats_loc);
}
if (state->obinfos_loc != -1) {
- GPU_uniformbuffer_unbind(DST.vmempool->obinfos_ubo[state->resource_chunk]);
- GPU_uniformbuffer_bind(DST.vmempool->obinfos_ubo[chunk], state->obinfos_loc);
+ GPU_uniformbuf_unbind(DST.vmempool->obinfos_ubo[state->resource_chunk]);
+ GPU_uniformbuf_bind(DST.vmempool->obinfos_ubo[chunk], state->obinfos_loc);
}
state->resource_chunk = chunk;
}
@@ -893,10 +893,10 @@ static void draw_call_batching_finish(DRWShadingGroup *shgroup, DRWCommandsState
GPU_front_facing(DST.view_active->is_inverted);
}
if (state->obmats_loc != -1) {
- GPU_uniformbuffer_unbind(DST.vmempool->matrices_ubo[state->resource_chunk]);
+ GPU_uniformbuf_unbind(DST.vmempool->matrices_ubo[state->resource_chunk]);
}
if (state->obinfos_loc != -1) {
- GPU_uniformbuffer_unbind(DST.vmempool->obinfos_ubo[state->resource_chunk]);
+ GPU_uniformbuf_unbind(DST.vmempool->obinfos_ubo[state->resource_chunk]);
}
}
@@ -926,7 +926,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
/* Unbinding can be costly. Skip in normal condition. */
if (G.debug & G_DEBUG_GPU) {
GPU_texture_unbind_all();
- GPU_uniformbuffer_unbind_all();
+ GPU_uniformbuf_unbind_all();
}
}
GPU_shader_bind(shgroup->shader);
@@ -1062,7 +1062,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
static void drw_update_view(void)
{
/* TODO(fclem) update a big UBO and only bind ranges here. */
- DRW_uniformbuffer_update(G_draw.view_ubo, &DST.view_active->storage);
+ GPU_uniformbuf_update(G_draw.view_ubo, &DST.view_active->storage);
/* TODO get rid of this. */
DST.view_storage_cpy = DST.view_active->storage;