Commit Graph

68480 Commits

Author SHA1 Message Date
Campbell Barton
0a62e971b2 Draw Engine: Draw sets recursively
Matchers regular viewport behavior
2017-04-13 19:42:59 +10:00
Campbell Barton
ffa63d2de6 Use regular header guards in GPU 2017-04-13 19:11:55 +10:00
Mike Erwin
1c426d5b6c OpenGL: implement 2D with 4x4 matrices
... even though 3x3 feels better.
 
This is a compromise to get core profile up & running sooner. Eventually I'd like to finish the original 3x3 plans, but this commit will let us get on with other tasks.

External API stays (almost) the same. Our GLSL shaders can use this without any changes.

Part of T49450 and T51164
2017-04-13 04:00:19 -04:00
Mike Erwin
fae01c3a54 use new 3D matrix impl in draw manager
These functions mark the beginning and end of 3D drawing, causing the matrix API to use our own implementation instead of legacy OpenGL.

Part of T49450
2017-04-13 01:07:52 -04:00
Mike Erwin
56e9629d96 Gawain: look up array uniforms correctly
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.
2017-04-13 01:07:51 -04:00
Mike Erwin
f7087109ce cleanup image drawing setup 2017-04-13 01:07:51 -04:00
Mike Erwin
b02786ae6b Gawain: use ShaderInterface to manage uniforms
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
2017-04-13 01:07:51 -04:00
Mike Erwin
6bfb9b7b5f Gawain: add immUniform4iv
Needed soon by OCIO.
2017-04-13 01:07:50 -04:00
Mike Erwin
c61b7b0263 Gawain: add (temp) legacy GLSL support to ShaderInterface
A temporary measure needed by GPU_basic_shader.

Part of T51164
2017-04-13 01:07:50 -04:00
Mike Erwin
02fd9a1aaf Gawain: improve ShaderInterface
- 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
2017-04-13 01:07:49 -04:00
Campbell Barton
c0a9e388b3 GLSL: rename edit_overlay -> edit_mesh_overlay
Avoid confusion with overlays with non-mesh types
2017-04-13 14:13:46 +10:00
Campbell Barton
64660b902c Use 'safe' macros for common free operation
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.
2017-04-13 13:37:27 +10:00
Mike Erwin
c080702e73 fix drawing file column dividers (T51189)
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.
2017-04-12 14:20:55 -04:00
Dalai Felinto
2871bad8ea Fix T51188 compilation errors in Windows 2017-04-12 18:58:38 +02:00
Dalai Felinto
6e4cc26265 Layer / Outliner / Depsgraph: update depsgraph when running outliner operators 2017-04-12 16:55:04 +02:00
Julian Eisel
428e07a9f7 Outliner: Draw nested collections before objects of a collection
Collections may contain a huge list of objects, would be annoying having
to scroll over it all the time to get to the nested collections.
2017-04-12 14:47:54 +02:00
Julian Eisel
64905c4c77 Outliner: Fix objects of master collection not showing up in 'Master Collection Tree' 2017-04-12 14:45:42 +02:00
Campbell Barton
af2fc7b637 Merge branch 'master' into 28 2017-04-12 20:23:44 +10:00
Campbell Barton
4560f0b007 Cleanup: use lowercase gpu prefix for static funcs
This was mostly followed already.
2017-04-12 20:19:55 +10:00
Campbell Barton
0c9a2def8b Draw Engine: remove hard coded limit on array sizes
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.
2017-04-12 19:51:14 +10:00
Campbell Barton
b380f4927e Remove bool -> int cast
Wont work as expected on big endian systems
2017-04-12 18:23:40 +10:00
Sergey Sharybin
c29bc61829 Color management: Avoid memory copy into same buffer 2017-04-12 10:23:38 +02:00
Campbell Barton
208f25d626 Cleanup: naming & line length 2017-04-12 18:23:17 +10:00
Campbell Barton
cc0c5dbd91 Cleanup: use DRW_cache_mesh prefix w/ mesh objects
Avoid confusion for non mesh types where verts/wire/surface might apply.

Other object types use this convention already.
2017-04-12 18:11:10 +10:00
Campbell Barton
9e94479359 EditMesh Render: remove edges-of-vert loop
Replace topology check which checked edges twice
with a loop on the edge array.
2017-04-12 15:43:20 +10:00
Campbell Barton
dc1499ba1c Merge branch 'master' into 28 2017-04-12 14:23:47 +10:00
Campbell Barton
0ebe08af34 Docs: minor improvement to code example 2017-04-12 14:21:59 +10:00
Campbell Barton
ed8c71da1c Cleanup: replace char array with struct 2017-04-12 14:08:44 +10:00
Campbell Barton
5cf090ffec EditMode: remove edge-hash from MeshRenderData
LoopTri's can access this data.
2017-04-12 13:45:56 +10:00
Campbell Barton
e78412c905 Cleanup: use const pointer for view access API 2017-04-12 12:10:01 +10:00
Campbell Barton
95dd478e47 Cleanup: line length
Avoid right-shift
2017-04-12 12:05:11 +10:00
Mike Erwin
42349f6efd fix compile warnings 2017-04-11 19:35:30 -04:00
Campbell Barton
e8ddd258ef Correct own error in adding colors
Make comment regarding GLSL more clear.
2017-04-12 00:56:19 +10:00
Sergey Sharybin
5a4fceff1b Make image drawing code working with core profile
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.
2017-04-11 16:49:39 +02:00
Dalai Felinto
35ee9db1e2 Renaming: sl > scene_layer 2017-04-11 16:49:32 +02:00
Dalai Felinto
4fe4c82dbd Fix blenderplayer(tm) 2017-04-11 16:24:59 +02:00
Clément Foucault
70e4f1e003 Draw Manager: Fix blended color. 2017-04-11 16:13:29 +02:00
Clément Foucault
181c8f8ccd Draw Manager: Fix Background sets not being drawn. 2017-04-11 16:13:29 +02:00
Dalai Felinto
aef4519c8a Renaming: sl > scene_layer 2017-04-11 16:09:30 +02:00
Dalai Felinto
6f8c838b78 Cleanup: remove no longer needed BASE_ defines 2017-04-11 15:51:18 +02:00
Dalai Felinto
9a303d5db7 Bring snapping back (Base / BaseLegacy) 2017-04-11 15:46:01 +02:00
Sergey Sharybin
513aacbdb6 Use immediate mode API for OpenColorIO 2017-04-11 15:39:04 +02:00
Bastien Montagne
fd5b882a67 Move cage_manipulator.c to new GL code.
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...
2017-04-11 15:19:00 +02:00
Bastien Montagne
b8c4be0844 FIx copy/paste mistake in own previous commit. 2017-04-11 15:19:00 +02:00
Campbell Barton
85f81293c4 GL/WIP: fix crash drawing text object
Note that this doesn't set the normal as it should (noted as a TODO),
just committing to avoid the crash.
2017-04-11 22:46:56 +10:00
Campbell Barton
88fddd118f Draw Manager: replace varargs with a pointer array
Allows to ensure correct number of args
2017-04-11 21:20:18 +10:00
Bastien Montagne
7c4e164ff3 Get rid of last deprecated OpenGL calls in arrow_manipulator.c
Hope that makes sense...
2017-04-11 12:47:38 +02:00
Bastien Montagne
633a2a3592 Move arrow2d_manipulator to new immediate mode GL. 2017-04-11 12:46:49 +02:00
raa
31bdb31ecf Fix: width of UILayout.prop_enum() buttons 2017-04-11 13:25:46 +03:00
Mai Lavelle
d097c72f81 Cycles: Only calculate global size of split kernel once to avoid changes
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.
2017-04-11 03:26:18 -04:00