Blender V5.3
strings.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2010 Sony Pictures Imageworks Inc., et al. All Rights Reserved.
2 * SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Adapted code from Open Shading Language. */
7
8#pragma once
9
10#include "kernel/osl/types.h"
11
12#ifndef __KERNEL_GPU__
13# include "util/param.h"
14#endif
15
17
18/* On CPU this is ustring (interned string pointer) and on GPU this is the hash.
19 *
20 * We don't use OSL headers for GPU, so can't rely on the constexpr to compute the hash
21 * and need to hard-code it. The static assert checks it's correct and also shows the
22 * value in the error message for adding new entries. */
23#ifdef __KERNEL_GPU__
24# define OSL_DEVICE_STRING(name, str, hash) ccl_device_constant DeviceString name = hash;
25#else
26# define OSL_DEVICE_STRING(name, str, hash) \
27 static ustring name(str); \
28 static_assert(OIIO::Strutil::strhash(str) == hash);
29#endif
30
31namespace DeviceStrings {
32
33OSL_DEVICE_STRING(u_empty, "", 0ull)
34
35OSL_DEVICE_STRING(u_common, "common", 14645198576927606093ull)
36OSL_DEVICE_STRING(u_world, "world", 16436542438370751598ull)
37OSL_DEVICE_STRING(u_shader, "shader", 4279676006089868ull)
38OSL_DEVICE_STRING(u_object, "object", 973692718279674627ull)
39OSL_DEVICE_STRING(u_ndc, "NDC", 5148305047403260775ull)
40OSL_DEVICE_STRING(u_screen, "screen", 14159088609039777114ull)
41OSL_DEVICE_STRING(u_camera, "camera", 2159505832145726196ull)
42OSL_DEVICE_STRING(u_raster, "raster", 7759263238610201778ull)
43
44OSL_DEVICE_STRING(u_colorsystem, "colorsystem", 1390623632464445670ull)
45
46OSL_DEVICE_STRING(u_object_location, "object:location", 7846190347358762897ull)
47OSL_DEVICE_STRING(u_object_color, "object:color", 12695623857059169556ull)
48OSL_DEVICE_STRING(u_object_alpha, "object:alpha", 11165053919428293151ull)
49OSL_DEVICE_STRING(u_object_index, "object:index", 6588325838217472556ull)
50OSL_DEVICE_STRING(u_object_is_light, "object:is_light", 13979755312845091842ull)
51OSL_DEVICE_STRING(u_object_random, "object:random", 15789063994977955884ull)
52
53OSL_DEVICE_STRING(u_material_index, "material:index", 741770758159634623ull)
54
55OSL_DEVICE_STRING(u_particle_index, "particle:index", 9489711748229903784ull)
56OSL_DEVICE_STRING(u_particle_random, "particle:random", 17993722202766855761ull)
57OSL_DEVICE_STRING(u_particle_age, "particle:age", 7380730644710951109ull)
58OSL_DEVICE_STRING(u_particle_lifetime, "particle:lifetime", 16576828923156200061ull)
59OSL_DEVICE_STRING(u_particle_location, "particle:location", 10309536211423573010ull)
60OSL_DEVICE_STRING(u_particle_rotation, "particle:rotation", 17858543768041168459ull)
61OSL_DEVICE_STRING(u_particle_size, "particle:size", 16461524249715420389ull)
62OSL_DEVICE_STRING(u_particle_velocity, "particle:velocity", 13199101248768308863ull)
63OSL_DEVICE_STRING(u_particle_angular_velocity,
64 "particle:angular_velocity",
65 16327930120486517910ull)
66
67OSL_DEVICE_STRING(u_bump_map_normal, "geom:bump_map_normal", 9592102745179132106ull)
68OSL_DEVICE_STRING(u_curve_length, "geom:curve_length", 11423459517663715453ull)
69OSL_DEVICE_STRING(u_curve_random, "geom:curve_random", 15293085049960492358ull)
70OSL_DEVICE_STRING(u_curve_tangent_normal, "geom:curve_tangent_normal", 12301397394034985633ull)
71OSL_DEVICE_STRING(u_curve_thickness, "geom:curve_thickness", 10605802038397633852ull)
72OSL_DEVICE_STRING(u_geom_dupli_generated, "geom:dupli_generated", 6715607178003388908ull)
73OSL_DEVICE_STRING(u_geom_dupli_uv, "geom:dupli_uv", 1294253317490155849ull)
74OSL_DEVICE_STRING(u_geom_name, "geom:name", 13606338128269760050ull)
75OSL_DEVICE_STRING(u_geom_numpolyvertices, "geom:numpolyvertices", 382043551489988826ull)
76OSL_DEVICE_STRING(u_geom_polyvertices, "geom:polyvertices", 1345577201967881769ull)
77OSL_DEVICE_STRING(u_geom_trianglevertices, "geom:trianglevertices", 17839267571524187074ull)
78OSL_DEVICE_STRING(u_geom_undisplaced, "geom:undisplaced", 12431586303019276305ull)
79OSL_DEVICE_STRING(u_geom_radiance, "geom:radiance", 14074080478119832841ull)
80OSL_DEVICE_STRING(u_is_curve, "geom:is_curve", 129742495633653138ull)
81OSL_DEVICE_STRING(u_is_point, "geom:is_point", 2511357849436175953ull)
82OSL_DEVICE_STRING(u_is_smooth, "geom:is_smooth", 857544214094480123ull)
83OSL_DEVICE_STRING(u_normal_map_normal, "geom:normal_map_normal", 10718948685686827073ull)
84OSL_DEVICE_STRING(u_point_position, "geom:point_position", 15684484280742966916ull)
85OSL_DEVICE_STRING(u_point_radius, "geom:point_radius", 9956381140398668479ull)
86OSL_DEVICE_STRING(u_point_random, "geom:point_random", 5632627207092325544ull)
87
88OSL_DEVICE_STRING(u_path_ray_length, "path:ray_length", 16391985802412544524ull)
89OSL_DEVICE_STRING(u_path_ray_depth, "path:ray_depth", 16643933224879500399ull)
90OSL_DEVICE_STRING(u_path_diffuse_depth, "path:diffuse_depth", 13191651286699118408ull)
91OSL_DEVICE_STRING(u_path_glossy_depth, "path:glossy_depth", 15717768399057252940ull)
92OSL_DEVICE_STRING(u_path_transparent_depth, "path:transparent_depth", 7821650266475578543ull)
93OSL_DEVICE_STRING(u_path_transmission_depth, "path:transmission_depth", 15113408892323917624ull)
94OSL_DEVICE_STRING(u_path_portal_depth, "path:portal_depth", 12594534445945123289ull)
95
96OSL_DEVICE_STRING(u_sensor_size, "cam:sensor_size", 7525693591727141378ull)
97OSL_DEVICE_STRING(u_image_resolution, "cam:image_resolution", 5199143367706113607ull)
98OSL_DEVICE_STRING(u_aperture_aspect_ratio, "cam:aperture_aspect_ratio", 8708221138893210943ull)
99OSL_DEVICE_STRING(u_aperture_size, "cam:aperture_size", 3708482920470008383ull)
100OSL_DEVICE_STRING(u_aperture_position, "cam:aperture_position", 12926784411960338650ull)
101OSL_DEVICE_STRING(u_focal_distance, "cam:focal_distance", 7162995161881858159ull)
102
103OSL_DEVICE_STRING(u_resolution, "resolution", 2307859618413965908ull)
104OSL_DEVICE_STRING(u_channels, "channels", 12748693449878651001ull)
105OSL_DEVICE_STRING(u_format, "format", 17018903787179094860ull)
106OSL_DEVICE_STRING(u_fileformat, "fileformat", 4858431823914058665ull)
107OSL_DEVICE_STRING(u_colorspace, "colorspace", 8710743381164964946ull)
108OSL_DEVICE_STRING(u_exists, "exists", 11446133498368803600ull)
109OSL_DEVICE_STRING(u_averagecolor, "averagecolor", 3004396188475227877ull)
110
111OSL_DEVICE_STRING(u_distance, "distance", 5661183123366514158ull)
112OSL_DEVICE_STRING(u_index, "index", 15907549540151602841ull)
113OSL_DEVICE_STRING(u_trace, "trace", 13264932728578201327ull)
114OSL_DEVICE_STRING(u_traceset_only_local, "__only_local__", 12891670648956128852ull)
115OSL_DEVICE_STRING(u_traceset_raycast, "__raycast__", 2367107625979882517ull)
116OSL_DEVICE_STRING(u_hit, "hit", 7529033939518063282ull)
117OSL_DEVICE_STRING(u_hitdist, "hitdist", 17066342024105335641ull)
118OSL_DEVICE_STRING(u_hitself, "hitself", 12209754783026028319ull)
119OSL_DEVICE_STRING(u_N, "N", 4171503098073482778ull)
120OSL_DEVICE_STRING(u_Ng, "Ng", 8876595286590780628ull)
121OSL_DEVICE_STRING(u_P, "P", 6583699458582498608ull)
122OSL_DEVICE_STRING(u_I, "I", 939471844073562180ull)
123OSL_DEVICE_STRING(u_u, "u", 24377992418299859ull)
124OSL_DEVICE_STRING(u_v, "v", 5318568133543929321ull)
125
126OSL_DEVICE_STRING(u_scene_time, "scene:time", 18068208390528818485ull)
127OSL_DEVICE_STRING(u_scene_frame, "scene:frame", 4156453089429035495ull)
128
129} // namespace DeviceStrings
130
131#undef OSL_DEVICE_STRING
132
#define CCL_NAMESPACE_END
#define OSL_DEVICE_STRING(name, str, hash)
Definition strings.h:26