MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / DrawObjectGUI

Method DrawObjectGUI

samples/luxcoreui/ocldevicewindow.cpp:63–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63bool OCLDeviceWindow::DrawObjectGUI(Properties &props, bool &modifiedProps) {
64 int oclPlatformIndex = props.Get("opencl.platform.index").Get<int>();
65 if (ImGui::InputInt("OpenCL platform index", &oclPlatformIndex)) {
66 props.Set(Property("opencl.platform.index")(oclPlatformIndex));
67 modifiedProps = true;
68 }
69 LuxCoreApp::HelpMarker("opencl.platform.index");
70
71 try {
72 // Get the list of intersection devices
73 const Properties oclDevDescs = GetOpenCLDeviceDescs();
74 const vector<string> oclDevDescPrefixs = oclDevDescs.GetAllUniqueSubNames("opencl.device");
75
76 // Get the device selection string
77 string selection = props.Get("opencl.devices.select").Get<string>();
78 if (selection.length() != oclDevDescPrefixs.size()) {
79 const bool useCPU = props.Get("opencl.cpu.use").Get<bool>();
80 const bool useGPU = props.Get("opencl.gpu.use").Get<bool>();
81
82 selection.resize(oclDevDescPrefixs.size(), '0');
83 for (unsigned int i = 0; i < oclDevDescPrefixs.size(); ++i) {
84 const string devType = oclDevDescs.Get(oclDevDescPrefixs[i] + ".type").Get<string>();
85
86 if ((useCPU && (devType == "OPENCL_CPU")) ||
87 (useGPU && (devType == "OPENCL_GPU")))
88 selection.at(i) = '1';
89 }
90
91 modifiedProps = true;
92 }
93
94 if (ImGui::CollapsingHeader("General", NULL, true, true)) {
95 int ival;
96 bool bval;
97
98 bval = props.Get("opencl.cpu.use").Get<bool>();
99 if (ImGui::Checkbox("Use all CPU devices", &bval)) {
100 props.Set(Property("opencl.cpu.use")(bval));
101 modifiedProps = true;
102
103 for (unsigned int i = 0; i < oclDevDescPrefixs.size(); ++i) {
104 const string devType = oclDevDescs.Get(oclDevDescPrefixs[i] + ".type").Get<string>();
105
106 if (devType == "OPENCL_CPU")
107 selection.at(i) = bval ? '1' : '0';;
108 }
109 modifiedProps = true;
110 }
111 LuxCoreApp::HelpMarker("opencl.cpu.use");
112
113 bval = props.Get("opencl.gpu.use").Get<bool>();
114 if (ImGui::Checkbox("Use all GPU devices", &bval)) {
115 props.Set(Property("opencl.gpu.use")(bval));
116 modifiedProps = true;
117
118 for (unsigned int i = 0; i < oclDevDescPrefixs.size(); ++i) {
119 const string devType = oclDevDescs.Get(oclDevDescPrefixs[i] + ".type").Get<string>();
120

Callers

nothing calls this directly

Calls 13

Get<int>Method · 0.80
GetMethod · 0.80
SetMethod · 0.80
GetAllUniqueSubNamesMethod · 0.80
Get<string>Method · 0.80
Get<bool>Method · 0.80
atMethod · 0.80
c_strMethod · 0.80
whatMethod · 0.80
ToStringFunction · 0.50
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected