-
Notifications
You must be signed in to change notification settings - Fork 0
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
Shader standard? #20
Comments
My original intent was something like this:
The usage of shader_program would then be the same as how the object returned by GetDefaultShaderProgram is used. As far as using different version of GLSL, the intent was that the constructor would throw an exception if the Shader didn't compile (for whatever reason), and the same if a ShaderProgram didn't link properly. I had intended the order to not matter in the ShaderProgram constructor, that way you could provide them in either order, and later if/when Geometry shaders are supported you could just add them on the end. Using an array for the input of the ShaderProgram constructor would also make sense. Of course, this API has not been tested much (very late versions of the old graphics plugin had a similar API). |
For the record, this is how it is presently implemented in minisphere: var shader = new ShaderProgram({
fragment: 'fragment.glsl',
vertex: 'vertex.glsl'
}) I was originally going to have separate |
That makes sense for supporting HLSL. In fact, the way Pegasus is set up, you could support HLSL instead of OpenGL. In GL, you compile the shaders individually, and then link them into a program. In simple setups it's really no different than one step, but in larger ones it lets you reuse just the fragment or vertex shader, or one of the geometry shaders. Can you supply OpenGL shader program names to Allegro directly? If not, it probably would just be fine to only report compilation errors on linking. |
I don't believe you can pass GL object names to Allegro APIs, however Allegro doesn't stop you from calling into OpenGL directly as far as I'm aware. |
I'm thinking we should standardize on names for the standard uniforms. Currently writing a shader for minisphere requires attribute/uniforms with names like Here's what I'm thinking, we keep things simple:
Not sure whether texture coordinates should be Any other ideas? |
I think they should be namespaced a little. Maybe I would opt for |
What are the requirements for |
Yes, the UV are passed directly as Tex Coords into the shader. The only real work the default shader does is to convert screen coords to normalized GL coordinates for positions, and to apply color masking. |
@FlyingJester Do you still think shader support should be an extension (i.e. optional), or would you say GPU support for shaders is ubiquitous enough now that it can be a core part of the Sphere v2 API? |
Well, I had two main concerns about it being core originally. One is that I didn't like making a DirectX, Direct3D, legacy OpenGL, or whatever other API graphics plugin that wouldn't really have access to glsl that much harder to use (in the case of DirectX though, it would probably through the use of ANGLE, or just expose a 'hlsl' extension instead of 'glsl'). Two, there are a lot of different version of glsl, and I felt it would be better to deal with how to query and test for which versions are available. I suppose at this point, being able to query the glsl version, and maybe for shading extensions would address my original concerns. |
I know it was mentioned at some point by somebody (probably @FlyingJester) that shaders weren't part of the standard in order to keep them an optional feature and let the engine implement it as the developer sees fit.
However, with minisphere now supporting shaders and TurboSphere working up to it, this might be worthwhile to revisit. We can keep shader support optional but still standardize it. It would just get a separate extension designation than the core Galileo API.
I would propose that any standard for this be designed in a way such that new shader types can be added in the future without breaking backwards compatibility.
The text was updated successfully, but these errors were encountered: