slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
slang-cpp-types-core.h
浏览该文件的文档.
1#ifndef SLANG_PRELUDE_CPP_TYPES_CORE_H
2#define SLANG_PRELUDE_CPP_TYPES_CORE_H
3
4#ifndef SLANG_PRELUDE_ASSERT
5#ifdef SLANG_PRELUDE_ENABLE_ASSERT
6#define SLANG_PRELUDE_ASSERT(VALUE) assert(VALUE)
7#else
8#define SLANG_PRELUDE_ASSERT(VALUE)
9#endif
10#endif
11
12// Since we are using unsigned arithmatic care is need in this comparison.
13// It is *assumed* that sizeInBytes >= elemSize. Which means (sizeInBytes >= elemSize) >= 0
14// Which means only a single test is needed
15
16// Asserts for bounds checking.
17// It is assumed index/count are unsigned types.
18#define SLANG_BOUND_ASSERT(index, count) SLANG_PRELUDE_ASSERT(index < count);
19#define SLANG_BOUND_ASSERT_BYTE_ADDRESS(index, elemSize, sizeInBytes) \
20 SLANG_PRELUDE_ASSERT(index <= (sizeInBytes - elemSize) && (index & 3) == 0);
21
22// Macros to zero index if an access is out of range
23#define SLANG_BOUND_ZERO_INDEX(index, count) index = (index < count) ? index : 0;
24#define SLANG_BOUND_ZERO_INDEX_BYTE_ADDRESS(index, elemSize, sizeInBytes) \
25 index = (index <= (sizeInBytes - elemSize)) ? index : 0;
26
27// The 'FIX' macro define how the index is fixed. The default is to do nothing. If
28// SLANG_ENABLE_BOUND_ZERO_INDEX the fix macro will zero the index, if out of range
29#ifdef SLANG_ENABLE_BOUND_ZERO_INDEX
30#define SLANG_BOUND_FIX(index, count) SLANG_BOUND_ZERO_INDEX(index, count)
31#define SLANG_BOUND_FIX_BYTE_ADDRESS(index, elemSize, sizeInBytes) \
32 SLANG_BOUND_ZERO_INDEX_BYTE_ADDRESS(index, elemSize, sizeInBytes)
33#define SLANG_BOUND_FIX_FIXED_ARRAY(index, count) SLANG_BOUND_ZERO_INDEX(index, count)
34#else
35#define SLANG_BOUND_FIX(index, count)
36#define SLANG_BOUND_FIX_BYTE_ADDRESS(index, elemSize, sizeInBytes)
37#define SLANG_BOUND_FIX_FIXED_ARRAY(index, count)
38#endif
39
40#ifndef SLANG_BOUND_CHECK
41#define SLANG_BOUND_CHECK(index, count) \
42 SLANG_BOUND_ASSERT(index, count) SLANG_BOUND_FIX(index, count)
43#endif
44
45#ifndef SLANG_BOUND_CHECK_BYTE_ADDRESS
46#define SLANG_BOUND_CHECK_BYTE_ADDRESS(index, elemSize, sizeInBytes) \
47 SLANG_BOUND_ASSERT_BYTE_ADDRESS(index, elemSize, sizeInBytes) \
48 SLANG_BOUND_FIX_BYTE_ADDRESS(index, elemSize, sizeInBytes)
49#endif
50
51#ifndef SLANG_BOUND_CHECK_FIXED_ARRAY
52#define SLANG_BOUND_CHECK_FIXED_ARRAY(index, count) \
53 SLANG_BOUND_ASSERT(index, count) SLANG_BOUND_FIX_FIXED_ARRAY(index, count)
54#endif
55
57{
58 size_t typeSize;
59};
60
61template<typename T, size_t SIZE>
63{
64 const T& operator[](size_t index) const
65 {
67 return m_data[index];
68 }
69 T& operator[](size_t index)
70 {
72 return m_data[index];
73 }
74
75 T m_data[SIZE];
76};
77
78// An array that has no specified size, becomes a 'Array'. This stores the size so it can
79// potentially do bounds checking.
80template<typename T>
81struct Array
82{
83 const T& operator[](size_t index) const
84 {
86 return data[index];
87 }
88 T& operator[](size_t index)
89 {
91 return data[index];
92 }
93
94 T* data;
95 size_t count;
96};
97
98/* Constant buffers become a pointer to the contained type, so ConstantBuffer<T> becomes T* in C++
99 * code.
100 */
101
102template<typename T, int COUNT>
103struct Vector;
104
105template<typename T>
106struct Vector<T, 1>
107{
108 T x;
109 const T& operator[](size_t /*index*/) const { return x; }
110 T& operator[](size_t /*index*/) { return x; }
111 operator T() const { return x; }
112 Vector() = default;
113 Vector(T scalar) { x = scalar; }
114 template<typename U>
116 {
117 x = (T)other.x;
118 }
119 template<typename U, int otherSize>
121 {
122 int minSize = 1;
123 if (otherSize < minSize)
124 minSize = otherSize;
125 for (int i = 0; i < minSize; i++)
126 (*this)[i] = (T)other[i];
127 }
128};
129
130template<typename T>
131struct Vector<T, 2>
132{
133 T x, y;
134 const T& operator[](size_t index) const { return index == 0 ? x : y; }
135 T& operator[](size_t index) { return index == 0 ? x : y; }
136 Vector() = default;
137 Vector(T scalar) { x = y = scalar; }
138 Vector(T _x, T _y)
139 {
140 x = _x;
141 y = _y;
142 }
143 template<typename U>
145 {
146 x = (T)other.x;
147 y = (T)other.y;
148 }
149 template<typename U, int otherSize>
151 {
152 int minSize = 2;
153 if (otherSize < minSize)
154 minSize = otherSize;
155 for (int i = 0; i < minSize; i++)
156 (*this)[i] = (T)other[i];
157 }
158};
159
160template<typename T>
161struct Vector<T, 3>
162{
163 T x, y, z;
164 const T& operator[](size_t index) const { return *((T*)(this) + index); }
165 T& operator[](size_t index) { return *((T*)(this) + index); }
166
167 Vector() = default;
168 Vector(T scalar) { x = y = z = scalar; }
169 Vector(T _x, T _y, T _z)
170 {
171 x = _x;
172 y = _y;
173 z = _z;
174 }
175 template<typename U>
177 {
178 x = (T)other.x;
179 y = (T)other.y;
180 z = (T)other.z;
181 }
182 template<typename U, int otherSize>
184 {
185 int minSize = 3;
186 if (otherSize < minSize)
187 minSize = otherSize;
188 for (int i = 0; i < minSize; i++)
189 (*this)[i] = (T)other[i];
190 }
191};
192
193template<typename T>
194struct Vector<T, 4>
195{
196 T x, y, z, w;
197
198 const T& operator[](size_t index) const { return *((T*)(this) + index); }
199 T& operator[](size_t index) { return *((T*)(this) + index); }
200 Vector() = default;
201 Vector(T scalar) { x = y = z = w = scalar; }
202 Vector(T _x, T _y, T _z, T _w)
203 {
204 x = _x;
205 y = _y;
206 z = _z;
207 w = _w;
208 }
209 template<typename U, int otherSize>
211 {
212 int minSize = 4;
213 if (otherSize < minSize)
214 minSize = otherSize;
215 for (int i = 0; i < minSize; i++)
216 (*this)[i] = (T)other[i];
217 }
218};
219
220template<typename T, int N>
222 Vector<bool, N> condition,
223 Vector<T, N> v0,
224 Vector<T, N> v1)
225{
226 Vector<T, N> result;
227 for (int i = 0; i < N; i++)
228 {
229 result[i] = condition[i] ? v0[i] : v1[i];
230 }
231 return result;
232}
233
234template<typename T>
235SLANG_FORCE_INLINE T _slang_select(bool condition, T v0, T v1)
236{
237 return condition ? v0 : v1;
238}
239
240template<typename T, int N>
242{
243 return x[index];
244}
245
246template<typename T, int N>
248{
249 return &((*const_cast<Vector<T, N>*>(x))[index]);
250}
251
252template<typename T, int N>
254{
255 return &((*x)[index]);
256}
257
258template<typename T, int n, typename OtherT, int m>
260{
261 Vector<T, n> result;
262 for (int i = 0; i < n; i++)
263 {
264 OtherT otherElement = T(0);
265 if (i < m)
266 otherElement = _slang_vector_get_element(other, i);
267 *_slang_vector_get_element_ptr(&result, i) = (T)otherElement;
268 }
269 return result;
270}
271
272typedef uint32_t uint;
273
274#define SLANG_VECTOR_BINARY_OP(T, op) \
275 template<int n> \
276 SLANG_FORCE_INLINE Vector<T, n> operator op( \
277 const Vector<T, n>& thisVal, \
278 const Vector<T, n>& other) \
279 { \
280 Vector<T, n> result; \
281 for (int i = 0; i < n; i++) \
282 result[i] = thisVal[i] op other[i]; \
283 return result; \
284 }
285#define SLANG_VECTOR_BINARY_COMPARE_OP(T, op) \
286 template<int n> \
287 SLANG_FORCE_INLINE Vector<bool, n> operator op( \
288 const Vector<T, n>& thisVal, \
289 const Vector<T, n>& other) \
290 { \
291 Vector<bool, n> result; \
292 for (int i = 0; i < n; i++) \
293 result[i] = thisVal[i] op other[i]; \
294 return result; \
295 }
296
297#define SLANG_VECTOR_UNARY_OP(T, op) \
298 template<int n> \
299 SLANG_FORCE_INLINE Vector<T, n> operator op(const Vector<T, n>& thisVal) \
300 { \
301 Vector<T, n> result; \
302 for (int i = 0; i < n; i++) \
303 result[i] = op thisVal[i]; \
304 return result; \
305 }
306#define SLANG_INT_VECTOR_OPS(T) \
307 SLANG_VECTOR_BINARY_OP(T, +) \
308 SLANG_VECTOR_BINARY_OP(T, -) \
309 SLANG_VECTOR_BINARY_OP(T, *) \
310 SLANG_VECTOR_BINARY_OP(T, /) \
311 SLANG_VECTOR_BINARY_OP(T, &) \
312 SLANG_VECTOR_BINARY_OP(T, |) \
313 SLANG_VECTOR_BINARY_OP(T, &&) \
314 SLANG_VECTOR_BINARY_OP(T, ||) \
315 SLANG_VECTOR_BINARY_OP(T, ^) \
316 SLANG_VECTOR_BINARY_OP(T, %) \
317 SLANG_VECTOR_BINARY_OP(T, >>) \
318 SLANG_VECTOR_BINARY_OP(T, <<) \
319 SLANG_VECTOR_BINARY_COMPARE_OP(T, >) \
320 SLANG_VECTOR_BINARY_COMPARE_OP(T, <) \
321 SLANG_VECTOR_BINARY_COMPARE_OP(T, >=) \
322 SLANG_VECTOR_BINARY_COMPARE_OP(T, <=) \
323 SLANG_VECTOR_BINARY_COMPARE_OP(T, ==) \
324 SLANG_VECTOR_BINARY_COMPARE_OP(T, !=) \
325 SLANG_VECTOR_UNARY_OP(T, !) \
326 SLANG_VECTOR_UNARY_OP(T, ~)
327#define SLANG_FLOAT_VECTOR_OPS(T) \
328 SLANG_VECTOR_BINARY_OP(T, +) \
329 SLANG_VECTOR_BINARY_OP(T, -) \
330 SLANG_VECTOR_BINARY_OP(T, *) \
331 SLANG_VECTOR_BINARY_OP(T, /) \
332 SLANG_VECTOR_UNARY_OP(T, -) \
333 SLANG_VECTOR_BINARY_COMPARE_OP(T, >) \
334 SLANG_VECTOR_BINARY_COMPARE_OP(T, <) \
335 SLANG_VECTOR_BINARY_COMPARE_OP(T, >=) \
336 SLANG_VECTOR_BINARY_COMPARE_OP(T, <=) \
337 SLANG_VECTOR_BINARY_COMPARE_OP(T, ==) \
338 SLANG_VECTOR_BINARY_COMPARE_OP(T, !=)
339
347SLANG_INT_VECTOR_OPS(uint16_t)
348SLANG_INT_VECTOR_OPS(uint64_t)
349#if SLANG_INTPTR_TYPE_IS_DISTINCT
352#endif
353
356
357#define SLANG_VECTOR_INT_NEG_OP(T) \
358 template<int N> \
359 Vector<T, N> operator-(const Vector<T, N>& thisVal) \
360 { \
361 Vector<T, N> result; \
362 for (int i = 0; i < N; i++) \
363 result[i] = 0 - thisVal[i]; \
364 return result; \
365 }
374#if SLANG_INTPTR_TYPE_IS_DISTINCT
377#endif
378
379#define SLANG_FLOAT_VECTOR_MOD(T) \
380 template<int N> \
381 Vector<T, N> operator%(const Vector<T, N>& left, const Vector<T, N>& right) \
382 { \
383 Vector<T, N> result; \
384 for (int i = 0; i < N; i++) \
385 result[i] = _slang_fmod(left[i], right[i]); \
386 return result; \
387 }
388
391#undef SLANG_FLOAT_VECTOR_MOD
392#undef SLANG_VECTOR_BINARY_OP
393#undef SLANG_VECTOR_UNARY_OP
394#undef SLANG_INT_VECTOR_OPS
395#undef SLANG_FLOAT_VECTOR_OPS
396#undef SLANG_VECTOR_INT_NEG_OP
397#undef SLANG_FLOAT_VECTOR_MOD
398
399template<typename T, int ROWS, int COLS>
400struct Matrix
401{
403 const Vector<T, COLS>& operator[](size_t index) const { return rows[index]; }
404 Vector<T, COLS>& operator[](size_t index) { return rows[index]; }
405 Matrix() = default;
406 Matrix(T scalar)
407 {
408 for (int i = 0; i < ROWS; i++)
409 rows[i] = Vector<T, COLS>(scalar);
410 }
411 Matrix(const Vector<T, COLS>& row0) { rows[0] = row0; }
412 Matrix(const Vector<T, COLS>& row0, const Vector<T, COLS>& row1)
413 {
414 rows[0] = row0;
415 rows[1] = row1;
416 }
417 Matrix(const Vector<T, COLS>& row0, const Vector<T, COLS>& row1, const Vector<T, COLS>& row2)
418 {
419 rows[0] = row0;
420 rows[1] = row1;
421 rows[2] = row2;
422 }
424 const Vector<T, COLS>& row0,
425 const Vector<T, COLS>& row1,
426 const Vector<T, COLS>& row2,
427 const Vector<T, COLS>& row3)
428 {
429 rows[0] = row0;
430 rows[1] = row1;
431 rows[2] = row2;
432 rows[3] = row3;
433 }
434 template<typename U, int otherRow, int otherCol>
436 {
437 int minRow = ROWS;
438 int minCol = COLS;
439 if (minRow > otherRow)
440 minRow = otherRow;
441 if (minCol > otherCol)
442 minCol = otherCol;
443 for (int i = 0; i < minRow; i++)
444 for (int j = 0; j < minCol; j++)
445 rows[i][j] = (T)other.rows[i][j];
446 }
447 Matrix(T v0, T v1, T v2, T v3)
448 {
449 rows[0][0] = v0;
450 rows[0][1] = v1;
451 rows[1][0] = v2;
452 rows[1][1] = v3;
453 }
454 Matrix(T v0, T v1, T v2, T v3, T v4, T v5)
455 {
456 if (COLS == 3)
457 {
458 rows[0][0] = v0;
459 rows[0][1] = v1;
460 rows[0][2] = v2;
461 rows[1][0] = v3;
462 rows[1][1] = v4;
463 rows[1][2] = v5;
464 }
465 else
466 {
467 rows[0][0] = v0;
468 rows[0][1] = v1;
469 rows[1][0] = v2;
470 rows[1][1] = v3;
471 rows[2][0] = v4;
472 rows[2][1] = v5;
473 }
474 }
475 Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7)
476 {
477 if (COLS == 4)
478 {
479 rows[0][0] = v0;
480 rows[0][1] = v1;
481 rows[0][2] = v2;
482 rows[0][3] = v3;
483 rows[1][0] = v4;
484 rows[1][1] = v5;
485 rows[1][2] = v6;
486 rows[1][3] = v7;
487 }
488 else
489 {
490 rows[0][0] = v0;
491 rows[0][1] = v1;
492 rows[1][0] = v2;
493 rows[1][1] = v3;
494 rows[2][0] = v4;
495 rows[2][1] = v5;
496 rows[3][0] = v6;
497 rows[3][1] = v7;
498 }
499 }
500 Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8)
501 {
502 rows[0][0] = v0;
503 rows[0][1] = v1;
504 rows[0][2] = v2;
505 rows[1][0] = v3;
506 rows[1][1] = v4;
507 rows[1][2] = v5;
508 rows[2][0] = v6;
509 rows[2][1] = v7;
510 rows[2][2] = v8;
511 }
512 Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11)
513 {
514 if (COLS == 4)
515 {
516 rows[0][0] = v0;
517 rows[0][1] = v1;
518 rows[0][2] = v2;
519 rows[0][3] = v3;
520 rows[1][0] = v4;
521 rows[1][1] = v5;
522 rows[1][2] = v6;
523 rows[1][3] = v7;
524 rows[2][0] = v8;
525 rows[2][1] = v9;
526 rows[2][2] = v10;
527 rows[2][3] = v11;
528 }
529 else
530 {
531 rows[0][0] = v0;
532 rows[0][1] = v1;
533 rows[0][2] = v2;
534 rows[1][0] = v3;
535 rows[1][1] = v4;
536 rows[1][2] = v5;
537 rows[2][0] = v6;
538 rows[2][1] = v7;
539 rows[2][2] = v8;
540 rows[3][0] = v9;
541 rows[3][1] = v10;
542 rows[3][2] = v11;
543 }
544 }
546 T v0,
547 T v1,
548 T v2,
549 T v3,
550 T v4,
551 T v5,
552 T v6,
553 T v7,
554 T v8,
555 T v9,
556 T v10,
557 T v11,
558 T v12,
559 T v13,
560 T v14,
561 T v15)
562 {
563 rows[0][0] = v0;
564 rows[0][1] = v1;
565 rows[0][2] = v2;
566 rows[0][3] = v3;
567 rows[1][0] = v4;
568 rows[1][1] = v5;
569 rows[1][2] = v6;
570 rows[1][3] = v7;
571 rows[2][0] = v8;
572 rows[2][1] = v9;
573 rows[2][2] = v10;
574 rows[2][3] = v11;
575 rows[3][0] = v12;
576 rows[3][1] = v13;
577 rows[3][2] = v14;
578 rows[3][3] = v15;
579 }
580};
581
582#define SLANG_MATRIX_BINARY_OP(T, op) \
583 template<int R, int C> \
584 Matrix<T, R, C> operator op(const Matrix<T, R, C>& thisVal, const Matrix<T, R, C>& other) \
585 { \
586 Matrix<T, R, C> result; \
587 for (int i = 0; i < R; i++) \
588 for (int j = 0; j < C; j++) \
589 result.rows[i][j] = thisVal.rows[i][j] op other.rows[i][j]; \
590 return result; \
591 }
592
593#define SLANG_MATRIX_BINARY_COMPARE_OP(T, op) \
594 template<int R, int C> \
595 Matrix<bool, R, C> operator op(const Matrix<T, R, C>& thisVal, const Matrix<T, R, C>& other) \
596 { \
597 Matrix<bool, R, C> result; \
598 for (int i = 0; i < R; i++) \
599 for (int j = 0; j < C; j++) \
600 result.rows[i][j] = thisVal.rows[i][j] op other.rows[i][j]; \
601 return result; \
602 }
603
604#define SLANG_MATRIX_UNARY_OP(T, op) \
605 template<int R, int C> \
606 Matrix<T, R, C> operator op(const Matrix<T, R, C>& thisVal) \
607 { \
608 Matrix<T, R, C> result; \
609 for (int i = 0; i < R; i++) \
610 for (int j = 0; j < C; j++) \
611 result[i].rows[i][j] = op thisVal.rows[i][j]; \
612 return result; \
613 }
614
615#define SLANG_INT_MATRIX_OPS(T) \
616 SLANG_MATRIX_BINARY_OP(T, +) \
617 SLANG_MATRIX_BINARY_OP(T, -) \
618 SLANG_MATRIX_BINARY_OP(T, *) \
619 SLANG_MATRIX_BINARY_OP(T, /) \
620 SLANG_MATRIX_BINARY_OP(T, &) \
621 SLANG_MATRIX_BINARY_OP(T, |) \
622 SLANG_MATRIX_BINARY_OP(T, &&) \
623 SLANG_MATRIX_BINARY_OP(T, ||) \
624 SLANG_MATRIX_BINARY_OP(T, ^) \
625 SLANG_MATRIX_BINARY_OP(T, %) \
626 SLANG_MATRIX_BINARY_COMPARE_OP(T, >) \
627 SLANG_MATRIX_BINARY_COMPARE_OP(T, <) \
628 SLANG_MATRIX_BINARY_COMPARE_OP(T, >=) \
629 SLANG_MATRIX_BINARY_COMPARE_OP(T, <=) \
630 SLANG_MATRIX_BINARY_COMPARE_OP(T, ==) \
631 SLANG_MATRIX_BINARY_COMPARE_OP(T, !=) \
632 SLANG_MATRIX_UNARY_OP(T, !) \
633 SLANG_MATRIX_UNARY_OP(T, ~)
634#define SLANG_FLOAT_MATRIX_OPS(T) \
635 SLANG_MATRIX_BINARY_OP(T, +) \
636 SLANG_MATRIX_BINARY_OP(T, -) \
637 SLANG_MATRIX_BINARY_OP(T, *) \
638 SLANG_MATRIX_BINARY_OP(T, /) \
639 SLANG_MATRIX_UNARY_OP(T, -) \
640 SLANG_MATRIX_BINARY_COMPARE_OP(T, >) \
641 SLANG_MATRIX_BINARY_COMPARE_OP(T, <) \
642 SLANG_MATRIX_BINARY_COMPARE_OP(T, >=) \
643 SLANG_MATRIX_BINARY_COMPARE_OP(T, <=) \
644 SLANG_MATRIX_BINARY_COMPARE_OP(T, ==) \
645 SLANG_MATRIX_BINARY_COMPARE_OP(T, !=)
652SLANG_INT_MATRIX_OPS(uint16_t)
653SLANG_INT_MATRIX_OPS(uint64_t)
654#if SLANG_INTPTR_TYPE_IS_DISTINCT
657#endif
658
661
662#define SLANG_MATRIX_INT_NEG_OP(T) \
663 template<int R, int C> \
664 SLANG_FORCE_INLINE Matrix<T, R, C> operator-(Matrix<T, R, C> thisVal) \
665 { \
666 Matrix<T, R, C> result; \
667 for (int i = 0; i < R; i++) \
668 for (int j = 0; j < C; j++) \
669 result.rows[i][j] = 0 - thisVal.rows[i][j]; \
670 return result; \
671 }
680#if SLANG_INTPTR_TYPE_IS_DISTINCT
683#endif
684
685#define SLANG_FLOAT_MATRIX_MOD(T) \
686 template<int R, int C> \
687 SLANG_FORCE_INLINE Matrix<T, R, C> operator%(Matrix<T, R, C> left, Matrix<T, R, C> right) \
688 { \
689 Matrix<T, R, C> result; \
690 for (int i = 0; i < R; i++) \
691 for (int j = 0; j < C; j++) \
692 result.rows[i][j] = _slang_fmod(left.rows[i][j], right.rows[i][j]); \
693 return result; \
694 }
695
698#undef SLANG_FLOAT_MATRIX_MOD
699#undef SLANG_MATRIX_BINARY_OP
700#undef SLANG_MATRIX_UNARY_OP
701#undef SLANG_INT_MATRIX_OPS
702#undef SLANG_FLOAT_MATRIX_OPS
703#undef SLANG_MATRIX_INT_NEG_OP
704#undef SLANG_FLOAT_MATRIX_MOD
705
706template<typename TResult, typename TInput>
707TResult slang_bit_cast(TInput val)
708{
709 return *(TResult*)(&val);
710}
711
712#endif
#define SLANG_FORCE_INLINE
Definition slang-cpp-prelude.h:286
TResult slang_bit_cast(TInput val)
Definition slang-cpp-types-core.h:707
uint32_t uint
Definition slang-cpp-types-core.h:272
#define SLANG_MATRIX_INT_NEG_OP(T)
Definition slang-cpp-types-core.h:662
#define SLANG_INT_MATRIX_OPS(T)
Definition slang-cpp-types-core.h:615
#define SLANG_FLOAT_MATRIX_OPS(T)
Definition slang-cpp-types-core.h:634
SLANG_FORCE_INLINE Vector< T, n > _slang_vector_reshape(const Vector< OtherT, m > other)
Definition slang-cpp-types-core.h:259
#define SLANG_INT_VECTOR_OPS(T)
Definition slang-cpp-types-core.h:306
SLANG_FORCE_INLINE Vector< T, N > _slang_select(Vector< bool, N > condition, Vector< T, N > v0, Vector< T, N > v1)
Definition slang-cpp-types-core.h:221
SLANG_FORCE_INLINE T _slang_vector_get_element(Vector< T, N > x, int index)
Definition slang-cpp-types-core.h:241
SLANG_FORCE_INLINE const T * _slang_vector_get_element_ptr(const Vector< T, N > *x, int index)
Definition slang-cpp-types-core.h:247
#define SLANG_VECTOR_INT_NEG_OP(T)
Definition slang-cpp-types-core.h:357
#define SLANG_FLOAT_VECTOR_OPS(T)
Definition slang-cpp-types-core.h:327
#define SLANG_FLOAT_MATRIX_MOD(T)
Definition slang-cpp-types-core.h:685
#define SLANG_FLOAT_VECTOR_MOD(T)
Definition slang-cpp-types-core.h:379
#define SLANG_BOUND_CHECK_FIXED_ARRAY(index, count)
Definition slang-cuda-prelude.h:117
#define SLANG_BOUND_CHECK(index, count)
Definition slang-cuda-prelude.h:106
__INTPTR_TYPE__ intptr_t
Definition slang-llvm.h:146
__UINTPTR_TYPE__ uintptr_t
Definition slang-llvm.h:153
Definition slang-cpp-types-core.h:82
const T & operator[](size_t index) const
Definition slang-cpp-types-core.h:83
T & operator[](size_t index)
Definition slang-cpp-types-core.h:88
T * data
Definition slang-cpp-types-core.h:94
size_t count
Definition slang-cpp-types-core.h:95
Definition slang-cpp-types-core.h:63
const T & operator[](size_t index) const
Definition slang-cpp-types-core.h:64
T m_data[SIZE]
Definition slang-cpp-types-core.h:75
T & operator[](size_t index)
Definition slang-cpp-types-core.h:69
Definition slang-cpp-types-core.h:401
Matrix(const Vector< T, COLS > &row0)
Definition slang-cpp-types-core.h:411
Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11)
Definition slang-cpp-types-core.h:512
Matrix(const Vector< T, COLS > &row0, const Vector< T, COLS > &row1, const Vector< T, COLS > &row2, const Vector< T, COLS > &row3)
Definition slang-cpp-types-core.h:423
Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7)
Definition slang-cpp-types-core.h:475
const Vector< T, COLS > & operator[](size_t index) const
Definition slang-cpp-types-core.h:403
Matrix(const Matrix< U, otherRow, otherCol > &other)
Definition slang-cpp-types-core.h:435
Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8)
Definition slang-cpp-types-core.h:500
Matrix(const Vector< T, COLS > &row0, const Vector< T, COLS > &row1)
Definition slang-cpp-types-core.h:412
Matrix(T scalar)
Definition slang-cpp-types-core.h:406
Matrix(T v0, T v1, T v2, T v3)
Definition slang-cpp-types-core.h:447
Matrix()=default
Matrix(T v0, T v1, T v2, T v3, T v4, T v5)
Definition slang-cpp-types-core.h:454
Vector< T, COLS > & operator[](size_t index)
Definition slang-cpp-types-core.h:404
Matrix(T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15)
Definition slang-cpp-types-core.h:545
Matrix(const Vector< T, COLS > &row0, const Vector< T, COLS > &row1, const Vector< T, COLS > &row2)
Definition slang-cpp-types-core.h:417
Vector< T, COLS > rows[ROWS]
Definition slang-cpp-types-core.h:402
Definition slang-cpp-types-core.h:57
size_t typeSize
Definition slang-cpp-types-core.h:58
Vector()=default
Vector(T scalar)
Definition slang-cpp-types-core.h:113
T x
Definition slang-cpp-types-core.h:108
T & operator[](size_t)
Definition slang-cpp-types-core.h:110
Vector(Vector< U, otherSize > other)
Definition slang-cpp-types-core.h:120
Vector(Vector< U, 1 > other)
Definition slang-cpp-types-core.h:115
const T & operator[](size_t) const
Definition slang-cpp-types-core.h:109
const T & operator[](size_t index) const
Definition slang-cpp-types-core.h:134
Vector(Vector< U, otherSize > other)
Definition slang-cpp-types-core.h:150
T x
Definition slang-cpp-types-core.h:133
T & operator[](size_t index)
Definition slang-cpp-types-core.h:135
Vector()=default
Vector(T _x, T _y)
Definition slang-cpp-types-core.h:138
Vector(T scalar)
Definition slang-cpp-types-core.h:137
Vector(Vector< U, 2 > other)
Definition slang-cpp-types-core.h:144
const T & operator[](size_t index) const
Definition slang-cpp-types-core.h:164
Vector(T scalar)
Definition slang-cpp-types-core.h:168
Vector(Vector< U, otherSize > other)
Definition slang-cpp-types-core.h:183
T x
Definition slang-cpp-types-core.h:163
Vector(Vector< U, 3 > other)
Definition slang-cpp-types-core.h:176
T & operator[](size_t index)
Definition slang-cpp-types-core.h:165
Vector(T _x, T _y, T _z)
Definition slang-cpp-types-core.h:169
Vector()=default
T w
Definition slang-cpp-types-core.h:196
Vector(T scalar)
Definition slang-cpp-types-core.h:201
Vector(Vector< U, otherSize > other)
Definition slang-cpp-types-core.h:210
Vector()=default
Vector(T _x, T _y, T _z, T _w)
Definition slang-cpp-types-core.h:202
const T & operator[](size_t index) const
Definition slang-cpp-types-core.h:198
T & operator[](size_t index)
Definition slang-cpp-types-core.h:199
Definition slang-cpp-types-core.h:103