P4 to Git Change 1248071 by skeely@HSA_Perforce on 2016/03/16 13:57:32
SWDEV-90207 - Initial Mesa implementation. Interop is disabled pending further testing. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadefs.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#59 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#27 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaglinterop.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaglinterop.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsamemory.cpp#21 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsamemory.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsaregisters.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsasettings.cpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/mesa_glinterop.h#1 add ... //depot/stg/opencl/drivers/opencl/runtime/utils/util.hpp#11 edit
Этот коммит содержится в:
@@ -276,6 +276,37 @@ static inline bool Is32Bits() {
|
||||
static inline bool Is64Bits() {
|
||||
return LP64_SWITCH(false, true);
|
||||
}
|
||||
|
||||
template <typename lambda>
|
||||
class ScopeGuard {
|
||||
public:
|
||||
explicit ALWAYSINLINE ScopeGuard(const lambda& release)
|
||||
: release_(release), dismiss_(false) {}
|
||||
|
||||
ScopeGuard(ScopeGuard& rhs) { *this = rhs; }
|
||||
|
||||
ALWAYSINLINE ~ScopeGuard() {
|
||||
if (!dismiss_) release_();
|
||||
}
|
||||
ALWAYSINLINE ScopeGuard& operator=(ScopeGuard& rhs) {
|
||||
dismiss_ = rhs.dismiss_;
|
||||
release_ = rhs.release_;
|
||||
rhs.dismiss_ = true;
|
||||
}
|
||||
ALWAYSINLINE void Dismiss() { dismiss_ = true; }
|
||||
|
||||
private:
|
||||
lambda release_;
|
||||
bool dismiss_;
|
||||
};
|
||||
|
||||
#define MAKE_SCOPE_GUARD_HELPER(lname, sname, ...) \
|
||||
auto lname = __VA_ARGS__; \
|
||||
amd::ScopeGuard<decltype(lname)> sname(lname);
|
||||
#define MAKE_SCOPE_GUARD(name, ...) \
|
||||
MAKE_SCOPE_GUARD_HELPER(XCONCAT(scopeGuardLambda, __COUNTER__), name, \
|
||||
__VA_ARGS__)
|
||||
|
||||
/*@}*/} // namespace amd
|
||||
|
||||
#endif /*UTIL_HPP_*/
|
||||
|
||||
Ссылка в новой задаче
Block a user