1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
From 16d44f637e092e86d98eb968b1a0e9e213892f94 Mon Sep 17 00:00:00 2001
From: howetuft <howetuft@gmail.com>
Date: Sun, 3 Mar 2024 21:05:30 +0100
Subject: [PATCH] OSL 01.13.7
---
.../kernel/rendering/rendererservices.cpp | 108 +++++++++---------
.../kernel/rendering/rendererservices.h | 42 +++----
2 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/src/appleseed/renderer/kernel/rendering/rendererservices.cpp b/src/appleseed/renderer/kernel/rendering/rendererservices.cpp
index fcb491ea8..acd56a896 100644
--- a/src/appleseed/renderer/kernel/rendering/rendererservices.cpp
+++ b/src/appleseed/renderer/kernel/rendering/rendererservices.cpp
@@ -99,46 +99,46 @@ RendererServices::RendererServices(
, m_texture_store(nullptr)
{
// Set up attribute getters.
- m_global_attr_getters[OIIO::ustring("object:object_instance_id")] = &RendererServices::get_attr_object_instance_id;
- m_global_attr_getters[OIIO::ustring("object:object_instance_index")] = &RendererServices::get_attr_object_instance_index;
- m_global_attr_getters[OIIO::ustring("object:assembly_instance_id")] = &RendererServices::get_attr_assembly_instance_id;
- m_global_attr_getters[OIIO::ustring("object:assembly_name")] = &RendererServices::get_attr_assembly_name;
- m_global_attr_getters[OIIO::ustring("object:assembly_instance_name")] = &RendererServices::get_attr_assembly_instance_name;
- m_global_attr_getters[OIIO::ustring("object:object_instance_name")] = &RendererServices::get_attr_object_instance_name;
- m_global_attr_getters[OIIO::ustring("object:object_name")] = &RendererServices::get_attr_object_name;
-
- m_global_attr_getters[OIIO::ustring("camera:resolution")] = &RendererServices::get_attr_camera_resolution;
- m_global_attr_getters[OIIO::ustring("camera:projection")] = &RendererServices::get_attr_camera_projection;
- m_global_attr_getters[OIIO::ustring("camera:pixelaspect")] = &RendererServices::get_attr_camera_pixelaspect;
- m_global_attr_getters[OIIO::ustring("camera:screen_window")] = &RendererServices::get_attr_camera_screen_window;
- m_global_attr_getters[OIIO::ustring("camera:fov")] = &RendererServices::get_attr_camera_fov;
- m_global_attr_getters[OIIO::ustring("camera:clip")] = &RendererServices::get_attr_camera_clip;
- m_global_attr_getters[OIIO::ustring("camera:clip_near")] = &RendererServices::get_attr_camera_clip_near;
- m_global_attr_getters[OIIO::ustring("camera:clip_far")] = &RendererServices::get_attr_camera_clip_far;
- m_global_attr_getters[OIIO::ustring("camera:shutter")] = &RendererServices::get_attr_camera_shutter;
- m_global_attr_getters[OIIO::ustring("camera:shutter_open")] = &RendererServices::get_attr_camera_shutter_open;
- m_global_attr_getters[OIIO::ustring("camera:shutter_close")] = &RendererServices::get_attr_camera_shutter_close;
-
- m_global_attr_getters[OIIO::ustring("path:ray_depth")] = &RendererServices::get_attr_ray_depth;
- m_global_attr_getters[OIIO::ustring("path:ray_length")] = &RendererServices::get_attr_ray_length;
- m_global_attr_getters[OIIO::ustring("path:ray_ior")] = &RendererServices::get_attr_ray_ior;
- m_global_attr_getters[OIIO::ustring("path:ray_has_differentials")] = &RendererServices::get_attr_ray_has_differentials;
-
- m_global_attr_getters[OIIO::ustring("surface_shader:diffuse")] = &RendererServices::get_attr_surface_shader_diffuse;
- m_global_attr_getters[OIIO::ustring("surface_shader:glossy")] = &RendererServices::get_attr_surface_shader_glossy;
- m_global_attr_getters[OIIO::ustring("surface_shader:emission")] = &RendererServices::get_attr_surface_shader_emission;
-
- m_global_attr_getters[OIIO::ustring("appleseed:version_major")] = &RendererServices::get_attr_appleseed_version_major;
- m_global_attr_getters[OIIO::ustring("appleseed:version_minor")] = &RendererServices::get_attr_appleseed_version_minor;
- m_global_attr_getters[OIIO::ustring("appleseed:version_patch")] = &RendererServices::get_attr_appleseed_version_patch;
- m_global_attr_getters[OIIO::ustring("appleseed:version")] = &RendererServices::get_attr_appleseed_version;
+ m_global_attr_getters[OIIO::ustringhash("object:object_instance_id")] = &RendererServices::get_attr_object_instance_id;
+ m_global_attr_getters[OIIO::ustringhash("object:object_instance_index")] = &RendererServices::get_attr_object_instance_index;
+ m_global_attr_getters[OIIO::ustringhash("object:assembly_instance_id")] = &RendererServices::get_attr_assembly_instance_id;
+ m_global_attr_getters[OIIO::ustringhash("object:assembly_name")] = &RendererServices::get_attr_assembly_name;
+ m_global_attr_getters[OIIO::ustringhash("object:assembly_instance_name")] = &RendererServices::get_attr_assembly_instance_name;
+ m_global_attr_getters[OIIO::ustringhash("object:object_instance_name")] = &RendererServices::get_attr_object_instance_name;
+ m_global_attr_getters[OIIO::ustringhash("object:object_name")] = &RendererServices::get_attr_object_name;
+
+ m_global_attr_getters[OIIO::ustringhash("camera:resolution")] = &RendererServices::get_attr_camera_resolution;
+ m_global_attr_getters[OIIO::ustringhash("camera:projection")] = &RendererServices::get_attr_camera_projection;
+ m_global_attr_getters[OIIO::ustringhash("camera:pixelaspect")] = &RendererServices::get_attr_camera_pixelaspect;
+ m_global_attr_getters[OIIO::ustringhash("camera:screen_window")] = &RendererServices::get_attr_camera_screen_window;
+ m_global_attr_getters[OIIO::ustringhash("camera:fov")] = &RendererServices::get_attr_camera_fov;
+ m_global_attr_getters[OIIO::ustringhash("camera:clip")] = &RendererServices::get_attr_camera_clip;
+ m_global_attr_getters[OIIO::ustringhash("camera:clip_near")] = &RendererServices::get_attr_camera_clip_near;
+ m_global_attr_getters[OIIO::ustringhash("camera:clip_far")] = &RendererServices::get_attr_camera_clip_far;
+ m_global_attr_getters[OIIO::ustringhash("camera:shutter")] = &RendererServices::get_attr_camera_shutter;
+ m_global_attr_getters[OIIO::ustringhash("camera:shutter_open")] = &RendererServices::get_attr_camera_shutter_open;
+ m_global_attr_getters[OIIO::ustringhash("camera:shutter_close")] = &RendererServices::get_attr_camera_shutter_close;
+
+ m_global_attr_getters[OIIO::ustringhash("path:ray_depth")] = &RendererServices::get_attr_ray_depth;
+ m_global_attr_getters[OIIO::ustringhash("path:ray_length")] = &RendererServices::get_attr_ray_length;
+ m_global_attr_getters[OIIO::ustringhash("path:ray_ior")] = &RendererServices::get_attr_ray_ior;
+ m_global_attr_getters[OIIO::ustringhash("path:ray_has_differentials")] = &RendererServices::get_attr_ray_has_differentials;
+
+ m_global_attr_getters[OIIO::ustringhash("surface_shader:diffuse")] = &RendererServices::get_attr_surface_shader_diffuse;
+ m_global_attr_getters[OIIO::ustringhash("surface_shader:glossy")] = &RendererServices::get_attr_surface_shader_glossy;
+ m_global_attr_getters[OIIO::ustringhash("surface_shader:emission")] = &RendererServices::get_attr_surface_shader_emission;
+
+ m_global_attr_getters[OIIO::ustringhash("appleseed:version_major")] = &RendererServices::get_attr_appleseed_version_major;
+ m_global_attr_getters[OIIO::ustringhash("appleseed:version_minor")] = &RendererServices::get_attr_appleseed_version_minor;
+ m_global_attr_getters[OIIO::ustringhash("appleseed:version_patch")] = &RendererServices::get_attr_appleseed_version_patch;
+ m_global_attr_getters[OIIO::ustringhash("appleseed:version")] = &RendererServices::get_attr_appleseed_version;
// Set up user data getters.
- m_global_user_data_getters[OIIO::ustring("Tn")] = &RendererServices::get_user_data_tn;
- m_global_user_data_getters[OIIO::ustring("Bn")] = &RendererServices::get_user_data_bn;
- m_global_user_data_getters[OIIO::ustring("dNdu")] = &RendererServices::get_user_data_dndu;
- m_global_user_data_getters[OIIO::ustring("dNdv")] = &RendererServices::get_user_data_dndv;
- m_global_user_data_getters[OIIO::ustring("vertex_color")] = &RendererServices::get_user_data_vertex_color;
+ m_global_user_data_getters[OIIO::ustringhash("Tn")] = &RendererServices::get_user_data_tn;
+ m_global_user_data_getters[OIIO::ustringhash("Bn")] = &RendererServices::get_user_data_bn;
+ m_global_user_data_getters[OIIO::ustringhash("dNdu")] = &RendererServices::get_user_data_dndu;
+ m_global_user_data_getters[OIIO::ustringhash("dNdv")] = &RendererServices::get_user_data_dndv;
+ m_global_user_data_getters[OIIO::ustringhash("vertex_color")] = &RendererServices::get_user_data_vertex_color;
}
void RendererServices::initialize(TextureStore& texture_store)
@@ -240,7 +240,7 @@ bool RendererServices::get_inverse_matrix(
bool RendererServices::get_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OIIO::ustring from,
+ OIIO::ustringhash from,
float time)
{
if (from == g_camera_ustr)
@@ -258,7 +258,7 @@ bool RendererServices::get_matrix(
bool RendererServices::get_inverse_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OSL::ustring to,
+ OSL::ustringhash to,
float time)
{
if (to == g_camera_ustr)
@@ -280,7 +280,7 @@ bool RendererServices::get_inverse_matrix(
bool RendererServices::get_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OIIO::ustring from)
+ OIIO::ustringhash from)
{
if (from == g_camera_ustr)
{
@@ -299,7 +299,7 @@ bool RendererServices::get_matrix(
bool RendererServices::get_inverse_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OSL::ustring to)
+ OSL::ustringhash to)
{
if (to == g_camera_ustr)
{
@@ -340,8 +340,8 @@ namespace
bool RendererServices::transform_points(
OSL::ShaderGlobals* sg,
- OSL::ustring from,
- OSL::ustring to,
+ OSL::ustringhash from,
+ OSL::ustringhash to,
float time,
const OSL::Vec3* Pin,
OSL::Vec3* Pout,
@@ -515,8 +515,8 @@ bool RendererServices::trace(
bool RendererServices::getmessage(
OSL::ShaderGlobals* sg,
- OIIO::ustring source,
- OIIO::ustring name,
+ OIIO::ustringhash source,
+ OIIO::ustringhash name,
OIIO::TypeDesc type,
void* val,
bool derivatives)
@@ -559,9 +559,9 @@ bool RendererServices::getmessage(
bool RendererServices::get_attribute(
OSL::ShaderGlobals* sg,
bool derivatives,
- OIIO::ustring object,
+ OIIO::ustringhash object,
OIIO::TypeDesc type,
- OIIO::ustring name,
+ OIIO::ustringhash name,
void* val)
{
// We don't support getting attributes from named objects, yet.
@@ -586,9 +586,9 @@ bool RendererServices::get_attribute(
bool RendererServices::get_array_attribute(
OSL::ShaderGlobals* sg,
bool derivatives,
- OIIO::ustring object,
+ OIIO::ustringhash object,
OIIO::TypeDesc type,
- OIIO::ustring name,
+ OIIO::ustringhash name,
int index,
void* val)
{
@@ -597,7 +597,7 @@ bool RendererServices::get_array_attribute(
bool RendererServices::get_userdata(
bool derivatives,
- OIIO::ustring name,
+ OIIO::ustringhash name,
OIIO::TypeDesc type,
OSL::ShaderGlobals* sg,
void* val)
@@ -616,9 +616,9 @@ bool RendererServices::get_userdata(
bool RendererServices::get_attr_##name( \
OSL::ShaderGlobals* sg, \
bool derivs, \
- OIIO::ustring object, \
+ OIIO::ustringhash object, \
OIIO::TypeDesc type, \
- OIIO::ustring name, \
+ OIIO::ustringhash name, \
void* val) const
IMPLEMENT_ATTR_GETTER(object_instance_id)
@@ -1108,7 +1108,7 @@ IMPLEMENT_ATTR_GETTER(appleseed_version)
#define IMPLEMENT_USER_DATA_GETTER(name) \
bool RendererServices::get_user_data_##name( \
bool derivatives, \
- OIIO::ustring name, \
+ OIIO::ustringhash name, \
OIIO::TypeDesc type, \
OSL::ShaderGlobals* sg, \
void* val) const
diff --git a/src/appleseed/renderer/kernel/rendering/rendererservices.h b/src/appleseed/renderer/kernel/rendering/rendererservices.h
index 2bde0746a..4710a7e0e 100644
--- a/src/appleseed/renderer/kernel/rendering/rendererservices.h
+++ b/src/appleseed/renderer/kernel/rendering/rendererservices.h
@@ -123,7 +123,7 @@ class RendererServices
bool get_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OIIO::ustring from,
+ OIIO::ustringhash from,
float time) override;
// Get the 4x4 matrix that transforms points from "common" space to
@@ -134,7 +134,7 @@ class RendererServices
bool get_inverse_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OSL::ustring to,
+ OSL::ustringhash to,
float time) override;
// Get the 4x4 matrix that transforms 'from' to "common" space.
@@ -144,7 +144,7 @@ class RendererServices
bool get_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OIIO::ustring from) override;
+ OIIO::ustringhash from) override;
// Get the 4x4 matrix that transforms points from "common" space to
// the named 'to' coordinate system. Since there is no time value
@@ -156,7 +156,7 @@ class RendererServices
bool get_inverse_matrix(
OSL::ShaderGlobals* sg,
OSL::Matrix44& result,
- OSL::ustring to) override;
+ OSL::ustringhash to) override;
// Transform points Pin[0..npoints-1] in named coordinate system
// 'from' into 'to' coordinates, storing the result in Pout[] using
@@ -183,8 +183,8 @@ class RendererServices
// two spaces.
bool transform_points(
OSL::ShaderGlobals* sg,
- OSL::ustring from,
- OSL::ustring to,
+ OSL::ustringhash from,
+ OSL::ustringhash to,
float time,
const OSL::Vec3* Pin,
OSL::Vec3* Pout,
@@ -208,8 +208,8 @@ class RendererServices
// called for "sourced" messages, not ordinary intra-group messages.
bool getmessage(
OSL::ShaderGlobals* sg,
- OIIO::ustring source,
- OIIO::ustring name,
+ OIIO::ustringhash source,
+ OIIO::ustringhash name,
OIIO::TypeDesc type,
void* val,
bool derivatives) override;
@@ -229,9 +229,9 @@ class RendererServices
bool get_attribute(
OSL::ShaderGlobals* sg,
bool derivatives,
- OIIO::ustring object,
+ OIIO::ustringhash object,
OIIO::TypeDesc type,
- OIIO::ustring name,
+ OIIO::ustringhash name,
void* val) override;
// Similar to get_attribute(); this method will return the 'index'
@@ -239,9 +239,9 @@ class RendererServices
bool get_array_attribute(
OSL::ShaderGlobals* sg,
bool derivatives,
- OIIO::ustring object,
+ OIIO::ustringhash object,
OIIO::TypeDesc type,
- OIIO::ustring name,
+ OIIO::ustringhash name,
int index,
void* val) override;
@@ -250,7 +250,7 @@ class RendererServices
// as well. Return false if no user-data with the given name and type was found.
bool get_userdata(
bool derivatives,
- OIIO::ustring name,
+ OIIO::ustringhash name,
OIIO::TypeDesc type,
OSL::ShaderGlobals* sg,
void* val) override;
@@ -260,21 +260,21 @@ class RendererServices
typedef bool (RendererServices::*AttrGetterFun)(
OSL::ShaderGlobals* sg,
bool derivs,
- OIIO::ustring object,
+ OIIO::ustringhash object,
OIIO::TypeDesc type,
- OIIO::ustring name,
+ OIIO::ustringhash name,
void* val) const;
- typedef std::unordered_map<OIIO::ustring, AttrGetterFun, OIIO::ustringHash> AttrGetterMapType;
+ typedef std::unordered_map<OIIO::ustringhash, AttrGetterFun> AttrGetterMapType;
typedef bool (RendererServices::*UserDataGetterFun)(
bool derivatives,
- OIIO::ustring name,
+ OIIO::ustringhash name,
OIIO::TypeDesc type,
OSL::ShaderGlobals* sg,
void* val) const;
- typedef std::unordered_map<OIIO::ustring, UserDataGetterFun, OIIO::ustringHash> UserDataGetterMapType;
+ typedef std::unordered_map<OIIO::ustringhash, UserDataGetterFun> UserDataGetterMapType;
OIIO::TextureSystem& m_texture_sys;
AttrGetterMapType m_global_attr_getters;
@@ -291,9 +291,9 @@ class RendererServices
bool get_attr_##name( \
OSL::ShaderGlobals* sg, \
bool derivs, \
- OIIO::ustring object, \
+ OIIO::ustringhash object, \
OIIO::TypeDesc type, \
- OIIO::ustring name, \
+ OIIO::ustringhash name, \
void* val) const
// Object attributes.
@@ -340,7 +340,7 @@ class RendererServices
#define DECLARE_USER_DATA_GETTER(name) \
bool get_user_data_##name( \
bool derivatives,\
- OIIO::ustring name, \
+ OIIO::ustringhash name, \
OIIO::TypeDesc type, \
OSL::ShaderGlobals* sg, \
void* val) const
--
2.44.0
|