From: Francisco Jerez Date: Wed, 18 Sep 2013 06:13:48 +0000 (-0700) Subject: clover: Replace a bunch of double underscores with single underscores. X-Git-Tag: upstream/10.0.5~734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e14b82fd2c561cac3e0d5f84d5f67815ad53867;p=platform%2Fupstream%2Fmesa.git clover: Replace a bunch of double underscores with single underscores. Identifiers with double underscores are reserved, and using them has undefined behavior according to the C++ spec. It's unlikely to make any difference, but... Tested-by: Tom Stellard --- diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp index bfac67b..1f996a3 100644 --- a/src/gallium/state_trackers/clover/api/platform.cpp +++ b/src/gallium/state_trackers/clover/api/platform.cpp @@ -25,7 +25,9 @@ using namespace clover; -static platform __platform; +namespace { + platform _clover_platform; +} PUBLIC cl_int clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, @@ -37,7 +39,7 @@ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, if (num_platforms) *num_platforms = 1; if (platforms) - *platforms = &__platform; + *platforms = &_clover_platform; return CL_SUCCESS; } @@ -45,7 +47,7 @@ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, PUBLIC cl_int clGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name, size_t size, void *buf, size_t *size_ret) { - if (platform != &__platform) + if (platform != &_clover_platform) return CL_INVALID_PLATFORM; switch (param_name) { diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp index 1615d6f..43036da 100644 --- a/src/gallium/state_trackers/clover/api/transfer.cpp +++ b/src/gallium/state_trackers/clover/api/transfer.cpp @@ -67,9 +67,9 @@ namespace { /// \a T. The return value of get() should be implicitly /// convertible to \a void *. /// - template struct __map; + template struct _map; - template<> struct __map { + template<> struct _map { static void * get(cl_command_queue q, void *obj, cl_map_flags flags, size_t offset, size_t size) { @@ -77,7 +77,7 @@ namespace { } }; - template<> struct __map { + template<> struct _map { static const void * get(cl_command_queue q, const void *obj, cl_map_flags flags, size_t offset, size_t size) { @@ -85,7 +85,7 @@ namespace { } }; - template<> struct __map { + template<> struct _map { static mapping get(cl_command_queue q, memory_obj *obj, cl_map_flags flags, size_t offset, size_t size) { @@ -104,9 +104,9 @@ namespace { S src_obj, const point &src_orig, const point &src_pitch, const point ®ion) { return [=](event &) { - auto dst = __map::get(q, dst_obj, CL_MAP_WRITE, + auto dst = _map::get(q, dst_obj, CL_MAP_WRITE, dst_pitch(dst_orig), dst_pitch(region)); - auto src = __map::get(q, src_obj, CL_MAP_READ, + auto src = _map::get(q, src_obj, CL_MAP_READ, src_pitch(src_orig), src_pitch(region)); point p; diff --git a/src/gallium/state_trackers/clover/api/util.hpp b/src/gallium/state_trackers/clover/api/util.hpp index 6503d93..5765587 100644 --- a/src/gallium/state_trackers/clover/api/util.hpp +++ b/src/gallium/state_trackers/clover/api/util.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CL_UTIL_HPP__ -#define __CL_UTIL_HPP__ +#ifndef _CL_UTIL_HPP_ +#define _CL_UTIL_HPP_ #include #include diff --git a/src/gallium/state_trackers/clover/core/base.hpp b/src/gallium/state_trackers/clover/core/base.hpp index f5b0671..bbfe463 100644 --- a/src/gallium/state_trackers/clover/core/base.hpp +++ b/src/gallium/state_trackers/clover/core/base.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_BASE_HPP__ -#define __CORE_BASE_HPP__ +#ifndef _CORE_BASE_HPP_ +#define _CORE_BASE_HPP_ #include #include @@ -59,22 +59,22 @@ namespace clover { /// class ref_counter { public: - ref_counter() : __ref_count(1) {} + ref_counter() : _ref_count(1) {} unsigned ref_count() { - return __ref_count; + return _ref_count; } void retain() { - __ref_count++; + _ref_count++; } bool release() { - return (--__ref_count) == 0; + return (--_ref_count) == 0; } private: - std::atomic __ref_count; + std::atomic _ref_count; }; /// @@ -138,17 +138,17 @@ namespace clover { } template - struct __iter_helper { + struct _iter_helper { template static T step(F op, S state, Its its, Args... args) { - return __iter_helper::step( + return _iter_helper::step( op, state, its, *(std::get(its)++), args...); } }; template - struct __iter_helper { + struct _iter_helper { template static T step(F op, S state, Its its, Args... args) { @@ -156,19 +156,19 @@ namespace clover { } }; - struct __empty {}; + struct _empty {}; template - struct __iter_helper { + struct _iter_helper { template static T - step(F op, __empty state, Its its, Args... args) { + step(F op, _empty state, Its its, Args... args) { return op(*(std::get<0>(its)++), args...); } }; template - struct __result_helper { + struct _result_helper { typedef typename std::remove_const< typename std::result_of< F (typename std::iterator_traits::value_type...) @@ -187,7 +187,7 @@ namespace clover { F for_each(F op, It0 it0, It0 end0, Its... its) { while (it0 != end0) - __iter_helper::step( + _iter_helper::step( op, {}, std::tie(it0, its...)); return op; @@ -203,14 +203,14 @@ namespace clover { /// template::type>> + typename _result_helper::type>> C map(F op, It0 it0, It0 end0, Its... its) { C c; while (it0 != end0) c.push_back( - __iter_helper + _iter_helper ::step(op, {}, std::tie(it0, its...))); return c; @@ -228,7 +228,7 @@ namespace clover { T fold(F op, T a, It0 it0, It0 end0, Its... its) { while (it0 != end0) - a = __iter_helper::step( + a = _iter_helper::step( op, a, std::tie(it0, its...)); return a; @@ -245,7 +245,7 @@ namespace clover { bool any_of(F op, It0 it0, It0 end0, Its... its) { while (it0 != end0) - if (__iter_helper::step( + if (_iter_helper::step( op, {}, std::tie(it0, its...))) return true; diff --git a/src/gallium/state_trackers/clover/core/compat.hpp b/src/gallium/state_trackers/clover/core/compat.hpp index 6018838..2e51d0f 100644 --- a/src/gallium/state_trackers/clover/core/compat.hpp +++ b/src/gallium/state_trackers/clover/core/compat.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_COMPAT_HPP__ -#define __CORE_COMPAT_HPP__ +#ifndef _CORE_COMPAT_HPP_ +#define _CORE_COMPAT_HPP_ #include #include diff --git a/src/gallium/state_trackers/clover/core/compiler.hpp b/src/gallium/state_trackers/clover/core/compiler.hpp index b8af1c8..15df0b5 100644 --- a/src/gallium/state_trackers/clover/core/compiler.hpp +++ b/src/gallium/state_trackers/clover/core/compiler.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_COMPILER_HPP__ -#define __CORE_COMPILER_HPP__ +#ifndef _CORE_COMPILER_HPP_ +#define _CORE_COMPILER_HPP_ #include "core/compat.hpp" #include "core/module.hpp" diff --git a/src/gallium/state_trackers/clover/core/context.cpp b/src/gallium/state_trackers/clover/core/context.cpp index d6817bf..31e75bd 100644 --- a/src/gallium/state_trackers/clover/core/context.cpp +++ b/src/gallium/state_trackers/clover/core/context.cpp @@ -28,7 +28,7 @@ using namespace clover; _cl_context::_cl_context(const std::vector &props, const std::vector &devs) : - devs(devs), __props(props) { + devs(devs), _props(props) { } bool diff --git a/src/gallium/state_trackers/clover/core/context.hpp b/src/gallium/state_trackers/clover/core/context.hpp index 9d19b15..fa93b63 100644 --- a/src/gallium/state_trackers/clover/core/context.hpp +++ b/src/gallium/state_trackers/clover/core/context.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_CONTEXT_HPP__ -#define __CORE_CONTEXT_HPP__ +#ifndef _CORE_CONTEXT_HPP_ +#define _CORE_CONTEXT_HPP_ #include "core/base.hpp" #include "core/device.hpp" @@ -39,13 +39,13 @@ public: bool has_device(clover::device *dev) const; const std::vector &props() const { - return __props; + return _props; } const std::vector devs; private: - std::vector __props; + std::vector _props; }; #endif diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index c6e50db..ec8641c 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_DEVICE_HPP__ -#define __CORE_DEVICE_HPP__ +#ifndef _CORE_DEVICE_HPP_ +#define _CORE_DEVICE_HPP_ #include #include diff --git a/src/gallium/state_trackers/clover/core/event.cpp b/src/gallium/state_trackers/clover/core/event.cpp index b89d274..ce9eda3 100644 --- a/src/gallium/state_trackers/clover/core/event.cpp +++ b/src/gallium/state_trackers/clover/core/event.cpp @@ -28,7 +28,7 @@ using namespace clover; _cl_event::_cl_event(clover::context &ctx, std::vector deps, action action_ok, action action_fail) : - ctx(ctx), __status(0), wait_count(1), + ctx(ctx), _status(0), wait_count(1), action_ok(action_ok), action_fail(action_fail) { for (auto ev : deps) ev->chain(this); @@ -42,21 +42,21 @@ _cl_event::trigger() { if (!--wait_count) { action_ok(*this); - while (!__chain.empty()) { - __chain.back()->trigger(); - __chain.pop_back(); + while (!_chain.empty()) { + _chain.back()->trigger(); + _chain.pop_back(); } } } void _cl_event::abort(cl_int status) { - __status = status; + _status = status; action_fail(*this); - while (!__chain.empty()) { - __chain.back()->abort(status); - __chain.pop_back(); + while (!_chain.empty()) { + _chain.back()->abort(status); + _chain.pop_back(); } } @@ -69,7 +69,7 @@ void _cl_event::chain(clover::event *ev) { if (wait_count) { ev->wait_count++; - __chain.push_back(ev); + _chain.push_back(ev); } ev->deps.push_back(this); } @@ -77,7 +77,7 @@ _cl_event::chain(clover::event *ev) { hard_event::hard_event(clover::command_queue &q, cl_command_type command, std::vector deps, action action) : _cl_event(q.ctx, deps, profile(q, action), [](event &ev){}), - __queue(q), __command(command), __fence(NULL) { + _queue(q), _command(command), _fence(NULL) { if (q.profiling_enabled()) _time_queued = timestamp::current(q); @@ -87,20 +87,20 @@ hard_event::hard_event(clover::command_queue &q, cl_command_type command, hard_event::~hard_event() { pipe_screen *screen = queue()->dev.pipe; - screen->fence_reference(screen, &__fence, NULL); + screen->fence_reference(screen, &_fence, NULL); } cl_int hard_event::status() const { pipe_screen *screen = queue()->dev.pipe; - if (__status < 0) - return __status; + if (_status < 0) + return _status; - else if (!__fence) + else if (!_fence) return CL_QUEUED; - else if (!screen->fence_signalled(screen, __fence)) + else if (!screen->fence_signalled(screen, _fence)) return CL_SUBMITTED; else @@ -109,12 +109,12 @@ hard_event::status() const { cl_command_queue hard_event::queue() const { - return &__queue; + return &_queue; } cl_command_type hard_event::command() const { - return __command; + return _command; } void @@ -124,8 +124,8 @@ hard_event::wait() const { if (status() == CL_QUEUED) queue()->flush(); - if (!__fence || - !screen->fence_finish(screen, __fence, PIPE_TIMEOUT_INFINITE)) + if (!_fence || + !screen->fence_finish(screen, _fence, PIPE_TIMEOUT_INFINITE)) throw error(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST); } @@ -152,7 +152,7 @@ hard_event::time_end() const { void hard_event::fence(pipe_fence_handle *fence) { pipe_screen *screen = queue()->dev.pipe; - screen->fence_reference(screen, &__fence, fence); + screen->fence_reference(screen, &_fence, fence); } event::action @@ -176,16 +176,16 @@ hard_event::profile(command_queue &q, const action &action) const { soft_event::soft_event(clover::context &ctx, std::vector deps, - bool __trigger, action action) : + bool _trigger, action action) : _cl_event(ctx, deps, action, action) { - if (__trigger) + if (_trigger) trigger(); } cl_int soft_event::status() const { - if (__status < 0) - return __status; + if (_status < 0) + return _status; else if (!signalled() || any_of([](const ref_ptr &ev) { diff --git a/src/gallium/state_trackers/clover/core/event.hpp b/src/gallium/state_trackers/clover/core/event.hpp index ba9d500..040816c 100644 --- a/src/gallium/state_trackers/clover/core/event.hpp +++ b/src/gallium/state_trackers/clover/core/event.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_EVENT_HPP__ -#define __CORE_EVENT_HPP__ +#ifndef _CORE_EVENT_HPP_ +#define _CORE_EVENT_HPP_ #include @@ -73,14 +73,14 @@ public: protected: void chain(clover::event *ev); - cl_int __status; + cl_int _status; std::vector> deps; private: unsigned wait_count; action action_ok; action action_fail; - std::vector> __chain; + std::vector> _chain; }; namespace clover { @@ -119,9 +119,9 @@ namespace clover { virtual void fence(pipe_fence_handle *fence); action profile(command_queue &q, const action &action) const; - clover::command_queue &__queue; - cl_command_type __command; - pipe_fence_handle *__fence; + clover::command_queue &_queue; + cl_command_type _command; + pipe_fence_handle *_fence; lazy _time_queued, _time_submit, _time_start, _time_end; }; diff --git a/src/gallium/state_trackers/clover/core/format.hpp b/src/gallium/state_trackers/clover/core/format.hpp index 30b79fd..ff4d2be 100644 --- a/src/gallium/state_trackers/clover/core/format.hpp +++ b/src/gallium/state_trackers/clover/core/format.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_FORMAT_HPP__ -#define __CORE_FORMAT_HPP__ +#ifndef _CORE_FORMAT_HPP_ +#define _CORE_FORMAT_HPP_ #include diff --git a/src/gallium/state_trackers/clover/core/geometry.hpp b/src/gallium/state_trackers/clover/core/geometry.hpp index 2cb965b..c603125 100644 --- a/src/gallium/state_trackers/clover/core/geometry.hpp +++ b/src/gallium/state_trackers/clover/core/geometry.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_GEOMETRY_HPP__ -#define __CORE_GEOMETRY_HPP__ +#ifndef _CORE_GEOMETRY_HPP_ +#define _CORE_GEOMETRY_HPP_ #include #include diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp index a764bb5..6b949dd 100644 --- a/src/gallium/state_trackers/clover/core/kernel.cpp +++ b/src/gallium/state_trackers/clover/core/kernel.cpp @@ -30,7 +30,7 @@ using namespace clover; _cl_kernel::_cl_kernel(clover::program &prog, const std::string &name, const std::vector &margs) : - prog(prog), __name(name), exec(*this) { + prog(prog), _name(name), exec(*this) { for (auto marg : margs) { if (marg.type == module::argument::scalar) args.emplace_back(new scalar_argument(marg.size)); @@ -85,7 +85,7 @@ _cl_kernel::launch(clover::command_queue &q, q.pipe->launch_grid(q.pipe, pad_vector(q, block_size, 1).data(), pad_vector(q, grid_size, 1).data(), - module(q).sym(__name).offset, + module(q).sym(_name).offset, exec.input.data()); q.pipe->set_global_binding(q.pipe, 0, exec.g_buffers.size(), NULL, NULL); @@ -120,7 +120,7 @@ _cl_kernel::max_block_size() const { const std::string & _cl_kernel::name() const { - return __name; + return _name; } std::vector @@ -143,8 +143,8 @@ _cl_kernel::exec_context::~exec_context() { } void * -_cl_kernel::exec_context::bind(clover::command_queue *__q) { - std::swap(q, __q); +_cl_kernel::exec_context::bind(clover::command_queue *_q) { + std::swap(q, _q); // Bind kernel arguments. auto margs = kern.module(*q).sym(kern.name()).args; @@ -154,11 +154,11 @@ _cl_kernel::exec_context::bind(clover::command_queue *__q) { }, kern.args.begin(), kern.args.end(), margs.begin()); // Create a new compute state if anything changed. - if (!st || q != __q || + if (!st || q != _q || cs.req_local_mem != mem_local || cs.req_input_mem != input.size()) { if (st) - __q->pipe->delete_compute_state(__q->pipe, st); + _q->pipe->delete_compute_state(_q->pipe, st); cs.prog = kern.module(*q).sec(module::section::text).data.begin(); cs.req_local_mem = mem_local; @@ -259,12 +259,12 @@ namespace { } } -_cl_kernel::argument::argument() : __set(false) { +_cl_kernel::argument::argument() : _set(false) { } bool _cl_kernel::argument::set() const { - return __set; + return _set; } size_t @@ -281,7 +281,7 @@ _cl_kernel::scalar_argument::set(size_t size, const void *value) { throw error(CL_INVALID_ARG_SIZE); v = { (uint8_t *)value, (uint8_t *)value + size }; - __set = true; + _set = true; } void @@ -308,7 +308,7 @@ _cl_kernel::global_argument::set(size_t size, const void *value) { if (!obj) throw error(CL_INVALID_MEM_OBJECT); - __set = true; + _set = true; } void @@ -325,7 +325,7 @@ _cl_kernel::global_argument::unbind(exec_context &ctx) { size_t _cl_kernel::local_argument::storage() const { - return __storage; + return _storage; } void @@ -333,8 +333,8 @@ _cl_kernel::local_argument::set(size_t size, const void *value) { if (value) throw error(CL_INVALID_ARG_VALUE); - __storage = size; - __set = true; + _storage = size; + _set = true; } void @@ -347,7 +347,7 @@ _cl_kernel::local_argument::bind(exec_context &ctx, align(ctx.input, marg.target_align); insert(ctx.input, v); - ctx.mem_local += __storage; + ctx.mem_local += _storage; } void @@ -363,7 +363,7 @@ _cl_kernel::constant_argument::set(size_t size, const void *value) { if (!obj) throw error(CL_INVALID_MEM_OBJECT); - __set = true; + _set = true; } void @@ -394,7 +394,7 @@ _cl_kernel::image_rd_argument::set(size_t size, const void *value) { if (!obj) throw error(CL_INVALID_MEM_OBJECT); - __set = true; + _set = true; } void @@ -425,7 +425,7 @@ _cl_kernel::image_wr_argument::set(size_t size, const void *value) { if (!obj) throw error(CL_INVALID_MEM_OBJECT); - __set = true; + _set = true; } void @@ -453,7 +453,7 @@ _cl_kernel::sampler_argument::set(size_t size, const void *value) { throw error(CL_INVALID_ARG_SIZE); obj = *(cl_sampler *)value; - __set = true; + _set = true; } void diff --git a/src/gallium/state_trackers/clover/core/kernel.hpp b/src/gallium/state_trackers/clover/core/kernel.hpp index e508e3c..6d6cfde 100644 --- a/src/gallium/state_trackers/clover/core/kernel.hpp +++ b/src/gallium/state_trackers/clover/core/kernel.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_KERNEL_HPP__ -#define __CORE_KERNEL_HPP__ +#ifndef _CORE_KERNEL_HPP_ +#define _CORE_KERNEL_HPP_ #include @@ -88,7 +88,7 @@ public: virtual void unbind(exec_context &ctx) = 0; protected: - bool __set; + bool _set; }; _cl_kernel(clover::program &prog, @@ -149,7 +149,7 @@ private: virtual void unbind(exec_context &ctx); private: - size_t __storage; + size_t _storage; }; class constant_argument : public argument { @@ -200,7 +200,7 @@ private: void *st; }; - std::string __name; + std::string _name; exec_context exec; }; diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp index 63050b3..863a417 100644 --- a/src/gallium/state_trackers/clover/core/memory.cpp +++ b/src/gallium/state_trackers/clover/core/memory.cpp @@ -27,35 +27,35 @@ using namespace clover; _cl_mem::_cl_mem(clover::context &ctx, cl_mem_flags flags, size_t size, void *host_ptr) : - ctx(ctx), __flags(flags), - __size(size), __host_ptr(host_ptr), - __destroy_notify([]{}) { + ctx(ctx), _flags(flags), + _size(size), _host_ptr(host_ptr), + _destroy_notify([]{}) { if (flags & CL_MEM_COPY_HOST_PTR) data.append((char *)host_ptr, size); } _cl_mem::~_cl_mem() { - __destroy_notify(); + _destroy_notify(); } void _cl_mem::destroy_notify(std::function f) { - __destroy_notify = f; + _destroy_notify = f; } cl_mem_flags _cl_mem::flags() const { - return __flags; + return _flags; } size_t _cl_mem::size() const { - return __size; + return _size; } void * _cl_mem::host_ptr() const { - return __host_ptr; + return _host_ptr; } buffer::buffer(clover::context &ctx, cl_mem_flags flags, @@ -93,7 +93,7 @@ sub_buffer::sub_buffer(clover::root_buffer &parent, cl_mem_flags flags, size_t offset, size_t size) : buffer(parent.ctx, flags, size, (char *)parent.host_ptr() + offset), - parent(parent), __offset(offset) { + parent(parent), _offset(offset) { } clover::resource & @@ -111,7 +111,7 @@ sub_buffer::resource(cl_command_queue q) { size_t sub_buffer::offset() const { - return __offset; + return _offset; } image::image(clover::context &ctx, cl_mem_flags flags, @@ -120,8 +120,8 @@ image::image(clover::context &ctx, cl_mem_flags flags, size_t row_pitch, size_t slice_pitch, size_t size, void *host_ptr) : memory_obj(ctx, flags, size, host_ptr), - __format(*format), __width(width), __height(height), __depth(depth), - __row_pitch(row_pitch), __slice_pitch(slice_pitch) { + _format(*format), _width(width), _height(height), _depth(depth), + _row_pitch(row_pitch), _slice_pitch(slice_pitch) { } clover::resource & @@ -142,32 +142,32 @@ image::resource(cl_command_queue q) { cl_image_format image::format() const { - return __format; + return _format; } size_t image::width() const { - return __width; + return _width; } size_t image::height() const { - return __height; + return _height; } size_t image::depth() const { - return __depth; + return _depth; } size_t image::row_pitch() const { - return __row_pitch; + return _row_pitch; } size_t image::slice_pitch() const { - return __slice_pitch; + return _slice_pitch; } image2d::image2d(clover::context &ctx, cl_mem_flags flags, diff --git a/src/gallium/state_trackers/clover/core/memory.hpp b/src/gallium/state_trackers/clover/core/memory.hpp index c71a03c..50d7e1a 100644 --- a/src/gallium/state_trackers/clover/core/memory.hpp +++ b/src/gallium/state_trackers/clover/core/memory.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_MEMORY_HPP__ -#define __CORE_MEMORY_HPP__ +#ifndef _CORE_MEMORY_HPP_ +#define _CORE_MEMORY_HPP_ #include #include @@ -57,10 +57,10 @@ public: clover::context &ctx; private: - cl_mem_flags __flags; - size_t __size; - void *__host_ptr; - std::function __destroy_notify; + cl_mem_flags _flags; + size_t _size; + void *_host_ptr; + std::function _destroy_notify; protected: std::string data; @@ -99,7 +99,7 @@ namespace clover { clover::root_buffer &parent; private: - size_t __offset; + size_t _offset; std::map> resources; }; @@ -122,12 +122,12 @@ namespace clover { size_t slice_pitch() const; private: - cl_image_format __format; - size_t __width; - size_t __height; - size_t __depth; - size_t __row_pitch; - size_t __slice_pitch; + cl_image_format _format; + size_t _width; + size_t _height; + size_t _depth; + size_t _row_pitch; + size_t _slice_pitch; std::map> resources; }; diff --git a/src/gallium/state_trackers/clover/core/module.cpp b/src/gallium/state_trackers/clover/core/module.cpp index 662e55d..de38438 100644 --- a/src/gallium/state_trackers/clover/core/module.cpp +++ b/src/gallium/state_trackers/clover/core/module.cpp @@ -29,34 +29,34 @@ using namespace clover; namespace { template - struct __serializer; + struct _serializer; /// Serialize the specified object. template void - __proc(compat::ostream &os, const T &x) { - __serializer::proc(os, x); + _proc(compat::ostream &os, const T &x) { + _serializer::proc(os, x); } /// Deserialize the specified object. template void - __proc(compat::istream &is, T &x) { - __serializer::proc(is, x); + _proc(compat::istream &is, T &x) { + _serializer::proc(is, x); } template T - __proc(compat::istream &is) { + _proc(compat::istream &is) { T x; - __serializer::proc(is, x); + _serializer::proc(is, x); return x; } /// (De)serialize a scalar value. template - struct __serializer::value>::type> { + struct _serializer::value>::type> { static void proc(compat::ostream &os, const T &x) { os.write(reinterpret_cast(&x), sizeof(x)); @@ -70,69 +70,69 @@ namespace { /// (De)serialize a vector. template - struct __serializer> { + struct _serializer> { static void proc(compat::ostream &os, const compat::vector &v) { - __proc(os, v.size()); + _proc(os, v.size()); for (size_t i = 0; i < v.size(); i++) - __proc(os, v[i]); + _proc(os, v[i]); } static void proc(compat::istream &is, compat::vector &v) { - v.reserve(__proc(is)); + v.reserve(_proc(is)); for (size_t i = 0; i < v.size(); i++) - new(&v[i]) T(__proc(is)); + new(&v[i]) T(_proc(is)); } }; /// (De)serialize a module::section. template<> - struct __serializer { + struct _serializer { template static void proc(S &s, QT &x) { - __proc(s, x.id); - __proc(s, x.type); - __proc(s, x.size); - __proc(s, x.data); + _proc(s, x.id); + _proc(s, x.type); + _proc(s, x.size); + _proc(s, x.data); } }; /// (De)serialize a module::argument. template<> - struct __serializer { + struct _serializer { template static void proc(S &s, QT &x) { - __proc(s, x.type); - __proc(s, x.size); + _proc(s, x.type); + _proc(s, x.size); } }; /// (De)serialize a module::symbol. template<> - struct __serializer { + struct _serializer { template static void proc(S &s, QT &x) { - __proc(s, x.name); - __proc(s, x.section); - __proc(s, x.offset); - __proc(s, x.args); + _proc(s, x.name); + _proc(s, x.section); + _proc(s, x.offset); + _proc(s, x.args); } }; /// (De)serialize a module. template<> - struct __serializer { + struct _serializer { template static void proc(S &s, QT &x) { - __proc(s, x.syms); - __proc(s, x.secs); + _proc(s, x.syms); + _proc(s, x.secs); } }; }; @@ -140,12 +140,12 @@ namespace { namespace clover { void module::serialize(compat::ostream &os) const { - __proc(os, *this); + _proc(os, *this); } module module::deserialize(compat::istream &is) { - return __proc(is); + return _proc(is); } const module::symbol & diff --git a/src/gallium/state_trackers/clover/core/module.hpp b/src/gallium/state_trackers/clover/core/module.hpp index e25524e..776dee8 100644 --- a/src/gallium/state_trackers/clover/core/module.hpp +++ b/src/gallium/state_trackers/clover/core/module.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_MODULE_HPP__ -#define __CORE_MODULE_HPP__ +#ifndef _CORE_MODULE_HPP_ +#define _CORE_MODULE_HPP_ #include "core/compat.hpp" diff --git a/src/gallium/state_trackers/clover/core/platform.hpp b/src/gallium/state_trackers/clover/core/platform.hpp index 831a742..6f99166 100644 --- a/src/gallium/state_trackers/clover/core/platform.hpp +++ b/src/gallium/state_trackers/clover/core/platform.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_PLATFORM_HPP__ -#define __CORE_PLATFORM_HPP__ +#ifndef _CORE_PLATFORM_HPP_ +#define _CORE_PLATFORM_HPP_ #include diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp index e85f27a..219a1e0 100644 --- a/src/gallium/state_trackers/clover/core/program.cpp +++ b/src/gallium/state_trackers/clover/core/program.cpp @@ -27,7 +27,7 @@ using namespace clover; _cl_program::_cl_program(clover::context &ctx, const std::string &source) : - ctx(ctx), __source(source) { + ctx(ctx), _source(source) { } _cl_program::_cl_program(clover::context &ctx, @@ -35,7 +35,7 @@ _cl_program::_cl_program(clover::context &ctx, const std::vector &binaries) : ctx(ctx) { for_each([&](clover::device *dev, const clover::module &bin) { - __binaries.insert({ dev, bin }); + _binaries.insert({ dev, bin }); }, devs.begin(), devs.end(), binaries.begin()); } @@ -45,20 +45,20 @@ _cl_program::build(const std::vector &devs, const char *opts) { for (auto dev : devs) { - __binaries.erase(dev); - __logs.erase(dev); - __opts.erase(dev); + _binaries.erase(dev); + _logs.erase(dev); + _opts.erase(dev); - __opts.insert({ dev, opts }); + _opts.insert({ dev, opts }); try { auto module = (dev->ir_format() == PIPE_SHADER_IR_TGSI ? - compile_program_tgsi(__source) : - compile_program_llvm(__source, dev->ir_format(), + compile_program_tgsi(_source) : + compile_program_llvm(_source, dev->ir_format(), dev->ir_target(), build_opts(dev))); - __binaries.insert({ dev, module }); + _binaries.insert({ dev, module }); } catch (build_error &e) { - __logs.insert({ dev, e.what() }); + _logs.insert({ dev, e.what() }); throw error(CL_BUILD_PROGRAM_FAILURE); } catch (invalid_option_error &e) { throw error(CL_INVALID_BUILD_OPTIONS); @@ -68,25 +68,25 @@ _cl_program::build(const std::vector &devs, const std::string & _cl_program::source() const { - return __source; + return _source; } const std::map & _cl_program::binaries() const { - return __binaries; + return _binaries; } cl_build_status _cl_program::build_status(clover::device *dev) const { - return __binaries.count(dev) ? CL_BUILD_SUCCESS : CL_BUILD_NONE; + return _binaries.count(dev) ? CL_BUILD_SUCCESS : CL_BUILD_NONE; } std::string _cl_program::build_opts(clover::device *dev) const { - return __opts.count(dev) ? __opts.find(dev)->second : ""; + return _opts.count(dev) ? _opts.find(dev)->second : ""; } std::string _cl_program::build_log(clover::device *dev) const { - return __logs.count(dev) ? __logs.find(dev)->second : ""; + return _logs.count(dev) ? _logs.find(dev)->second : ""; } diff --git a/src/gallium/state_trackers/clover/core/program.hpp b/src/gallium/state_trackers/clover/core/program.hpp index a1452df..8d4ca0d 100644 --- a/src/gallium/state_trackers/clover/core/program.hpp +++ b/src/gallium/state_trackers/clover/core/program.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_PROGRAM_HPP__ -#define __CORE_PROGRAM_HPP__ +#ifndef _CORE_PROGRAM_HPP_ +#define _CORE_PROGRAM_HPP_ #include @@ -53,10 +53,10 @@ public: clover::context &ctx; private: - std::map __binaries; - std::map __logs; - std::map __opts; - std::string __source; + std::map _binaries; + std::map _logs; + std::map _opts; + std::string _source; }; #endif diff --git a/src/gallium/state_trackers/clover/core/queue.cpp b/src/gallium/state_trackers/clover/core/queue.cpp index d8cf77a..62a59f8 100644 --- a/src/gallium/state_trackers/clover/core/queue.cpp +++ b/src/gallium/state_trackers/clover/core/queue.cpp @@ -31,7 +31,7 @@ using namespace clover; _cl_command_queue::_cl_command_queue(context &ctx, device &dev, cl_command_queue_properties props) : - ctx(ctx), dev(dev), __props(props) { + ctx(ctx), dev(dev), _props(props) { pipe = dev.pipe->context_create(dev.pipe, NULL); if (!pipe) throw error(CL_INVALID_DEVICE); @@ -62,12 +62,12 @@ _cl_command_queue::flush() { cl_command_queue_properties _cl_command_queue::props() const { - return __props; + return _props; } bool _cl_command_queue::profiling_enabled() const { - return __props & CL_QUEUE_PROFILING_ENABLE; + return _props & CL_QUEUE_PROFILING_ENABLE; } void diff --git a/src/gallium/state_trackers/clover/core/queue.hpp b/src/gallium/state_trackers/clover/core/queue.hpp index 4f58968..535147a 100644 --- a/src/gallium/state_trackers/clover/core/queue.hpp +++ b/src/gallium/state_trackers/clover/core/queue.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_QUEUE_HPP__ -#define __CORE_QUEUE_HPP__ +#ifndef _CORE_QUEUE_HPP_ +#define _CORE_QUEUE_HPP_ #include "core/base.hpp" #include "core/context.hpp" @@ -64,7 +64,7 @@ private: /// and push it to the pending list. void sequence(clover::hard_event *ev); - cl_command_queue_properties __props; + cl_command_queue_properties _props; pipe_context *pipe; typedef clover::ref_ptr event_ptr; diff --git a/src/gallium/state_trackers/clover/core/resource.hpp b/src/gallium/state_trackers/clover/core/resource.hpp index f5a4deb..6af23e1 100644 --- a/src/gallium/state_trackers/clover/core/resource.hpp +++ b/src/gallium/state_trackers/clover/core/resource.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_RESOURCE_HPP__ -#define __CORE_RESOURCE_HPP__ +#ifndef _CORE_RESOURCE_HPP_ +#define _CORE_RESOURCE_HPP_ #include diff --git a/src/gallium/state_trackers/clover/core/sampler.cpp b/src/gallium/state_trackers/clover/core/sampler.cpp index 55a66a1..32c415e 100644 --- a/src/gallium/state_trackers/clover/core/sampler.cpp +++ b/src/gallium/state_trackers/clover/core/sampler.cpp @@ -28,23 +28,23 @@ using namespace clover; _cl_sampler::_cl_sampler(clover::context &ctx, bool norm_mode, cl_addressing_mode addr_mode, cl_filter_mode filter_mode) : - ctx(ctx), __norm_mode(norm_mode), - __addr_mode(addr_mode), __filter_mode(filter_mode) { + ctx(ctx), _norm_mode(norm_mode), + _addr_mode(addr_mode), _filter_mode(filter_mode) { } bool _cl_sampler::norm_mode() { - return __norm_mode; + return _norm_mode; } cl_addressing_mode _cl_sampler::addr_mode() { - return __addr_mode; + return _addr_mode; } cl_filter_mode _cl_sampler::filter_mode() { - return __filter_mode; + return _filter_mode; } void * diff --git a/src/gallium/state_trackers/clover/core/sampler.hpp b/src/gallium/state_trackers/clover/core/sampler.hpp index 850240e..a18a2ec 100644 --- a/src/gallium/state_trackers/clover/core/sampler.hpp +++ b/src/gallium/state_trackers/clover/core/sampler.hpp @@ -20,8 +20,8 @@ // OTHER DEALINGS IN THE SOFTWARE. // -#ifndef __CORE_SAMPLER_HPP__ -#define __CORE_SAMPLER_HPP__ +#ifndef _CORE_SAMPLER_HPP_ +#define _CORE_SAMPLER_HPP_ #include "core/base.hpp" #include "core/queue.hpp" @@ -47,9 +47,9 @@ private: void *bind(clover::command_queue &q); void unbind(clover::command_queue &q, void *st); - bool __norm_mode; - cl_addressing_mode __addr_mode; - cl_filter_mode __filter_mode; + bool _norm_mode; + cl_addressing_mode _addr_mode; + cl_filter_mode _filter_mode; }; #endif