There is no more point of keep those around. ES20 may need special case
when/if we dabble with it again. Meanwhile no point on polluting the
code with this.
(ghost still has reference for the PROFILE, but that's reasonable)
Revert 7a18ee62eb and 1ff97bbfff after discussing with @fclem.
VertexBuffer_size should always report the same buffer size, but without asking/calling OpenGL.
The issue was happening when display device is set to None, which makes it so
all the color transformation is a no-op which does not really require any LUT.
This is something we can not know from Blender side easily, because LUT sampling
and related logic is fully done in OCIO library itself. The following happens:
- OCIO sees that no LUT is needed and uses simple pass-through logic in the
color conversion function.
- GLSL compiles sees that uniform used for LUT is unused in the GLSL code and
strips it out.
We can not know this from Blender side because technically any conversion to
the same space might be a no-op and that we wouldn't know without some tricky
parse of the OCIO configuration.
So for now we simply avoid crash but are disabling checks for existence of the
uniform.
Ideally would be nice to have some GLSL-code parses which gets the uniforms
from the code itself, so we can distinguish between typo in the uniform name
and uniform being optimized out.
Adds 2 static unsigned int to Gawain and GPUTexture to roughly keep track of the memory stats on the GPU.
Stats can be view at the bottom of the GPU stats with debug value > 20.
This is a bad implementation waiting for some improvement that are :
- Gawain support for multiple names. -> will remove duplication of attribute alloc
- Glsl safe name string escaping. -> will remove any risk of hash colision.
Old glsl drawing was relying on attribute being choosen by DerivedMesh at drawing time.
For this reason, we declare all possible attrib "name" for each data layer inside the batches.
In the glsl code, we declare required data by type and name.
Then Gawain only bind vbos if names correspond.
This is way cleaner as we do not need to access the CD itself when drawing.
One other problem is that the hash maybe 11 caracters long and rapidly overload gawain's attrib name buffer.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
There are multiple ways to orphan a buffer resource, and this code picks the oldest/safest way no matter which OpenGL version we're running.
TODO: use other (more recent) methods after thorough testing
Follow up to 8e0c57a812
Blender subsystems that care about OpenGL use GL_DEFINITIONS, which now includes the newest (temporary) WITH_LEGACY_OPENGL.
Also updated Gawain's CMake to use this instead of its own logic.
This is an OpenGL 3.3 feature, currently being used for surface normals. It's 1/3 the size of floating point triples and perfect for normals or colors.
See T49012 for why Windows can use this feature regardless of core vs compatibility.
Follow-up to 3bc6b831d8
Initial code was getting the number of ShaderInterfaces that could fit between two pointers (which makes no sense). I really meant number of bytes.
Surprised it worked on Mac, glad I tested on Windows before bed :D
ShaderInterface stores names of custom uniforms and all attributes in an internal buffer, but it doesn't know how large to make this buffer until all inputs are scanned.
This commit shrinks the buffer to the exact size needed.
ShaderInterface_uniform searches custom uniforms first, then builtin uniforms if needed.
This reduces the amount of string matching since you're almost certainly looking for one of those custom uniforms. Otherwise you would've called ShaderInterface_**builtin**_uniform.
attrib_binding.c uses NULL, so include stddef.
Also swapped stdlib for stddef in vertex_format.c, since it only needs NULL.
Not sure why MSVC 2017 and clang/Mac work without this...
Thanks to @youle for reporting!
This eliminates tons of glGetAttribLocation calls from the drawing loop. Vast majority of code can keep making the same function calls. They're just faster now!
- remove 2D-specific variants of BuiltinUniform enum
- rename remaining builtins to exclude "_3D" since they can be used by 2D or 3D shaders
Follow up to D2626
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