Implement GL_EXT_spirv_intrinsics_variadic and GL_EXT_spirv_intrinsics_string#4321
Open
rdb wants to merge 2 commits into
Open
Implement GL_EXT_spirv_intrinsics_variadic and GL_EXT_spirv_intrinsics_string#4321rdb wants to merge 2 commits into
rdb wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These implement the extensions discussed in KhronosGroup/GLSL#331 that extend
GL_EXT_spirv_intrinsics. These are necessary to be able to represent functions likedebugPrintfEXT.This is one PR with separate commits per extension; let me know if I should split this into two PRs instead, but I figured this might be easier since they both touch the parser.
Example
Variadics support
Implements
GL_EXT_spirv_intrinsics_variadic(KhronosGroup/GLSL#332). This builds upon the existing variadic parsing that was used for builtins, notably:...now lexes as a single ELLIPSIS token (so. . .is no longer accepted; doesn't affect existing uses)f(...)are now allowedspirv_literalandspirv_by_referencequalifiers on the variadic tailString support
Implements
GL_EXT_spirv_intrinsics_string(KhronosGroup/GLSL#333). Adds a newspirv_stringtype that is only valid in a parameter type of aspirv_instructionfunction declaration, which is mapped to EbtString.It should be noted that glslang currently parses strings as a primary-expression, which is laxer than the specified grammar prescribes (which just allows it in a function argument). This basically allows parenthesized strings and the comma operator in relaxation of the spec. This is a pre-existing "issue" that my implementation inherits, because it also applies to
GL_EXT_debug_printf,GL_EXT_abort, etc., none of which suggest that strings can be expressions or that such expressions are accepted by these calls.Embedded NUL characters now cause an error across the board, not scoped to this extension; the previous behavior was silent truncation.