GithubHelp home page GithubHelp logo

Comments (2)

tangent-vector-personal avatar tangent-vector-personal commented on July 2, 2024

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.

tangent-vector avatar tangent-vector commented on July 2, 2024

Slang no longer accepts GLSL as an input language, so this issue is no longer relevant.

from slang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.