Commit Graph

92 Commits

Author SHA1 Message Date
Sybren A. Stüvel
3bacd17b1c Added comment to explain MeshRenderData.orco 2018-04-18 14:13:20 +02:00
Clément Foucault
1816d1f992 Mesh: Batch cache: Fix sculpt update issue.
Old solution was to create a new vbo and copy it to the location of
the old vbo hoping for the batches to update their vaos before drawing.

The issue is that the new VAO caching is not updating the VAOs at all
unless the shader interface changes.

So unless we expand gawain to support updating of vertex buffers (in a
better way than the current "dynamic" buffer) we need to delete every batch
linked to the vbo we want to recreate.

This solution might have performance implications.
2018-03-15 13:58:25 +01:00
Campbell Barton
2094bbd033 Fix assert in mesh batch conversion 2018-01-17 19:54:13 +11:00
Campbell Barton
1c7cfa025c Merge branch 'master' into blender2.8 2017-12-07 23:53:03 +11:00
Germano
5d70e847dd Fix T51604: Support Auto-Smooth in Edit-Mesh
and allocate loop_normals in MeshRenderData instead of CustomData

Differential Revision: D2907
2017-11-06 14:14:07 -02:00
Germano
59f238ba09 Mesh Auto-Smooth Split Normal Support
From D2906 with few changes
2017-10-31 15:15:14 -02:00
Campbell Barton
adfbf276a1 Cleanup: style, duplicate includes 2017-10-07 15:57:14 +11:00
Campbell Barton
2f19559258 Cleanup: naming for mesh dirty flags
- NOCHECK -> ALL
- ALL -> MAYBE_ALL

Where 'MAYBE_ALL' checks to see if the mesh has changed.
This is clearer that `BKE_MESH_BATCH_DIRTY_ALL` is dirty and
going to be updated without any guess-work.
2017-08-22 22:07:25 +10:00
Campbell Barton
4b6c482d69 DwM: use batch select for vertex paint mode 2017-08-17 07:13:02 +10:00
Campbell Barton
7c96f613e4 DwM: Use Batch's for drawing selection
Use mesh batch cache for mesh selection.
Note that we could create the batches and free immediately
so they don't take up memory.

This resolves a problem where selection was limited
to immediate-mode buffer size.
2017-08-17 06:34:02 +10:00
Campbell Barton
dbd300ab20 DwM: use gawain ownership flags for mesh drawing 2017-08-16 17:47:58 +10:00
Brecht Van Lommel
76d0ab9750 Code cleanup: fix various compiler warnings. 2017-08-12 14:08:03 +02:00
Campbell Barton
b4988d01cb DwM: Option to use final material over mode shading
Support using full material shading in sculpt & paint modes mode.

Access 'Full Shading' from the display panel when in paint modes.
2017-07-13 01:59:44 +10:00
Luca Rood
0a57597aff Temporary fix for crash related to VBO update on shader change
This frees the whole mesh batch cache, instead of only the required
parts, as freeing specific parts of a cache is currently causing
crashes.
2017-07-11 13:03:27 +02:00
Luca Rood
45897f12f8 Fix T51931: VBO not updating when UVs are added to shader node tree
UVs need specific data in the VBO, which is not computed unless the
shaders assigned to the mesh actually use UVs. When adding UVs to the
shader, the VBOs were not being recomputed to include the required data.

This adds a DEG relation between the shader and the mesh, and recomputes
the required data if the shader changed.

Thanks Sergey, for all the DEG stuff...
2017-07-10 14:43:57 +02:00
Alexander Romanov
0ef48ad504 One more fix for merged 'normal map tangents not working correctly when there are no UV maps.' 2017-07-04 16:25:49 +03:00
Alexander Romanov
e1482841dd Merge branch 'master' into blender2.8 2017-07-03 19:53:00 +03:00
Dalai Felinto
871325e26f Fix T51963: Eevee: ASAN crash on copy_attrib_name
Bug introduced on f6bb3262f1.

CustomData_get_named_layer returns a different result than
CustomData_get_named_layer_index.
2017-07-03 12:47:00 +02:00
Campbell Barton
1a6ae0c70e DwM: Use GWN_vertbuf_raw_* access for shading data
Gives approx 14% speedup here.
2017-06-30 18:31:04 +10:00
Campbell Barton
34e4948682 Fix T51919: Tangents need UV's allocated 2017-06-30 17:48:18 +10:00
Luca Rood
f39d06589e Fix warnings in draw_cache_impl files 2017-06-29 15:46:00 +02:00
Campbell Barton
fd3589e4c9 DwM: optimize mesh batch conversion
- Replace GWN_vertbuf_attr_set with Gwn_VertBufRaw & GWN_vertbuf_raw_step
  to avoid intermediate copy.
- Avoid extra conversion step with: float[3] -> short[3] -> Gwn_PackedNormal.
  We can skip the short[3].

Gives approx 6% speedup here.
2017-06-29 20:11:16 +10:00
Campbell Barton
2343dcf0d2 Gawain: Use common prefix for packed normal 2017-06-29 18:54:23 +10:00
Campbell Barton
10c887762a DwM: no need to calculate face normal 2017-06-29 15:52:08 +10:00
Campbell Barton
abd9d50faa Cleanup: quiet negative shift warning 2017-06-29 15:34:50 +10:00
Campbell Barton
f6bb3262f1 DwM: add CD_AUTO_FROM_NAME for mesh conversion 2017-06-29 15:23:47 +10:00
Campbell Barton
4a061a87e6 DwM: mesh data now only creates data thats used
Read from the GPUMaterial to find custom-data layers used for drawing.

This resolves problem where having UV's would always calculate tangents
causing noticeable slow down compared to 2.7x.
2017-06-28 13:44:28 +10:00
Campbell Barton
fc3d0da2fd DWM: Fix own error checking wrong layer type
Would calculate all tangents for every UV layer.
2017-06-28 11:39:05 +10:00
Campbell Barton
df70e3de63 DWM: separate tangents from UV conversion
Prepare for different number of UV/Tangent layers.
2017-06-28 09:55:40 +10:00
Luca Rood
bafb904807 Fix T51559: Update draw cache when changing flat/smooth shading
This also renames some flags/variables to be more generic for updating
purposes. The call used here was previously only used for updating
paint data, but as it was reused here, flags and variables were renamed
to accomodate more clearly to the new usages.
2017-06-26 14:52:59 +02:00
Campbell Barton
b4d053efc7 Gawain API naming refactor
Use consistent prefix for gawain API names as well as
some abbreviations to avoid over-long names, see: D2678
2017-06-19 20:18:04 +10:00
Campbell Barton
f8ea2c92db Suppress assert for meshes with no faces 2017-06-02 16:42:39 +10:00
Campbell Barton
a5783d08f9 Resolve assert in weight paint mode w/ no weights 2017-06-01 13:37:18 +10:00
Campbell Barton
390648b984 DwM: Show wire only mesh objects 2017-06-01 02:26:24 +10:00
Campbell Barton
214c42157a Only calc split normals when auto-smooth is enabled
This matches cycles & derived-mesh
2017-05-25 02:31:39 +10:00
Campbell Barton
154ff1afde Fix/Workaround T51561: Disable split normals 2017-05-25 01:40:15 +10:00
Campbell Barton
707340edd7 Cleanup: minor de-duplicate from last commit 2017-05-24 22:54:19 +10:00
Campbell Barton
429f6bee28 Fix T51561: Normal maps fail w/ quad + eevee
Generalize derived-mesh tangent calculation so
it can be used by Batch cache creation too.
2017-05-24 22:39:50 +10:00
Campbell Barton
3c92e6b8f0 Cleanup: bmesh var naming 2017-05-24 13:33:48 +10:00
Campbell Barton
c9d890585b DwM: avoid indirect edit-mesh conversion
Storing edit-mesh data as indices for passing
only to get back edit-mesh data.

This also complicated checks for real edges in tessellation tris.

Simpler to pass data directly.
2017-05-24 13:27:11 +10:00
Campbell Barton
b2dc54ffe5 Stupid mistake in material access optimization 2017-05-23 21:52:18 +10:00
Campbell Barton
96f7b08aec DwM: optimize material access
- Split BMesh/Mesh loops.
- Loop over faces instead of tris.
- Add out-of-bounds check for material index (rare but can happen).
2017-05-23 18:26:16 +10:00
Campbell Barton
611779ca96 Cleanup: use more generic naming
Can be used by any user that needs faces split by materials.
2017-05-23 17:48:05 +10:00
Campbell Barton
f21c235c6f DwM: texture paint support & mask mode
Uses workaround so material slots are used when neither blender-internal
or cycles are enabled.
2017-05-23 17:40:48 +10:00
Campbell Barton
9efd3a3f63 Cleanup: move custom-data layers into a struct
Changed because the values co-exist with active layers
(Mesh.mloopuv, Mesh.mloopcol).
2017-05-22 17:25:31 +10:00
Campbell Barton
02cc4d8cec Cleanup: line length 2017-05-22 16:25:27 +10:00
Campbell Barton
e98652b64f Cleanup: minor edits 2017-05-22 16:21:44 +10:00
Mike Erwin
68d8618538 Gawain: promote 10_10_10 to first-class vertex format
This format is part of OpenGL 3.3, and one of the reasons for choosing 3.3 over 3.2.

Instead of checking #if USE_10_10_10 just use it wherever needed.
2017-05-21 15:59:34 -04:00
Campbell Barton
07dd208209 Cleanup: warnings 2017-05-21 09:39:31 +10:00
Clément Foucault
242a044bd1 GPUMaterial: Add support for tangent node. 2017-05-18 16:05:03 +02:00