[Bf-viewport] OpenGL low level shader API proposal
significant.bit at gmail.com
Sun Dec 6 00:34:32 CET 2015
Yes, thank you! Interesting stuff. Here's my first round of notes:
+1 for immutable draw state.
+100 for minimizing state changes! Marry desired state to the draw call.
Re: Uniform Buffer Objects -- Compatibility with GL 2.1 is a temporary
concern, so anything we do there should be minimal and marked for future
For passing in the current transformation, I don't think the lowest-level
API should treat this or any other inputs special. Do like the convenience
of not having to specify CTM every time though... maybe I'm on the fence
about this one! Since a lot of this has to do with UI drawing, how about a
dedicated 2D transformation system, stack or otherwise? See bottom part of:
3D shaders would automatically get a 3x4 ModelView and 4x4 Projection
matrix, maybe a 4x4 MVP for efficiency. 2D shaders would automatically get
a 2x3 ModelView matrix and that's it.
Some basic assumptions, definitions, questions... please let me know if any
of these are way off:
GPUShader is a compiled & linked set of Vertex shader, optional Geometry
shader, and Fragment shader.
Inputs for the GPUShader are the active uniforms (which could be from any
of the above shader stages) and vertex attributes from the first stage.
Uniform values are set once per draw. Attribute values are typically set
per vertex from data in VBOs. Attributes can also be set once per draw
using glVertexAttrib, acting more like uniforms from client program's point
Uniforms can have default values in GLSL. Is there any way to query the
program to see if an input *requires* us to set a value? Beyond parsing the
GLSL source text.
Anyone interested in parsing GLSL source text?
musician, naturalist, pixel pusher, hacker extraordinaire
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Bf-viewport