GithubHelp home page GithubHelp logo

Comments (3)

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

We've discussed this over slack, and it seems like Slang is going to have to help solve this issue. There are a few pieces to the puzzle here:

  • struct types are already allowed as varying input/output by GLSL/glslang, for everything except vertex shader input and fragment output. If that alone is the ask, then nothing is actually needed from Slang.

  • struct types as VS input seem to be required, to handle VS_IN (which is defined in the same place as VS_OUT, so that seems to be part of the request (can you confirm, Nir?)

  • The other thing I think is hidden in this ask (and this was subtle enough I almost missed it) is the ability for a struct like VS_OUT to declare "system-value semantic" inputs/outputs, and to translate a GLSL shader that uses that type to use the appropriate gl_* built-in variables, just like we would do when that type is used as a parameter to the entry point.

That last issue forces Slang to scalarize a struct being used as varying input/output even when it might not seem to be required by GLSL/glslang. If we don't scalarize things, and switch an SV_Position output over to gl_Position, then we will be declaring something very different from what the user meant.

This is a big, messy feature, but it seems tied in to a bunch of places where Slang is already doing a bad job with GLSL style global-scope varying input/output, so it probably makes sense to try to bite this off.

Nir, can you confirm that your expectation is for Slang to auto-magically handle the system-value semantic fields inside VS_OUT when it is used for a global-scope in or out variable?

from slang.

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

This basics of this should be implemented in #118.
I'm going to keep this open a bit longer to confirm that the changes actually work in the context of Falcor (instead of just for my Slang test case).

from slang.

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

Okay, "customer" feedback tells me this is working well enough in simple cases, so I'll close it for now and we can open new issues when things break in more involved cases.

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.