2022-02-11 13:53:21 +01:00
|
|
|
/* SPDX-License-Identifier: Apache-2.0
|
|
|
|
* Copyright 2011-2022 Blender Foundation */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "device/device.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "scene/background.h"
|
|
|
|
#include "scene/colorspace.h"
|
|
|
|
#include "scene/light.h"
|
|
|
|
#include "scene/osl.h"
|
|
|
|
#include "scene/scene.h"
|
|
|
|
#include "scene/shader.h"
|
|
|
|
#include "scene/shader_graph.h"
|
|
|
|
#include "scene/shader_nodes.h"
|
|
|
|
#include "scene/stats.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
#ifdef WITH_OSL
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
# include "kernel/osl/globals.h"
|
|
|
|
# include "kernel/osl/services.h"
|
|
|
|
# include "kernel/osl/shader.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
# include "util/aligned_malloc.h"
|
|
|
|
# include "util/foreach.h"
|
|
|
|
# include "util/log.h"
|
|
|
|
# include "util/md5.h"
|
|
|
|
# include "util/path.h"
|
|
|
|
# include "util/progress.h"
|
|
|
|
# include "util/projection.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
#ifdef WITH_OSL
|
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
/* Shared Texture and Shading System */
|
2013-04-04 23:48:07 +00:00
|
|
|
|
|
|
|
OSL::TextureSystem *OSLShaderManager::ts_shared = NULL;
|
|
|
|
int OSLShaderManager::ts_shared_users = 0;
|
|
|
|
thread_mutex OSLShaderManager::ts_shared_mutex;
|
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
OSL::ShadingSystem *OSLShaderManager::ss_shared = NULL;
|
|
|
|
OSLRenderServices *OSLShaderManager::services_shared = NULL;
|
|
|
|
int OSLShaderManager::ss_shared_users = 0;
|
|
|
|
thread_mutex OSLShaderManager::ss_shared_mutex;
|
|
|
|
thread_mutex OSLShaderManager::ss_mutex;
|
2019-05-14 12:13:43 +02:00
|
|
|
int OSLCompiler::texture_shared_unique_id = 0;
|
2013-04-22 14:27:12 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Shader Manager */
|
|
|
|
|
|
|
|
OSLShaderManager::OSLShaderManager()
|
|
|
|
{
|
2012-11-03 14:32:35 +00:00
|
|
|
texture_system_init();
|
2013-02-14 16:11:47 +00:00
|
|
|
shading_system_init();
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OSLShaderManager::~OSLShaderManager()
|
|
|
|
{
|
2013-04-22 14:27:12 +00:00
|
|
|
shading_system_free();
|
|
|
|
texture_system_free();
|
2019-03-13 18:26:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSLShaderManager::free_memory()
|
|
|
|
{
|
2018-08-27 19:37:55 -06:00
|
|
|
# ifdef OSL_HAS_BLENDER_CLEANUP_FIX
|
2020-10-09 12:12:29 +11:00
|
|
|
/* There is a problem with LLVM+OSL: The order global destructors across
|
2018-08-27 19:37:55 -06:00
|
|
|
* different compilation units run cannot be guaranteed, on windows this means
|
2020-10-09 12:12:29 +11:00
|
|
|
* that the LLVM destructors run before the osl destructors, causing a crash
|
2018-08-27 19:37:55 -06:00
|
|
|
* when the process exits. the OSL in svn has a special cleanup hack to
|
|
|
|
* sidestep this behavior */
|
|
|
|
OSL::pvt::LLVM_Util::Cleanup();
|
|
|
|
# endif
|
2013-02-14 16:11:47 +00:00
|
|
|
}
|
|
|
|
|
2015-03-27 15:47:55 +05:00
|
|
|
void OSLShaderManager::reset(Scene * /*scene*/)
|
2013-02-14 16:11:47 +00:00
|
|
|
{
|
2013-04-22 14:27:12 +00:00
|
|
|
shading_system_free();
|
2013-02-14 16:11:47 +00:00
|
|
|
shading_system_init();
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 11:55:35 +02:00
|
|
|
uint64_t OSLShaderManager::get_attribute_id(ustring name)
|
|
|
|
{
|
|
|
|
return name.hash();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t OSLShaderManager::get_attribute_id(AttributeStandard std)
|
|
|
|
{
|
|
|
|
/* if standard attribute, use geom: name convention */
|
|
|
|
ustring stdname(string("geom:") + string(Attribute::standard_name(std)));
|
|
|
|
return stdname.hash();
|
|
|
|
}
|
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
void OSLShaderManager::device_update_specific(Device *device,
|
|
|
|
DeviceScene *dscene,
|
|
|
|
Scene *scene,
|
|
|
|
Progress &progress)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2021-10-21 14:52:34 +02:00
|
|
|
if (!need_update())
|
2011-04-27 11:58:34 +00:00
|
|
|
return;
|
|
|
|
|
2020-10-01 23:16:01 +02:00
|
|
|
scoped_callback_timer timer([scene](double time) {
|
|
|
|
if (scene->update_stats) {
|
2021-10-21 14:52:34 +02:00
|
|
|
scene->update_stats->osl.times.add_entry({"device_update", time});
|
2020-10-01 23:16:01 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-06-16 19:39:13 +02:00
|
|
|
VLOG_INFO << "Total " << scene->shaders.size() << " shaders.";
|
2016-04-22 10:55:26 +02:00
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
device_free(device, dscene, scene);
|
|
|
|
|
2020-03-11 17:49:00 +01:00
|
|
|
/* set texture system */
|
|
|
|
scene->image_manager->set_osl_texture_system((void *)ts);
|
2012-10-30 11:51:17 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* create shaders */
|
2021-10-21 14:52:34 +02:00
|
|
|
OSLGlobals *og = (OSLGlobals *)device->get_cpu_osl_memory();
|
2020-01-20 13:42:26 +01:00
|
|
|
Shader *background_shader = scene->background->get_shader(scene);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
foreach (Shader *shader, scene->shaders) {
|
2011-04-27 11:58:34 +00:00
|
|
|
assert(shader->graph);
|
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
if (progress.get_cancel())
|
2011-04-27 11:58:34 +00:00
|
|
|
return;
|
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
/* we can only compile one shader at the time as the OSL ShadingSytem
|
2013-04-22 14:27:12 +00:00
|
|
|
* has a single state, but we put the lock here so different renders can
|
|
|
|
* compile shaders alternating */
|
|
|
|
thread_scoped_lock lock(ss_mutex);
|
|
|
|
|
Add support for tiled images and the UDIM naming scheme
This patch contains the work that I did during my week at the Code Quest - adding support for tiled images to Blender.
With this patch, images now contain a list of tiles. By default, this just contains one tile, but if the source type is set to Tiled, the user can add additional tiles. When acquiring an ImBuf, the tile to be loaded is specified in the ImageUser.
Therefore, code that is not yet aware of tiles will just access the default tile as usual.
The filenames of the additional tiles are derived from the original filename according to the UDIM naming scheme - the filename contains an index that is calculated as (1001 + 10*<y coordinate of the tile> + <x coordinate of the tile>), where the x coordinate never goes above 9.
Internally, the various tiles are stored in a cache just like sequences. When acquired for the first time, the code will try to load the corresponding file from disk. Alternatively, a new operator can be used to initialize the tile similar to the New Image operator.
The following features are supported so far:
- Automatic detection and loading of all tiles when opening the first tile (1001)
- Saving all tiles
- Adding and removing tiles
- Filling tiles with generated images
- Drawing all tiles in the Image Editor
- Viewing a tiled grid even if no image is selected
- Rendering tiled images in Eevee
- Rendering tiled images in Cycles (in SVM mode)
- Automatically skipping loading of unused tiles in Cycles
- 2D texture painting (also across tiles)
- 3D texture painting (also across tiles, only limitation: individual faces can not cross tile borders)
- Assigning custom labels to individual tiles (drawn in the Image Editor instead of the ID)
- Different resolutions between tiles
There still are some missing features that will be added later (see T72390):
- Workbench engine support
- Packing/Unpacking support
- Baking support
- Cycles OSL support
- many other Blender features that rely on images
Thanks to Brecht for the review and to all who tested the intermediate versions!
Differential Revision: https://developer.blender.org/D3509
2019-12-12 16:06:08 +01:00
|
|
|
OSLCompiler compiler(this, services, ss, scene);
|
2020-01-20 13:42:26 +01:00
|
|
|
compiler.background = (shader == background_shader);
|
2021-10-21 14:52:34 +02:00
|
|
|
compiler.compile(og, shader);
|
2012-12-12 06:51:06 +00:00
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
if (shader->get_use_mis() && shader->has_surface_emission)
|
Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).
Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.
The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.
On average, for a variety of animated scenes, this gives a 3x speedup.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D9555
2021-01-22 15:01:26 +01:00
|
|
|
scene->light_manager->tag_update(scene, LightManager::SHADER_COMPILED);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
/* setup shader engine */
|
|
|
|
og->ss = ss;
|
|
|
|
og->ts = ts;
|
|
|
|
og->services = services;
|
|
|
|
|
|
|
|
int background_id = scene->shader_manager->get_shader_id(background_shader);
|
|
|
|
og->background_state = og->surface_state[background_id & SHADER_MASK];
|
|
|
|
og->use = true;
|
|
|
|
|
|
|
|
foreach (Shader *shader, scene->shaders)
|
|
|
|
shader->clear_modified();
|
|
|
|
|
|
|
|
update_flags = UPDATE_NONE;
|
|
|
|
|
2019-05-02 12:40:24 +02:00
|
|
|
/* add special builtin texture types */
|
2019-05-14 12:13:43 +02:00
|
|
|
services->textures.insert(ustring("@ao"), new OSLTextureHandle(OSLTextureHandle::AO));
|
|
|
|
services->textures.insert(ustring("@bevel"), new OSLTextureHandle(OSLTextureHandle::BEVEL));
|
2019-05-02 12:40:24 +02:00
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
device_update_common(device, dscene, scene, progress);
|
|
|
|
|
2013-06-28 13:05:21 +00:00
|
|
|
{
|
2016-01-03 18:28:33 +05:00
|
|
|
/* Perform greedyjit optimization.
|
|
|
|
*
|
2019-08-01 13:53:25 +10:00
|
|
|
* This might waste time on optimizing groups which are never actually
|
2016-01-03 18:28:33 +05:00
|
|
|
* used, but this prevents OSL from allocating data on TLS at render
|
|
|
|
* time.
|
|
|
|
*
|
|
|
|
* This is much better for us because this way we aren't required to
|
|
|
|
* stop task scheduler threads to make sure all TLS is clean and don't
|
|
|
|
* have issues with TLS data free accessing freed memory if task scheduler
|
|
|
|
* is being freed after the Session is freed.
|
|
|
|
*/
|
2013-06-28 13:05:21 +00:00
|
|
|
thread_scoped_lock lock(ss_shared_mutex);
|
|
|
|
ss->optimize_all_groups();
|
2016-01-03 18:28:33 +05:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2013-04-01 20:26:52 +00:00
|
|
|
void OSLShaderManager::device_free(Device *device, DeviceScene *dscene, Scene *scene)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
OSLGlobals *og = (OSLGlobals *)device->get_cpu_osl_memory();
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2013-04-01 20:26:52 +00:00
|
|
|
device_free_common(device, dscene, scene);
|
2011-09-27 20:37:24 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* clear shader engine */
|
|
|
|
og->use = false;
|
|
|
|
og->ss = NULL;
|
2012-11-20 17:40:21 +00:00
|
|
|
og->ts = NULL;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-10-12 23:03:12 +00:00
|
|
|
og->surface_state.clear();
|
|
|
|
og->volume_state.clear();
|
2011-04-27 11:58:34 +00:00
|
|
|
og->displacement_state.clear();
|
2017-07-08 02:46:06 +02:00
|
|
|
og->bump_state.clear();
|
2011-04-27 11:58:34 +00:00
|
|
|
og->background_state.reset();
|
|
|
|
}
|
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
void OSLShaderManager::texture_system_init()
|
|
|
|
{
|
2013-04-04 23:48:07 +00:00
|
|
|
/* create texture system, shared between different renders to reduce memory usage */
|
|
|
|
thread_scoped_lock lock(ts_shared_mutex);
|
|
|
|
|
|
|
|
if (ts_shared_users == 0) {
|
|
|
|
ts_shared = TextureSystem::create(true);
|
|
|
|
|
|
|
|
ts_shared->attribute("automip", 1);
|
|
|
|
ts_shared->attribute("autotile", 64);
|
|
|
|
ts_shared->attribute("gray_to_rgb", 1);
|
|
|
|
|
|
|
|
/* effectively unlimited for now, until we support proper mipmap lookups */
|
|
|
|
ts_shared->attribute("max_memory_MB", 16384);
|
|
|
|
}
|
|
|
|
|
|
|
|
ts = ts_shared;
|
|
|
|
ts_shared_users++;
|
2012-11-03 14:32:35 +00:00
|
|
|
}
|
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
void OSLShaderManager::texture_system_free()
|
|
|
|
{
|
|
|
|
/* shared texture system decrease users and destroy if no longer used */
|
|
|
|
thread_scoped_lock lock(ts_shared_mutex);
|
|
|
|
ts_shared_users--;
|
|
|
|
|
|
|
|
if (ts_shared_users == 0) {
|
2016-02-03 12:10:00 +01:00
|
|
|
ts_shared->invalidate_all(true);
|
|
|
|
OSL::TextureSystem::destroy(ts_shared);
|
2013-04-22 14:27:12 +00:00
|
|
|
ts_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ts = NULL;
|
|
|
|
}
|
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
void OSLShaderManager::shading_system_init()
|
|
|
|
{
|
2013-04-22 14:27:12 +00:00
|
|
|
/* create shading system, shared between different renders to reduce memory usage */
|
|
|
|
thread_scoped_lock lock(ss_shared_mutex);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
if (ss_shared_users == 0) {
|
2019-05-14 15:05:24 +02:00
|
|
|
/* Must use aligned new due to concurrent hash map. */
|
|
|
|
services_shared = util_aligned_new<OSLRenderServices>(ts_shared);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-03-23 13:58:31 +01:00
|
|
|
string shader_path = path_get("shader");
|
|
|
|
# ifdef _WIN32
|
|
|
|
/* Annoying thing, Cycles stores paths in UTF-8 codepage, so it can
|
|
|
|
* operate with file paths with any character. This requires to use wide
|
|
|
|
* char functions, but OSL uses old fashioned ANSI functions which means:
|
|
|
|
*
|
|
|
|
* - We have to convert our paths to ANSI before passing to OSL
|
|
|
|
* - OSL can't be used when there's a multi-byte character in the path
|
|
|
|
* to the shaders folder.
|
|
|
|
*/
|
|
|
|
shader_path = string_to_ansi(shader_path);
|
|
|
|
# endif
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-28 01:07:59 +01:00
|
|
|
ss_shared = new OSL::ShadingSystem(services_shared, ts_shared, &errhandler);
|
2013-04-22 14:27:12 +00:00
|
|
|
ss_shared->attribute("lockgeom", 1);
|
|
|
|
ss_shared->attribute("commonspace", "world");
|
2016-03-23 13:58:31 +01:00
|
|
|
ss_shared->attribute("searchpath:shader", shader_path);
|
2016-01-03 18:28:33 +05:00
|
|
|
ss_shared->attribute("greedyjit", 1);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-16 19:39:13 +02:00
|
|
|
VLOG_INFO << "Using shader search path: " << shader_path;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
/* our own ray types */
|
|
|
|
static const char *raytypes[] = {
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
"camera", /* PATH_RAY_CAMERA */
|
|
|
|
"reflection", /* PATH_RAY_REFLECT */
|
|
|
|
"refraction", /* PATH_RAY_TRANSMIT */
|
|
|
|
"diffuse", /* PATH_RAY_DIFFUSE */
|
|
|
|
"glossy", /* PATH_RAY_GLOSSY */
|
|
|
|
"singular", /* PATH_RAY_SINGULAR */
|
|
|
|
"transparent", /* PATH_RAY_TRANSPARENT */
|
|
|
|
"volume_scatter", /* PATH_RAY_VOLUME_SCATTER */
|
|
|
|
|
|
|
|
"shadow", /* PATH_RAY_SHADOW_OPAQUE */
|
|
|
|
"shadow", /* PATH_RAY_SHADOW_TRANSPARENT */
|
|
|
|
|
|
|
|
"__unused__", /* PATH_RAY_NODE_UNALIGNED */
|
|
|
|
"__unused__", /* PATH_RAY_MIS_SKIP */
|
|
|
|
|
|
|
|
"diffuse_ancestor", /* PATH_RAY_DIFFUSE_ANCESTOR */
|
|
|
|
|
2021-11-12 16:43:43 +01:00
|
|
|
/* Remaining irrelevant bits up to 32. */
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
|
|
|
"__unused__",
|
2013-04-22 14:27:12 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
const int nraytypes = sizeof(raytypes) / sizeof(raytypes[0]);
|
|
|
|
ss_shared->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-08 19:31:44 +02:00
|
|
|
OSLRenderServices::register_closures(ss_shared);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
loaded_shaders.clear();
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-22 14:27:12 +00:00
|
|
|
ss = ss_shared;
|
|
|
|
services = services_shared;
|
|
|
|
ss_shared_users++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLShaderManager::shading_system_free()
|
|
|
|
{
|
|
|
|
/* shared shading system decrease users and destroy if no longer used */
|
|
|
|
thread_scoped_lock lock(ss_shared_mutex);
|
|
|
|
ss_shared_users--;
|
|
|
|
|
|
|
|
if (ss_shared_users == 0) {
|
2015-01-28 01:07:59 +01:00
|
|
|
delete ss_shared;
|
2013-04-22 14:27:12 +00:00
|
|
|
ss_shared = NULL;
|
|
|
|
|
2019-05-14 15:05:24 +02:00
|
|
|
util_aligned_delete(services_shared);
|
2013-04-22 14:27:12 +00:00
|
|
|
services_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ss = NULL;
|
|
|
|
services = NULL;
|
2012-11-03 14:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool OSLShaderManager::osl_compile(const string &inputfile, const string &outputfile)
|
|
|
|
{
|
2015-01-17 00:13:30 +05:00
|
|
|
vector<string> options;
|
2012-11-03 14:32:35 +00:00
|
|
|
string stdosl_path;
|
2014-08-05 15:53:00 +06:00
|
|
|
string shader_path = path_get("shader");
|
2012-11-03 14:32:35 +00:00
|
|
|
|
2021-10-28 15:46:20 +02:00
|
|
|
/* Specify output file name. */
|
2012-11-03 14:32:35 +00:00
|
|
|
options.push_back("-o");
|
|
|
|
options.push_back(outputfile);
|
|
|
|
|
2021-10-28 15:46:20 +02:00
|
|
|
/* Specify standard include path. */
|
2015-02-05 12:06:24 +05:00
|
|
|
string include_path_arg = string("-I") + shader_path;
|
|
|
|
options.push_back(include_path_arg);
|
2014-08-05 11:11:52 +02:00
|
|
|
|
2021-01-12 14:30:35 +01:00
|
|
|
stdosl_path = path_join(shader_path, "stdcycles.h");
|
2012-11-03 14:32:35 +00:00
|
|
|
|
2021-10-28 15:46:20 +02:00
|
|
|
/* Compile.
|
|
|
|
*
|
|
|
|
* Mutex protected because the OSL compiler does not appear to be thread safe, see T92503. */
|
|
|
|
static thread_mutex osl_compiler_mutex;
|
|
|
|
thread_scoped_lock lock(osl_compiler_mutex);
|
|
|
|
|
2016-01-16 01:32:22 +01:00
|
|
|
OSL::OSLCompiler *compiler = new OSL::OSLCompiler(&OSL::ErrorHandler::default_handler());
|
2014-08-05 11:11:52 +02:00
|
|
|
bool ok = compiler->compile(string_view(inputfile), options, string_view(stdosl_path));
|
2012-11-03 14:32:35 +00:00
|
|
|
delete compiler;
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OSLShaderManager::osl_query(OSL::OSLQuery &query, const string &filepath)
|
|
|
|
{
|
|
|
|
string searchpath = path_user_get("shaders");
|
|
|
|
return query.open(filepath, searchpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
static string shader_filepath_hash(const string &filepath, uint64_t modified_time)
|
|
|
|
{
|
|
|
|
/* compute a hash from filepath and modified time to detect changes */
|
|
|
|
MD5Hash md5;
|
|
|
|
md5.append((const uint8_t *)filepath.c_str(), filepath.size());
|
|
|
|
md5.append((const uint8_t *)&modified_time, sizeof(modified_time));
|
|
|
|
|
|
|
|
return md5.get_hex();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *OSLShaderManager::shader_test_loaded(const string &hash)
|
|
|
|
{
|
2012-12-12 06:51:06 +00:00
|
|
|
map<string, OSLShaderInfo>::iterator it = loaded_shaders.find(hash);
|
|
|
|
return (it == loaded_shaders.end()) ? NULL : it->first.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
OSLShaderInfo *OSLShaderManager::shader_loaded_info(const string &hash)
|
|
|
|
{
|
|
|
|
map<string, OSLShaderInfo>::iterator it = loaded_shaders.find(hash);
|
|
|
|
return (it == loaded_shaders.end()) ? NULL : &it->second;
|
2012-11-03 14:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *OSLShaderManager::shader_load_filepath(string filepath)
|
|
|
|
{
|
|
|
|
size_t len = filepath.size();
|
|
|
|
string extension = filepath.substr(len - 4);
|
|
|
|
uint64_t modified_time = path_modified_time(filepath);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
if (extension == ".osl") {
|
|
|
|
/* .OSL File */
|
|
|
|
string osopath = filepath.substr(0, len - 4) + ".oso";
|
|
|
|
uint64_t oso_modified_time = path_modified_time(osopath);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* test if we have loaded the corresponding .OSO already */
|
|
|
|
if (oso_modified_time != 0) {
|
|
|
|
const char *hash = shader_test_loaded(shader_filepath_hash(osopath, oso_modified_time));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
if (hash)
|
|
|
|
return hash;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-02-05 16:23:34 +11:00
|
|
|
/* Auto-compile .OSL to .OSO if needed. */
|
2012-11-03 14:32:35 +00:00
|
|
|
if (oso_modified_time == 0 || (oso_modified_time < modified_time)) {
|
|
|
|
OSLShaderManager::osl_compile(filepath, osopath);
|
|
|
|
modified_time = path_modified_time(osopath);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
modified_time = oso_modified_time;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
filepath = osopath;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (extension == ".oso") {
|
|
|
|
/* .OSO File, nothing to do */
|
|
|
|
}
|
|
|
|
else if (path_dirname(filepath) == "") {
|
|
|
|
/* .OSO File in search path */
|
|
|
|
filepath = path_join(path_user_get("shaders"), filepath + ".oso");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* unknown file */
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* test if we have loaded this .OSO already */
|
|
|
|
const char *hash = shader_test_loaded(shader_filepath_hash(filepath, modified_time));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
if (hash)
|
|
|
|
return hash;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* read oso bytecode from file */
|
|
|
|
string bytecode_hash = shader_filepath_hash(filepath, modified_time);
|
|
|
|
string bytecode;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
if (!path_read_text(filepath, bytecode)) {
|
|
|
|
fprintf(stderr, "Cycles shader graph: failed to read file %s\n", filepath.c_str());
|
2012-12-12 06:51:06 +00:00
|
|
|
OSLShaderInfo info;
|
|
|
|
loaded_shaders[bytecode_hash] = info; /* to avoid repeat tries */
|
2012-11-03 14:32:35 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
return shader_load_bytecode(bytecode_hash, bytecode);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *OSLShaderManager::shader_load_bytecode(const string &hash, const string &bytecode)
|
|
|
|
{
|
2013-05-09 14:13:43 +00:00
|
|
|
ss->LoadMemoryCompiledShader(hash.c_str(), bytecode.c_str());
|
2012-11-03 14:32:35 +00:00
|
|
|
|
2012-12-12 06:51:06 +00:00
|
|
|
OSLShaderInfo info;
|
2016-05-29 15:10:34 +02:00
|
|
|
|
|
|
|
if (!info.query.open_bytecode(bytecode)) {
|
|
|
|
fprintf(stderr, "OSL query error: %s\n", info.query.geterror().c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this is a bit weak, but works */
|
2012-12-12 06:51:06 +00:00
|
|
|
info.has_surface_emission = (bytecode.find("\"emission\"") != string::npos);
|
|
|
|
info.has_surface_transparent = (bytecode.find("\"transparent\"") != string::npos);
|
2013-04-01 20:26:52 +00:00
|
|
|
info.has_surface_bssrdf = (bytecode.find("\"bssrdf\"") != string::npos);
|
2016-05-29 15:10:34 +02:00
|
|
|
|
2012-12-12 06:51:06 +00:00
|
|
|
loaded_shaders[hash] = info;
|
|
|
|
|
|
|
|
return loaded_shaders.find(hash)->first.c_str();
|
2012-11-03 14:32:35 +00:00
|
|
|
}
|
|
|
|
|
2020-03-11 16:51:42 +01:00
|
|
|
/* This is a static function to avoid RTTI link errors with only this
|
|
|
|
* file being compiled without RTTI to match OSL and LLVM libraries. */
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
OSLNode *OSLShaderManager::osl_node(ShaderGraph *graph,
|
|
|
|
ShaderManager *manager,
|
2020-03-11 16:51:42 +01:00
|
|
|
const std::string &filepath,
|
2016-05-29 15:10:34 +02:00
|
|
|
const std::string &bytecode_hash,
|
|
|
|
const std::string &bytecode)
|
|
|
|
{
|
2020-03-11 16:51:42 +01:00
|
|
|
if (!manager->use_osl()) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
/* create query */
|
2020-03-11 16:51:42 +01:00
|
|
|
OSLShaderManager *osl_manager = static_cast<OSLShaderManager *>(manager);
|
2016-05-29 15:10:34 +02:00
|
|
|
const char *hash;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!filepath.empty()) {
|
2020-03-11 16:51:42 +01:00
|
|
|
hash = osl_manager->shader_load_filepath(filepath);
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
else {
|
2020-03-11 16:51:42 +01:00
|
|
|
hash = osl_manager->shader_test_loaded(bytecode_hash);
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!hash)
|
2020-03-11 16:51:42 +01:00
|
|
|
hash = osl_manager->shader_load_bytecode(bytecode_hash, bytecode);
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!hash) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-11 16:51:42 +01:00
|
|
|
OSLShaderInfo *info = osl_manager->shader_loaded_info(hash);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
/* count number of inputs */
|
|
|
|
size_t num_inputs = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
for (int i = 0; i < info->query.nparams(); i++) {
|
|
|
|
const OSL::OSLQuery::Parameter *param = info->query.getparam(i);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
/* skip unsupported types */
|
|
|
|
if (param->varlenarray || param->isstruct || param->type.arraylen > 1)
|
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!param->isoutput)
|
|
|
|
num_inputs++;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
/* create node */
|
Cycles: introduce an ownership system to protect nodes from unwanted deletions.
Problem: the Blender synchronization process creates and tags nodes for usage. It does
this by directly adding and removing nodes from the scene data. If some node is not tagged
as used at the end of a synchronization, it then deletes the node from the scene. This poses
a problem when it comes to supporting procedural nodes who can create other nodes not known
by the Blender synchonization system, which will remove them.
Nodes now have a NodeOwner, which is set after creation. Those owners for now are the Scene
for scene level nodes and ShaderGraph for shader nodes. Instead of creating and deleting
nodes using `new` and `delete` explicitely, we now use `create_node` and `delete_node` methods
found on the owners. `delete_node` will assert that the owner is the right one.
Whenever a scene level node is created or deleted, the appropriate node manager is tagged for
an update, freeing this responsability from BlenderSync or other software exporters.
Concerning BlenderSync, the `id_maps` do not explicitely manipulate scene data anymore, they
only keep track of which nodes are used, employing the scene to create and delete them. To
achieve this, the ParticleSystem is now a Node, although it does not have any sockets.
This is part of T79131.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79131
Differential Revision: https://developer.blender.org/D8540
2020-08-30 23:20:51 +02:00
|
|
|
OSLNode *node = OSLNode::create(graph, num_inputs);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
/* add new sockets from parameters */
|
|
|
|
set<void *> used_sockets;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
for (int i = 0; i < info->query.nparams(); i++) {
|
|
|
|
const OSL::OSLQuery::Parameter *param = info->query.getparam(i);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
/* skip unsupported types */
|
|
|
|
if (param->varlenarray || param->isstruct || param->type.arraylen > 1)
|
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
SocketType::Type socket_type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (param->isclosure) {
|
|
|
|
socket_type = SocketType::CLOSURE;
|
|
|
|
}
|
|
|
|
else if (param->type.vecsemantics != TypeDesc::NOSEMANTICS) {
|
|
|
|
if (param->type.vecsemantics == TypeDesc::COLOR)
|
|
|
|
socket_type = SocketType::COLOR;
|
|
|
|
else if (param->type.vecsemantics == TypeDesc::POINT)
|
|
|
|
socket_type = SocketType::POINT;
|
|
|
|
else if (param->type.vecsemantics == TypeDesc::VECTOR)
|
|
|
|
socket_type = SocketType::VECTOR;
|
|
|
|
else if (param->type.vecsemantics == TypeDesc::NORMAL)
|
|
|
|
socket_type = SocketType::NORMAL;
|
|
|
|
else
|
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!param->isoutput && param->validdefault) {
|
2016-05-07 19:48:28 +02:00
|
|
|
float3 *default_value = (float3 *)node->input_default_value();
|
|
|
|
default_value->x = param->fdefault[0];
|
|
|
|
default_value->y = param->fdefault[1];
|
|
|
|
default_value->z = param->fdefault[2];
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (param->type.aggregate == TypeDesc::SCALAR) {
|
|
|
|
if (param->type.basetype == TypeDesc::INT) {
|
|
|
|
socket_type = SocketType::INT;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!param->isoutput && param->validdefault) {
|
2016-05-07 19:48:28 +02:00
|
|
|
*(int *)node->input_default_value() = param->idefault[0];
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (param->type.basetype == TypeDesc::FLOAT) {
|
|
|
|
socket_type = SocketType::FLOAT;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!param->isoutput && param->validdefault) {
|
2016-05-07 19:48:28 +02:00
|
|
|
*(float *)node->input_default_value() = param->fdefault[0];
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (param->type.basetype == TypeDesc::STRING) {
|
|
|
|
socket_type = SocketType::STRING;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!param->isoutput && param->validdefault) {
|
2016-05-07 19:48:28 +02:00
|
|
|
*(ustring *)node->input_default_value() = param->sdefault[0];
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
if (param->isoutput) {
|
2016-05-07 19:48:28 +02:00
|
|
|
node->add_output(param->name, socket_type);
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
else {
|
2016-05-07 19:48:28 +02:00
|
|
|
node->add_input(param->name, socket_type);
|
2016-05-29 15:10:34 +02:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-02-05 16:23:34 +11:00
|
|
|
/* Set byte-code hash or file-path. */
|
2016-05-29 15:10:34 +02:00
|
|
|
if (!bytecode_hash.empty()) {
|
|
|
|
node->bytecode_hash = bytecode_hash;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
node->filepath = filepath;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
/* Generate inputs and outputs */
|
|
|
|
node->create_inputs_outputs(node->type);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-29 15:10:34 +02:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Graph Compiler */
|
|
|
|
|
2019-05-14 12:13:43 +02:00
|
|
|
OSLCompiler::OSLCompiler(OSLShaderManager *manager,
|
|
|
|
OSLRenderServices *services,
|
|
|
|
OSL::ShadingSystem *ss,
|
Add support for tiled images and the UDIM naming scheme
This patch contains the work that I did during my week at the Code Quest - adding support for tiled images to Blender.
With this patch, images now contain a list of tiles. By default, this just contains one tile, but if the source type is set to Tiled, the user can add additional tiles. When acquiring an ImBuf, the tile to be loaded is specified in the ImageUser.
Therefore, code that is not yet aware of tiles will just access the default tile as usual.
The filenames of the additional tiles are derived from the original filename according to the UDIM naming scheme - the filename contains an index that is calculated as (1001 + 10*<y coordinate of the tile> + <x coordinate of the tile>), where the x coordinate never goes above 9.
Internally, the various tiles are stored in a cache just like sequences. When acquired for the first time, the code will try to load the corresponding file from disk. Alternatively, a new operator can be used to initialize the tile similar to the New Image operator.
The following features are supported so far:
- Automatic detection and loading of all tiles when opening the first tile (1001)
- Saving all tiles
- Adding and removing tiles
- Filling tiles with generated images
- Drawing all tiles in the Image Editor
- Viewing a tiled grid even if no image is selected
- Rendering tiled images in Eevee
- Rendering tiled images in Cycles (in SVM mode)
- Automatically skipping loading of unused tiles in Cycles
- 2D texture painting (also across tiles)
- 3D texture painting (also across tiles, only limitation: individual faces can not cross tile borders)
- Assigning custom labels to individual tiles (drawn in the Image Editor instead of the ID)
- Different resolutions between tiles
There still are some missing features that will be added later (see T72390):
- Workbench engine support
- Packing/Unpacking support
- Baking support
- Cycles OSL support
- many other Blender features that rely on images
Thanks to Brecht for the review and to all who tested the intermediate versions!
Differential Revision: https://developer.blender.org/D3509
2019-12-12 16:06:08 +01:00
|
|
|
Scene *scene)
|
|
|
|
: scene(scene), manager(manager), services(services), ss(ss)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2011-10-12 23:03:12 +00:00
|
|
|
current_type = SHADER_TYPE_SURFACE;
|
2011-04-27 11:58:34 +00:00
|
|
|
current_shader = NULL;
|
|
|
|
background = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
string OSLCompiler::id(ShaderNode *node)
|
|
|
|
{
|
|
|
|
/* assign layer unique name based on pointer address + bump mode */
|
|
|
|
stringstream stream;
|
2016-08-04 14:48:34 +03:00
|
|
|
stream << "node_" << node->type->name << "_" << node;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
return stream.str();
|
|
|
|
}
|
|
|
|
|
2012-09-15 16:31:07 +00:00
|
|
|
string OSLCompiler::compatible_name(ShaderNode *node, ShaderInput *input)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2016-05-08 01:32:09 +02:00
|
|
|
string sname(input->name().string());
|
2011-04-27 11:58:34 +00:00
|
|
|
size_t i;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-10-24 19:31:08 +11:00
|
|
|
/* Strip white-space. */
|
2011-04-27 11:58:34 +00:00
|
|
|
while ((i = sname.find(" ")) != string::npos)
|
|
|
|
sname.replace(i, 1, "");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-15 16:31:07 +00:00
|
|
|
/* if output exists with the same name, add "In" suffix */
|
|
|
|
foreach (ShaderOutput *output, node->outputs) {
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->name() == output->name()) {
|
2012-09-15 16:31:07 +00:00
|
|
|
sname += "In";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-15 16:31:07 +00:00
|
|
|
return sname;
|
|
|
|
}
|
|
|
|
|
|
|
|
string OSLCompiler::compatible_name(ShaderNode *node, ShaderOutput *output)
|
|
|
|
{
|
2016-05-08 01:32:09 +02:00
|
|
|
string sname(output->name().string());
|
2012-09-15 16:31:07 +00:00
|
|
|
size_t i;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-10-24 19:31:08 +11:00
|
|
|
/* Strip white-space. */
|
2012-09-15 16:31:07 +00:00
|
|
|
while ((i = sname.find(" ")) != string::npos)
|
|
|
|
sname.replace(i, 1, "");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-20 17:40:21 +00:00
|
|
|
/* if input exists with the same name, add "Out" suffix */
|
2012-09-15 16:31:07 +00:00
|
|
|
foreach (ShaderInput *input, node->inputs) {
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->name() == output->name()) {
|
2012-09-15 16:31:07 +00:00
|
|
|
sname += "Out";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
return sname;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
|
|
|
|
{
|
|
|
|
/* exception for output node, only one input is actually used
|
2012-06-09 17:22:52 +00:00
|
|
|
* depending on the current shader type */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->flags() & SocketType::SVM_INTERNAL)
|
2012-11-27 16:02:12 +00:00
|
|
|
return true;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-08 00:41:01 +02:00
|
|
|
if (node->special_type == SHADER_SPECIAL_TYPE_OUTPUT) {
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->name() == "Surface" && current_type != SHADER_TYPE_SURFACE)
|
2011-10-12 23:03:12 +00:00
|
|
|
return true;
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->name() == "Volume" && current_type != SHADER_TYPE_VOLUME)
|
2011-04-27 11:58:34 +00:00
|
|
|
return true;
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->name() == "Displacement" && current_type != SHADER_TYPE_DISPLACEMENT)
|
2011-04-27 11:58:34 +00:00
|
|
|
return true;
|
2016-08-14 11:44:25 -04:00
|
|
|
if (input->name() == "Normal" && current_type != SHADER_TYPE_BUMP)
|
2012-10-20 12:18:00 +00:00
|
|
|
return true;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2016-05-02 00:05:16 +02:00
|
|
|
else if (node->special_type == SHADER_SPECIAL_TYPE_BUMP) {
|
2016-05-08 01:32:09 +02:00
|
|
|
if (input->name() == "Height")
|
2012-10-20 15:09:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
2016-05-02 00:05:16 +02:00
|
|
|
else if (current_type == SHADER_TYPE_DISPLACEMENT && input->link &&
|
|
|
|
input->link->parent->special_type == SHADER_SPECIAL_TYPE_BUMP)
|
2011-04-27 11:58:34 +00:00
|
|
|
return true;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2012-11-03 14:32:35 +00:00
|
|
|
/* load filepath */
|
|
|
|
if (isfilepath) {
|
2019-05-14 12:13:43 +02:00
|
|
|
name = manager->shader_load_filepath(name);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
if (name == NULL)
|
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* pass in fixed parameter values */
|
|
|
|
foreach (ShaderInput *input, node->inputs) {
|
|
|
|
if (!input->link) {
|
|
|
|
/* checks to untangle graphs */
|
|
|
|
if (node_skip_input(node, input))
|
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-15 16:31:07 +00:00
|
|
|
string param_name = compatible_name(node, input);
|
2016-05-07 19:48:28 +02:00
|
|
|
const SocketType &socket = input->socket_type;
|
2016-05-08 01:32:09 +02:00
|
|
|
switch (input->type()) {
|
|
|
|
case SocketType::COLOR:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter_color(param_name.c_str(), node->get_float3(socket));
|
2011-04-27 11:58:34 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::POINT:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter_point(param_name.c_str(), node->get_float3(socket));
|
2011-04-27 11:58:34 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::VECTOR:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter_vector(param_name.c_str(), node->get_float3(socket));
|
2011-04-27 11:58:34 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::NORMAL:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter_normal(param_name.c_str(), node->get_float3(socket));
|
2011-04-27 11:58:34 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::FLOAT:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter(param_name.c_str(), node->get_float(socket));
|
2011-04-27 11:58:34 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::INT:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter(param_name.c_str(), node->get_int(socket));
|
2012-10-20 13:11:45 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::STRING:
|
2016-05-07 19:48:28 +02:00
|
|
|
parameter(param_name.c_str(), node->get_string(socket));
|
2012-11-06 21:36:44 +00:00
|
|
|
break;
|
2016-05-08 01:32:09 +02:00
|
|
|
case SocketType::CLOSURE:
|
|
|
|
case SocketType::UNDEFINED:
|
|
|
|
default:
|
2011-04-27 11:58:34 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-09-24 11:31:23 +10:00
|
|
|
/* Create shader of the appropriate type. OSL only distinguishes between "surface"
|
|
|
|
* and "displacement" at the moment. */
|
2011-10-12 23:03:12 +00:00
|
|
|
if (current_type == SHADER_TYPE_SURFACE)
|
|
|
|
ss->Shader("surface", name, id(node).c_str());
|
|
|
|
else if (current_type == SHADER_TYPE_VOLUME)
|
2011-04-27 11:58:34 +00:00
|
|
|
ss->Shader("surface", name, id(node).c_str());
|
|
|
|
else if (current_type == SHADER_TYPE_DISPLACEMENT)
|
2014-03-06 21:02:41 +01:00
|
|
|
ss->Shader("displacement", name, id(node).c_str());
|
2016-08-14 11:44:25 -04:00
|
|
|
else if (current_type == SHADER_TYPE_BUMP)
|
|
|
|
ss->Shader("displacement", name, id(node).c_str());
|
2011-04-27 11:58:34 +00:00
|
|
|
else
|
|
|
|
assert(0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* link inputs to other nodes */
|
|
|
|
foreach (ShaderInput *input, node->inputs) {
|
|
|
|
if (input->link) {
|
|
|
|
if (node_skip_input(node, input))
|
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* connect shaders */
|
|
|
|
string id_from = id(input->link->parent);
|
|
|
|
string id_to = id(node);
|
2012-09-15 16:31:07 +00:00
|
|
|
string param_from = compatible_name(input->link->parent, input->link);
|
|
|
|
string param_to = compatible_name(node, input);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
ss->ConnectShaders(id_from.c_str(), param_from.c_str(), id_to.c_str(), param_to.c_str());
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-12 06:51:06 +00:00
|
|
|
/* test if we shader contains specific closures */
|
2019-05-14 12:13:43 +02:00
|
|
|
OSLShaderInfo *info = manager->shader_loaded_info(name);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-02-05 22:13:51 +01:00
|
|
|
if (current_type == SHADER_TYPE_SURFACE) {
|
|
|
|
if (info) {
|
|
|
|
if (info->has_surface_emission)
|
|
|
|
current_shader->has_surface_emission = true;
|
|
|
|
if (info->has_surface_transparent)
|
|
|
|
current_shader->has_surface_transparent = true;
|
|
|
|
if (info->has_surface_bssrdf) {
|
|
|
|
current_shader->has_surface_bssrdf = true;
|
|
|
|
current_shader->has_bssrdf_bump = true; /* can't detect yet */
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
current_shader->has_bump = true; /* can't detect yet */
|
|
|
|
current_shader->has_surface_raytrace = true; /* can't detect yet */
|
2016-02-05 22:13:51 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-02-05 22:13:51 +01:00
|
|
|
if (node->has_spatial_varying()) {
|
|
|
|
current_shader->has_surface_spatial_varying = true;
|
2013-08-18 14:15:57 +00:00
|
|
|
}
|
2012-12-12 06:51:06 +00:00
|
|
|
}
|
2014-04-04 13:20:46 +02:00
|
|
|
else if (current_type == SHADER_TYPE_VOLUME) {
|
|
|
|
if (node->has_spatial_varying())
|
2016-02-05 21:33:37 +01:00
|
|
|
current_shader->has_volume_spatial_varying = true;
|
2020-03-07 14:38:52 +01:00
|
|
|
if (node->has_attribute_dependency())
|
|
|
|
current_shader->has_volume_attribute_dependency = true;
|
2014-04-04 13:20:46 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-11-20 18:18:27 +05:00
|
|
|
if (node->has_integrator_dependency()) {
|
|
|
|
current_shader->has_integrator_dependency = true;
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
static TypeDesc array_typedesc(TypeDesc typedesc, int arraylength)
|
|
|
|
{
|
|
|
|
return TypeDesc((TypeDesc::BASETYPE)typedesc.basetype,
|
|
|
|
(TypeDesc::AGGREGATE)typedesc.aggregate,
|
|
|
|
(TypeDesc::VECSEMANTICS)typedesc.vecsemantics,
|
|
|
|
arraylength);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter(ShaderNode *node, const char *name)
|
|
|
|
{
|
|
|
|
ustring uname = ustring(name);
|
|
|
|
const SocketType &socket = *(node->type->find_input(uname));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
switch (socket.type) {
|
|
|
|
case SocketType::BOOLEAN: {
|
|
|
|
int value = node->get_bool(socket);
|
|
|
|
ss->Parameter(name, TypeDesc::TypeInt, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::FLOAT: {
|
|
|
|
float value = node->get_float(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeFloat, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::INT: {
|
|
|
|
int value = node->get_int(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeInt, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::COLOR: {
|
|
|
|
float3 value = node->get_float3(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeColor, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::VECTOR: {
|
|
|
|
float3 value = node->get_float3(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeVector, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::POINT: {
|
|
|
|
float3 value = node->get_float3(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypePoint, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::NORMAL: {
|
|
|
|
float3 value = node->get_float3(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeNormal, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::POINT2: {
|
|
|
|
float2 value = node->get_float2(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc(TypeDesc::FLOAT, TypeDesc::VEC2, TypeDesc::POINT), &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::STRING: {
|
|
|
|
ustring value = node->get_string(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeString, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::ENUM: {
|
|
|
|
ustring value = node->get_string(socket);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeString, &value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::TRANSFORM: {
|
|
|
|
Transform value = node->get_transform(socket);
|
2018-03-08 06:48:14 +01:00
|
|
|
ProjectionTransform projection(value);
|
|
|
|
projection = projection_transpose(projection);
|
|
|
|
ss->Parameter(uname, TypeDesc::TypeMatrix, &projection);
|
2016-05-07 19:48:28 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::BOOLEAN_ARRAY: {
|
|
|
|
// OSL does not support booleans, so convert to int
|
|
|
|
const array<bool> &value = node->get_bool_array(socket);
|
|
|
|
array<int> intvalue(value.size());
|
2016-10-24 12:26:12 +02:00
|
|
|
for (size_t i = 0; i < value.size(); i++)
|
2016-05-07 19:48:28 +02:00
|
|
|
intvalue[i] = value[i];
|
|
|
|
ss->Parameter(uname, array_typedesc(TypeDesc::TypeInt, value.size()), intvalue.data());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::FLOAT_ARRAY: {
|
|
|
|
const array<float> &value = node->get_float_array(socket);
|
|
|
|
ss->Parameter(uname, array_typedesc(TypeDesc::TypeFloat, value.size()), value.data());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::INT_ARRAY: {
|
|
|
|
const array<int> &value = node->get_int_array(socket);
|
|
|
|
ss->Parameter(uname, array_typedesc(TypeDesc::TypeInt, value.size()), value.data());
|
2019-04-17 06:17:24 +02:00
|
|
|
break;
|
|
|
|
}
|
2016-05-07 19:48:28 +02:00
|
|
|
case SocketType::COLOR_ARRAY:
|
|
|
|
case SocketType::VECTOR_ARRAY:
|
|
|
|
case SocketType::POINT_ARRAY:
|
|
|
|
case SocketType::NORMAL_ARRAY: {
|
|
|
|
TypeDesc typedesc;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
switch (socket.type) {
|
|
|
|
case SocketType::COLOR_ARRAY:
|
|
|
|
typedesc = TypeDesc::TypeColor;
|
|
|
|
break;
|
|
|
|
case SocketType::VECTOR_ARRAY:
|
|
|
|
typedesc = TypeDesc::TypeVector;
|
|
|
|
break;
|
|
|
|
case SocketType::POINT_ARRAY:
|
|
|
|
typedesc = TypeDesc::TypePoint;
|
|
|
|
break;
|
|
|
|
case SocketType::NORMAL_ARRAY:
|
|
|
|
typedesc = TypeDesc::TypeNormal;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
break;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
// convert to tightly packed array since float3 has padding
|
|
|
|
const array<float3> &value = node->get_float3_array(socket);
|
|
|
|
array<float> fvalue(value.size() * 3);
|
2016-10-24 12:26:12 +02:00
|
|
|
for (size_t i = 0, j = 0; i < value.size(); i++) {
|
2016-05-07 19:48:28 +02:00
|
|
|
fvalue[j++] = value[i].x;
|
|
|
|
fvalue[j++] = value[i].y;
|
|
|
|
fvalue[j++] = value[i].z;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
ss->Parameter(uname, array_typedesc(typedesc, value.size()), fvalue.data());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::POINT2_ARRAY: {
|
|
|
|
const array<float2> &value = node->get_float2_array(socket);
|
|
|
|
ss->Parameter(
|
|
|
|
uname,
|
|
|
|
array_typedesc(TypeDesc(TypeDesc::FLOAT, TypeDesc::VEC2, TypeDesc::POINT), value.size()),
|
|
|
|
value.data());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::STRING_ARRAY: {
|
|
|
|
const array<ustring> &value = node->get_string_array(socket);
|
|
|
|
ss->Parameter(uname, array_typedesc(TypeDesc::TypeString, value.size()), value.data());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::TRANSFORM_ARRAY: {
|
|
|
|
const array<Transform> &value = node->get_transform_array(socket);
|
2018-03-08 06:48:14 +01:00
|
|
|
array<ProjectionTransform> fvalue(value.size());
|
|
|
|
for (size_t i = 0; i < value.size(); i++) {
|
|
|
|
fvalue[i] = projection_transpose(ProjectionTransform(value[i]));
|
|
|
|
}
|
|
|
|
ss->Parameter(uname, array_typedesc(TypeDesc::TypeMatrix, fvalue.size()), fvalue.data());
|
2016-05-07 19:48:28 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SocketType::CLOSURE:
|
|
|
|
case SocketType::NODE:
|
|
|
|
case SocketType::NODE_ARRAY:
|
|
|
|
case SocketType::UNDEFINED:
|
2016-06-13 10:14:18 +02:00
|
|
|
case SocketType::UINT: {
|
2016-05-07 19:48:28 +02:00
|
|
|
assert(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
void OSLCompiler::parameter(const char *name, float f)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypeFloat, &f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter_color(const char *name, float3 f)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypeColor, &f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter_point(const char *name, float3 f)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypePoint, &f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter_normal(const char *name, float3 f)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypeNormal, &f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter_vector(const char *name, float3 f)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypeVector, &f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter(const char *name, int f)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypeInt, &f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter(const char *name, const char *s)
|
|
|
|
{
|
|
|
|
ss->Parameter(name, TypeDesc::TypeString, &s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter(const char *name, ustring s)
|
|
|
|
{
|
|
|
|
const char *str = s.c_str();
|
|
|
|
ss->Parameter(name, TypeDesc::TypeString, &str);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter(const char *name, const Transform &tfm)
|
|
|
|
{
|
2018-03-08 06:48:14 +01:00
|
|
|
ProjectionTransform projection(tfm);
|
|
|
|
projection = projection_transpose(projection);
|
|
|
|
ss->Parameter(name, TypeDesc::TypeMatrix, (float *)&projection);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2012-09-15 15:41:37 +00:00
|
|
|
void OSLCompiler::parameter_array(const char *name, const float f[], int arraylen)
|
|
|
|
{
|
|
|
|
TypeDesc type = TypeDesc::TypeFloat;
|
|
|
|
type.arraylen = arraylen;
|
|
|
|
ss->Parameter(name, type, f);
|
|
|
|
}
|
|
|
|
|
2016-05-08 01:54:35 +02:00
|
|
|
void OSLCompiler::parameter_color_array(const char *name, const array<float3> &f)
|
2012-09-15 15:41:37 +00:00
|
|
|
{
|
2021-07-21 13:05:39 +10:00
|
|
|
/* NOTE: cycles float3 type is actually 4 floats! need to use an explicit array. */
|
2016-05-08 01:54:35 +02:00
|
|
|
array<float[3]> table(f.size());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-08 01:54:35 +02:00
|
|
|
for (int i = 0; i < f.size(); ++i) {
|
|
|
|
table[i][0] = f[i].x;
|
|
|
|
table[i][1] = f[i].y;
|
|
|
|
table[i][2] = f[i].z;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-08 01:54:35 +02:00
|
|
|
TypeDesc type = TypeDesc::TypeColor;
|
|
|
|
type.arraylen = table.size();
|
|
|
|
ss->Parameter(name, type, table.data());
|
2012-09-15 15:41:37 +00:00
|
|
|
}
|
|
|
|
|
2018-02-18 03:20:39 +01:00
|
|
|
void OSLCompiler::parameter_attribute(const char *name, ustring s)
|
|
|
|
{
|
|
|
|
if (Attribute::name_standard(s.c_str()))
|
|
|
|
parameter(name, (string("geom:") + s.c_str()).c_str());
|
|
|
|
else
|
|
|
|
parameter(name, s.c_str());
|
|
|
|
}
|
|
|
|
|
2015-11-25 13:07:29 +05:00
|
|
|
void OSLCompiler::find_dependencies(ShaderNodeSet &dependencies, ShaderInput *input)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
ShaderNode *node = (input->link) ? input->link->parent : NULL;
|
|
|
|
|
2015-11-25 13:46:51 +05:00
|
|
|
if (node != NULL && dependencies.find(node) == dependencies.end()) {
|
2011-04-27 11:58:34 +00:00
|
|
|
foreach (ShaderInput *in, node->inputs)
|
|
|
|
if (!node_skip_input(node, in))
|
|
|
|
find_dependencies(dependencies, in);
|
|
|
|
|
|
|
|
dependencies.insert(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 13:07:29 +05:00
|
|
|
void OSLCompiler::generate_nodes(const ShaderNodeSet &nodes)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2015-11-25 13:07:29 +05:00
|
|
|
ShaderNodeSet done;
|
2011-04-27 11:58:34 +00:00
|
|
|
bool nodes_done;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
do {
|
|
|
|
nodes_done = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
foreach (ShaderNode *node, nodes) {
|
|
|
|
if (done.find(node) == done.end()) {
|
|
|
|
bool inputs_done = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
foreach (ShaderInput *input, node->inputs)
|
|
|
|
if (!node_skip_input(node, input))
|
|
|
|
if (input->link && done.find(input->link->parent) == done.end())
|
|
|
|
inputs_done = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
if (inputs_done) {
|
|
|
|
node->compile(*this);
|
|
|
|
done.insert(node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-03-29 13:03:48 +01:00
|
|
|
if (current_type == SHADER_TYPE_SURFACE) {
|
|
|
|
if (node->has_surface_emission())
|
|
|
|
current_shader->has_surface_emission = true;
|
|
|
|
if (node->has_surface_transparent())
|
|
|
|
current_shader->has_surface_transparent = true;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
if (node->get_feature() & KERNEL_FEATURE_NODE_RAYTRACE)
|
|
|
|
current_shader->has_surface_raytrace = true;
|
2016-02-05 22:13:51 +01:00
|
|
|
if (node->has_spatial_varying())
|
|
|
|
current_shader->has_surface_spatial_varying = true;
|
2014-03-29 13:03:48 +01:00
|
|
|
if (node->has_surface_bssrdf()) {
|
|
|
|
current_shader->has_surface_bssrdf = true;
|
|
|
|
if (node->has_bssrdf_bump())
|
|
|
|
current_shader->has_bssrdf_bump = true;
|
|
|
|
}
|
2017-08-20 03:25:13 +02:00
|
|
|
if (node->has_bump()) {
|
|
|
|
current_shader->has_bump = true;
|
|
|
|
}
|
2013-08-18 14:15:57 +00:00
|
|
|
}
|
2014-04-04 13:20:46 +02:00
|
|
|
else if (current_type == SHADER_TYPE_VOLUME) {
|
|
|
|
if (node->has_spatial_varying())
|
2016-02-05 21:33:37 +01:00
|
|
|
current_shader->has_volume_spatial_varying = true;
|
2014-04-04 13:20:46 +02:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
nodes_done = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (!nodes_done);
|
|
|
|
}
|
|
|
|
|
2016-01-07 13:15:30 +05:00
|
|
|
OSL::ShaderGroupRef OSLCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType type)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
current_type = type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-07 13:15:30 +05:00
|
|
|
OSL::ShaderGroupRef group = ss->ShaderGroupBegin(shader->name.c_str());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
ShaderNode *output = graph->output();
|
2015-11-25 13:07:29 +05:00
|
|
|
ShaderNodeSet dependencies;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-10-12 23:03:12 +00:00
|
|
|
if (type == SHADER_TYPE_SURFACE) {
|
2011-04-27 11:58:34 +00:00
|
|
|
/* generate surface shader */
|
2011-10-12 23:03:12 +00:00
|
|
|
find_dependencies(dependencies, output->input("Surface"));
|
|
|
|
generate_nodes(dependencies);
|
|
|
|
output->compile(*this);
|
|
|
|
}
|
2016-08-14 11:44:25 -04:00
|
|
|
else if (type == SHADER_TYPE_BUMP) {
|
|
|
|
/* generate bump shader */
|
|
|
|
find_dependencies(dependencies, output->input("Normal"));
|
|
|
|
generate_nodes(dependencies);
|
|
|
|
output->compile(*this);
|
|
|
|
}
|
2011-10-12 23:03:12 +00:00
|
|
|
else if (type == SHADER_TYPE_VOLUME) {
|
|
|
|
/* generate volume shader */
|
|
|
|
find_dependencies(dependencies, output->input("Volume"));
|
2011-04-27 11:58:34 +00:00
|
|
|
generate_nodes(dependencies);
|
|
|
|
output->compile(*this);
|
|
|
|
}
|
|
|
|
else if (type == SHADER_TYPE_DISPLACEMENT) {
|
|
|
|
/* generate displacement shader */
|
|
|
|
find_dependencies(dependencies, output->input("Displacement"));
|
|
|
|
generate_nodes(dependencies);
|
|
|
|
output->compile(*this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
assert(0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
ss->ShaderGroupEnd();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-12-08 15:15:27 +01:00
|
|
|
return group;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2021-10-21 14:52:34 +02:00
|
|
|
void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2020-11-04 11:17:38 +01:00
|
|
|
if (shader->is_modified()) {
|
2012-11-03 14:32:35 +00:00
|
|
|
ShaderGraph *graph = shader->graph;
|
|
|
|
ShaderNode *output = (graph) ? graph->output() : NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
bool has_bump = (shader->get_displacement_method() != DISPLACE_TRUE) &&
|
2017-08-20 14:02:16 +02:00
|
|
|
output->input("Surface")->link && output->input("Displacement")->link;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* finalize */
|
2015-11-20 18:18:27 +05:00
|
|
|
shader->graph->finalize(scene,
|
2017-08-20 14:02:16 +02:00
|
|
|
has_bump,
|
|
|
|
shader->has_integrator_dependency,
|
2020-11-04 11:17:38 +01:00
|
|
|
shader->get_displacement_method() == DISPLACE_BOTH);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
current_shader = shader;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
shader->has_surface = false;
|
|
|
|
shader->has_surface_emission = false;
|
|
|
|
shader->has_surface_transparent = false;
|
2013-04-01 20:26:52 +00:00
|
|
|
shader->has_surface_bssrdf = false;
|
2017-08-20 14:02:16 +02:00
|
|
|
shader->has_bump = has_bump;
|
|
|
|
shader->has_bssrdf_bump = has_bump;
|
2012-11-03 14:32:35 +00:00
|
|
|
shader->has_volume = false;
|
|
|
|
shader->has_displacement = false;
|
2016-02-05 22:13:51 +01:00
|
|
|
shader->has_surface_spatial_varying = false;
|
2016-02-05 21:33:37 +01:00
|
|
|
shader->has_volume_spatial_varying = false;
|
2020-03-07 14:38:52 +01:00
|
|
|
shader->has_volume_attribute_dependency = false;
|
2015-11-20 18:18:27 +05:00
|
|
|
shader->has_integrator_dependency = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* generate surface shader */
|
2021-05-02 02:34:56 +02:00
|
|
|
if (shader->reference_count() && graph && output->input("Surface")->link) {
|
2013-12-08 15:15:27 +01:00
|
|
|
shader->osl_surface_ref = compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-08-20 14:02:16 +02:00
|
|
|
if (has_bump)
|
|
|
|
shader->osl_surface_bump_ref = compile_type(shader, shader->graph, SHADER_TYPE_BUMP);
|
2013-06-28 13:05:21 +00:00
|
|
|
else
|
2016-08-14 11:44:25 -04:00
|
|
|
shader->osl_surface_bump_ref = OSL::ShaderGroupRef();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
shader->has_surface = true;
|
|
|
|
}
|
|
|
|
else {
|
2016-01-07 13:15:30 +05:00
|
|
|
shader->osl_surface_ref = OSL::ShaderGroupRef();
|
|
|
|
shader->osl_surface_bump_ref = OSL::ShaderGroupRef();
|
2012-11-03 14:32:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* generate volume shader */
|
2021-05-02 02:34:56 +02:00
|
|
|
if (shader->reference_count() && graph && output->input("Volume")->link) {
|
2013-12-08 15:15:27 +01:00
|
|
|
shader->osl_volume_ref = compile_type(shader, shader->graph, SHADER_TYPE_VOLUME);
|
2012-11-03 14:32:35 +00:00
|
|
|
shader->has_volume = true;
|
|
|
|
}
|
|
|
|
else
|
2016-01-07 13:15:30 +05:00
|
|
|
shader->osl_volume_ref = OSL::ShaderGroupRef();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
/* generate displacement shader */
|
2021-05-02 02:34:56 +02:00
|
|
|
if (shader->reference_count() && graph && output->input("Displacement")->link) {
|
2013-12-08 15:15:27 +01:00
|
|
|
shader->osl_displacement_ref = compile_type(shader, shader->graph, SHADER_TYPE_DISPLACEMENT);
|
2012-11-03 14:32:35 +00:00
|
|
|
shader->has_displacement = true;
|
|
|
|
}
|
|
|
|
else
|
2016-01-07 13:15:30 +05:00
|
|
|
shader->osl_displacement_ref = OSL::ShaderGroupRef();
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2021-10-21 14:52:34 +02:00
|
|
|
|
|
|
|
/* push state to array for lookup */
|
|
|
|
og->surface_state.push_back(shader->osl_surface_ref);
|
|
|
|
og->volume_state.push_back(shader->osl_volume_ref);
|
|
|
|
og->displacement_state.push_back(shader->osl_displacement_ref);
|
|
|
|
og->bump_state.push_back(shader->osl_surface_bump_ref);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2019-05-02 15:45:31 +02:00
|
|
|
void OSLCompiler::parameter_texture(const char *name, ustring filename, ustring colorspace)
|
2019-05-02 12:40:24 +02:00
|
|
|
{
|
2019-05-02 15:45:31 +02:00
|
|
|
/* Textured loaded through the OpenImageIO texture cache. For this
|
|
|
|
* case we need to do runtime color space conversion. */
|
|
|
|
OSLTextureHandle *handle = new OSLTextureHandle(OSLTextureHandle::OIIO);
|
|
|
|
handle->processor = ColorSpaceManager::get_processor(colorspace);
|
2019-05-14 12:13:43 +02:00
|
|
|
services->textures.insert(filename, handle);
|
2019-05-02 15:45:31 +02:00
|
|
|
parameter(name, filename);
|
|
|
|
}
|
2019-05-02 12:40:24 +02:00
|
|
|
|
2022-05-11 20:11:44 -07:00
|
|
|
void OSLCompiler::parameter_texture(const char *name, const ImageHandle &handle)
|
2019-05-02 15:45:31 +02:00
|
|
|
{
|
|
|
|
/* Texture loaded through SVM image texture system. We generate a unique
|
|
|
|
* name, which ends up being used in OSLRenderServices::get_texture_handle
|
2019-05-14 12:13:43 +02:00
|
|
|
* to get handle again. Note that this name must be unique between multiple
|
|
|
|
* render sessions as the render services are shared. */
|
|
|
|
ustring filename(string_printf("@svm%d", texture_shared_unique_id++).c_str());
|
2022-05-11 20:11:44 -07:00
|
|
|
services->textures.insert(filename,
|
|
|
|
new OSLTextureHandle(OSLTextureHandle::SVM, handle.get_svm_slots()));
|
2019-05-02 12:40:24 +02:00
|
|
|
parameter(name, filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter_texture_ies(const char *name, int svm_slot)
|
|
|
|
{
|
2019-05-02 15:45:31 +02:00
|
|
|
/* IES light textures stored in SVM. */
|
2019-05-14 12:13:43 +02:00
|
|
|
ustring filename(string_printf("@svm%d", texture_shared_unique_id++).c_str());
|
|
|
|
services->textures.insert(filename, new OSLTextureHandle(OSLTextureHandle::IES, svm_slot));
|
2019-05-02 12:40:24 +02:00
|
|
|
parameter(name, filename);
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
#else
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::add(ShaderNode * /*node*/, const char * /*name*/, bool /*isfilepath*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-07 19:48:28 +02:00
|
|
|
void OSLCompiler::parameter(ShaderNode * /*node*/, const char * /*name*/)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter(const char * /*name*/, float /*f*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter_color(const char * /*name*/, float3 /*f*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter_vector(const char * /*name*/, float3 /*f*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter_point(const char * /*name*/, float3 /*f*/)
|
2012-09-15 18:08:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter_normal(const char * /*name*/, float3 /*f*/)
|
2012-09-15 18:08:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter(const char * /*name*/, int /*f*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter(const char * /*name*/, const char * /*s*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter(const char * /*name*/, ustring /*s*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter(const char * /*name*/, const Transform & /*tfm*/)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:09:41 +05:00
|
|
|
void OSLCompiler::parameter_array(const char * /*name*/, const float /*f*/[], int /*arraylen*/)
|
2012-09-15 16:31:11 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-18 09:12:47 +02:00
|
|
|
void OSLCompiler::parameter_color_array(const char * /*name*/, const array<float3> & /*f*/)
|
2012-09-15 16:31:11 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-05-02 12:40:24 +02:00
|
|
|
void OSLCompiler::parameter_texture(const char * /* name */,
|
|
|
|
ustring /* filename */,
|
2019-05-02 15:45:31 +02:00
|
|
|
ustring /* colorspace */)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-05-11 20:11:44 -07:00
|
|
|
void OSLCompiler::parameter_texture(const char * /* name */, const ImageHandle & /*handle*/)
|
2019-05-02 12:40:24 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSLCompiler::parameter_texture_ies(const char * /* name */, int /* svm_slot */)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
#endif /* WITH_OSL */
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|