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:
authorJeroen Bakker <jeroen@blender.org>2021-07-02 17:25:13 +0300
committerJeroen Bakker <jeroen@blender.org>2021-07-02 17:25:13 +0300
commitfd4652d4f621ca71fd2945c8003de764c6e7a800 (patch)
tree4b6e3e587a1c4db502f769ee83090f6616af8b3d
parent2e7ea42377bb91416477290eb0c43244ddc85bf5 (diff)
DrawManager: Add push constants command.
m---------release/datafiles/locale0
m---------release/scripts/addons0
m---------release/scripts/addons_contrib0
-rw-r--r--source/blender/draw/intern/DRW_render.h1
-rw-r--r--source/blender/draw/intern/draw_manager.h6
-rw-r--r--source/blender/draw/intern/draw_manager_data.c22
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c3
m---------source/tools0
8 files changed, 28 insertions, 4 deletions
diff --git a/release/datafiles/locale b/release/datafiles/locale
-Subproject 4833954c0ac85cc407e1d5a153aa11b1d1823ec
+Subproject 78591466c335ab055e11729d8af814ce7ce6edc
diff --git a/release/scripts/addons b/release/scripts/addons
-Subproject f86f25e62217264495d05f116ccb09d575fe984
+Subproject c84f83153900009f1c7743e3b21792ab1a73025
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
-Subproject 5a82baad9f986722104280e8354a4427d8e9eab
+Subproject fd1bed98c9e0a733451168eecc828cce460205d
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 5d5a506c1e7..132b5e6163f 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -445,6 +445,7 @@ void DRW_shgroup_call_compute(DRWShadingGroup *shgroup,
void DRW_shgroup_call_procedural_points(DRWShadingGroup *sh, Object *ob, uint point_count);
void DRW_shgroup_call_procedural_lines(DRWShadingGroup *sh, Object *ob, uint line_count);
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *sh, Object *ob, uint tri_count);
+void DRW_shgroup_call_push_constants(DRWShadingGroup *shgroup, GPUUniformBuf *ubo);
/* Warning: Only use with Shaders that have IN_PLACE_INSTANCES defined. */
void DRW_shgroup_call_instances(DRWShadingGroup *shgroup,
Object *ob,
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index 373b51a67e0..ac301107920 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -192,6 +192,7 @@ typedef enum {
DRW_CMD_COMPUTE = 8,
/* Other Commands */
+ DRW_CMD_PUSH_CONSTANTS = 11,
DRW_CMD_CLEAR = 12,
DRW_CMD_DRWSTATE = 13,
DRW_CMD_STENCIL = 14,
@@ -234,6 +235,10 @@ typedef struct DRWCommandCompute {
int groups_z_len;
} DRWCommandCompute;
+typedef struct DRWCommandPushConstants {
+ GPUUniformBuf *buf;
+} DRWCommandPushConstants;
+
typedef struct DRWCommandDrawProcedural {
GPUBatch *batch;
DRWResourceHandle handle;
@@ -271,6 +276,7 @@ typedef union DRWCommand {
DRWCommandDrawInstanceRange instance_range;
DRWCommandDrawProcedural procedural;
DRWCommandCompute compute;
+ DRWCommandPushConstants push_constants;
DRWCommandSetMutableState state;
DRWCommandSetStencil stencil;
DRWCommandSetSelectID select_id;
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 5eedca4507e..73bce05af12 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -528,10 +528,10 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
drw_call_calc_orco(ob, ob_infos->orcotexfac);
/* Random float value. */
uint random = (DST.dupli_source) ?
- DST.dupli_source->random_id :
- /* TODO(fclem): this is rather costly to do at runtime. Maybe we can
- * put it in ob->runtime and make depsgraph ensure it is up to date. */
- BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
+ DST.dupli_source->random_id :
+ /* TODO(fclem): this is rather costly to do at runtime. Maybe we can
+ * put it in ob->runtime and make depsgraph ensure it is up to date. */
+ BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
ob_infos->ob_random = random * (1.0f / (float)0xFFFFFFFF);
/* Object State. */
ob_infos->ob_flag = 1.0f; /* Required to have a correct sign */
@@ -725,6 +725,12 @@ static void drw_command_compute(DRWShadingGroup *shgroup,
cmd->groups_z_len = groups_z_len;
}
+static void drw_command_push_constants(DRWShadingGroup *shgroup, GPUUniformBuf *ubo)
+{
+ DRWCommandPushConstants *cmd = drw_command_create(shgroup, DRW_CMD_PUSH_CONSTANTS);
+ cmd->buf = ubo;
+}
+
static void drw_command_draw_procedural(DRWShadingGroup *shgroup,
GPUBatch *batch,
DRWResourceHandle handle,
@@ -851,6 +857,14 @@ void DRW_shgroup_call_compute(DRWShadingGroup *shgroup,
drw_command_compute(shgroup, groups_x_len, groups_y_len, groups_z_len);
}
+void DRW_shgroup_call_push_constants(DRWShadingGroup *shgroup, GPUUniformBuf *ubo)
+{
+ BLI_assert(ubo);
+ BLI_assert(GPU_compute_shader_support());
+
+ drw_command_push_constants(shgroup, ubo);
+}
+
static void drw_shgroup_call_procedural_add_ex(DRWShadingGroup *shgroup,
GPUBatch *geom,
Object *ob,
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index f29caebeb84..0dc81f23968 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -1060,6 +1060,9 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
cmd->compute.groups_y_len,
cmd->compute.groups_z_len);
break;
+ case DRW_CMD_PUSH_CONSTANTS:
+ GPU_shader_uniform_push_constant(shgroup->shader, cmd->push_constants.buf);
+ break;
}
}
diff --git a/source/tools b/source/tools
-Subproject 01f51a0e551ab730f0934dc6488613690ac4bf8
+Subproject c8579c5cf43229843df505da9644b5b0b720197