Commit Graph

241 Commits

Author SHA1 Message Date
a4fe338dd8 Cleanup: add missing braces to draw manager 2019-01-25 07:12:13 +11:00
bc32240105 Fix T60810: crash editing mesh with subdivision modifier
typo in rBdc7e49298940

Reviewers: fclem

Maniphest Tasks: T60810

Differential Revision: https://developer.blender.org/D4244
2019-01-24 14:36:01 +01:00
dc7e492989 Fix T60545: Buffer overflow in selection batch creation
Use loose_edges and loose_verts buffer instead of detecting them manually.
2019-01-17 19:48:00 +01:00
9d8445d6a9 Cleanup: de-duplicate loose vert/edge checks 2019-01-17 13:20:44 +11:00
76fdd33df2 Fix T60578: Crash selecting after hiding vertices 2019-01-17 13:05:45 +11:00
6f9e3e9d33 Fix T60476 Loose vertices only partially drawn
Was caused by a missing vbo attachement.

Also fix said Vbo refreshing when selecting.
2019-01-14 18:33:07 +01:00
9f51fc656e EditUV: Only clear data VBO when selection changes
This is a small optimisation that make UV selection faster.
2019-01-11 20:09:42 +01:00
3a9909f38e Fix T59990: Crash when entering edit mode with skin modifier enabled
The skin modifier does not keep the UV layers.

This just add a safety check when there is no UV layers.
2019-01-11 18:56:05 +01:00
1c91b6ee29 UVEdit: Port texpaint_loop_wire to batch request
This removes code duplication and put an end to the old "create at request"
batch creation.

Also it uses the same vbo as the uv layer used for shading. Reducing VRAM
usage.

Also fixes the modified uv display in uv edit mode.
2019-01-11 16:00:23 +01:00
621a6d4a5d UVEdit: Add back uv angle stretch aspect correction
This is now done in shader so that the batches are shared across ImageUV
areas.
2019-01-11 16:00:23 +01:00
5f3fdee53a UVEdit: Port batches to batch request
This is in order to allow more spaces to have their batches created at the
same time and sharing the batches.

This is part of the effort fo making the drawing code more optimized. This
commit however should not introduce any difference.

This commit bypass the aspect ratio correction for angle stretch display
but this should be fixed in the next commit.
2019-01-11 16:00:23 +01:00
a46dc9b234 Mesh Batch Cache: Cleanup Unused 2019-01-11 16:00:23 +01:00
55ddb21b7c Mesh Selection: Port to batch cache request
This makes it more future proof and remove baked id offset inside the vbos.
Instead we add the offset as a uniform. This makes it possible to reuse
the vbos instead of discarding them all the time.

Also using batch request may reduce batches creation time.
2019-01-11 16:00:23 +01:00
4c0c4e7f9f Mesh Batch Cache: Fix wrong assert 2019-01-11 16:00:23 +01:00
943852c0dc Mesh Batch Cache: Put context evaluation out of batch cache
This is in order to be able to call DRW_mesh_batch_cache_create_requested
outside of the draw manager
2019-01-11 16:00:23 +01:00
369e1d46f0 Fix T56545: Material referencing missing UV crash 2019-01-09 01:05:43 +11:00
543ddbe6bf Cleanup: warnings (clang) 2018-12-30 15:15:05 +11:00
7a26e930a8 Cleanup: macro hygiene, line length 2018-12-21 10:46:26 +11:00
217727cb35 Mesh Batch Cache: Fix missing flag for looptris indexbuf generation
Fix T59637: Crash report - Overlays -> Face Orientation causes crash
2018-12-20 23:42:21 +01:00
a9706476e3 Mesh Batch Cache: Fix uninitialized loop variable 2018-12-19 22:56:15 +01:00
1a7fe54a85 Fix T59578: enabling "vertex group weights" in edit mode results in crash 2018-12-19 12:32:13 +01:00
5b277d7a18 Mesh Batch Cache: Port loose_edges to batch request 2018-12-18 22:17:53 +01:00
2f00e0a37b Mesh Batch Cache: Cleanup / Reorder function for more consistency 2018-12-18 22:17:53 +01:00
604101d262 Mesh Batch Cache: Port edge_detection to batch request
Also add proper support for mapped meshes (deformed by modifiers in edit
mode). So this fixes the shadows of workbench in edit mode.
2018-12-18 20:51:52 +01:00
99fb654ffd DRW: Cleanup / Renaming of mesh batch cache functions
THis is in order to avoid the jungle of names being different at each
step of the API.

Also removes some unused functions.
2018-12-18 20:51:52 +01:00
df88b6a48d Mesh Batch Cache: Port all_edges batch to batch request 2018-12-18 20:51:52 +01:00
8839152abf Fix T59529: Auto smooth not working 2018-12-18 14:27:13 +01:00
a68edaf11d Mesh Batch Cache: Port vertex paint surface to batch request 2018-12-18 02:19:52 +01:00
bcf390a6c3 Mesh Batch Cache: Port weight paint surface to batch request 2018-12-18 02:19:52 +01:00
6a1315d6e7 Weight Paint Overlay: Refactor wire drawing
This reduce the number of batch/data needed. Stores a select/visiblee
flag inside the vert/loop normals.
2018-12-18 02:19:52 +01:00
f6a77a759b Fix error when Blender starts - variable not initializated 2018-12-17 19:09:27 +01:00
4cd558b711 Mesh Batch Cache: Port Texture paint wires to new batch request 2018-12-17 17:11:45 +01:00
7ac49a07c6 Mesh Batch Cache: Port Texture paint batches to new batch request 2018-12-17 17:05:57 +01:00
36cc42e796 Mesh Batch Cache: Optimization & Refactor shaded surface support
This now only upload data per loops to the GPU, making use of index buffer
to draw polygon. This make use of the vertex cache, speed up renders
and saves a lot of vram.

Update performance is also slightly faster and can even be improved further
by updating only uvs or vcol independently.

This commits breaks texture paint batches. It will be added back in another
commit.
2018-12-17 17:05:57 +01:00
f371e633f9 Curve Batch Cache: Add support for loose edges and curve/surf modifier
Fixes T58298 Nurbs circle and curve dont draw in objectmode
Fixes T58107 Modified curves/surfaces/fonts do not show their eval mesh
2018-12-14 16:17:29 +01:00
2afed99da3 Curve Batch Cache: Rework Implementation to use new batch request
Shaded triangles are not yet implemented (request from gpumaterials).

This also changes the mechanism to draw curve normals to make it not
dependant on normal size display. This way different viewport can
reuse the same batch.
2018-12-14 16:17:29 +01:00
dd4c87cd04 Merge branch 'master' into blender2.8 2018-12-14 11:09:42 +11:00
10eb92035c Fix T59234: Crash when enter in Edit mode
Edit mode triangles does always need to have access to faces for visibility
and select/active flags.
2018-12-12 15:19:21 +01:00
cf92795953 Mesh Batch Cache: Fix crash when using edit mode normal display. 2018-12-12 15:19:21 +01:00
b87b6e8e28 Fix T59211: Edit-mesh display crashes
Caused by ae1f563899
2018-12-12 11:16:56 +11:00
c7ec1fa5e6 Cleanup: use BKE_object_* prefix for object API
Also minor style cleanup.
2018-12-11 15:09:09 +11:00
834bf357c8 Edit Mesh: Draw inner edge selected in vert edit mode if both verts selected
This only make the edge fully selected. There is still no gradient like in
2.79 when only one vertex is selected.
2018-12-10 19:02:17 +01:00
f7b558cbdc DRW: Batch Cache: Mesh: Port edit mesh batches to batch request method
This also do some renaming/cleanups.
2018-12-10 19:02:17 +01:00
ae1f563899 DRW: Batch Cache: Mesh: Port more batches to batch request method 2018-12-10 19:02:17 +01:00
1d92888ee8 DRW: Batch Cache: Add batch request system
This makes it possible for engines to ask for batches and only fill their
data after all engine populate functions have run.
This means that, when creating the batches data we already know all the
batches that are needed for this redraw and the needed data.

This allows for less redundant data preparation and better attrib masking.
Ideally, we should run all viewports populate function before executing
the batch construction but this is not the scope of this patch.

Conversion from the old request method will be progressive and both can
coexist (see uses of mesh_create_pos_and_nor()).
2018-12-10 19:02:17 +01:00
942e9835a9 Fix/workaround crash opening almost any Spring file
The issue was caused mpoly array urequired by the cache filling,
but the pointer was never set when preparing render data.

Seems this change is safe enough, in terms it shouldn't be
causing slowdown, since the assignment of mpoly is cheap, but
hard to tell if there is anything else affected by thing underneath.
2018-12-07 12:41:46 +01:00
0c6d5232a3 DRW: Remove the use of GPUTexture buffers for edit wire rendering
See previous commit for detail as why.
2018-12-07 05:33:53 +01:00
e929cad706 DRW: Rework wireframe overlay implementation
The shader is way simpler and run way faster on lower end hardware
(2x faster on intel HD5000) but did not notice any improvement on AMD Vega.

This also adds a few changes to the way the wireframes are drawn:
- the slider is more linearly progressive.
- optimize display shows all wires and progressively decrease "inner" wires
  intensity. This is subject to change in the future.
- text/surface/metaballs support is pretty rough. More work needs to be done.

This remove the optimization introduced in f1975a4639.
This also removes the GPU side "sharpness" calculation which means that
animated meshes with wireframe display will update slower.
The CPU sharpness calculation has still room for optimization. Also
it is not excluded that GPU calculation can be added back as a
separate preprocessing pass (saving the computation result [compute or
feedback]).

The goal here was to have more speed for static objects and remove
the dependency of having buffer textures with triangle count. This is
preparation work for multithreading the whole DRW manager.
2018-12-07 05:33:53 +01:00
b0726b31e6 DRW: Mesh: Make uvs use the final mesh display 2018-12-06 14:43:09 +01:00
b576e14902 DRW: Fix Uvs not working in solid mode + edit mesh 2018-12-06 14:42:25 +01:00