Age | Commit message (Collapse) | Author |
|
This adds less than a megabyte of mem usage.
FT_Get_Kerning was the 2nd hotspot when profilling. This commit completly
remove this cost.
One concern though: I don't know if the kerning data is constant for every
sizes but it seems to be the case. I tested different fonts at different
dpi scalling and saw no differences.
|
|
- use x/y/width/height/max as a suffix.
- replace 'num' prefix /w 'len' suffix.
|
|
- batching -> batch_draw.
- ct & size -> len.
- start/end -> begin/end (follow GL convention).
|
|
You can now use BLF_batching_start and BLF_batching_end to batch every
drawcall to BLF together minimizing the overhead introduced by BLF and the
opengl driver.
These calls cannot be nested (for now).
If the modelview matrix changes, previously batched calls are issued and a
the process resume with the new matrix.
However the projection matrix MUST not change and gl scissors as well.
|
|
This is not a perfect win just yet. It's now calling glBufferSubData for
every call (instead of using glMapBufferRange which is almost faster), but
with this system we will be able to batch drawcalls together.
See next commit.
|
|
This means smaller imm buffer usage.
This does not reduce the number of drawcalls.
This uses geometry shader which is slow for the GPU but given we are really
CPU bound on this case, it should not matter.
A perfect implementation would:
- Set the glyph coord in a bufferTexture and just send the glyph ID to the
GPU to read the bufferTexture.
- Use GWN_draw_primitive and draw 2*strllen triangle and just retrieve the
glyph ID and color based on gl_VertexID / 6.
- Stream fixed size buffer that the Driver can discard quickly but this is
the same as improving IMM directly.
|
|
|
|
BLF is a low level module, which might (and is) used without Blender.
Thanks Campbell for review!
|
|
|
|
This includes a few modification:
- The biggest one is call glActiveTexture before doing any call to
glBindTexture for rendering purpose (uniform value depends on it).
This is also better to know what's going on when rendering UI. So if
there is missing UI elements because of this commit look for this first.
This allows us to have "less calls" to glActiveTexture (I did not
measure the final count) and less checks inside GPU_texture.
- Remove use of GL_TEXTURE0 as a uniform value in a few places.
- Be more strict and use BLI_assert for bad usage of GPU_texture functions.
- Disable filtering for integer and stencil textures (not supported by
OGL specs).
- Replace bools inside GPUTexture by a bitflag supporting more options to
identify texture types.
|
|
The issue was going to the fact that GL_ALPHA was deprecated in core profile
and common solution online is to use GL_RED instead. That is what is done in
this commit.
|
|
Conflicts:
source/blender/alembic/intern/abc_exporter.cc
|
|
Causes crash if the font size isn't set after clearing (see T51200)
|
|
|
|
|
|
Make color values compact. Set color once per primitive. Use new immSkipAttrib to avoid useless color copies.
All of this should make text drawing less CPU hungry.
|
|
We still need to BeginAtMost instead of simple Begin, since some glyphs could be clipped & not drawn.
|
|
While trying to simplify text drawing, noticed no Blender code uses the blur feature. Hopefully scripts don't use it!
|
|
Was one draw call per glyph, now one per line.
Still room for improvement here.
|
|
Part of T49043
|
|
All text was displaying black.
BLF uses alpha-only textures which aren't supported by the basic-shader,
Workaround this by using texture swizzle so the RGB components of the texture are set to 1.
|
|
|
|
need it.
|
|
Maybe this is pedantic but I read it’s best to explicitly set the
desired component size.
Also append “_ARB” to float texture formats since those need an
extension in GL 2.1.
|
|
|
|
Very minor, but since it was reported...
|
|
|
|
also edit comments for knife tool
|
|
also use UNLIKELY for error cases
|
|
|
|
Each dpi value stores its own set of font sizes, so while dragging the
dpi value would collect many sizes and never free.
Also change how BLF_cache_clear works,
it was freeing memory but not the OpenGL textures.
Now just free all the cache and GL textures and let drawing allocate them again as needed.
|
|
|
|
|
|
place (pragmas were copied around).
also enable more strict warnings for BLF (which had some incorrect casts).
|
|
takes a key as an arg and isnt popping any element from the hash as you might expect).
add BLI_pophead/tail, since getting the first element from a list and removing it is a common task.
|
|
|
|
render.
Printing text on the color grid image would initialize font glyphs from a thread at
the same time as the UI, causing conflicts. The freetype glyph renderer needs to be
mutex locked because it uses a shared buffer internally even when rendering for
different fonts. Also needed to change the image generate function to use the render
monospace font to avoid conflicts in blenfont.
What's still weak in the blenfont API is that there is no distinction between a font
and a thread using that font to render with some particular size, style, etc.
|
|
clipping without the shadow since not-drawing characters because of subtle effect is rather annoying.
|
|
and BLF.
|
|
blender-playanim and not really needed.
this reverts part of 55995
|
|
functions aware of this limit.
|
|
Added "Panel Title" style to Theme settings.
Allows to make these nice larger or draw differently.
Also tried to put hinting in Style, but this needs to be a per-font
setting. uiFont data is still not being saved (also not allowing
to set own font files for UI). That's a todo for 267 then.
|
|
|
|
debug option.
|
|
applied to the characters y offset causing out of bounds pixels to be requested from glTexSubImage2D().
also clamp width, height of the character bitmap to the bitmap bounds since this can still happen for very small text (2-3 pixels high).
|
|
|
|
our naming convention.
|
|
|
|
|
|
|