diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-21 00:09:37 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-21 15:16:42 +0300 |
commit | 7edd8a7738481b3d4f0720a173dca2a1853996d6 (patch) | |
tree | 4b507b4535c0fbe84fc25a21ddf2db55476b1b9b /source/blender/draw/engines | |
parent | 4f0a749489af9de9b2ec0b5768d6e10898885a17 (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/engines')
19 files changed, 103 insertions, 102 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); |