Hash :
cddb2003
Author :
Date :
2021-04-23T18:26:51
Stubs for CL validation entry points Bug: angleproject:5775 Change-Id: Ic3b15efdf602bad8f5f170f03ba24b421a398ca8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2848504 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: John Plate <jplate@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// entry_points_cl_utils.h:
// These helpers are used in CL entry point routines.
#ifndef LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_
#define LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_
#include <cinttypes>
#include <cstdio>
#include <type_traits>
#if defined(ANGLE_TRACE_ENABLED)
# define CL_EVENT(entryPoint, ...) \
std::printf("CL " #entryPoint ": " __VA_ARGS__); \
std::printf("\n")
#else
# define CL_EVENT(entryPoint, ...) (void(0))
#endif
namespace cl
{
// First case: handling packed enums.
template <typename PackedT, typename FromT>
typename std::enable_if_t<std::is_enum<PackedT>::value, PackedT> PackParam(FromT from)
{
return FromCLenum<PackedT>(from);
}
// Cast CL object types to ANGLE types marked with 'using IsCLObjectType = std::true_type;'
template <typename PackedT, typename FromT>
inline std::enable_if_t<
std::remove_pointer_t<std::remove_pointer_t<PackedT>>::IsCLObjectType::value,
PackedT>
PackParam(FromT from)
{
return reinterpret_cast<PackedT>(from);
}
// First case: handling packed enums.
template <typename UnpackedT, typename FromT>
typename std::enable_if_t<std::is_enum<FromT>::value, UnpackedT> UnpackParam(FromT from)
{
return ToCLenum(from);
}
// Cast ANGLE types marked with 'using IsCLObjectType = std::true_type;' to CL object types
template <typename UnpackedT, typename FromT>
inline typename std::enable_if_t<std::remove_pointer_t<FromT>::IsCLObjectType::value, UnpackedT>
UnpackParam(FromT from)
{
return reinterpret_cast<UnpackedT>(from);
}
} // namespace cl
#endif // LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_