diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-02-09 01:19:31 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-03-18 22:49:45 +0300 |
commit | 8c93f8c6cc9c7300a150118d8a29f98b1ba7bbdd (patch) | |
tree | ec7aa41774b2df29d5a46bc3fb1b52aaed83f63f /source/blender/draw/intern/draw_manager_data.c | |
parent | bacfd55a0e4ca5a59ee46824c500992a3dddc6b6 (diff) |
DRW: Add support for GPUStorageBuf
Diffstat (limited to 'source/blender/draw/intern/draw_manager_data.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager_data.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 95691a0df68..be45cee8759 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -216,6 +216,8 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup, BLI_assert(arraysize > 0 && arraysize <= 16); BLI_assert(length >= 0 && length <= 16); BLI_assert(!ELEM(type, + DRW_UNIFORM_STORAGE_BLOCK, + DRW_UNIFORM_STORAGE_BLOCK_REF, DRW_UNIFORM_BLOCK, DRW_UNIFORM_BLOCK_REF, DRW_UNIFORM_TEXTURE, @@ -310,6 +312,50 @@ void DRW_shgroup_uniform_block_ref_ex(DRWShadingGroup *shgroup, drw_shgroup_uniform_create_ex(shgroup, loc, DRW_UNIFORM_BLOCK_REF, ubo, 0, 0, 1); } +void DRW_shgroup_storage_block_ex(DRWShadingGroup *shgroup, + const char *name, + const GPUStorageBuf *ssbo DRW_DEBUG_FILE_LINE_ARGS) +{ + BLI_assert(ssbo != NULL); + /* TODO(@fclem): Fix naming inconsistency. */ + int loc = GPU_shader_get_ssbo(shgroup->shader, name); + if (loc == -1) { +#ifdef DRW_UNUSED_RESOURCE_TRACKING + printf("%s:%d: Unable to locate binding of shader storage buffer object: %s.\n", + file, + line, + name); +#else + /* TODO(@fclem): Would be good to have, but eevee has too much of this for the moment. */ + // BLI_assert_msg(0, "Unable to locate binding of shader storage buffer objects."); +#endif + return; + } + drw_shgroup_uniform_create_ex(shgroup, loc, DRW_UNIFORM_STORAGE_BLOCK, ssbo, 0, 0, 1); +} + +void DRW_shgroup_storage_block_ref_ex(DRWShadingGroup *shgroup, + const char *name, + GPUStorageBuf **ssbo DRW_DEBUG_FILE_LINE_ARGS) +{ + BLI_assert(ssbo != NULL); + /* TODO(@fclem): Fix naming inconsistency. */ + int loc = GPU_shader_get_ssbo(shgroup->shader, name); + if (loc == -1) { +#ifdef DRW_UNUSED_RESOURCE_TRACKING + printf("%s:%d: Unable to locate binding of shader storage buffer object: %s.\n", + file, + line, + name); +#else + /* TODO(@fclem): Would be good to have, but eevee has too much of this for the moment. */ + // BLI_assert_msg(0, "Unable to locate binding of shader storage buffer objects."); +#endif + return; + } + drw_shgroup_uniform_create_ex(shgroup, loc, DRW_UNIFORM_STORAGE_BLOCK_REF, ssbo, 0, 0, 1); +} + void DRW_shgroup_uniform_bool(DRWShadingGroup *shgroup, const char *name, const int *value, |