@@ -91,7 +91,7 @@ namespace RadeonRays
91
91
92
92
IntersectorLDS::IntersectorLDS (Calc::Device *device)
93
93
: Intersector(device)
94
- , m_gpuData (new GpuData(device))
94
+ , m_gpudata (new GpuData(device))
95
95
{
96
96
std::string buildopts;
97
97
#ifdef RR_RAY_MASK
@@ -108,49 +108,49 @@ namespace RadeonRays
108
108
109
109
int numheaders = sizeof (headers) / sizeof (const char *);
110
110
111
- m_gpuData ->bvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/CL/intersect_bvh2_lds.cl" , headers, numheaders, buildopts.c_str ());
112
- m_gpuData ->qbvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/CL/intersect_bvh2_lds_fp16.cl" , headers, numheaders, buildopts.c_str ());
111
+ m_gpudata ->bvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/CL/intersect_bvh2_lds.cl" , headers, numheaders, buildopts.c_str ());
112
+ m_gpudata ->qbvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/CL/intersect_bvh2_lds_fp16.cl" , headers, numheaders, buildopts.c_str ());
113
113
}
114
114
else
115
115
{
116
116
assert (device->GetPlatform () == Calc::Platform::kVulkan );
117
- m_gpuData ->bvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/GLSL/bvh2.comp" , nullptr , 0 , buildopts.c_str ());
118
- m_gpuData ->qbvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/GLSL/bvh2_fp16.comp" , nullptr , 0 , buildopts.c_str ());
117
+ m_gpudata ->bvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/GLSL/bvh2.comp" , nullptr , 0 , buildopts.c_str ());
118
+ m_gpudata ->qbvh_prog .executable = m_device->CompileExecutable (" ../RadeonRays/src/kernels/GLSL/bvh2_fp16.comp" , nullptr , 0 , buildopts.c_str ());
119
119
}
120
120
#else
121
121
#if USE_OPENCL
122
122
if (device->GetPlatform () == Calc::Platform::kOpenCL )
123
123
{
124
- m_gpuData ->bvh_prog .executable = m_device->CompileExecutable (g_intersect_bvh2_lds_opencl, std::strlen (g_intersect_bvh2_lds_opencl), buildopts.c_str ());
125
- m_gpuData ->qbvh_prog .executable = m_device->CompileExecutable (g_intersect_bvh2_lds_fp16_opencl, std::strlen (g_intersect_bvh2_lds_fp16_opencl), buildopts.c_str ());
124
+ m_gpudata ->bvh_prog .executable = m_device->CompileExecutable (g_intersect_bvh2_lds_opencl, std::strlen (g_intersect_bvh2_lds_opencl), buildopts.c_str ());
125
+ m_gpudata ->qbvh_prog .executable = m_device->CompileExecutable (g_intersect_bvh2_lds_fp16_opencl, std::strlen (g_intersect_bvh2_lds_fp16_opencl), buildopts.c_str ());
126
126
}
127
127
#endif
128
128
#if USE_VULKAN
129
129
if (device->GetPlatform () == Calc::Platform::kVulkan )
130
130
{
131
- if (m_gpuData ->bvh_prog .executable == nullptr )
132
- m_gpuData ->bvh_prog .executable = m_device->CompileExecutable (g_bvh2_vulkan, std::strlen (g_bvh2_vulkan), buildopts.c_str ());
133
- if (m_gpuData ->qbvh_prog .executable == nullptr )
134
- m_gpuData ->qbvh_prog .executable = m_device->CompileExecutable (g_bvh2_fp16_vulkan, std::strlen (g_bvh2_fp16_vulkan), buildopts.c_str ());
131
+ if (m_gpudata ->bvh_prog .executable == nullptr )
132
+ m_gpudata ->bvh_prog .executable = m_device->CompileExecutable (g_bvh2_vulkan, std::strlen (g_bvh2_vulkan), buildopts.c_str ());
133
+ if (m_gpudata ->qbvh_prog .executable == nullptr )
134
+ m_gpudata ->qbvh_prog .executable = m_device->CompileExecutable (g_bvh2_fp16_vulkan, std::strlen (g_bvh2_fp16_vulkan), buildopts.c_str ());
135
135
}
136
136
#endif
137
137
#endif
138
138
139
- m_gpuData ->bvh_prog .isect_func = m_gpuData ->bvh_prog .executable ->CreateFunction (" intersect_main" );
140
- m_gpuData ->qbvh_prog .isect_func = m_gpuData ->qbvh_prog .executable ->CreateFunction (" intersect_main" );
141
- m_gpuData ->bvh_prog .occlude_func = m_gpuData ->bvh_prog .executable ->CreateFunction (" occluded_main" );
142
- m_gpuData ->qbvh_prog .occlude_func = m_gpuData ->qbvh_prog .executable ->CreateFunction (" occluded_main" );
139
+ m_gpudata ->bvh_prog .isect_func = m_gpudata ->bvh_prog .executable ->CreateFunction (" intersect_main" );
140
+ m_gpudata ->qbvh_prog .isect_func = m_gpudata ->qbvh_prog .executable ->CreateFunction (" intersect_main" );
141
+ m_gpudata ->bvh_prog .occlude_func = m_gpudata ->bvh_prog .executable ->CreateFunction (" occluded_main" );
142
+ m_gpudata ->qbvh_prog .occlude_func = m_gpudata ->qbvh_prog .executable ->CreateFunction (" occluded_main" );
143
143
}
144
144
145
145
void IntersectorLDS::Process (const World &world)
146
146
{
147
147
// If something has been changed we need to rebuild BVH
148
- if (!m_gpuData ->bvh || world.has_changed () || world.GetStateChange () != ShapeImpl::kStateChangeNone )
148
+ if (!m_gpudata ->bvh || world.has_changed () || world.GetStateChange () != ShapeImpl::kStateChangeNone )
149
149
{
150
150
// Free previous data
151
- if (m_gpuData ->bvh )
151
+ if (m_gpudata ->bvh )
152
152
{
153
- m_device->DeleteBuffer (m_gpuData ->bvh );
153
+ m_device->DeleteBuffer (m_gpudata ->bvh );
154
154
}
155
155
156
156
// Look up build options for world
@@ -183,13 +183,13 @@ namespace RadeonRays
183
183
if (!use_qbvh)
184
184
{
185
185
auto bvh_size_in_bytes = bvh.GetSizeInBytes ();
186
- m_gpuData ->bvh = m_device->CreateBuffer (bvh_size_in_bytes, Calc::BufferType::kRead );
186
+ m_gpudata ->bvh = m_device->CreateBuffer (bvh_size_in_bytes, Calc::BufferType::kRead );
187
187
188
188
// Get the pointer to mapped data
189
189
Calc::Event *e = nullptr ;
190
190
Bvh2::Node *bvhdata = nullptr ;
191
191
192
- m_device->MapBuffer (m_gpuData ->bvh , 0 , 0 , bvh_size_in_bytes, Calc::MapType::kMapWrite , (void **)&bvhdata, &e);
192
+ m_device->MapBuffer (m_gpudata ->bvh , 0 , 0 , bvh_size_in_bytes, Calc::MapType::kMapWrite , (void **)&bvhdata, &e);
193
193
194
194
e->Wait ();
195
195
m_device->DeleteEvent (e);
@@ -199,13 +199,13 @@ namespace RadeonRays
199
199
bvhdata[i] = bvh.m_nodes [i];
200
200
201
201
// Unmap gpu data
202
- m_device->UnmapBuffer (m_gpuData ->bvh , 0 , bvhdata, &e);
202
+ m_device->UnmapBuffer (m_gpudata ->bvh , 0 , bvhdata, &e);
203
203
204
204
e->Wait ();
205
205
m_device->DeleteEvent (e);
206
206
207
207
// Select intersection program
208
- m_gpuData ->prog = &m_gpuData ->bvh_prog ;
208
+ m_gpudata ->prog = &m_gpudata ->bvh_prog ;
209
209
}
210
210
else
211
211
{
@@ -214,13 +214,13 @@ namespace RadeonRays
214
214
215
215
// Update GPU data
216
216
auto bvh_size_in_bytes = translator.GetSizeInBytes ();
217
- m_gpuData ->bvh = m_device->CreateBuffer (bvh_size_in_bytes, Calc::BufferType::kRead );
217
+ m_gpudata ->bvh = m_device->CreateBuffer (bvh_size_in_bytes, Calc::BufferType::kRead );
218
218
219
219
// Get the pointer to mapped data
220
220
Calc::Event *e = nullptr ;
221
221
QBvhTranslator::Node *bvhdata = nullptr ;
222
222
223
- m_device->MapBuffer (m_gpuData ->bvh , 0 , 0 , bvh_size_in_bytes, Calc::MapType::kMapWrite , (void **)&bvhdata, &e);
223
+ m_device->MapBuffer (m_gpudata ->bvh , 0 , 0 , bvh_size_in_bytes, Calc::MapType::kMapWrite , (void **)&bvhdata, &e);
224
224
225
225
e->Wait ();
226
226
m_device->DeleteEvent (e);
@@ -231,13 +231,13 @@ namespace RadeonRays
231
231
bvhdata[i++] = *it;
232
232
233
233
// Unmap gpu data
234
- m_device->UnmapBuffer (m_gpuData ->bvh , 0 , bvhdata, &e);
234
+ m_device->UnmapBuffer (m_gpudata ->bvh , 0 , bvhdata, &e);
235
235
236
236
e->Wait ();
237
237
m_device->DeleteEvent (e);
238
238
239
239
// Select intersection program
240
- m_gpuData ->prog = &m_gpuData ->qbvh_prog ;
240
+ m_gpudata ->prog = &m_gpudata ->qbvh_prog ;
241
241
}
242
242
243
243
// Make sure everything is committed
@@ -252,22 +252,22 @@ namespace RadeonRays
252
252
std::size_t stack_size = 4 * max_rays * kMaxStackSize ;
253
253
254
254
// Check if we need to reallocate memory
255
- if (!m_gpuData ->stack || stack_size > m_gpuData ->stack ->GetSize ())
255
+ if (!m_gpudata ->stack || stack_size > m_gpudata ->stack ->GetSize ())
256
256
{
257
- m_device->DeleteBuffer (m_gpuData ->stack );
258
- m_gpuData ->stack = m_device->CreateBuffer (stack_size, Calc::BufferType::kWrite );
257
+ m_device->DeleteBuffer (m_gpudata ->stack );
258
+ m_gpudata ->stack = m_device->CreateBuffer (stack_size, Calc::BufferType::kWrite );
259
259
}
260
260
261
- assert (m_gpuData ->prog );
262
- auto &func = m_gpuData ->prog ->isect_func ;
261
+ assert (m_gpudata ->prog );
262
+ auto &func = m_gpudata ->prog ->isect_func ;
263
263
264
264
// Set args
265
265
int arg = 0 ;
266
266
267
- func->SetArg (arg++, m_gpuData ->bvh );
267
+ func->SetArg (arg++, m_gpudata ->bvh );
268
268
func->SetArg (arg++, rays);
269
269
func->SetArg (arg++, num_rays);
270
- func->SetArg (arg++, m_gpuData ->stack );
270
+ func->SetArg (arg++, m_gpudata ->stack );
271
271
func->SetArg (arg++, hits);
272
272
273
273
std::size_t localsize = kWorkGroupSize ;
@@ -283,22 +283,22 @@ namespace RadeonRays
283
283
std::size_t stack_size = 4 * max_rays * kMaxStackSize ;
284
284
285
285
// Check if we need to reallocate memory
286
- if (!m_gpuData ->stack || stack_size > m_gpuData ->stack ->GetSize ())
286
+ if (!m_gpudata ->stack || stack_size > m_gpudata ->stack ->GetSize ())
287
287
{
288
- m_device->DeleteBuffer (m_gpuData ->stack );
289
- m_gpuData ->stack = m_device->CreateBuffer (stack_size, Calc::BufferType::kWrite );
288
+ m_device->DeleteBuffer (m_gpudata ->stack );
289
+ m_gpudata ->stack = m_device->CreateBuffer (stack_size, Calc::BufferType::kWrite );
290
290
}
291
291
292
- assert (m_gpuData ->prog );
293
- auto &func = m_gpuData ->prog ->occlude_func ;
292
+ assert (m_gpudata ->prog );
293
+ auto &func = m_gpudata ->prog ->occlude_func ;
294
294
295
295
// Set args
296
296
int arg = 0 ;
297
297
298
- func->SetArg (arg++, m_gpuData ->bvh );
298
+ func->SetArg (arg++, m_gpudata ->bvh );
299
299
func->SetArg (arg++, rays);
300
300
func->SetArg (arg++, num_rays);
301
- func->SetArg (arg++, m_gpuData ->stack );
301
+ func->SetArg (arg++, m_gpudata ->stack );
302
302
func->SetArg (arg++, hits);
303
303
304
304
std::size_t localsize = kWorkGroupSize ;
0 commit comments