summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/clover/api/device.cpp2
-rw-r--r--src/gallium/state_trackers/clover/api/event.cpp4
-rw-r--r--src/gallium/state_trackers/clover/api/kernel.cpp4
-rw-r--r--src/gallium/state_trackers/clover/core/context.cpp10
-rw-r--r--src/gallium/state_trackers/clover/core/context.hpp5
-rw-r--r--src/gallium/state_trackers/clover/core/device.cpp5
-rw-r--r--src/gallium/state_trackers/clover/core/device.hpp3
-rw-r--r--src/gallium/state_trackers/clover/core/format.hpp11
-rw-r--r--src/gallium/state_trackers/clover/core/memory.cpp5
-rw-r--r--src/gallium/state_trackers/clover/core/memory.hpp3
10 files changed, 47 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index 7e99f740684..dd7ef408f22 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -40,7 +40,7 @@ clGetDeviceIDs(cl_platform_id d_platform, cl_device_type device_type,
// Collect matching devices
for (device &dev : platform) {
if (((device_type & CL_DEVICE_TYPE_DEFAULT) &&
- &dev == &platform.front()) ||
+ dev == platform.front()) ||
(device_type & dev.type()))
d_devs.push_back(desc(dev));
}
diff --git a/src/gallium/state_trackers/clover/api/event.cpp b/src/gallium/state_trackers/clover/api/event.cpp
index 1395c54db08..4ed96b06313 100644
--- a/src/gallium/state_trackers/clover/api/event.cpp
+++ b/src/gallium/state_trackers/clover/api/event.cpp
@@ -63,7 +63,7 @@ clWaitForEvents(cl_uint num_evs, const cl_event *d_evs) try {
auto evs = objs(d_evs, num_evs);
for (auto &ev : evs) {
- if (&ev.ctx != &evs.front().ctx)
+ if (ev.ctx != evs.front().ctx)
throw error(CL_INVALID_CONTEXT);
if (ev.status() < 0)
@@ -199,7 +199,7 @@ clEnqueueWaitForEvents(cl_command_queue d_q, cl_uint num_evs,
auto evs = objs(d_evs, num_evs);
for (auto &ev : evs) {
- if (&ev.ctx != &q.ctx)
+ if (ev.ctx != q.ctx)
throw error(CL_INVALID_CONTEXT);
}
diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp
index 15b4c14e1d9..dd742c3bb05 100644
--- a/src/gallium/state_trackers/clover/api/kernel.cpp
+++ b/src/gallium/state_trackers/clover/api/kernel.cpp
@@ -202,9 +202,9 @@ namespace {
void
validate_common(command_queue &q, kernel &kern,
const ref_vector<event> &deps) {
- if (&kern.prog.ctx != &q.ctx ||
+ if (kern.prog.ctx != q.ctx ||
any_of([&](const event &ev) {
- return &ev.ctx != &q.ctx;
+ return ev.ctx != q.ctx;
}, deps))
throw error(CL_INVALID_CONTEXT);
diff --git a/src/gallium/state_trackers/clover/core/context.cpp b/src/gallium/state_trackers/clover/core/context.cpp
index 7b79f82547e..f4f98004790 100644
--- a/src/gallium/state_trackers/clover/core/context.cpp
+++ b/src/gallium/state_trackers/clover/core/context.cpp
@@ -36,6 +36,16 @@ context::has_device(device &dev) const {
return std::count(devs.begin(), devs.end(), &dev);
}
+bool
+context::operator==(const context &ctx) const {
+ return this == &ctx;
+}
+
+bool
+context::operator!=(const context &ctx) const {
+ return this != &ctx;
+}
+
const context::property_list &
context::props() const {
return _props;
diff --git a/src/gallium/state_trackers/clover/core/context.hpp b/src/gallium/state_trackers/clover/core/context.hpp
index 6fda06155ea..576e95281be 100644
--- a/src/gallium/state_trackers/clover/core/context.hpp
+++ b/src/gallium/state_trackers/clover/core/context.hpp
@@ -39,6 +39,11 @@ namespace clover {
bool has_device(device &dev) const;
+ bool
+ operator==(const context &ctx) const;
+ bool
+ operator!=(const context &ctx) const;
+
const property_list &
props() const;
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 9f6407e9cd7..39322707b36 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -68,6 +68,11 @@ device::operator=(device dev) {
return *this;
}
+bool
+device::operator==(const device &dev) const {
+ return this == &dev;
+}
+
cl_device_type
device::type() const {
switch (ldev->type) {
diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
index 42e32a19077..fd6b4570f13 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -44,6 +44,9 @@ namespace clover {
device &operator=(device dev);
+ bool
+ operator==(const device &dev) const;
+
cl_device_type type() const;
cl_uint vendor_id() const;
size_t max_images_read() const;
diff --git a/src/gallium/state_trackers/clover/core/format.hpp b/src/gallium/state_trackers/clover/core/format.hpp
index 26439c7a93c..a8b7053c5dc 100644
--- a/src/gallium/state_trackers/clover/core/format.hpp
+++ b/src/gallium/state_trackers/clover/core/format.hpp
@@ -48,4 +48,15 @@ operator<(const cl_image_format &a, const cl_image_format &b) {
a.image_channel_data_type < b.image_channel_data_type);
}
+static inline bool
+operator==(const cl_image_format &a, const cl_image_format &b) {
+ return (a.image_channel_order == b.image_channel_order &&
+ a.image_channel_data_type == b.image_channel_data_type);
+}
+
+static inline bool
+operator!=(const cl_image_format &a, const cl_image_format &b) {
+ return !(a == b);
+}
+
#endif
diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp
index 106936bef56..1c38597215f 100644
--- a/src/gallium/state_trackers/clover/core/memory.cpp
+++ b/src/gallium/state_trackers/clover/core/memory.cpp
@@ -38,6 +38,11 @@ memory_obj::~memory_obj() {
_destroy_notify();
}
+bool
+memory_obj::operator==(const memory_obj &obj) const {
+ return this == &obj;
+}
+
void
memory_obj::destroy_notify(std::function<void ()> f) {
_destroy_notify = f;
diff --git a/src/gallium/state_trackers/clover/core/memory.hpp b/src/gallium/state_trackers/clover/core/memory.hpp
index 7c5300899ef..86f7ddaca3a 100644
--- a/src/gallium/state_trackers/clover/core/memory.hpp
+++ b/src/gallium/state_trackers/clover/core/memory.hpp
@@ -43,6 +43,9 @@ namespace clover {
public:
virtual ~memory_obj();
+ bool
+ operator==(const memory_obj &obj) const;
+
virtual cl_mem_object_type type() const = 0;
virtual clover::resource &resource(command_queue &q) = 0;