MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ KernelOp

enum class MayaFlux::Portal::Graphics::KernelOp : uint8_t
strong

Named operation the SPIR-V emitter knows how to lower to opcodes.

Each value maps to a fixed, unambiguous instruction sequence. No string parsing or expression compilation is involved.

Naming convention: operands are listed in application order. PC fields are consumed in declaration order from ShaderSpec::pc_fields. SSBO operands are the InOut/Output bindings in declaration order.

Single-SSBO elementwise — arithmetic (sig[i] = f(sig[i], pc...)): Scale sig[i] = sig[i] * pc[0] ScaleOffset sig[i] = sig[i] * pc[0] + pc[1] Fma sig[i] = sig[i] * pc[0] + pc[1] (fused, single instruction) Offset sig[i] = sig[i] + pc[0] Clip sig[i] = clamp(sig[i], pc[0], pc[1]) Abs sig[i] = abs(sig[i]) Negate sig[i] = -sig[i] Floor sig[i] = floor(sig[i]) Ceil sig[i] = ceil(sig[i]) Round sig[i] = round(sig[i]) Trunc sig[i] = trunc(sig[i]) Fract sig[i] = fract(sig[i]) Sqrt sig[i] = sqrt(sig[i]) InverseSqrt sig[i] = 1/sqrt(sig[i])

Single-SSBO elementwise — transcendental (sig[i] = f(sig[i])): Sin sig[i] = sin(sig[i]) Cos sig[i] = cos(sig[i]) Tan sig[i] = tan(sig[i]) Asin sig[i] = asin(sig[i]) Acos sig[i] = acos(sig[i]) Atan sig[i] = atan(sig[i]) Sinh sig[i] = sinh(sig[i]) Cosh sig[i] = cosh(sig[i]) Tanh sig[i] = tanh(sig[i]) Exp sig[i] = e^sig[i] Exp2 sig[i] = 2^sig[i] Log sig[i] = ln(sig[i]) Log2 sig[i] = log2(sig[i])

Two-SSBO elementwise (out[i] = f(a[i], b[i])): Add out[i] = a[i] + b[i] Multiply out[i] = a[i] * b[i] Mix out[i] = a[i] + (b[i] - a[i]) * pc[0] Sub out[i] = a[i] - b[i] Pow out[i] = pow(a[i], b[i]) Atan2 out[i] = atan(a[i], b[i]) Min out[i] = min(a[i], b[i]) MaxTwo out[i] = max(a[i], b[i]) Step out[i] = step(a[i], b[i]) edge=a, x=b

Two-SSBO + one PC: SmoothStep out[i] = smoothstep(a[i], b[i], pc[0])

Image body elementwise (out = f(pixel, pc)): CompareGE out[ch] = pixel[ch] >= pc[0] ? 1.0 : 0.0 CompareGEPreserve out[ch] = pixel[ch] >= pc[0] ? pc[1] : pixel[ch] ChannelDot out = dot(pixel.rgba, pc[0..3]) broadcast to all channels ChannelReplicate out = pixel[pc_channel_index].xxxx (single channel to all)

Reduction operations (one InOut SSBO, shared memory): Sum accumulate + into shared[lid], tree reduce Max accumulate max into shared[lid], tree reduce IndexScale sig[i] = float(i) * sig[i]

Enumerator
Scale 
ScaleOffset 
Fma 
Offset 
Clip 
Abs 
Negate 
Floor 
Ceil 
Round 
Trunc 
Fract 
Sqrt 
InverseSqrt 
Sin 
Cos 
Tan 
Asin 
Acos 
Atan 
Sinh 
Cosh 
Tanh 
Exp 
Exp2 
Log 
Log2 
Add 
Multiply 
Mix 
Sub 
Pow 
Atan2 
Min 
MaxTwo 
Step 
SmoothStep 
Sum 
Max 
ScanSum 

Inclusive prefix sum: shared[i] = sum(x[0..i])

MaxIndex 

Reduction variant: finds max value AND its index.

First InOut SSBO holds the values (overwritten with the max in slot 0). Second InOut SSBO (UINT32) receives the winning index in slot 0.

IndexScale 

out[i] = float(i) * a[i].

The only op that uses the invocation index itself as an arithmetic operand rather than purely for addressing.

CompareGE 

out[ch] = pixel[ch] >= pc[0] ? 1.0 : 0.0

CompareGEPreserve 

out[ch] = pixel[ch] >= pc[0] ? pc[1] : pixel[ch]

ChannelDot 

out = dot(pixel.rgba, pc[0..3]) broadcast to all channels

ChannelReplicate 

out = pixel[pc_channel_index].xxxx (single channel to all)

Definition at line 227 of file ShaderSpec.hpp.

227 : uint8_t {
228 // arithmetic
229 Scale,
231 Fma,
232 Offset,
233 Clip,
234 Abs,
235 Negate,
236 Floor,
237 Ceil,
238 Round,
239 Trunc,
240 Fract,
241 Sqrt,
243 // transcendental
244 Sin,
245 Cos,
246 Tan,
247 Asin,
248 Acos,
249 Atan,
250 Sinh,
251 Cosh,
252 Tanh,
253 Exp,
254 Exp2,
255 Log,
256 Log2,
257 // two-SSBO
258 Add,
259 Multiply,
260 Mix,
261 Sub,
262 Pow,
263 Atan2,
264 Min,
265 MaxTwo,
266 Step,
268 // reduction
269 Sum,
270 Max,
271 ScanSum, ///< Inclusive prefix sum: shared[i] = sum(x[0..i])
272 MaxIndex, ///< Reduction variant: finds max value AND its index.
273 ///< First InOut SSBO holds the values (overwritten with the
274 ///< max in slot 0). Second InOut SSBO (UINT32) receives the
275 ///< winning index in slot 0.
276 IndexScale, ///< out[i] = float(i) * a[i]. The only op that uses the
277 ///< invocation index itself as an arithmetic operand rather
278 ///< than purely for addressing.
279
280 CompareGE, ///< out[ch] = pixel[ch] >= pc[0] ? 1.0 : 0.0
281 CompareGEPreserve, ///< out[ch] = pixel[ch] >= pc[0] ? pc[1] : pixel[ch]
282 ChannelDot, ///< out = dot(pixel.rgba, pc[0..3]) broadcast to all channels
283 ChannelReplicate, ///< out = pixel[pc_channel_index].xxxx (single channel to all)
284};
@ CompareGE
out[ch] = pixel[ch] >= pc[0] ? 1.0 : 0.0
@ ChannelDot
out = dot(pixel.rgba, pc[0..3]) broadcast to all channels
@ ScanSum
Inclusive prefix sum: shared[i] = sum(x[0..i])
@ IndexScale
out[i] = float(i) * a[i].
@ CompareGEPreserve
out[ch] = pixel[ch] >= pc[0] ? pc[1] : pixel[ch]
@ MaxIndex
Reduction variant: finds max value AND its index.
@ ChannelReplicate
out = pixel[pc_channel_index].xxxx (single channel to all)