Commit Graph

1866 Commits

Author SHA1 Message Date
Brecht Van Lommel
2816694b05 Code cleanup: fix various compiler warnings on clang/macOS. 2018-03-16 05:08:56 +01:00
Clément Foucault
3530ee2949 GPUViewport: Fix offscreen multisample syncing. 2018-03-14 12:55:19 +01:00
Clément Foucault
f7f3b08977 GPUTexture: Unlock GL_R16I format. 2018-03-14 12:41:00 +01:00
Clément Foucault
f5d529b8e2 GPUViewport: Fix offscreen multisample rendering.
Multisample rendering needs to have both a multisample and a regular color/depth target for engines that does not support MSAA.
2018-03-14 03:29:10 +01:00
Clément Foucault
bba3b43112 GPUTexture: Save sample count inside texture struct.
This adds a quick way to know if a texture is a multisample texture and its sample count.
2018-03-14 03:29:10 +01:00
Clément Foucault
0acccda4a4 GPUMaterial: Fix non finished material status if shader has no output.
This wasn't producing any issue for now but it's better to make things clean.
2018-03-13 03:49:04 +01:00
Clément Foucault
765d7242d5 GPUMaterial: Add Material shader cache.
This is mostly to avoid re-compilation when using undo/redo operators.
This also has the benefit to reuse the same GPUShader for multiple materials using the same nodetree configuration.

The cache stores GPUPasses that already contains the shader code and a hash to test for matches.
We use refcounts to know when a GPUPass is not used anymore.

I had to move the GPUInput list from GPUPass to GPUMaterial because it's containing references to the material nodetree and cannot be reused.

A garbage collection is hardcoded to run every 60 seconds to free every unused GPUPass.
2018-03-11 23:44:10 +01:00
Brecht Van Lommel
93e0e716f3 Merge branch 'master' into blender2.8 2018-03-10 19:06:28 +01:00
Brecht Van Lommel
7613ffc944 Cycles: switch to squared roughness convention for all nodes.
This was already done for the Principled BSDF to be compatible with typical
baked roughness maps in PBR workflows.
2018-03-10 18:05:01 +01:00
Brecht Van Lommel
d27158aae9 Merge branch 'master' into blender2.8 2018-03-10 06:55:39 +01:00
Clément Foucault
82957cfec8 Eevee: Make use of the new view matrix UBO. 2018-03-10 02:18:25 +01:00
Clément Foucault
41abbc271c DRW: Change UBOs binding logic.
Use the same logic than textures. Also reset bindings only on shader changes.
2018-03-10 02:18:25 +01:00
Clément Foucault
2faa809ea6 GPU: Fix typo. 2018-03-06 16:45:23 +01:00
Clément Foucault
3a209c2857 DRW: Deferred compilation initial implementation. 2018-03-06 16:44:04 +01:00
Campbell Barton
b5cc55c822 Merge branch 'master' into blender2.8 2018-03-01 16:48:13 +11:00
Campbell Barton
172614fb7d GPU_select: remove unused finalize function
Changed 2.8x code so this is no longer needed.
2018-03-01 16:43:45 +11:00
Clément Foucault
1ba96857d1 DRW: Merge calls_generate pool with calls pool & add DRWCallState pool. 2018-03-01 03:53:25 +01:00
Brecht Van Lommel
33b6f944c6 Merge branch 'master' into blender2.8 2018-02-28 21:34:09 +01:00
Brecht Van Lommel
c0d6627dc5 Merge branch 'master' into blender2.8 2018-02-28 03:11:17 +01:00
Brecht Van Lommel
2329cc09e6 Code cleanup: make viewport free simpler and consistent with GPU module. 2018-02-28 03:04:15 +01:00
Campbell Barton
6bd53cb541 Cleanup: comment for depth picking code, const args
Note that setting `glDepthFunc` isn't important,
since 2.8 branch changes this value it might seem like an error
however it's harmless in this case - so better make note of this.
2018-02-28 11:47:54 +11:00
Campbell Barton
6addaf7393 Cleanup: use 'uint' for GPU_select 2018-02-28 11:37:39 +11:00
Campbell Barton
aa592cc00c Merge branch 'master' into blender2.8 2018-02-27 20:45:33 +11:00
Campbell Barton
a7ef312611 GPU_select: correction to select-pick-finalize
Would run twice, harmless at the moment but could cause issues later.
2018-02-27 20:44:12 +11:00
Campbell Barton
efef0ee672 Merge branch 'master' into blender2.8 2018-02-27 20:24:02 +11:00
Campbell Barton
4de50d7572 GPU_select: utility function to finalize selection
Needed for depth picking in 2.8
2018-02-27 20:16:53 +11:00
Clément Foucault
fa7e4cc685 WM/GPU: Clear VAO cache of batch preset when switching context.
This is needed for multiple windows to draw the batch presets.
This will not be needed once we use only one context for UI.
2018-02-26 19:49:06 +01:00
Clément Foucault
13261304a3 DRW: Add new Draw Manager OpenGL Context.
This separate context allows two things:
- It allows viewports in multi-windows configuration.
- F12 render can use this context in a separate thread and do a non-blocking render.

The downside is that the context cannot be used while rendering so a request to refresh a viewport will lock the UI. This is something that will be adressed in the future.

Under the hood what does that mean:
- Not adding more mess with VAOs management in gawain.
- Doing depth only draw for operators / selection needs to be done in an offscreen buffer.
- The 3D cursor "autodis" operator is still reading the backbuffer so we need to copy the result to it.
- All FBOs needed by the drawmanager must to be created/destroyed with its context active.
- We cannot use batches created for UI in the DRW context and vice-versa. There is a clear separation of resources that enables the use of safe multi-threading.
2018-02-26 19:41:17 +01:00
Brecht Van Lommel
38ccd1fe33 Eevee: add Principled Volume shader. 2018-02-23 19:10:24 +01:00
Brecht Van Lommel
77062e8bbb Eevee: add blackbody shader node support.
This replaces the blackbody to RGB code with the simpler and faster one from
Cycles. It's a little different but the other placing using this is the legacy
volume drawing, so no need to stay compatible with that.
2018-02-23 19:10:24 +01:00
Brecht Van Lommel
57609993d0 GPU: fixes for string socket types in shader nodes.
These are not passed to GLSL functions, but should be used to load e.g.
a texture or attribute.
2018-02-23 19:10:24 +01:00
Brecht Van Lommel
af061b4dac Eeevee: add temperature grid support, make color grid unpremultiplied.
This matches similar changes done for Cycles.
2018-02-23 19:10:02 +01:00
Campbell Barton
2bc952fdb6 Merge branch 'master' into blender2.8 2018-02-18 22:33:05 +11:00
Brecht Van Lommel
cbd0e09898 Fix GL_FRAMEBUFFER_UNSUPPORTED warning in console on macOS. 2018-02-17 14:12:54 +01:00
Germano
fa0e89b9e8 Metalball drawing: rename mball helpers to handles
and also rename some related functions
2018-02-16 02:01:09 -02:00
Campbell Barton
ca5fdd857b Merge branch 'master' into blender2.8 2018-02-16 01:17:43 +11:00
Campbell Barton
2aef87bfae Cleanup: rename BLI_thread.h API
- Use BLI_threadpool_ prefix for (deprecated)
  thread/listbase API.
- Use BLI_thread as prefix for other functions.

See P614 to apply instead of manually resolving conflicts.
2018-02-16 01:13:46 +11:00
Sergey Sharybin
df1c88b652 Merge branch 'master' into blender2.8 2018-02-15 14:15:55 +01:00
Campbell Barton
ccdacf1c9b Cleanup: use '_len' instead of '_size' w/ BLI API
- When returning the number of items in a collection use BLI_*_len()
- Keep _size() for size in bytes.
- Keep _count() for data structures that don't store length
  (hint this isn't a simple getter).

See P611 to apply instead of manually resolving conflicts.
2018-02-15 23:39:08 +11:00
Campbell Barton
b8b8669b28 Cleanup: style, warning 2018-02-15 18:03:55 +11:00
Brecht Van Lommel
e6386ed286 Merge branch 'master' into blender2.8 2018-02-14 21:49:13 +01:00
Brecht Van Lommel
b5fe00d1ac Cycles: restore Particle Info Index for now, keep it next to Random.
It seems to be useful still in cases where the particle are distributed in
a particular order or pattern, to colorize them along with that. This isn't
really well defined, but might as well avoid breaking backwards compatibility
for now.
2018-02-14 21:45:57 +01:00
Clément Foucault
01244df007 DRW: Refactor: Make use of the new Gawain long attrib support. 2018-02-14 18:59:42 +01:00
Brecht Van Lommel
3102bf2889 Merge branch 'master' into blender2.8 2018-02-14 15:16:50 +01:00
Brecht Van Lommel
f6107af4cf Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range.
These are used for randomization, so it's convenient if the index is already
hashed and consistent with the Object Info node.
2018-02-14 14:55:46 +01:00
Brecht Van Lommel
618bc6c679 GPU: use alpha blend that works for drawing to transparent buffer.
It's unlikely to ever be intentional to square the source alpha, as happens
with glBlendFunc, so this changes the blending throughout the code.
2018-02-14 14:00:57 +01:00
Brecht Van Lommel
7028a11db9 GPU: don't use multisample for entire window, only for offscreen 3D viewport.
Now that the new 3D viewport draws to a multisample offscreen buffer, there is
no good reason anymore to create an entire multisample window and pay the
performance/memory cost for other regions that don't need it.

GL_MULTISAMPLE now only gets enabled for offscreen buffers, so we don't need
to check for it throughout the UI code anymore.

Differential Revision: https://developer.blender.org/D3062
2018-02-14 14:00:48 +01:00
Brecht Van Lommel
6e040b045a GPU: add offscreen buffer drawing utility functions. 2018-02-13 20:02:31 +01:00
Brecht Van Lommel
e9b1163162 Code cleanup: stop using rectangle textures in window draw, simplify code. 2018-02-13 20:02:31 +01:00
Brecht Van Lommel
832f7a6648 Merge branch 'master' into blender2.8 2018-02-09 20:36:59 +01:00