[Mesa-dev] [PATCH 2/2] clover: Include generic type in several kernel/device obj() calls

Aaron Watry awatry at gmail.com
Thu Mar 1 19:44:34 UTC 2018


Fixes auto-completion for some device and kernel methods in my IDE.

No functional change intended.

Signed-off-by: Aaron Watry <awatry at gmail.com>
---
 src/gallium/state_trackers/clover/api/device.cpp |  2 +-
 src/gallium/state_trackers/clover/api/kernel.cpp | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index 3572bb0c92..2aaa2c59cb 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -98,7 +98,7 @@ CLOVER_API cl_int
 clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
                 size_t size, void *r_buf, size_t *r_size) try {
    property_buffer buf { r_buf, size, r_size };
-   auto &dev = obj(d_dev);
+   auto &dev = obj<device>(d_dev);
 
    switch (param) {
    case CL_DEVICE_TYPE:
diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp
index b665773d9e..705828a688 100644
--- a/src/gallium/state_trackers/clover/api/kernel.cpp
+++ b/src/gallium/state_trackers/clover/api/kernel.cpp
@@ -28,7 +28,7 @@ using namespace clover;
 
 CLOVER_API cl_kernel
 clCreateKernel(cl_program d_prog, const char *name, cl_int *r_errcode) try {
-   auto &prog = obj(d_prog);
+   auto &prog = obj<program>(d_prog);
 
    if (!name)
       throw error(CL_INVALID_VALUE);
@@ -50,7 +50,7 @@ clCreateKernel(cl_program d_prog, const char *name, cl_int *r_errcode) try {
 CLOVER_API cl_int
 clCreateKernelsInProgram(cl_program d_prog, cl_uint count,
                          cl_kernel *rd_kerns, cl_uint *r_count) try {
-   auto &prog = obj(d_prog);
+   auto &prog = obj<program>(d_prog);
    auto &syms = prog.symbols();
 
    if (rd_kerns && count < syms.size())
@@ -76,7 +76,7 @@ clCreateKernelsInProgram(cl_program d_prog, cl_uint count,
 
 CLOVER_API cl_int
 clRetainKernel(cl_kernel d_kern) try {
-   obj(d_kern).retain();
+   obj<kernel>(d_kern).retain();
    return CL_SUCCESS;
 
 } catch (error &e) {
@@ -85,7 +85,7 @@ clRetainKernel(cl_kernel d_kern) try {
 
 CLOVER_API cl_int
 clReleaseKernel(cl_kernel d_kern) try {
-   if (obj(d_kern).release())
+   if (obj<kernel>(d_kern).release())
       delete pobj(d_kern);
 
    return CL_SUCCESS;
@@ -97,7 +97,7 @@ clReleaseKernel(cl_kernel d_kern) try {
 CLOVER_API cl_int
 clSetKernelArg(cl_kernel d_kern, cl_uint idx, size_t size,
                const void *value) try {
-   obj(d_kern).args().at(idx).set(size, value);
+   obj<kernel>(d_kern).args().at(idx).set(size, value);
    return CL_SUCCESS;
 
 } catch (std::out_of_range &e) {
@@ -111,7 +111,7 @@ CLOVER_API cl_int
 clGetKernelInfo(cl_kernel d_kern, cl_kernel_info param,
                 size_t size, void *r_buf, size_t *r_size) try {
    property_buffer buf { r_buf, size, r_size };
-   auto &kern = obj(d_kern);
+   auto &kern = obj<kernel>(d_kern);
 
    switch (param) {
    case CL_KERNEL_FUNCTION_NAME:
@@ -149,7 +149,7 @@ clGetKernelWorkGroupInfo(cl_kernel d_kern, cl_device_id d_dev,
                          cl_kernel_work_group_info param,
                          size_t size, void *r_buf, size_t *r_size) try {
    property_buffer buf { r_buf, size, r_size };
-   auto &kern = obj(d_kern);
+   auto &kern = obj<kernel>(d_kern);
    auto &dev = (d_dev ? *pobj(d_dev) : unique(kern.program().devices()));
 
    if (!count(dev, kern.program().devices()))
@@ -279,8 +279,8 @@ clEnqueueNDRangeKernel(cl_command_queue d_q, cl_kernel d_kern,
                        const size_t *d_grid_size, const size_t *d_block_size,
                        cl_uint num_deps, const cl_event *d_deps,
                        cl_event *rd_ev) try {
-   auto &q = obj(d_q);
-   auto &kern = obj(d_kern);
+   auto &q = obj<command_queue>(d_q);
+   auto &kern = obj<kernel>(d_kern);
    auto deps = objs<wait_list_tag>(d_deps, num_deps);
    auto grid_size = validate_grid_size(q, dims, d_grid_size);
    auto grid_offset = validate_grid_offset(q, dims, d_grid_offset);
@@ -306,8 +306,8 @@ CLOVER_API cl_int
 clEnqueueTask(cl_command_queue d_q, cl_kernel d_kern,
               cl_uint num_deps, const cl_event *d_deps,
               cl_event *rd_ev) try {
-   auto &q = obj(d_q);
-   auto &kern = obj(d_kern);
+   auto &q = obj<command_queue>(d_q);
+   auto &kern = obj<kernel>(d_kern);
    auto deps = objs<wait_list_tag>(d_deps, num_deps);
 
    validate_common(q, kern, deps);
-- 
2.14.1



More information about the mesa-dev mailing list