Skip to content

spirv-opt: Add constant folding for more GLSL.std.450 extended instructions - #6983

Open
juliusikkala wants to merge 5 commits into
KhronosGroup:mainfrom
juliusikkala:glsl_std450_const_folding1
Open

juliusikkala wants to merge 5 commits into
KhronosGroup:mainfrom
juliusikkala:glsl_std450_const_folding1

Conversation

@juliusikkala

@juliusikkala juliusikkala commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Includes constant folding for the following GLSL.std.450 extended instructions: Sinh, Cosh, Tanh, Asinh, Acosh, Atanh, InverseSqrt, Round, Trunc, Floor, Ceil, Fract, FSign, SSign, Radians, Degrees, Step, SmoothStep and Fma. This subset is included mostly because constant folding is fairly trivial to implement for them.

To handle Fma and SmoothStep, there's now TernaryScalarFoldingRule, FoldTernaryOp and FoldFPTernaryOp. Their implementation is mostly copypasta from the binary equivalents. I also renamed FoldFTranscendentalUnary to FoldUnaryFloatingPointOperation because nothing about it is specific to transcendental functions and this naming is more in line with the already existing FoldUnaryIntegerOperation.

Works towards fixing #6981 but does not implement all of it.

@juliusikkala juliusikkala changed the title Add constant folding for more GLSL.std.450 extended instructions spirv-opt: Add constant folding for more GLSL.std.450 extended instructions Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant