Skip to content

Commit 1399c6c

Browse files
author
FlorentGuinier
authored
Merge pull request #2 from GPUOpen-LibrariesAndSDKs/master
merge from main repo
2 parents 5c48fb0 + 07a0304 commit 1399c6c

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

CLW/CLW.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ project "CLW"
1414

1515
configuration {}
1616

17+
if _OPTIONS["allow_cpu_devices"] then
18+
defines {"RR_ALLOW_CPU_DEVICES=1"}
19+
end
20+
1721
-- we rely on RadeonRays to do the actual embedding for us
1822
if _OPTIONS["embed_kernels"] then
1923
defines {"RR_EMBED_KERNELS=1"}

CLW/CLWPlatform.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ void CLWPlatform::CreateAllPlatforms(std::vector<CLWPlatform>& platforms)
4848
status = clGetPlatformIDs(numPlatforms, &platformIds[0], nullptr);
4949
ThrowIf(status != CL_SUCCESS, status, "clGetPlatformIDs failed");
5050

51-
cl_device_type type = CL_DEVICE_TYPE_ALL;
51+
52+
#ifdef RR_ALLOW_CPU_DEVICES
53+
cl_device_type type = CL_DEVICE_TYPE_ALL;
54+
#else
55+
cl_device_type type = CL_DEVICE_TYPE_GPU;
56+
#endif
5257

5358
// TODO: this is a workaround for nasty Apple's OpenCL runtime
5459
// which doesn't allow to have work group sizes > 1 on CPU devices

RadeonRays/src/device/embree_intersection_device.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace RadeonRays
116116
if (result != RTC_NO_ERROR)
117117
std::cout << "Failed to create embree rtcDevice: " << result << std::endl;
118118

119-
m_scene = rtcDeviceNewScene(m_device, RTC_SCENE_STATIC, RTC_INTERSECT1 | RTC_INTERSECT4 | RTC_INTERSECT8 | RTC_INTERSECT16 | RTC_INTERSECT_STREAM);
119+
m_scene = rtcDeviceNewScene(m_device, RTC_SCENE_STATIC, RTC_INTERSECT1 | RTC_INTERSECT4 | RTC_INTERSECT8 | RTC_INTERSECT16 );
120120
result = rtcDeviceGetError(m_device);
121121
if (result != RTC_NO_ERROR)
122122
std::cout << "Failed to create embree scene: " << result << std::endl;
@@ -171,7 +171,7 @@ namespace RadeonRays
171171
}
172172
m_instances.clear();
173173
rtcDeleteScene(m_scene); CheckEmbreeError();
174-
m_scene = rtcDeviceNewScene(m_device, RTC_SCENE_STATIC, RTC_INTERSECT1 | RTC_INTERSECT4 | RTC_INTERSECT8 | RTC_INTERSECT16 | RTC_INTERSECT_STREAM); CheckEmbreeError();
174+
m_scene = rtcDeviceNewScene(m_device, RTC_SCENE_STATIC, RTC_INTERSECT1 | RTC_INTERSECT4 | RTC_INTERSECT8 | RTC_INTERSECT16 ); CheckEmbreeError();
175175

176176
for (auto i : world.shapes_)
177177
{
@@ -500,7 +500,7 @@ namespace RadeonRays
500500
{
501501
if (m_meshes.count(mesh))
502502
return m_meshes[mesh].scene;
503-
RTCScene result = rtcDeviceNewScene(m_device, RTC_SCENE_STATIC, RTC_INTERSECT1 | RTC_INTERSECT4 | RTC_INTERSECT8 | RTC_INTERSECT16 | RTC_INTERSECT_STREAM);
503+
RTCScene result = rtcDeviceNewScene(m_device, RTC_SCENE_STATIC, RTC_INTERSECT1 | RTC_INTERSECT4 | RTC_INTERSECT8 | RTC_INTERSECT16 );
504504
CheckEmbreeError();
505505
ThrowIf(!mesh->puretriangle(), "Only triangle meshes supported by now.");
506506

premake5.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ newoption {
88
description = "Embed CL kernels into binary module"
99
}
1010

11+
newoption {
12+
trigger = "allow_cpu_devices",
13+
description = "Allows CPU Devices"
14+
}
15+
1116
newoption {
1217
trigger = "use_opencl",
1318
description = "Use OpenCL for GPU hit testing"

0 commit comments

Comments
 (0)