-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfix_resharper_error.hlsl
279 lines (194 loc) · 5.72 KB
/
fix_resharper_error.hlsl
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#ifndef __FIX_RESHARPER_ERROR__
#define __FIX_RESHARPER_ERROR__
#ifndef __HLSL_SHADER__
#define inout
#define in
#define out
#define RAY_FLAG_FORCE_OPAQUE 1
#define RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH 1
#define RAY_FLAG_SKIP_CLOSEST_HIT_SHADER 1
#define SV_RayPayload
#define SV_POSITION
#define SV_TARGET
#define SV_InstanceID
#define POSITION
#define COLOR
#define SHADER_STRUCTURED_BUFFER_DEFINE(type, name, base, space) type name[1]
#define SHADER_CONSTANT_BUFFER_DEFINE(type, name, base, space) type name
#define SHADER_RESOURCE_DEFINE(type, name, base, space) type name
#define SYSTEM_VALUE(type, name, value) type name
#define OPERATOR_DEFINE(type, op, argument) type operator op (argument) { return type(); }
#define ANY_OPERATOR_DEFINE() \
OPERATOR_DEFINE(this_type, +, this_type); \
OPERATOR_DEFINE(this_type, -, this_type); \
OPERATOR_DEFINE(this_type, *, this_type); \
OPERATOR_DEFINE(this_type, /, this_type); \
OPERATOR_DEFINE(this_type, +, T); \
OPERATOR_DEFINE(this_type, *, T); \
OPERATOR_DEFINE(this_type, -, T); \
OPERATOR_DEFINE(this_type, / , T); \
OPERATOR_DEFINE(this_type, +, ); \
OPERATOR_DEFINE(this_type, -, ); \
OPERATOR_DEFINE(this_type, +=, this_type); \
OPERATOR_DEFINE(this_type, -=, this_type); \
OPERATOR_DEFINE(this_type, *=, this_type); \
OPERATOR_DEFINE(this_type, +=, T); \
OPERATOR_DEFINE(this_type, *=, T); \
OPERATOR_DEFINE(this_type, -=, T); \
OPERATOR_DEFINE(this_type, /=, T);
using uint = unsigned;
template <typename T>
struct any1 {
using this_type = any1;
T x;
any1() = default;
any1(T x) {}
ANY_OPERATOR_DEFINE();
};
template <typename T>
struct any2 {
using this_type = any2;
T x, y;
T xy;
any2() = default;
any2(T x, T y) {}
any2(T v) {}
operator any1<T>() { return any1<T>(); }
ANY_OPERATOR_DEFINE();
};
template <typename T>
struct any3 {
using this_type = any3;
T x, y, z;
T xyz;
T xy;
any3() = default;
any3(T x, T y, T z) {}
any3(any2 v, T z) {}
any3(T v) {}
operator any2<T>() { return any2<T>(); }
operator any1<T>() { return any1<T>(); }
ANY_OPERATOR_DEFINE();
};
template <typename T>
struct any4 {
using this_type = any4;
T x, y, z, w;
T xyzw;
T xyz;
T xy;
any4() = default;
any4(T x, T y, T z, T w) {}
any4(any3 v, T w) {}
any4(any2 v, T z, T w) {}
any4(T v) {}
operator any3<T>() { return any3<T>(); }
operator any2<T>() { return any2<T>(); }
operator any1<T>() { return any1<T>(); }
ANY_OPERATOR_DEFINE();
};
using uint1 = any1<uint>;
using uint2 = any2<uint>;
using uint3 = any3<uint>;
using uint4 = any4<uint>;
using float1 = any1<float>;
using float2 = any2<float>;
using float3 = any3<float>;
using float4 = any4<float>;
template <typename T>
struct RWTexture2D { T value; T& operator[](float2 value) { return value; } };
struct SamplerState {};
struct Texture2D {
float4 Sample(SamplerState state, float2 value) { return float4(); }
float4 SampleLevel(SamplerState state, float2 value, float level) { return float4(); }
};
struct RayDesc {
float3 Direction;
float3 Origin;
float TMin;
float TMax;
};
struct float4x4 {
float4 x, y, z, w;
};
struct float4x3 {
float4 x, y, w;
float4 operator[](uint index) { return 1; }
};
struct float3x3 {
float3 x, y, z;
float3x3() = default;
float3x3(float3 x, float3 y, float3 z) : x(x), y(y), z(z) {}
};
struct BuiltInTriangleIntersectionAttributes {
float2 barycentrics;
};
struct RaytracingAccelerationStructure {
};
template <typename Payload>
void TraceRay(
RaytracingAccelerationStructure AccelerationStructure,
uint RayFlags,
uint InstanceInclusionMask,
uint RayContributionToHitGroupIndex,
uint MultiplierForGeometryContributionToShaderIndex,
uint MissShaderIndex,
RayDesc ray,
inout Payload payload) {}
uint2 DispatchRaysDimensions() { return 0; };
uint2 DispatchRaysIndex() { return 0; }
uint PrimitiveIndex() { return 0; }
uint InstanceID() { return 0; }
float4x3 ObjectToWorld4x3() { return float4x3(); }
float4x3 WorldToObject4x3() { return float4x3(); }
float3 WorldRayDirection() { return float3(); }
float3 WorldRayOrigin() { return float3(); }
float RayTCurrent() { return 0; }
template <typename T>
T normalize(T value) { return value; }
template <typename T>
T abs(T value) { return value; }
template <typename T>
T cos(T value) { return value; }
template <typename T>
T sin(T value) { return value; }
template <typename T>
T acos(T value) { return value; }
template <typename T>
T atan2(T y, T x) { return x; }
template <typename T>
T sqrt(T value) { return value; }
template <typename T>
T floor(T value) { return value; }
template <typename T>
float dot(T x, T y) { return x; }
template <typename T>
float length(T x) { return 0; }
template <typename T>
T pow(T x, float v) { return x; }
template <typename T>
T cross(T x, T y) { return x; }
template <typename T>
T lerp(T x, T y, float s) { return x * (1 - s) + y * s; }
template <typename T>
bool isnan(T x) { return true; }
template <typename T>
bool isinf(T x) { return true; }
template <typename T>
T log(T x) { return x; }
template <typename T>
T transpose(T x) { return x; }
float4 mul(float4 x, float4x4 y) { return 0; }
float4 mul(float4 x, float4x3 y) { return 0; }
float3 mul(float3x3 x, float3 y) { return 0; }
float max(float x, float y) { return x; }
float min(float x, float y) { return x; }
float clamp(float x, float min, float max) { return x; }
float ldexp(float x, float y) { return x; }
#else
#define SHADER_STRUCTURED_BUFFER_DEFINE(type, name, base, space) StructuredBuffer<type> name : register(base, space)
#define SHADER_CONSTANT_BUFFER_DEFINE(type, name, base, space) ConstantBuffer<type> name : register(base, space)
#define SHADER_RESOURCE_DEFINE(type, name, base, space) type name : register(base, space)
#define SYSTEM_VALUE(type, name, value) type name : value
#endif
#endif