Age | Commit message (Collapse) | Author |
|
BF-admins agree to remove header information that isn't useful,
to reduce noise.
- BEGIN/END license blocks
Developers should add non license comments as separate comment blocks.
No need for separator text.
- Contributors
This is often invalid, outdated or misleading
especially when splitting files.
It's more useful to git-blame to find out who has developed the code.
See P901 for script to perform these edits.
|
|
Also rename GPUVertexAttribs to GPUVertAttrLayers,
avoids confusion with GPUVertAttr which isn't closely related.
|
|
|
|
This is in order to make the API more multithread friendly inside the
draw manager.
GPU_shader_get_uniform will only serve to query the shader interface and
not do any GL call, making it threadsafe.
For now it only print a warning if the uniform was not queried before.
|
|
- immAttrib* -> immAttr*
- immSkipAttrib -> immAttrSkip
Term 'attr' is a convention for GPU module.
|
|
|
|
|
|
|
|
GPUFrameBuffers were being free when no context was attached or in the
wrong gl context. This make sure this does not happen again.
You can now safely free any gl resource from any thread (well as long as
it's not used anymore!).
|
|
|
|
|
|
|
|
This does not include all the struct and type renaming. Only files were
renamed.
gwn_batch.c/h was fusioned with GPU_batch.c/h
gwn_immediate.c/h was fusioned with GPU_immediate.c/h
gwn_imm_util.c/h was fusioned with GPU_immediate_util.c/h
|
|
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
|
|
Core of the issue was that some of our Theme colors are RGB-only, but
were loaded as RGBA.
Note that tracking all possible cases is pretty impossible, so we'll
have to tackle those as they get reported am afraid.
|
|
Had to add a few utility functions to replace existing functions. Let me know if these are duplicates.
Reviewers: merwin
Reviewed By: merwin
Tags: #bf_blender_2.8
Maniphest Tasks: T49043
Differential Revision: https://developer.blender.org/D2434
|
|
|
|
- any shader program can use matrix state (not only built-in shaders)
- you can mix matrix & begin/end calls, and the bound shader will use the latest matrix state
Part of T49450 & T49043
|
|
Plus some naming cleanup.
Supports T49043
|
|
immUniformThemeColorBlendShade
|
|
|
|
Built-in shaders now use uniforms instead of legacy built-in matrices. So far I only hooked this up for new immediate mode.
We use the same matrix naming convention as OpenGL, but without the gl_ prefix, e.g. gl_ModelView becomes ModelView.
Right now it can skip the new matrix stack and use the legacy built-in matrices app-side. This will help us transition gradually from glMatrix functions to gpuMatrix functions.
Still some work to do in gpuBindMatrices. See TODO comments in gpu_matrix.c for specifics.
|
|
Was already done for immediate mode, but rearranged code to make a clean separation. Cleaned up #includes for code that uses this feature.
Added same for batched rendering.
|
|
Put Gawain source code in a subfolder to make the boundary between the
library and the rest of Blender clear.
Changed Gawain’s license from Apache to Mozilla Public License. Has
more essence of copyleft — closer to GPL but not as restrictive.
Split immediate.c into several files so parts can be reused (adding
more files soon…)
|
|
immBegin requires us to know how many vertices will be drawn. Most times this is fine, but sometimes it can be tricky. Do we make the effort to count everything in one pass, then draw it in a second?
immBeginAtMost makes this simple. Example: I'll draw at most 100 vertices. Supply only 6 verts and it draws only 6.
Any unused space is reclaimed and given to the next immBegin.
|
|
Was using GL_NONE to mean "no primitive" but GL_NONE and GL_POINTS are both defined as 0x0000.
Introducing PRIM_NONE = 0xF which does not clash with any primitive types.
|
|
Application code can pass ubytes, Gawain converts to float vec4 expected by shader.
For now the conversion is simple linear. We can add sRGB support later if needed.
|
|
Scanned Blender code for commonly used glVertex, glColor functions.
Implemented immVertex, immAttrib versions of these to ease transition
away from legacy OpenGL.
|
|
Legacy OpenGL has a matching Vertex3fv for every Vertex3f, and so on. Add something similar to Gawain, just for a few common functions. Might add more as the need arises.
|
|
New value of 4MB should handle our needs without taking up too many GPU
resources.
Old value of 1KB was for observing what happens when the buffer fills up
and we need to flush and start a new one.
|
|
If you don’t specify a vertex’s color, it will use the color of the
previous vertex. Similar for all other attributes.
This matches the legacy behavior of glColor, glNormal, etc. *except* in
Gawain the first vertex of each immBegin must be fully specified. There
is no “current” color in the new system.
|
|
Should be simpler to use now.
Made vertex format structure private. New immVertexFormat() function
clears and returns the format. Devs can start with add_attrib(format...)
and not have to clear it first.
immBindProgram automatically packs the vertex format if needed.
Updated 3D cursor drawing to use new API.
|
|
Track previously enabled attrib locations so we can call OpenGL only
when needed.
Same result, fewer GL calls.
|
|
glBindAttribLocation does not take effect until the program is
re-linked. In other words I was doing it wrong!
New code gets attrib locations from program, then remembers the attrib
-> location mapping for subsequent draw calls.
The program and VertexFormat are not modified (makes threading and reuse
easier).
|
|
properly typed function parameters
pointer casting & arithmetic
ptrdiff_t formatting
|
|
There are older ways to give OpenGL hints about buffer invalidation, but
glInvalidateBufferData does exactly what we want. Use this function when
OpenGL 4.3 is available (Windows and proprietary Linux drivers).
Part of Gawain immediate mode.
|
|
MSVC is more strict than gcc or clang about pointer arithmetic. Also
fixed pointer cast warnings.
|
|
Start simple with vec4 uniforms. Add more later.
|
|
glMapBufferRange is a wonderful function that doesn’t exist on GL < 3.0.
Use the APPLE_flush_buffer_range extension on Mac. It offers several of
glMapBufferRange’s benefits.
Use older “black arts” method to orphan VBOs when we are done with
them. In modern OpenGL this behavior is more obvious.
Add APPLE_flush_buffer_range to Mac requirements. Every GPU is
supported. T49012
|
|
Apple invented VAOs and exposes them via an extension in legacy GL.
Other platforms use at least GL 3.0 which has VAOs built in.
QUADS were removed from core profile but are useful for immediate-mode
drawing. We’ll have to implement our own QUAD drawing before switching
to core profile.
|
|
Immediate mode no longer leaves its internals bound after use. Part of
transition from a simple prototype app to non-simple Blender, which has
lots of other parts using OpenGL.
|
|
More ways to send values via immAttrib:
2D float vectors
3 & 4 component ubytes (for colors mostly)
New immVertex functions that act more like familiar glVertex. We’ll
find a balance between making this API convenient and keeping it small.
2f and 3f are enough for now.
|
|
Introducing an immediate mode drawing API that works with modern GL 3.2
core profile. I wrote and tested this using a core context on Mac.
This is part of the Gawain library which is Apache 2 licensed. Be very
careful not to pull other Blender code into these files.
Modifications for the Blender integration:
- prefix filenames to match rest of Blender’s GPU libs
- include GPU_glew.h instead of <OpenGL/gl3.h>
- disable thread-local vars until we figure out how best to do this
|