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:
-rw-r--r--source/blender/gpu/intern/gpu_shader.cc4
-rw-r--r--source/blender/gpu/intern/gpu_uniform_buffer_private.hh5
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc
index 1c66b43d93e..e108fb4a977 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -558,7 +558,11 @@ void GPU_shader_uniform_4fv_array(GPUShader *sh, const char *name, int len, cons
void GPU_shader_uniform_push_constant(GPUShader *sh, GPUUniformBuf *ubo)
{
+ /* According to the specification all platforms should at least support 128 bytes. We should
+ * support only upto the minimum size as some platforms have set this as their max. */
+ static constexpr size_t MAX_PUSH_CONSTANTS_LEN = 128;
UniformBuf *buf = unwrap(ubo);
+ BLI_assert(buf->size_in_bytes() < MAX_PUSH_CONSTANTS_LEN);
unwrap(sh)->uniform_push_constant(buf);
}
diff --git a/source/blender/gpu/intern/gpu_uniform_buffer_private.hh b/source/blender/gpu/intern/gpu_uniform_buffer_private.hh
index e8fc1343eaf..603af550d28 100644
--- a/source/blender/gpu/intern/gpu_uniform_buffer_private.hh
+++ b/source/blender/gpu/intern/gpu_uniform_buffer_private.hh
@@ -63,6 +63,11 @@ class UniformBuf {
{
data_ = data;
}
+
+ size_t size_in_bytes() const
+ {
+ return size_in_bytes_;
+ }
};
/* Syntactic sugar. */