From: Francisco Jerez Date: Mon, 16 Sep 2013 06:07:10 +0000 (-0700) Subject: clover: Tidy up resource::mapping. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d741e3ac06300437c26675e5503a8b791970e0b;p=mesa.git clover: Tidy up resource::mapping. Tested-by: Tom Stellard --- 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(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 ®ion); - 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 + operator T *() const { + return (T *)p; } private: