Skip to content

Add GL_EXT_spirv_intrinsics_string extension#333

Open
rdb wants to merge 1 commit into
KhronosGroup:mainfrom
rdb:spirv-intrinsics-string
Open

Add GL_EXT_spirv_intrinsics_string extension#333
rdb wants to merge 1 commit into
KhronosGroup:mainfrom
rdb:spirv-intrinsics-string

Conversation

@rdb

@rdb rdb commented Jun 28, 2026

Copy link
Copy Markdown

This is the second half of #331, adding the string part (see #332 for the variadic extension). They are separate extensions because they describe orthogonal features with minimal interaction. The glslang implementation will follow soon.

This extension builds on GL_EXT_spirv_intrinsics and adds a spirv_string pseudo-type that is only valid as a formal parameter type in a spirv_instruction-qualified function declaration. It furthermore provides the ability for literal string arguments to be passed to those parameters, as well as to variadic tails (when the variadic extension is enabled). It is lowered to an OpString whose result id is used as the operand.

The main conundrum I've had to work through was determining whether literal strings are treated as primary expressions (which matches what glslang implements, eg. allowing a parenthesized ("foo")), or can only be used as function call arguments (which matches what can actually be derived from the motivating GL_EXT_debug_printf extension, though it is a bit light on the actual grammar).

I have deliberately decided to stick with the most restrictive reading of what is actually specified, since doing otherwise would ask this extension to do much more work to more generally define strings as a type and expression. I deemed that to be out of scope for an extension that just aims to represent functions like debugPrintfEXT as a spirv_instruction. It may be worth revisiting this in a future extension that reusably and more generally defines string expressions in GLSL, or the referenced extensions should be revised to define the grammar in more detail and this one changed to match.

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