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/engines/workbench
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/engines/workbench')
-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
5 files changed, 21 insertions, 21 deletions
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);