[Bf-viewport] OpenGL low level shader API proposal

Mike Erwin 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
removal.

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:
http://wiki.blender.org/index.php/Dev:2.8/Source/OpenGL/Transformations
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
of view.

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?


Mike Erwin
musician, naturalist, pixel pusher, hacker extraordinaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-viewport/attachments/20151205/5bd85cd5/attachment-0001.htm 


More information about the Bf-viewport mailing list