diff options
author | GPUCode <[email protected]> | 2022-11-06 21:02:05 +0200 |
---|---|---|
committer | GPUCode <[email protected]> | 2023-05-09 17:18:45 +0300 |
commit | e0d528d7bfc638684afebd9b4b0272be8ca80c89 (patch) | |
tree | 7c8393737e61a71cd8173f1170e4148a6fff379e /include | |
parent | ab75463999f4f3291976b079d42d52ee91eebf3f (diff) | |
download | sirit-e0d528d7bfc638684afebd9b4b0272be8ca80c89.tar.gz sirit-e0d528d7bfc638684afebd9b4b0272be8ca80c89.zip |
Add missing GLSL instructions
Diffstat (limited to 'include')
-rw-r--r-- | include/sirit/sirit.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index aea4468..0a9fce9 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -365,6 +365,17 @@ public: /// Make a copy of a vector, with a single, variably selected, component modified. Id OpVectorInsertDynamic(Id result_type, Id vector, Id component, Id index); + /// Select arbitrary components from two vectors to make a new vector. + Id OpVectorShuffle(Id result_type, Id vector_1, Id vector_2, std::span<const Literal> components); + + /// Select arbitrary components from two vectors to make a new vector. + template <typename... Ts> + requires(...&& std::is_convertible_v<Ts, Literal>) Id + OpVectorShuffle(Id result_type, Id vector_1, Id vector_2, Ts&&... components) { + const Literal stack_literals[] = {std::forward<Ts>(components)...}; + return OpVectorShuffle(result_type, vector_1, vector_2, std::span<const Literal>{stack_literals}); + } + /// Make a copy of a composite object, while modifying one part of it. Id OpCompositeInsert(Id result_type, Id object, Id composite, std::span<const Literal> indexes = {}); @@ -686,6 +697,12 @@ public: /// Result is the unsigned integer addition of Operand 1 and Operand 2, including its carry. Id OpIAddCarry(Id result_type, Id operand_1, Id operand_2); + /// Multiplication of floating-point vector Operand 1 with scalar Operand 2. + Id OpVectorTimesScalar(Id result_type, Id operand_1, Id operand_2); + + /// Dot product of floating-point vector Operand 1 and vector Operand 2. + Id OpDot(Id result_type, Id operand_1, Id operand_2); + // Extensions /// Execute an instruction in an imported set of extended instructions. @@ -837,6 +854,18 @@ public: /// of the pixel specified by offset. Id OpInterpolateAtOffset(Id result_type, Id interpolant, Id offset); + /// Result is the vector in the same direction as x but with a length of 1. + Id OpNormalize(Id result_type, Id x); + + /// Result is the cross product of x and y. + Id OpCross(Id result_type, Id x, Id y); + + /// Result is the length of vector x. + Id OpLength(Id result_type, Id x); + + /// Result is the linear blend of x and y i.e x * (1 - a) + y * a + Id OpFMix(Id result_type, Id x, Id y, Id a); + // Derivatives /// Same result as either OpDPdxFine or OpDPdxCoarse on the input. |