Skip to content

Commit ffe35a2

Browse files
committed
Fixed naming conventions
1 parent 5e44473 commit ffe35a2

File tree

6 files changed

+104
-104
lines changed

6 files changed

+104
-104
lines changed

RadeonRays/src/intersector/intersector_lds.cpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace RadeonRays
9191

9292
IntersectorLDS::IntersectorLDS(Calc::Device *device)
9393
: Intersector(device)
94-
, m_gpuData(new GpuData(device))
94+
, m_gpudata(new GpuData(device))
9595
{
9696
std::string buildopts;
9797
#ifdef RR_RAY_MASK
@@ -108,49 +108,49 @@ namespace RadeonRays
108108

109109
int numheaders = sizeof(headers) / sizeof(const char *);
110110

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());
113113
}
114114
else
115115
{
116116
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());
119119
}
120120
#else
121121
#if USE_OPENCL
122122
if (device->GetPlatform() == Calc::Platform::kOpenCL)
123123
{
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());
126126
}
127127
#endif
128128
#if USE_VULKAN
129129
if (device->GetPlatform() == Calc::Platform::kVulkan)
130130
{
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());
135135
}
136136
#endif
137137
#endif
138138

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");
143143
}
144144

145145
void IntersectorLDS::Process(const World &world)
146146
{
147147
// 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)
149149
{
150150
// Free previous data
151-
if (m_gpuData->bvh)
151+
if (m_gpudata->bvh)
152152
{
153-
m_device->DeleteBuffer(m_gpuData->bvh);
153+
m_device->DeleteBuffer(m_gpudata->bvh);
154154
}
155155

156156
// Look up build options for world
@@ -183,13 +183,13 @@ namespace RadeonRays
183183
if (!use_qbvh)
184184
{
185185
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);
187187

188188
// Get the pointer to mapped data
189189
Calc::Event *e = nullptr;
190190
Bvh2::Node *bvhdata = nullptr;
191191

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);
193193

194194
e->Wait();
195195
m_device->DeleteEvent(e);
@@ -199,13 +199,13 @@ namespace RadeonRays
199199
bvhdata[i] = bvh.m_nodes[i];
200200

201201
// Unmap gpu data
202-
m_device->UnmapBuffer(m_gpuData->bvh, 0, bvhdata, &e);
202+
m_device->UnmapBuffer(m_gpudata->bvh, 0, bvhdata, &e);
203203

204204
e->Wait();
205205
m_device->DeleteEvent(e);
206206

207207
// Select intersection program
208-
m_gpuData->prog = &m_gpuData->bvh_prog;
208+
m_gpudata->prog = &m_gpudata->bvh_prog;
209209
}
210210
else
211211
{
@@ -214,13 +214,13 @@ namespace RadeonRays
214214

215215
// Update GPU data
216216
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);
218218

219219
// Get the pointer to mapped data
220220
Calc::Event *e = nullptr;
221221
QBvhTranslator::Node *bvhdata = nullptr;
222222

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);
224224

225225
e->Wait();
226226
m_device->DeleteEvent(e);
@@ -231,13 +231,13 @@ namespace RadeonRays
231231
bvhdata[i++] = *it;
232232

233233
// Unmap gpu data
234-
m_device->UnmapBuffer(m_gpuData->bvh, 0, bvhdata, &e);
234+
m_device->UnmapBuffer(m_gpudata->bvh, 0, bvhdata, &e);
235235

236236
e->Wait();
237237
m_device->DeleteEvent(e);
238238

239239
// Select intersection program
240-
m_gpuData->prog = &m_gpuData->qbvh_prog;
240+
m_gpudata->prog = &m_gpudata->qbvh_prog;
241241
}
242242

243243
// Make sure everything is committed
@@ -252,22 +252,22 @@ namespace RadeonRays
252252
std::size_t stack_size = 4 * max_rays * kMaxStackSize;
253253

254254
// 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())
256256
{
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);
259259
}
260260

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;
263263

264264
// Set args
265265
int arg = 0;
266266

267-
func->SetArg(arg++, m_gpuData->bvh);
267+
func->SetArg(arg++, m_gpudata->bvh);
268268
func->SetArg(arg++, rays);
269269
func->SetArg(arg++, num_rays);
270-
func->SetArg(arg++, m_gpuData->stack);
270+
func->SetArg(arg++, m_gpudata->stack);
271271
func->SetArg(arg++, hits);
272272

273273
std::size_t localsize = kWorkGroupSize;
@@ -283,22 +283,22 @@ namespace RadeonRays
283283
std::size_t stack_size = 4 * max_rays * kMaxStackSize;
284284

285285
// 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())
287287
{
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);
290290
}
291291

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;
294294

295295
// Set args
296296
int arg = 0;
297297

298-
func->SetArg(arg++, m_gpuData->bvh);
298+
func->SetArg(arg++, m_gpudata->bvh);
299299
func->SetArg(arg++, rays);
300300
func->SetArg(arg++, num_rays);
301-
func->SetArg(arg++, m_gpuData->stack);
301+
func->SetArg(arg++, m_gpudata->stack);
302302
func->SetArg(arg++, hits);
303303

304304
std::size_t localsize = kWorkGroupSize;

RadeonRays/src/intersector/intersector_lds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ namespace RadeonRays
4949
struct GpuData;
5050

5151
// Implementation data
52-
std::unique_ptr<GpuData> m_gpuData;
52+
std::unique_ptr<GpuData> m_gpudata;
5353
};
5454
}

RadeonRays/src/kernelcache/kernels_cl.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,17 +2534,17 @@ static const char g_intersect_bvh2_lds_opencl[]= \
25342534
" // Handle only working subset \n"\
25352535
" if (index < *num_rays) \n"\
25362536
" { \n"\
2537-
" const ray myRay = rays[index]; \n"\
2537+
" const ray my_ray = rays[index]; \n"\
25382538
" \n"\
2539-
" if (ray_is_active(&myRay)) \n"\
2539+
" if (ray_is_active(&my_ray)) \n"\
25402540
" { \n"\
25412541
" __local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE]; \n"\
25422542
" \n"\
2543-
" const float3 invDir = safe_invdir(myRay); \n"\
2544-
" const float3 oxInvDir = -myRay.o.xyz * invDir; \n"\
2543+
" const float3 invDir = safe_invdir(my_ray); \n"\
2544+
" const float3 oxInvDir = -my_ray.o.xyz * invDir; \n"\
25452545
" \n"\
25462546
" // Intersection parametric distance \n"\
2547-
" float closest_t = myRay.o.w; \n"\
2547+
" float closest_t = my_ray.o.w; \n"\
25482548
" \n"\
25492549
" // Current node address \n"\
25502550
" uint addr = 0; \n"\
@@ -2614,7 +2614,7 @@ static const char g_intersect_bvh2_lds_opencl[]= \
26142614
" else \n"\
26152615
" { \n"\
26162616
" float t = fast_intersect_triangle( \n"\
2617-
" myRay, \n"\
2617+
" my_ray, \n"\
26182618
" node.aabb_left_min_or_v0_and_addr_left.xyz, \n"\
26192619
" node.aabb_left_max_or_v1_and_mesh_id.xyz, \n"\
26202620
" node.aabb_right_min_or_v2_and_addr_right.xyz, \n"\
@@ -2647,7 +2647,7 @@ static const char g_intersect_bvh2_lds_opencl[]= \
26472647
" { \n"\
26482648
" // Calculate hit position \n"\
26492649
" const bvh_node node = nodes[closest_addr]; \n"\
2650-
" const float3 p = myRay.o.xyz + closest_t * myRay.d.xyz; \n"\
2650+
" const float3 p = my_ray.o.xyz + closest_t * my_ray.d.xyz; \n"\
26512651
" \n"\
26522652
" // Calculate barycentric coordinates \n"\
26532653
" const float2 uv = triangle_calculate_barycentrics( \n"\
@@ -2690,17 +2690,17 @@ static const char g_intersect_bvh2_lds_opencl[]= \
26902690
" // Handle only working subset \n"\
26912691
" if (index < *num_rays) \n"\
26922692
" { \n"\
2693-
" const ray myRay = rays[index]; \n"\
2693+
" const ray my_ray = rays[index]; \n"\
26942694
" \n"\
2695-
" if (ray_is_active(&myRay)) \n"\
2695+
" if (ray_is_active(&my_ray)) \n"\
26962696
" { \n"\
26972697
" __local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE]; \n"\
26982698
" \n"\
2699-
" const float3 invDir = safe_invdir(myRay); \n"\
2700-
" const float3 oxInvDir = -myRay.o.xyz * invDir; \n"\
2699+
" const float3 invDir = safe_invdir(my_ray); \n"\
2700+
" const float3 oxInvDir = -my_ray.o.xyz * invDir; \n"\
27012701
" \n"\
27022702
" // Intersection parametric distance \n"\
2703-
" float closest_t = myRay.o.w; \n"\
2703+
" float closest_t = my_ray.o.w; \n"\
27042704
" \n"\
27052705
" // Current node address \n"\
27062706
" uint addr = 0; \n"\
@@ -2770,7 +2770,7 @@ static const char g_intersect_bvh2_lds_opencl[]= \
27702770
" else \n"\
27712771
" { \n"\
27722772
" float t = fast_intersect_triangle( \n"\
2773-
" myRay, \n"\
2773+
" my_ray, \n"\
27742774
" node.aabb_left_min_or_v0_and_addr_left.xyz, \n"\
27752775
" node.aabb_left_max_or_v1_and_mesh_id.xyz, \n"\
27762776
" node.aabb_right_min_or_v2_and_addr_right.xyz, \n"\
@@ -3201,19 +3201,19 @@ static const char g_intersect_bvh2_lds_fp16_opencl[]= \
32013201
" // Handle only working subset \n"\
32023202
" if (index < *num_rays) \n"\
32033203
" { \n"\
3204-
" const ray myRay = rays[index]; \n"\
3204+
" const ray my_ray = rays[index]; \n"\
32053205
" \n"\
3206-
" if (ray_is_active(&myRay)) \n"\
3206+
" if (ray_is_active(&my_ray)) \n"\
32073207
" { \n"\
32083208
" __local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE]; \n"\
32093209
" \n"\
32103210
" // Precompute inverse direction and origin / dir for bbox testing \n"\
3211-
" const float3 invDir32 = safe_invdir2(myRay); \n"\
3211+
" const float3 invDir32 = safe_invdir2(my_ray); \n"\
32123212
" const half3 invDir = convert_half3(invDir32); \n"\
3213-
" const half3 oxInvDir = convert_half3(-myRay.o.xyz * invDir32); \n"\
3213+
" const half3 oxInvDir = convert_half3(-my_ray.o.xyz * invDir32); \n"\
32143214
" \n"\
32153215
" // Intersection parametric distance \n"\
3216-
" float closest_t = myRay.o.w; \n"\
3216+
" float closest_t = my_ray.o.w; \n"\
32173217
" \n"\
32183218
" // Current node address \n"\
32193219
" uint addr = 0; \n"\
@@ -3304,7 +3304,7 @@ static const char g_intersect_bvh2_lds_fp16_opencl[]= \
33043304
" else \n"\
33053305
" { \n"\
33063306
" float t = fast_intersect_triangle( \n"\
3307-
" myRay, \n"\
3307+
" my_ray, \n"\
33083308
" as_float3(node.aabb01_min_or_v0_and_addr0.xyz), \n"\
33093309
" as_float3(node.aabb01_max_or_v1_and_addr1_or_mesh_id.xyz), \n"\
33103310
" as_float3(node.aabb23_min_or_v2_and_addr2_or_prim_id.xyz), \n"\
@@ -3337,7 +3337,7 @@ static const char g_intersect_bvh2_lds_fp16_opencl[]= \
33373337
" { \n"\
33383338
" // Calculate hit position \n"\
33393339
" const bvh_node node = nodes[closest_addr]; \n"\
3340-
" const float3 p = myRay.o.xyz + closest_t * myRay.d.xyz; \n"\
3340+
" const float3 p = my_ray.o.xyz + closest_t * my_ray.d.xyz; \n"\
33413341
" \n"\
33423342
" // Calculate barycentric coordinates \n"\
33433343
" const float2 uv = triangle_calculate_barycentrics( \n"\
@@ -3380,19 +3380,19 @@ static const char g_intersect_bvh2_lds_fp16_opencl[]= \
33803380
" // Handle only working subset \n"\
33813381
" if (index < *num_rays) \n"\
33823382
" { \n"\
3383-
" const ray myRay = rays[index]; \n"\
3383+
" const ray my_ray = rays[index]; \n"\
33843384
" \n"\
3385-
" if (ray_is_active(&myRay)) \n"\
3385+
" if (ray_is_active(&my_ray)) \n"\
33863386
" { \n"\
33873387
" __local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE]; \n"\
33883388
" \n"\
33893389
" // Precompute inverse direction and origin / dir for bbox testing \n"\
3390-
" const float3 invDir32 = safe_invdir2(myRay); \n"\
3390+
" const float3 invDir32 = safe_invdir2(my_ray); \n"\
33913391
" const half3 invDir = convert_half3(invDir32); \n"\
3392-
" const half3 oxInvDir = convert_half3(-myRay.o.xyz * invDir32); \n"\
3392+
" const half3 oxInvDir = convert_half3(-my_ray.o.xyz * invDir32); \n"\
33933393
" \n"\
33943394
" // Intersection parametric distance \n"\
3395-
" float closest_t = myRay.o.w; \n"\
3395+
" float closest_t = my_ray.o.w; \n"\
33963396
" \n"\
33973397
" // Current node address \n"\
33983398
" uint addr = 0; \n"\
@@ -3483,7 +3483,7 @@ static const char g_intersect_bvh2_lds_fp16_opencl[]= \
34833483
" else \n"\
34843484
" { \n"\
34853485
" float t = fast_intersect_triangle( \n"\
3486-
" myRay, \n"\
3486+
" my_ray, \n"\
34873487
" as_float3(node.aabb01_min_or_v0_and_addr0.xyz), \n"\
34883488
" as_float3(node.aabb01_max_or_v1_and_addr1_or_mesh_id.xyz), \n"\
34893489
" as_float3(node.aabb23_min_or_v2_and_addr2_or_prim_id.xyz), \n"\

0 commit comments

Comments
 (0)