diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-12 19:42:35 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-12 19:42:35 +0400 |
commit | 7503a7edfba9496521baefd70fe6cbcbfce5127b (patch) | |
tree | 9800ef871191ce52396048681d393d62c0c30cc5 /intern/cycles/kernel | |
parent | 85818c8209bc6df4f60c7e86173521f5fa1a5a96 (diff) |
Cycles: replace surface/volume sockets in output nodes with a single shader socket,
decided it's better to render objects as either surface or volume.
This may break the volume rendering patch, but shaders with volume closures still
get tagged as having volume closures, so it should be fixable without too many
changes.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_shader.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/CMakeLists.txt | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_output_closure.osl (renamed from intern/cycles/kernel/osl/nodes/node_output_surface.osl) | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_output_volume.osl | 25 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_types.h | 3 |
7 files changed, 12 insertions, 40 deletions
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index c1bcbb067b5..7ca7f96d73b 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -482,7 +482,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, #else #ifdef __SVM__ - svm_eval_nodes(kg, sd, SHADER_TYPE_SURFACE, randb, path_flag); + svm_eval_nodes(kg, sd, SHADER_TYPE_CLOSURE, randb, path_flag); #else bsdf_diffuse_setup(sd, &sd->closure); sd->closure.weight = make_float3(0.8f, 0.8f, 0.8f); @@ -500,7 +500,7 @@ __device float3 shader_eval_background(KernelGlobals *kg, ShaderData *sd, int pa #else #ifdef __SVM__ - svm_eval_nodes(kg, sd, SHADER_TYPE_SURFACE, 0.0f, path_flag); + svm_eval_nodes(kg, sd, SHADER_TYPE_CLOSURE, 0.0f, path_flag); #ifdef __MULTI_CLOSURE__ float3 eval = make_float3(0.0f, 0.0f, 0.0f); @@ -562,7 +562,7 @@ __device void shader_eval_volume(KernelGlobals *kg, ShaderData *sd, #ifdef __OSL__ OSLShader::eval_volume(kg, sd, randb, path_flag); #else - svm_eval_nodes(kg, sd, SHADER_TYPE_VOLUME, randb, path_flag); + svm_eval_nodes(kg, sd, SHADER_TYPE_CLOSURE, randb, path_flag); #endif #endif } diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt index 7d37bb09d71..a1e420e8ac1 100644 --- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt +++ b/intern/cycles/kernel/osl/nodes/CMakeLists.txt @@ -32,9 +32,8 @@ set(osl_sources node_musgrave_texture.osl node_blend_weight_texture.osl node_noise_texture.osl + node_output_closure.osl node_output_displacement.osl - node_output_surface.osl - node_output_volume.osl node_sky_texture.osl node_stucci_texture.osl node_texture_coordinate.osl diff --git a/intern/cycles/kernel/osl/nodes/node_output_surface.osl b/intern/cycles/kernel/osl/nodes/node_output_closure.osl index 6efaf91121b..075cf35f60b 100644 --- a/intern/cycles/kernel/osl/nodes/node_output_surface.osl +++ b/intern/cycles/kernel/osl/nodes/node_output_closure.osl @@ -18,8 +18,8 @@ #include "stdosl.h" -surface node_output_surface(closure color Surface = background()) +surface node_output_surface(closure color Closure = background()) { - Ci = Surface; + Ci = Closure; } diff --git a/intern/cycles/kernel/osl/nodes/node_output_volume.osl b/intern/cycles/kernel/osl/nodes/node_output_volume.osl deleted file mode 100644 index 18094242dc7..00000000000 --- a/intern/cycles/kernel/osl/nodes/node_output_volume.osl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2011, Blender Foundation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "stdosl.h" - -volume node_output_volume(closure color Volume = background()) -{ - Ci = Volume; -} - diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 18a8e974492..42e63552063 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -218,8 +218,8 @@ void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int /* execute shader for this point */ int shader = sd->shader & SHADER_MASK; - if(kg->osl.surface_state[shader]) - ctx->execute(OSL::pvt::ShadUseSurface, *(kg->osl.surface_state[shader]), *globals); + if(kg->osl.state[shader]) + ctx->execute(OSL::pvt::ShadUseSurface, *(kg->osl.state[shader]), *globals); /* flatten closure tree */ sd->num_closure = 0; @@ -355,8 +355,8 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int /* execute shader */ int shader = sd->shader & SHADER_MASK; - if(kg->osl.volume_state[shader]) - ctx->execute(OSL::pvt::ShadUseSurface, *(kg->osl.volume_state[shader]), *globals); + if(kg->osl.state[shader]) + ctx->execute(OSL::pvt::ShadUseSurface, *(kg->osl.state[shader]), *globals); /* retrieve resulting closures */ sd->osl_closure.volume_sample_sum = 0.0f; diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h index 62e02f1a01a..4e0ed25baea 100644 --- a/intern/cycles/kernel/svm/svm.h +++ b/intern/cycles/kernel/svm/svm.h @@ -166,8 +166,7 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT switch(node.x) { case NODE_SHADER_JUMP: { - if(type == SHADER_TYPE_SURFACE) offset = node.y; - else if(type == SHADER_TYPE_VOLUME) offset = node.z; + if(type == SHADER_TYPE_CLOSURE) offset = node.y; else if(type == SHADER_TYPE_DISPLACEMENT) offset = node.w; else return; break; diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index baec3d7ac6e..fb52a923b0c 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -257,8 +257,7 @@ typedef enum NodeBlendWeightType { } NodeBlendWeightType; typedef enum ShaderType { - SHADER_TYPE_SURFACE, - SHADER_TYPE_VOLUME, + SHADER_TYPE_CLOSURE, SHADER_TYPE_DISPLACEMENT } ShaderType; |