Commit Graph

628 Commits

Author SHA1 Message Date
e9cf9e0a39 Gpencil: Fix assert when rendering with Eevee 2019-05-23 12:58:50 +02:00
8b52619ff8 DRW/Eevee: Fix camera texture coordinates in renders
This patch fix the issue introduced by recent refactor and fixes
computation when using overscans.
2019-05-22 16:09:10 +02:00
60319e25f2 GPU: Refactor GPU_batch_draw_range_ex
Rename it to GPU_batch_draw_advanced and use base instance when possible.

Also add GPU_batch_bind to bind the vao independantly of drawing commands.
2019-05-22 13:29:05 +02:00
7b3f64e12a Cleanup: DRW: Remove, rename stuffs 2019-05-22 13:29:05 +02:00
6914f7125b DRW: Do not update the view ubo for each pass
Only update if the view changes.
2019-05-22 13:29:05 +02:00
9f3010e1c0 DRW: DRWView: Finish refactor 2019-05-22 13:29:05 +02:00
21dc2816d6 BLI_memblock: Refactor for faster iteration and allocation
Remove the clear allocation flag as it has little impact since there should
be very few allocation per redraw.

Make BLI_memblock_alloc and BLI_memblock_iterstep much more cache efficient
removing them almost entirely from performance profiles.
2019-05-22 13:29:04 +02:00
45c085a171 DRW: Add DRWView to improve different view handling
This will have multiple benefit.

TODO detail benefits (culling, more explicit, handling of clipping planes)

For now the view usage is wrapped to make changes needed more progressive.
2019-05-22 13:29:04 +02:00
2b1da51b2f Cleanup: DRW: Refactor code for better readability and simplification
- Remove DST.frontface and DST.backface.
- Separate uniform update into its own function draw_update_uniforms.
2019-05-22 13:29:04 +02:00
ee7093689f GPU: Use uint in GPU_batch_uniform_1ui. 2019-05-20 15:45:35 -03:00
d7ef7d8046 Edit Mesh Select: Fix OpenGL status to use GPU_point_size.
The problem has worsened in rB94db2c1f3243.
Maybe this has contributed to T64779.
2019-05-20 11:08:18 -03:00
c99838f40f Fix missing assignments in object mode select id drawing
The code currently doesn't run, needed for upgrading all selection
code to use the new API's.
2019-05-20 12:14:30 +10:00
17c15be48f Fix invalid face offset in DRW_draw_select_id_object 2019-05-20 11:36:50 +10:00
94db2c1f32 Edit Mesh Selection Drawing: Make sure the state of point size is enabled. 2019-05-18 12:25:53 -03:00
4f6e252805 Fix T54686: objects don't occlude each other for edit-mesh select (part 2)
The previous fix 8a6414ed46, resolved selection picking but didn't
work for box/circle/lasso select.

- Add ED_select_buffer_utils.h for general select-buffer operations
  unrelated to edit-mesh.

- Circle select still needs to cache select-id's for each update.
2019-05-18 23:58:46 +10:00
97d22e12b5 Cleanup: DRW: Remove uneeded DRWState values
This removes:
- DRW_STATE_TRANS_FEEDBACK
- DRW_STATE_WIRE
- DRW_STATE_POINT
2019-05-17 18:17:23 +02:00
f4755ef695 Fix edit-mesh select crash when using face-dots
The GPUVertBuf was freed but not the GPUBatch.

Old bug exposed by new code from 8a6414ed46.
2019-05-16 21:45:24 +10:00
8a6414ed46 Fix T54686: objects don't occlude each other for edit-mesh select 2019-05-16 09:36:15 +10:00
8bc8a62c57 DRW: Refactor: Use DRWCall to accumulate per instance attributes
This is a big change that cleanup a lot of confusing code.
- The instancing/batching data buffer distribution in draw_instance_data.c.
- The selection & drawing code in draw_manager_exec.c
- Prety much every non-meshes object drawing (object_mode.c).

Most of the changes are just renaming but there still a chance a typo might
have sneek through.

The Batching/Instancing Shading groups are replace by DRWCallBuffers. This
is cleaner and conceptually more in line with what a DRWShadingGroup should
be.

There is still some little confusion in draw_common.c where some function
takes shgroup as input and some don't.
2019-05-14 10:57:03 +02:00
e5349f14eb BLI_memblock: Add more options
- Use int instead of uint for safety and less conversions.
- Add free callback
- Add cleared alloc option
2019-05-14 10:57:03 +02:00
ed3f05aca9 DRW: Fix threading hazard when rendering and using auto depth 2019-05-14 10:57:03 +02:00
de9d846353 Fix T64137 Empty Images flickering graphics when "Auto Depth" is enabled
Also fix T64373 Grid intensity increases in Ortographic when use Circle
Select in GPencil Edit mode
2019-05-11 00:21:35 +02:00
6ef48b1318 DrawManager/GreasePencil: Select Correct ViewLayer
The DrawManager assumed that the first render layer was the render layer
where GP needed to render on. In viewport this is always the case as we
only have a single view layer. When rendering this can be multiple when
multiple layers are rendered and composited in the compositor.

In stead of the assumption that the first render layer is the render
layer we need to draw on, we search for the render layer with the same
name as the viewlayer.

Reviewed By: fclem, brecht, antoniov

Maniphest Tasks: T63099

Differential Revision: https://developer.blender.org/D4818
2019-05-09 15:13:11 +02:00
8342a124c4 DepsGraph: Multi ViewLayer Selection
When using multiple viewlayers and switching between them the selection
gets buggy. The reason for this is that the select_id is updated based
on the index in the viewlayer. This makes the select_id not unique as
objects might be shared or not shared at all.

This fix will update the select_id on all objects in main. This will be triggered in all the selection operators.

Reviewed By: sergey, brecht

Maniphest Tasks: T55617

Differential Revision: https://developer.blender.org/D4824
2019-05-09 13:27:23 +02:00
8d3e2ffa07 DRW: Speedup: Only do batch cache request and validation once for duplis 2019-05-08 17:52:48 +02:00
0030e4da70 DRW: Make batch validation run first during iteration
This reduces the cost of querying the batches to the batch cache.
2019-05-08 17:52:48 +02:00
b6b3a57c22 DRW: Add DRW_duplidata_get to create fast path for duplis
This is in order to create less shading group when using duplis.

Data for dupli objects keep in draw manager state until the source object
changes so retrieval is fast.

Note that this system could be extended to all meshes.
2019-05-08 17:52:48 +02:00
1ae2385106 GPUViewport: Fix possible hash colision with enabled engines
Also fix engine data validation that was not previously not working.
2019-05-08 17:49:28 +02:00
ac2e23c739 DRW: Remove uneeded calls to drw_viewport_engine_data_ensure when iterating
This remove a bit of overhead specially in scene with lots of objects.
2019-05-08 17:49:28 +02:00
820a64b9e5 DRW: Replace BLI_mempool by BLI_memblock
This remove a avoid the big overhead present in BLI_mempool when it is
cleared.
2019-05-08 17:49:28 +02:00
f273141556 Fix T64302: objects disappearing when disabling overlays
Only happened for Cycles, after recent changes.

Differential Revision: https://developer.blender.org/D4826
2019-05-08 16:55:43 +02:00
4d78f5a4a7 DrawManager: External Engines + Overlays
Do not iterate over degsgraph when overlays are turned off and
rendering via an external engine. External engines sync data
from Blender differently. The external engine
draws the depth buffer, but that is only needed for overlays.

Reviewers: fclem, brecht

Differential Revision: https://developer.blender.org/D4791
2019-05-07 09:26:44 +02:00
55bf2adbea DRW: Attempt to fix slowdown caused by gizmo drawing 2019-05-06 22:33:05 +02:00
95e052f830 Fix T63997 Weird z-fight during weight paint
PBVH drawing was used even in weightpaint/vertexpaint because both uses
the sculpt session.
2019-05-02 16:51:45 +02:00
47717060af DRW: Draw checkerboard alpha pattern for Cycles
Add checkerboard alpha pattern like it was in 2.79
2019-05-01 12:09:18 +02:00
21aa4d73bf DRW: Cleanup: use iter_flag const for readability 2019-04-25 17:27:21 +02:00
148c0aa0fa Fix T63178 Eevee animation render crash
If image buffer is not loaded and blender attempts to reload it (during
`BKE_image_acquire_ibuf`) over and over for each frame rendered.
When attempting this reload, image_load_image_file is calling
`BKE_image_free_buffers` and tag the Image to the (GPU) image_free_queue
(because this run on the rendering thread).

If the main thread decide to redraw the UI and go through `GPU_free_unused_buffers` they all get deleted and if that happens before the rendering thread use them ... segfault.

If I replace the environment textures with correct ones (the file does not seems to contain them), there is no crash when rendering.

I used a list of GPUTexture from blender Image to increase and decrease the
reference counter correctly.

This add very little memory and computation overhead.
2019-04-23 20:35:02 +02:00
5a144c797a Fix T63816: Crash opening file with multiple view layers
Dependency graph will not be crated for view layers which were never visible.
2019-04-23 14:31:21 +02:00
7d6a9b5517 Cleanup: style, use braces
Add braces for modules already using braces almost everywhere.
2019-04-22 19:48:17 +10:00
44ca116ca2 Cleanup: formatting, unused args 2019-04-20 09:15:06 +02:00
3368df4ab6 DRW: Expose VBO garbage collection timings
This adds user side options to tweak the behavior
of the vbo garbage collection.
2019-04-19 18:52:38 +02:00
8f4ba1c046 Fix T63669: Particle editing bypassing occlusion.
The problem occurs because status changes between BackBuffer and Offscreen.

Reviewers: fclem

Differential Revision: https://developer.blender.org/D4703
2019-04-19 11:49:17 -03:00
223f7e79f9 DRW: Add batch garbage collection
This is only working for shading batches for the moment and only if some Custom data layer are not needed anymore.

The collection rate is hardcoded at 60 sec but could be exposed to the user.

This system can be extended and discard most unused batches in the future.

This commit is in prevision of removing BKE_MESH_BATCH_DIRTY_SHADING when changing shader parameters.
2019-04-19 15:19:43 +02:00
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
65b0312904 3D View: move gizmo draw options out of overlays
Gizmo's now have their own popover in preparation
for making transform gizmos accessible without having to use tools

See: T63518
2019-04-13 12:45:02 +02:00
a1a8578d5c Fix T62449: Subsurf+hidden faces
When using subsurf (and other modifiers) the edit flags are not
propagated correctly. Currently we assume to read the edit flags
from the original object which is kind off hinding the real issue.

Modifiers use `mesh_new_nomain_from_template_ex` to create a copy
from an existing mesh. this method is only used by modifiers. So
by placing this we will make sure that editmesh is propagated.

Reviewed By: fclem, sergey

Maniphest Tasks: T62449

Differential Revision: https://developer.blender.org/D4666
2019-04-10 12:44:31 +02:00
fefc9c95e4 DRW: Opti: Replace bound tex/ubo tracking array by bitfields
release_texture_slots() and release_ubo_slots() were one hotspot when
drawing taking ~9% of total CPU counters for no reason.

This was because of the loops using GPU_max_textures that was overkill and
slow.

Replace those by a simple 64bit bitwise OR operation.
2019-04-05 21:15:25 +02:00
3464a53477 Fix T63255: Crash when circle select performs selection outside the viewport's bounds. 2019-04-03 20:05:59 -03:00
6470056a0d Cleanup: empty expression statement warning 2019-04-02 17:54:04 +11:00
4d71b655ec GPU: Fix color difference when rendering to gpu_py_offscreen
Now we do the color management inside the Draw manager and output CM byte
buffer.
2019-03-28 22:38:55 +01:00