Cycles: Add support for bindless textures.
[blender.git] / intern / cycles / kernel / kernel_textures.h
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef KERNEL_TEX
18 #  define KERNEL_TEX(type, ttype, name)
19 #endif
20
21 #ifndef KERNEL_IMAGE_TEX
22 #  define KERNEL_IMAGE_TEX(type, ttype, name)
23 #endif
24
25 /* bvh */
26 KERNEL_TEX(float4, texture_float4, __bvh_nodes)
27 KERNEL_TEX(float4, texture_float4, __bvh_leaf_nodes)
28 KERNEL_TEX(float4, texture_float4, __tri_storage)
29 KERNEL_TEX(uint, texture_uint, __prim_type)
30 KERNEL_TEX(uint, texture_uint, __prim_visibility)
31 KERNEL_TEX(uint, texture_uint, __prim_index)
32 KERNEL_TEX(uint, texture_uint, __prim_object)
33 KERNEL_TEX(uint, texture_uint, __object_node)
34
35 /* objects */
36 KERNEL_TEX(float4, texture_float4, __objects)
37 KERNEL_TEX(float4, texture_float4, __objects_vector)
38
39 /* triangles */
40 KERNEL_TEX(uint, texture_uint, __tri_shader)
41 KERNEL_TEX(float4, texture_float4, __tri_vnormal)
42 KERNEL_TEX(float4, texture_float4, __tri_vindex)
43 KERNEL_TEX(float4, texture_float4, __tri_verts)
44
45 /* curves */
46 KERNEL_TEX(float4, texture_float4, __curves)
47 KERNEL_TEX(float4, texture_float4, __curve_keys)
48
49 /* attributes */
50 KERNEL_TEX(uint4, texture_uint4, __attributes_map)
51 KERNEL_TEX(float, texture_float, __attributes_float)
52 KERNEL_TEX(float4, texture_float4, __attributes_float3)
53 KERNEL_TEX(uchar4, texture_uchar4, __attributes_uchar4)
54
55 /* lights */
56 KERNEL_TEX(float4, texture_float4, __light_distribution)
57 KERNEL_TEX(float4, texture_float4, __light_data)
58 KERNEL_TEX(float2, texture_float2, __light_background_marginal_cdf)
59 KERNEL_TEX(float2, texture_float2, __light_background_conditional_cdf)
60
61 /* particles */
62 KERNEL_TEX(float4, texture_float4, __particles)
63
64 /* shaders */
65 KERNEL_TEX(uint4, texture_uint4, __svm_nodes)
66 KERNEL_TEX(uint, texture_uint, __shader_flag)
67 KERNEL_TEX(uint, texture_uint, __object_flag)
68
69 /* lookup tables */
70 KERNEL_TEX(float, texture_float, __lookup_table)
71
72 /* sobol */
73 KERNEL_TEX(uint, texture_uint, __sobol_directions)
74
75 #ifdef __KERNEL_CUDA__
76 #  if __CUDA_ARCH__ < 300
77 /* full-float image */
78 KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float4_000)
79 KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float4_001)
80 KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float4_002)
81 KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float4_003)
82 KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float4_004)
83
84 KERNEL_IMAGE_TEX(float4, texture_image3d_float4, __tex_image_float4_3d_000)
85 KERNEL_IMAGE_TEX(float4, texture_image3d_float4, __tex_image_float4_3d_001)
86 KERNEL_IMAGE_TEX(float4, texture_image3d_float4, __tex_image_float4_3d_002)
87 KERNEL_IMAGE_TEX(float4, texture_image3d_float4, __tex_image_float4_3d_003)
88 KERNEL_IMAGE_TEX(float4, texture_image3d_float4, __tex_image_float4_3d_004)
89
90 /* image */
91 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_005)
92 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_006)
93 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_007)
94 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_008)
95 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_009)
96 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_010)
97 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_011)
98 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_012)
99 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_013)
100 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_014)
101 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_015)
102 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_016)
103 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_017)
104 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_018)
105 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_019)
106 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_020)
107 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_021)
108 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_022)
109 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_023)
110 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_024)
111 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_025)
112 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_026)
113 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_027)
114 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_028)
115 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_029)
116 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_030)
117 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_031)
118 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_032)
119 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_033)
120 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_034)
121 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_035)
122 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_036)
123 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_037)
124 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_038)
125 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_039)
126 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_040)
127 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_041)
128 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_042)
129 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_043)
130 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_044)
131 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_045)
132 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_046)
133 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_047)
134 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_048)
135 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_049)
136 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_050)
137 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_051)
138 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_052)
139 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_053)
140 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_054)
141 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_055)
142 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_056)
143 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_057)
144 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_058)
145 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_059)
146 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_060)
147 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_061)
148 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_062)
149 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_063)
150 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_064)
151 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_065)
152 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_066)
153 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_067)
154 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_068)
155 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_069)
156 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_070)
157 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_071)
158 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_072)
159 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_073)
160 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_074)
161 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_075)
162 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_076)
163 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_077)
164 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_078)
165 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_079)
166 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_080)
167 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_081)
168 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_082)
169 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_083)
170 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_084)
171 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_085)
172 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_086)
173 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_087)
174 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_088)
175 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_089)
176 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_090)
177 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_091)
178 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_byte4_092)
179
180 #  else
181 /* bindless textures */
182 KERNEL_TEX(uint, texture_uint, __bindless_mapping)
183 #  endif
184 #endif
185
186 /* packed image (opencl) */
187 KERNEL_TEX(uchar4, texture_uchar4, __tex_image_byte4_packed)
188 KERNEL_TEX(float4, texture_float4, __tex_image_float4_packed)
189 KERNEL_TEX(uint4, texture_uint4, __tex_image_packed_info)
190
191 #undef KERNEL_TEX
192 #undef KERNEL_IMAGE_TEX
193
194