summaryrefslogtreecommitdiffstats
path: root/scene/main/shader_globals_override.cpp
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-07-05 22:40:29 -0300
committerreduz <reduzio@gmail.com>2021-07-07 10:57:56 -0300
commitd41e3f9aebf294ccb6238795b8cfb3c815ea3a93 (patch)
tree01fd4469b3de3f20e2d96c224c764ec0d2931d32 /scene/main/shader_globals_override.cpp
parent8cd1b59ea78f5145eae1762e2b1311c1a1b92cbc (diff)
downloadredot-engine-d41e3f9aebf294ccb6238795b8cfb3c815ea3a93.tar.gz
Fix Command Queue Crash
* No longer allow sending an object (texture) to the server as material parameter * Keep a parameter cache locally in ShaderMaterial
Diffstat (limited to 'scene/main/shader_globals_override.cpp')
-rw-r--r--scene/main/shader_globals_override.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index 3d65c12cb7..d22a6b2875 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -63,7 +63,12 @@ bool ShaderGlobalsOverride::_set(const StringName &p_name, const Variant &p_valu
if (o) {
o->override = p_value;
if (active) {
- RS::get_singleton()->global_variable_set_override(*r, p_value);
+ if (o->override.get_type() == Variant::OBJECT) {
+ RID tex_rid = p_value;
+ RS::get_singleton()->global_variable_set_override(*r, tex_rid);
+ } else {
+ RS::get_singleton()->global_variable_set_override(*r, p_value);
+ }
}
o->in_use = p_value.get_type() != Variant::NIL;
return true;
@@ -228,7 +233,12 @@ void ShaderGlobalsOverride::_activate() {
while ((K = overrides.next(K))) {
Override *o = overrides.getptr(*K);
if (o->in_use && o->override.get_type() != Variant::NIL) {
- RS::get_singleton()->global_variable_set_override(*K, o->override);
+ if (o->override.get_type() == Variant::OBJECT) {
+ RID tex_rid = o->override;
+ RS::get_singleton()->global_variable_set_override(*K, tex_rid);
+ } else {
+ RS::get_singleton()->global_variable_set_override(*K, o->override);
+ }
}
}