Add basic support to evaluate operator value in shader language #93822
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a basic set of evaluator functions to the shader language. This might be needed in some places, like an array initialization. After this PR got merged, user may define and use basic constant expression like:
Also, I've fixed
parse_array_size
function to allow declaring expression inside it:Also, constant may be used like this:
Besides array size, the expressions can now be passed to specific built-in functions:
Note, the advanced constant constructions like:
still doesn't work, I may improve it lately.
PS: Yes, I renamed
ShaderLanguage::ConstantNode::Value
toShaderLanguage::Scalar
because it fits better and other nodes may use it, not only constant node (currently anOperatorNode
will also start to use it).