summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2013-09-15 23:07:10 -0700
committerFrancisco Jerez <[email protected]>2013-10-21 10:47:03 -0700
commit1d741e3ac06300437c26675e5503a8b791970e0b (patch)
tree39953340d38f4c63c5ac7f94fa4bceea53a9bb1e /src
parent6db102597a0978f53e19c59244cf6ef10babae26 (diff)
clover: Tidy up resource::mapping.
Tested-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/clover/core/resource.cpp5
-rw-r--r--src/gallium/state_trackers/clover/core/resource.hpp15
2 files changed, 9 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/clover/core/resource.cpp b/src/gallium/state_trackers/clover/core/resource.cpp
index c503c86d771..7e6b51f7c62 100644
--- a/src/gallium/state_trackers/clover/core/resource.cpp
+++ b/src/gallium/state_trackers/clover/core/resource.cpp
@@ -71,7 +71,7 @@ resource::add_map(command_queue &q, cl_map_flags flags, bool blocking,
void
resource::del_map(void *p) {
- erase_if([&](mapping &m) {
+ erase_if([&](const mapping &m) {
return static_cast<void *>(m) == p;
}, maps);
}
@@ -185,8 +185,9 @@ mapping::mapping(command_queue &q, resource &r,
mapping::mapping(mapping &&m) :
pctx(m.pctx), pxfer(m.pxfer), p(m.p) {
- m.p = NULL;
+ m.pctx = NULL;
m.pxfer = NULL;
+ m.p = NULL;
}
mapping::~mapping() {
diff --git a/src/gallium/state_trackers/clover/core/resource.hpp b/src/gallium/state_trackers/clover/core/resource.hpp
index f447088055a..7a6a3f19a23 100644
--- a/src/gallium/state_trackers/clover/core/resource.hpp
+++ b/src/gallium/state_trackers/clover/core/resource.hpp
@@ -62,7 +62,7 @@ namespace clover {
friend class kernel;
protected:
- resource(device &dev, clover::memory_obj &obj);
+ resource(device &dev, memory_obj &obj);
pipe_sampler_view *bind_sampler_view(command_queue &q);
void unbind_sampler_view(command_queue &q,
@@ -86,8 +86,7 @@ namespace clover {
public:
root_resource(device &dev, memory_obj &obj,
command_queue &q, const std::string &data);
- root_resource(device &dev, memory_obj &obj,
- root_resource &r);
+ root_resource(device &dev, memory_obj &obj, root_resource &r);
virtual ~root_resource();
};
@@ -109,19 +108,17 @@ namespace clover {
mapping(command_queue &q, resource &r, cl_map_flags flags,
bool blocking, const resource::vector &origin,
const resource::vector &region);
- mapping(const mapping &m) = delete;
mapping(mapping &&m);
~mapping();
mapping &
operator=(mapping m);
- operator void *() {
- return p;
- }
+ mapping(const mapping &m) = delete;
- operator char *() {
- return (char *)p;
+ template<typename T>
+ operator T *() const {
+ return (T *)p;
}
private: