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:
authorLukas Stockner <lukas.stockner@freenet.de>2022-10-10 02:03:12 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-10-26 11:11:55 +0300
commit7e942b2a1e3d4d72ba90b498a514455452eab94c (patch)
tree80ed0b975415d0efbcba56a0a288f72933b815f0
parente1e9c838899dd1a8f55a5c67b2d5716a6a5b88a6 (diff)
Partially fix T101702: OSL Shaders with boolean inputs crash
OSL (like Cycles) has no internal boolean type, instead an integer input can be flagged to be shown as a boolean in the UI. Cycles reacts to this by creating a boolean socket on the Blender side, but as a result incorrectly called the boolean overload of the set function even though the internal type is an integer. There's another unrelated crash in the GPU viewport shader code that appears to apply to every OSL node that outputs a shader, and the file in T101702 triggers both, so this is only a partial fix for the report.
-rw-r--r--intern/cycles/blender/shader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/intern/cycles/blender/shader.cpp b/intern/cycles/blender/shader.cpp
index 04eb1576330..c8798e23b0c 100644
--- a/intern/cycles/blender/shader.cpp
+++ b/intern/cycles/blender/shader.cpp
@@ -205,7 +205,9 @@ static void set_default_value(ShaderInput *input,
}
case SocketType::INT: {
if (b_sock.type() == BL::NodeSocket::type_BOOLEAN) {
- node->set(socket, get_boolean(b_sock.ptr, "default_value"));
+ /* Make sure to call the int overload of set() since this is an integer socket as far as
+ * Cycles is concerned. */
+ node->set(socket, get_boolean(b_sock.ptr, "default_value") ? 1 : 0);
}
else {
node->set(socket, get_int(b_sock.ptr, "default_value"));