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

Identification of shaders #10

Closed
benjymous opened this issue Apr 13, 2015 · 4 comments
Closed

Identification of shaders #10

benjymous opened this issue Apr 13, 2015 · 4 comments

Comments

@benjymous
Copy link

Is there a simple way I can tag my shaders, so that the UI knows what each one is? (I.e. sticking some sort of comment at the top of the source, so it can show "Main", "Post Process", "Overlay", etc rather than "Program 0", "Program 1", "Program 2")

@spite
Copy link
Owner

spite commented Apr 13, 2015

It would be great to have a feature like that, but I don't see how it could be done so the labels stay between reloads.

The WebGLPrograms don't have an easily identifiable trait. I'm adding a UUID, but that changes every time a program is created, so it's not consistent across sessions.

The order of creation looks like it's reliable, but it might change if the shaders are created from files downloaded from a network, or if they depend on loading a model, etc.

Storing a reference to the combination of vertex shader source and fragment shader source might work, but it sounds very brittle as a solution. There might be something to investigate there.

In the mean time, the option is to use shader highlighting, but it's disabled at the moment since it's creating problems. Once it's fixed it'll be easier to identify each shader.

@benjymous
Copy link
Author

You could just take the first comment in the vertex shader source to be the name, I guess (or look for a comment with a specific prefix)

@spite
Copy link
Owner

spite commented Jun 22, 2015

It's working since this commit 74dbb90. I've opened a discussion on a gist here to discuss how it works and if it would be good to try to standarise it

@spite
Copy link
Owner

spite commented Jun 25, 2015

Ok. Based on the discussion here, this is how it's implemented:

  • #define SHADER_NAME {name} to specify name for the shader in an ASCII string
    screen shot 2015-06-25 at 15 45 39
  • #define SHADER_NAME_B64 {name} to specify in a base64-encoded UTF-8 string
    screen shot 2015-06-25 at 15 44 50

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