EEVEE-Next: Fix overlap with nodetree UBO

Reserve the slot 0 for nodetree and bind
directly to it in Next engines.
This commit is contained in:
Clément Foucault
2023-06-29 21:10:08 +02:00
parent 57852a6688
commit ff62f402da
5 changed files with 15 additions and 10 deletions
@@ -120,15 +120,16 @@
#define GBUF_COLOR_SLOT 4
/* Uniform Buffers. */
#define CAMERA_BUF_SLOT 0
#define RBUFS_BUF_SLOT 1
/* Slot 0 is GPU_NODE_TREE_UBO_SLOT. */
#define CAMERA_BUF_SLOT 1
#define RBUFS_BUF_SLOT 2
/* Only during surface shading (forward and deferred eval). */
#define HIZ_BUF_SLOT 2
#define IRRADIANCE_GRID_BUF_SLOT 3
#define HIZ_BUF_SLOT 3
#define IRRADIANCE_GRID_BUF_SLOT 4
/* Only during pre-pass. */
#define VELOCITY_CAMERA_PREV_BUF 2
#define VELOCITY_CAMERA_CURR_BUF 3
#define VELOCITY_CAMERA_NEXT_BUF 4
#define VELOCITY_CAMERA_PREV_BUF 3
#define VELOCITY_CAMERA_CURR_BUF 4
#define VELOCITY_CAMERA_NEXT_BUF 5
/* Storage Buffers. */
#define LIGHT_CULL_BUF_SLOT 0
@@ -208,7 +208,10 @@ GPU_SHADER_CREATE_INFO(eevee_volume_deferred)
#ifdef DEBUG
/* Stub functions defined by the material evaluation. */
GPU_SHADER_CREATE_INFO(eevee_material_stub).define("EEVEE_MATERIAL_STUBS");
GPU_SHADER_CREATE_INFO(eevee_material_stub)
.define("EEVEE_MATERIAL_STUBS")
/* Dummy uniform buffer to detect overlap with material node-tree. */
.uniform_buf(0, "int", "node_tree");
# define EEVEE_MAT_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
+1 -1
View File
@@ -857,7 +857,7 @@ template<class T> inline void PassBase<T>::material_set(Manager &manager, GPUMat
GPUUniformBuf *ubo = GPU_material_uniform_buffer_get(material);
if (ubo != nullptr) {
bind_ubo(GPU_UBO_BLOCK_NAME, ubo);
bind_ubo(GPU_NODE_TREE_UBO_SLOT, ubo);
}
}
+1
View File
@@ -49,6 +49,7 @@ void GPU_uniformbuf_clear_to_zero(GPUUniformBuf *ubo);
#define GPU_UBO_BLOCK_NAME "node_tree"
#define GPU_ATTRIBUTE_UBO_BLOCK_NAME "unf_attrs"
#define GPU_LAYER_ATTRIBUTE_UBO_BLOCK_NAME "drw_layer_attrs"
#define GPU_NODE_TREE_UBO_SLOT 0
#ifdef __cplusplus
}
+1 -1
View File
@@ -459,7 +459,7 @@ void GPUCodegen::generate_resources()
}
ss << "};\n\n";
info.uniform_buf(1, "NodeTree", GPU_UBO_BLOCK_NAME, Frequency::BATCH);
info.uniform_buf(GPU_NODE_TREE_UBO_SLOT, "NodeTree", GPU_UBO_BLOCK_NAME, Frequency::BATCH);
}
if (!BLI_listbase_is_empty(&graph.uniform_attrs.list)) {