From 6267ecc3dce8f1a230265c2c5d774eb3f9953e8e Mon Sep 17 00:00:00 2001
From: XMRig <support@xmrig.com>
Date: Tue, 24 Sep 2019 18:39:43 +0700
Subject: [PATCH] Implemented --opencl-no-cache, --opencl-loader,
 --opencl-platform command line options.

---
 src/core/config/ConfigTransform.cpp | 13 +++++++++++++
 src/core/config/Config_platform.h   |  8 ++++++++
 src/core/config/usage.h             |  9 +++++++++
 3 files changed, 30 insertions(+)

diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp
index fdf70b378..58f6aa64a 100644
--- a/src/core/config/ConfigTransform.cpp
+++ b/src/core/config/ConfigTransform.cpp
@@ -155,6 +155,19 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
     case IConfig::OclKey: /* --opencl */
         m_opencl = true;
         break;
+
+    case IConfig::OclCacheKey: /* --opencl-no-cache */
+        return set(doc, kOcl, "cache", false);
+
+    case IConfig::OclLoaderKey: /* --opencl-loader */
+        return set(doc, kOcl, "loader", arg);
+
+    case IConfig::OclPlatformKey: /* --opencl-platform */
+        if (strlen(arg) < 3) {
+            return set(doc, kOcl, "platform", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
+        }
+
+        return set(doc, kOcl, "platform", arg);
 #   endif
 
     default:
diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h
index fcad8bc5e..79c3b1596 100644
--- a/src/core/config/Config_platform.h
+++ b/src/core/config/Config_platform.h
@@ -94,6 +94,14 @@ static const option options[] = {
 #   endif
 #   ifdef XMRIG_FEATURE_OPENCL
     { "opencl",                0, nullptr, IConfig::OclKey                },
+    { "opencl-devices",        1, nullptr, IConfig::OclDevicesKey         },
+    { "opencl-launch",         1, nullptr, IConfig::OclLaunchKey          },
+    { "opencl-strided-index",  1, nullptr, IConfig::OclSridedIndexKey     },
+    { "opencl-mem-chunk",      1, nullptr, IConfig::OclMemChunkKey        },
+    { "opencl-affinity",       1, nullptr, IConfig::OclAffinityKey        },
+    { "opencl-platform",       1, nullptr, IConfig::OclPlatformKey        },
+    { "opencl-loader",         1, nullptr, IConfig::OclLoaderKey          },
+    { "opencl-no-cache",       0, nullptr, IConfig::OclCacheKey           },
 #   endif
     { nullptr,                 0, nullptr, 0 }
 };
diff --git a/src/core/config/usage.h b/src/core/config/usage.h
index 60225d0b8..f1d5fda5d 100644
--- a/src/core/config/usage.h
+++ b/src/core/config/usage.h
@@ -97,6 +97,15 @@ static inline const std::string &usage()
 #   ifdef XMRIG_FEATURE_OPENCL
     u += "\nOpenCL backend:\n";
     u += "      --opencl                  enable OpenCL mining backend\n";
+    u += "      --opencl-devices=N        list of OpenCL devices to use\n";
+    u += "      --opencl-launch=IxW       list of launch config, intensity and worksize\n";
+    u += "      --opencl-strided-index=N  list of strided_index option values for each thread\n";
+    u += "      --opencl-mem-chunk=N      list of mem_chunk option values for each thread\n";
+    u += "      --opencl-affinity=N       list of affinity GPU threads to a CPU\n";
+    u += "      --opencl-platform=N       OpenCL platform index or name\n";
+    u += "      --opencl-loader=N         path to OpenCL-ICD-Loader (OpenCL.dll or libOpenCL.so)\n";
+    u += "      --opencl-no-cache         disable OpenCL cache\n";
+    u += "      --print-platforms         print available OpenCL platforms and exit\n";
 #   endif
 
     u += "\nLogging:\n";