Closed ennis closed 2 years ago
Thanks for the contribution! However, in order to add support for more Vulkan tokens (aside from the ones from the GLSL 4.60 spec, which are a subset of GL_KHR_vulkan_glsl), you need to add the new tokens to some other locations as well:
Token
enum: this allows representing the new Vulkan type names in lexing stages, https://github.com/vtavernier/glsl-lang/blob/52f54daa6d2d3b21d8d80f6f05ad704af43e6be8/lang-lexer/src/token.rs#L590-L714type_name!
macro, https://github.com/vtavernier/glsl-lang/blob/52f54daa6d2d3b21d8d80f6f05ad704af43e6be8/lang-pp/build.rs#L17-L190 target_vulkan
shall be true), https://github.com/vtavernier/glsl-lang/blob/52f54daa6d2d3b21d8d80f6f05ad704af43e6be8/lang-pp/src/types/token.rs#L528-L1157It looks like the 41 tokens were already there in lexer and pp. If I'm not mistaken, only AST code needed to be updated.
It looks like the 41 tokens were already there in lexer and pp. If I'm not mistaken, only AST code needed to be updated.
Yes, my bad, I thought there were extra tokens compared to what is mentioned in the GLSL 4.60 spec. It's all good on the lexing/parsing side. However you'll need to update glsl-lang-quote to support the changes in the AST (see lang-quote/src/tokenize.rs).
Since this brings Vulkan types as part of the AST, it would be nice to cover these with at least some tests. Maybe by adding lang/data/vulkan_types.glsl
as follows:
uniform texture1D u1;
uniform texture2D u2;
uniform texture3D u3;
uniform textureCube u4;
uniform texture2DRect u5;
uniform texture1DArray u6;
uniform texture2DArray u7;
uniform textureBuffer u8;
uniform texture2DMS u9;
uniform texture2DMSArray u10;
uniform textureCubeArray u11;
uniform itexture1D u12;
uniform itexture2D u13;
uniform itexture3D u14;
uniform itextureCube u15;
uniform itexture2DRect u16;
uniform itexture1DArray u17;
uniform itexture2DArray u18;
uniform itextureBuffer u19;
uniform itexture2DMS u20;
uniform itexture2DMSArray u21;
uniform itextureCubeArray u22;
uniform sampler u23;
uniform samplerShadow u24;
uniform subpassInput u25;
uniform isubpassInput u26;
uniform usubpassInput u27;
uniform subpassInputMS u28;
uniform isubpassInputMS u29;
uniform usubpassInputMS u30;
And then parsing it and comparing it with an AST structure in lang/src/parse_tests.rs
? parse_buffer_block_0
is an example of such a test.
Added parser tests as suggested, and updated lang-quote
This PR adds parser and AST support for the types defined in GL_KHR_vulkan_glsl.