I am working on an automatic OpenGL batch processing method in my game engine to reduce callbacks and redundant calls.
My batch tree design starts with the most expensive estates and adds leaves for every less expensive fortune.
Example: Tree root: shaders / programs Siblings: blending states ... aso
So my question is the most likely most expensive calls on this list:
- binding program
- texture snapping
- buffer binding
- buffer texture, vertex data
- binding of rendering objects
- glEnable / glDisable
- mixing state equation, color, functions, colorWriteMask
- depth state of the stencil depth Func, stencil operation, stencil function, writeMasks
It is also interesting which method will be faster:
- Collect all drawing command commands into a single vertex buffer and call only one draw call (this method will also force the matrix transformations to be updated to the vertex from the processor side)
- Do not partition and do not make many small drawing calls, only a system of batch particles ...
PS: The visualization goals will always change Pre or Post depending on usage.
Progress so far:
- Andon M. Coleman: the cheapest form and vertex array binding, expensive FBOs, texture bindings.
- datenwolf: programs invalid state cache
1: Framebuffer states
2: Program
3: texture binding
...
N: vertex array binding, uniform binding -
The current runtime tree in WebGL:
- Program
- Attribute Pointers
- Texture
- Mix State
- Depth state
- Stencil Status / Back
- Rasterizer Status
- Sampler State
- Bind buffer
- Arrays of drawing
Each step is a sister hash tree to avoid checking the status of the state cache inside the main rendering queue
The loading of textures / programs / shaders / buffers takes place before rendering in an additional queue, for future multithreading, as well as in order to initialize the context before doing anything with it.
The biggest problem with self-learning objects is that you cannot control when something happens, for example, if a developer calls these methods before gl initializes, he would not know why, but he will have some errors or problems ...
source share