Skip to content

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

Merged
s-perron merged 7 commits into
KhronosGroup:mainfrom
juliusikkala:glsl_std450_const_folding1
Oct 30, 2026
Merged

s-perron merged 7 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
@s-perron
s-perron enabled auto-merge (squash) October 30, 2026 15:50
@s-perron
s-perron merged commit ff505d5 into KhronosGroup:main Oct 30, 2026
26 of 27 checks passed
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.

3 participants