Look up "name[0]" when asked for "name", since that marks the beginning of the array.
We're comparing to the name stored in ShaderInterface which comes from glGetActiveUniform.
This eliminates tons of glGetUniformLocation calls from the drawing loop. Vast majority of code can keep making the same function calls. They're just faster now!
- Batch_Uniform*
- immUniform*
- gpuBindMatrices
- and others
- builtin uniforms match what Blender needs
- set input counts in struct (stupid mistake)
- look up uniforms by name
- look up builtin uniforms by enum
- check attrib/uniform locations for error
Same as MEM_SAFE_FREE macro,
checks for NULL, runs free then sets NULL.
Blocks of code that do this many times are noisy and likely
errors here wouldn't be noticed immediately.
Also NULL's static vars which were being left set.
Problem was an edge case where vertex_ct logic and draw logic disagreed on how many dividers to draw.
Fix: copy draw logic to earlier vertex_ct
I also skip any drawing or setup if vertex_ct = 0, and set color attribute only for each line's provoking vertex. Small optimizations but these things add up.
This removes MAX_STORAGE, MAX_BUFFERS, MAX_TEXTURES, MAX_PASSES limits.
Actual memory saving isn't so important, it just means we don't need to
manually bump these based on changes to engines.
The issue was caused here by usage of deprecated GL_CURRENT_PROGRAM
which was returning rubbish value.
Now we use imm API and create vertex format prior to immBindProgram.
This made us required to have some sort of state passed from setup
function to actual drawing.
Note: I’d assume gawain equivalent to glDrawArrays would be batches? But
for two lines drawn twice this looks totally overkill anyway, so
switched back to basic immediate-mode-like API.
A bit frustrating to work on this code, since afaict you cannot check
the results in Blender, being mostly unused currently...
Global size depends on memory usage which might change during rendering.
Havent seen it happen but seems possible that this could cause the global
size to be different than what was used for allocating buffers.