-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathutility.hlsl
More file actions
70 lines (54 loc) · 1.23 KB
/
utility.hlsl
File metadata and controls
70 lines (54 loc) · 1.23 KB
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
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2024 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_BUILTIN_HLSL_UTILITY_INCLUDED_
#define _NBL_BUILTIN_HLSL_UTILITY_INCLUDED_
#include <nbl/builtin/hlsl/type_traits.hlsl>
namespace nbl
{
namespace hlsl
{
template<typename T1, typename T2>
struct pair
{
using first_type = T1;
using second_type = T2;
first_type first;
second_type second;
};
template<typename T1, typename T2>
pair<T1, T2> make_pair(T1 f, T2 s)
{
pair<T1, T2> p;
p.first = f;
p.second = s;
return p;
}
template<typename T1, typename T2>
void swap(NBL_REF_ARG(pair<T1, T2>) a, NBL_REF_ARG(pair<T1, T2>) b)
{
T1 temp_first = a.first;
T2 temp_second = a.second;
a.first = b.first;
a.second = b.second;
b.first = temp_first;
b.second = temp_second;
}
template<typename T>
const static bool always_true = true;
#ifndef __HLSL_VERSION
template<class T>
std::add_rvalue_reference_t<T> declval() noexcept
{
static_assert(false,"Actually calling declval is ill-formed.");
}
#else
namespace experimental
{
template<class T>
T declval() {}
}
#endif
}
}
#endif