Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] GlSL macro #2050

Open
tmvkrpxl0 opened this issue Mar 25, 2023 · 3 comments
Open

[Feature Request] GlSL macro #2050

tmvkrpxl0 opened this issue Mar 25, 2023 · 3 comments

Comments

@tmvkrpxl0
Copy link

tmvkrpxl0 commented Mar 25, 2023

yew has html macro like this:
image
Which allows rust compiler to verify syntax of html code and even highlight errors. Referencing and invoking rust code inside html also works. I think it would be nice if glium had something similar.
I admit that it would be hard to implement such thing in glium, but still, it would greatly simplify implementing shader, as not only devs can work on it in rust file, but it can also be extended to treat uniforms also as variable reference

let t = 0.0; // this will be uniform
let shader = program! {
  vertex! {
    in vec2 position;
    
    uniform float t;
    
    void main() {
        vec2 pos = position;
        pos.x += t;
        gl_Position = vec4(pos, 0.0, 1.0);
    }
  }
  fragment! {
  ...
  }
}

If variable t in this case is i32, it would cause compiler error

@tmvkrpxl0
Copy link
Author

Sorry, I should've researched more, I've just discovered that there's macro called program already.
Still, expanding its capability to such level would be nice addition

@Melchizedek6809
Copy link
Member

Yeah, it does sounds a bit too ambitious for glium. A big feature like this should also probably go in a separate crate to keep glium somewhat small.

@tmvkrpxl0
Copy link
Author

https://github.com/vtavernier/glsl-lang and https://github.com/phaazon/glsl
For future record, thees already implemented macro for it

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

No branches or pull requests

2 participants