Comments (2)
To be clear, C-style cast syntax isn't supported in GLSL, so glslang is correct in reporting a syntax error. The real problem is that the parse errors that glslang outputs are not very useful (this is a big down-side to their use of a parser generator).
In this case I assume Slang is in what I call "full rewriter" mode, where it doesn't even parse function bodies. This mode is what happens if Slang is being invoked with semantic off and there are no import
declarations. We reproduce the input function body exactly and glslang gives a parse error.
I suspect that in the "rewriter with imports" mode (when we see at least one import
, and actually do parse function bodies) this case would work by accident because the cross-compiler logic is set up to turn HLSL casts into GLSL constructor calls. This behavior is technically a bug, since it means we accept invalid GLSL, but I'm okay with us accepting a useful superset of GLSL.
The right long-term fix is for Slang to either always accept this syntax in GLSL, and validate it so that glslang never sees it, or never accept C-style casts in GLSL but report our own error message that is more clear ("GLSL does not support C-style cast syntax") to spare the user.
A useful goal for Slang would be that the user never sees a parse error from glslang.
from slang.
Slang no longer accepts GLSL as an input language, so this issue is no longer relevant.
from slang.
Related Issues (20)
- Function param input modifiers `out` and `inout` are unexpectedly strict HOT 2
- Latest macOS release x64 build is actually an ARM64 build
- `and` intrinsic does not support vector arguments HOT 1
- SPIRV and Metal `TextureBufferType` support HOT 4
- Missing `uint2` variant of `asdouble`
- Unexpected error: unable to parse target intrinsic snippet: `CheckAccessFullyMapped`
- `countbits` intrinsic does not support vector arguments
- SPIR-V: `SubpassInput` should default to `float4` if explicit type parameter is not provided
- Missing support for `or` intrinsic
- Add support for matrix variants of `select`
- SPIR-V: Error message for `WaveMultiPrefix` functions is not easy to understand HOT 1
- Missing SM 6.6 function: `IsHelperLane()` HOT 2
- `Load(in int Location, out uint Status)` missing from `Buffer/RWBuffer`? HOT 2
- Does Slang allow function implementation to live outside of namespace? HOT 2
- Improve documentation and error message to clarify user defined data structures: `struct` vs `class` HOT 1
- Use of base struct's resource member causes assert HOT 2
- Does/should Slang allow left side cast? HOT 1
- Hitting assert due to NULL struct type layout
- NULL pointer access when retrieving field layout HOT 6
- Does Slang allow for static const global references to `cbuffer` data? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slang.