4 years agoFix empty struct errors in paint_vertex_mode.c
Luca Rood [Fri, 5 May 2017 09:38:15 +0000 (11:38 +0200)]
Fix empty struct errors in paint_vertex_mode.c

4 years agoUse immediate mode for back-buffer selection
Campbell Barton [Fri, 5 May 2017 00:36:09 +0000 (10:36 +1000)]
Use immediate mode for back-buffer selection

Needed so selection works with core profile.

4 years agoMerge branch 'master' into blender2.8
Campbell Barton [Thu, 4 May 2017 22:23:59 +0000 (08:23 +1000)]
Merge branch 'master' into blender2.8

4 years agoFix reading past bounds removing from color ramp
Campbell Barton [Thu, 4 May 2017 21:41:12 +0000 (07:41 +1000)]
Fix reading past bounds removing from color ramp

4 years agoRemove redundant backbuffer/transform check
Campbell Barton [Thu, 4 May 2017 21:06:15 +0000 (07:06 +1000)]
Remove redundant backbuffer/transform check

Transform no longer uses backbuffer for snap.

4 years agoCleanup: include the type of data in function name
Campbell Barton [Thu, 4 May 2017 19:41:30 +0000 (05:41 +1000)]
Cleanup: include the type of data in function name

Was confusing, some functions return vert or triangle data
but naming wasn't very clear.

4 years agoMultiline support for ED_region_info_draw
Dalai Felinto [Thu, 4 May 2017 19:56:34 +0000 (21:56 +0200)]
Multiline support for ED_region_info_draw

Many thanks for Campbell Barton for the help here and the idea to
implement the multi-line as a new function with array as arguments.

4 years agoTypo: 'Signle program' -> 'Single program'
Pablo Vazquez [Thu, 4 May 2017 20:15:53 +0000 (22:15 +0200)]
Typo: 'Signle program' -> 'Single program'

4 years agoDraw Manager: Add a memory stats to debug view.
Clément Foucault [Thu, 4 May 2017 19:22:41 +0000 (21:22 +0200)]
Draw Manager: Add a memory stats to debug view.

Adds 2 static unsigned int to Gawain and GPUTexture to roughly keep track of the memory stats on the GPU.

Stats can be view at the bottom of the GPU stats with debug value > 20.

4 years agoUse mesh draw cache for back-buffer selection
Campbell Barton [Thu, 4 May 2017 19:17:31 +0000 (05:17 +1000)]
Use mesh draw cache for back-buffer selection

Vertex/weight paint now work with core profile, resolves T51380.

4 years agoCleanup: use doxy categories
Campbell Barton [Thu, 4 May 2017 19:07:52 +0000 (05:07 +1000)]
Cleanup: use doxy categories

4 years agoMissed last commit
Campbell Barton [Thu, 4 May 2017 19:06:57 +0000 (05:06 +1000)]
Missed last commit

4 years agoCleanup: de-duplicate mesh data calculation
Campbell Barton [Thu, 4 May 2017 18:56:28 +0000 (04:56 +1000)]
Cleanup: de-duplicate mesh data calculation

4 years agoCycles: Fix crash when assigning KernelGlobals
Lukas Stockner [Thu, 4 May 2017 18:49:04 +0000 (20:49 +0200)]
Cycles: Fix crash when assigning KernelGlobals

The memory isn't initialized during allocation, so calling the assignment operator is a bad idea.

4 years agoVertex paint with draw manager
Luca Rood [Thu, 4 May 2017 17:59:27 +0000 (19:59 +0200)]
Vertex paint with draw manager

Reviewers: fclem

Subscribers: campbellbarton, dfelinto

Differential Revision:

4 years agoDraw Manager: Combine multiple engines info texts
Dalai Felinto [Thu, 4 May 2017 17:35:53 +0000 (19:35 +0200)]
Draw Manager: Combine multiple engines info texts

This join them with \n separators.(right now they clash on top of each

Note: We still need to change "ED_region_info_draw" to accept multi-line strings.

4 years agoDraw Manager: Fix debugging output.
Clément Foucault [Thu, 4 May 2017 17:38:03 +0000 (19:38 +0200)]
Draw Manager: Fix debugging output.

4 years agoGLSL Materials: Fix envmap node artifacts.
Clément Foucault [Thu, 4 May 2017 17:12:19 +0000 (19:12 +0200)]
GLSL Materials: Fix envmap node artifacts.

4 years agoEevee: Motion blur switch
Clément Foucault [Thu, 4 May 2017 17:11:20 +0000 (19:11 +0200)]
Eevee: Motion blur switch

4 years agoGPUMaterial: Remove unused Normal input.
Clément Foucault [Thu, 4 May 2017 15:40:28 +0000 (17:40 +0200)]
GPUMaterial: Remove unused Normal input.

4 years agoEevee: Draw background shader.
Clément Foucault [Thu, 4 May 2017 15:39:50 +0000 (17:39 +0200)]
Eevee: Draw background shader.

Also fixes some remaining errors caused by some matrices not updated.

4 years agoEevee: Simple Camera Motion Blur.
Clément Foucault [Thu, 4 May 2017 15:36:40 +0000 (17:36 +0200)]
Eevee: Simple Camera Motion Blur.

Disabled by default. Set ENABLE_EFFECT_MOTION_BLUR to 1 to enable.
No fancy motion blur. Use depth and camera matrix to get the motion vectors. Then blur in this direction.
Only available in camera view.
Only Camera animation is supported, does not take into account the parents motion

4 years agoDraw Manager: Implement render info for external engines
Dalai Felinto [Thu, 4 May 2017 13:46:09 +0000 (15:46 +0200)]
Draw Manager: Implement render info for external engines

This can be used by any engine actually. For example to give feedback
regarding probe caching in Eevee, ....

Unline master, we try to conciliate both the original viewport info
(FPS, view name) and the render info.

Note: I had to split the function in two because the camera alpha
passepartout is handled inside the view3d_draw_region_info function.

Review: Campbell Barton and Clement Foucault.

Thanks to Sergey Sharybin and Pablo Vazquez for some of the design

4 years agoFix T51412: Instant crash with texture plugged into the Displacement output
Sergey Sharybin [Thu, 4 May 2017 14:27:31 +0000 (16:27 +0200)]
Fix T51412: Instant crash with texture plugged into the Displacement output

The issue was caused by unlimited textures commit, root of the issue is that
displacement code updates some of the image slots directly, so it needs to
ensure device vectors are all proper size.

4 years agoCleanup: rename ct -> len
Campbell Barton [Thu, 4 May 2017 13:35:50 +0000 (23:35 +1000)]
Cleanup: rename ct -> len

Also use 'defgroup' instead of 'index' for passing weight arg.

4 years agoFix missing usercount update of poselib when copying Object.
Bastien Montagne [Thu, 4 May 2017 13:08:05 +0000 (15:08 +0200)]
Fix missing usercount update of poselib when copying Object.

Still finding such missing cases... :(

4 years agoAdd debug/timing prints in MakeLocal and remapping code.
Bastien Montagne [Thu, 4 May 2017 13:07:21 +0000 (15:07 +0200)]
Add debug/timing prints in MakeLocal and remapping code.

4 years agoCycles: Remove "Preview active layer"
Dalai Felinto [Thu, 4 May 2017 10:49:46 +0000 (12:49 +0200)]
Cycles: Remove "Preview active layer"

In Blender 2.8 we always only preview active layer
Also remove use_viewport_visibility since it's no longer required.

Reviewer: Sergey Sharybin

4 years agoRemove cpack
Campbell Barton [Thu, 4 May 2017 10:50:03 +0000 (20:50 +1000)]
Remove cpack

Places where it's removed are already replaced by newer logic.

4 years agoFix use after free of new render layer ID properites after copying scene
Sergey Sharybin [Thu, 4 May 2017 10:27:28 +0000 (12:27 +0200)]
Fix use after free of new render layer ID properites after copying scene

4 years agoFix memory leak of ID properties after recent render passes commit
Sergey Sharybin [Thu, 4 May 2017 10:18:39 +0000 (12:18 +0200)]
Fix memory leak of ID properties after recent render passes commit

4 years agoRemove visibility check for project paint
Campbell Barton [Thu, 4 May 2017 09:58:48 +0000 (19:58 +1000)]
Remove visibility check for project paint

This is such a corner case, and currently there is no way to paint on a
hidden object, removing.

4 years agoFix "doversion" of collection settings for collections
Dalai Felinto [Thu, 4 May 2017 09:25:03 +0000 (11:25 +0200)]
Fix "doversion" of collection settings for collections

For collections we do not need a doversion as granular as the scene one.
However if a new engine settings is added we need to take care of it.

4 years agoFix passing object to BKE_mesh_batch_cache_dirty
Campbell Barton [Thu, 4 May 2017 09:30:32 +0000 (19:30 +1000)]
Fix passing object to BKE_mesh_batch_cache_dirty

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Thu, 4 May 2017 08:05:01 +0000 (10:05 +0200)]
Merge branch 'master' into blender2.8

4 years agoFix relationship lines in draw manager [*]
Dalai Felinto [Thu, 4 May 2017 07:57:17 +0000 (09:57 +0200)]
Fix relationship lines in draw manager [*]

This fix doesn't really fix the situaion now because at the moment we
only flush the evaluated flags at DEG_OBJECT_ITER time, which is silly.

But it's all we can do until we have CoW.

So the parent visibility flag is not flushed. And even if we flushed its
visibility flag, we would need to rely on having the parent flag flushed
before we get to the object in question.

Anyways, take this commit as a future fix for when depsgraph comes to
rescue all our souls.

4 years agoFix relationship lines visibility test for legacy viewport
Dalai Felinto [Thu, 4 May 2017 07:47:17 +0000 (09:47 +0200)]
Fix relationship lines visibility test for legacy viewport

4 years agoCycles: Fix unused argument warning when building without debug passes
Sergey Sharybin [Thu, 4 May 2017 07:33:51 +0000 (09:33 +0200)]
Cycles: Fix unused argument warning when building without debug passes

4 years agoBetter fix for duplicate objects not moving them
Dalai Felinto [Wed, 3 May 2017 22:21:28 +0000 (00:21 +0200)]
Better fix for duplicate objects not moving them

(original fix on 51a977a86f6f)

4 years agoMerge remote-tracking branch 'origin/master' into blender2.8
Dalai Felinto [Wed, 3 May 2017 21:55:29 +0000 (23:55 +0200)]
Merge remote-tracking branch 'origin/master' into blender2.8

4 years ago[msvc/make.bat] Limit the amount of simultaneously compiled projects.
lazydodo [Wed, 3 May 2017 21:15:35 +0000 (15:15 -0600)]
[msvc/make.bat] Limit the amount of simultaneously compiled projects.

This was set to maxcpu which in an 8 core box would be 8, each project would then spawn
8 instances of cl.exe, making a possible of 64 simultaneously running compiler instances
slowing the compile down instead of speeding it up.

4 years agoFix Cycles build on Windows
Dalai Felinto [Wed, 3 May 2017 19:16:45 +0000 (21:16 +0200)]
Fix Cycles build on Windows

4 years agoFix projection paint initialization failing
Campbell Barton [Wed, 3 May 2017 19:06:56 +0000 (05:06 +1000)]
Fix projection paint initialization failing

4 years agoSelect new object bases using object's base flag
Campbell Barton [Wed, 3 May 2017 18:14:58 +0000 (04:14 +1000)]
Select new object bases using object's base flag

This fixes object duplicate operator.

4 years agoFix building on Windows and blenderplayer linking after weightpaint engine
Dalai Felinto [Wed, 3 May 2017 18:22:48 +0000 (20:22 +0200)]
Fix building on Windows and blenderplayer linking after weightpaint engine

Those problems were introduced on 20f95de6ba2d32dcff553251ff4de2efd5b76955.

4 years agoFix potential crash introduced by weightpaint engine when no active object
Dalai Felinto [Wed, 3 May 2017 18:10:54 +0000 (20:10 +0200)]
Fix potential crash introduced by weightpaint engine when no active object

4 years agoCleanup: line length
Campbell Barton [Wed, 3 May 2017 17:35:01 +0000 (03:35 +1000)]
Cleanup: line length

4 years agoCorrect struct type (harmless)
Campbell Barton [Wed, 3 May 2017 17:14:08 +0000 (03:14 +1000)]
Correct struct type (harmless)

4 years agoFix error in node flag check
Campbell Barton [Wed, 3 May 2017 16:57:39 +0000 (02:57 +1000)]
Fix error in node flag check

4 years agoWeight painting with draw manager
Luca Rood [Wed, 3 May 2017 16:55:40 +0000 (18:55 +0200)]
Weight painting with draw manager

This implements weight rendering with the draw manager, with all drawing
options (Shading, wire, face masking, vertex masking).

This is part of T51208

Reviewers: campbellbarton

Subscribers: dfelinto

Differential Revision:

4 years agoMerge branch 'master' into 28
Campbell Barton [Wed, 3 May 2017 16:58:26 +0000 (02:58 +1000)]
Merge branch 'master' into 28

4 years agoMerge branch 'master' into blender2.8
Lukas Stockner [Wed, 3 May 2017 16:33:02 +0000 (18:33 +0200)]
Merge branch 'master' into blender2.8

4 years agoCorrect over-alloc struct declaration
Campbell Barton [Wed, 3 May 2017 16:14:51 +0000 (02:14 +1000)]
Correct over-alloc struct declaration

4 years agoDraw Manager: Bring pose bones to the pose engine
Dalai Felinto [Wed, 3 May 2017 14:34:28 +0000 (16:34 +0200)]
Draw Manager: Bring pose bones to the pose engine

Note: We should test if the armature is the "armature modifier" parent of the

If any good samaritan feels like tackling this, the function to change
is: DRW_pose_mode_armature

4 years agoMove pose-bone colors into draw_data
Campbell Barton [Wed, 3 May 2017 15:32:16 +0000 (01:32 +1000)]
Move pose-bone colors into draw_data

Also only allocate necessary number of bone segments.

4 years ago"Fix" root cause of T51260 Forward compatibility crash fter adding new IDProp type.
Bastien Montagne [Wed, 3 May 2017 15:01:00 +0000 (17:01 +0200)]
"Fix" root cause of T51260 Forward compatibility crash fter adding new IDProp type.

We unfortunately cannot fix this for previous versions of Blender, but
at least the issue (Blender crashing on unknown IDProp types) should now
be addressed for future.

Simply reset unknown IDProp types to integer one, and reset its value to zero.

4 years agoRender API/Cycles: Identify Render Passes by their name instead of a type flag
Lukas Stockner [Tue, 2 May 2017 22:21:18 +0000 (00:21 +0200)]
Render API/Cycles: Identify Render Passes by their name instead of a type flag

Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.

To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.

To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.

From a user perspective, nothing should change with this commit.

Differential Revision:

Differential Revision:

4 years agoError in last commit
Campbell Barton [Wed, 3 May 2017 14:43:34 +0000 (00:43 +1000)]
Error in last commit

4 years agoRename bPoseChannel's temp/cache pointer for DrawManager to draw_data.
Bastien Montagne [Wed, 3 May 2017 14:10:25 +0000 (16:10 +0200)]
Rename bPoseChannel's temp/cache pointer for DrawManager to draw_data.

More generic name, this remains a temp solution anyway, until we have
proper handling of temp data from 'magic DEG'! ;)

4 years agoFix bad scaling of BBone single-segment bones in new Armature drawing code.
Bastien Montagne [Wed, 3 May 2017 13:33:30 +0000 (15:33 +0200)]
Fix bad scaling of BBone single-segment bones in new Armature drawing code.

Reported by @campbellbarton over irc, thanks.

4 years agoDraw Manager: Use color-sets for solid pose-bones
Campbell Barton [Wed, 3 May 2017 14:16:31 +0000 (00:16 +1000)]
Draw Manager: Use color-sets for solid pose-bones

4 years agoDraw Manager: use pose bone theme and constraint colors
Campbell Barton [Wed, 3 May 2017 14:00:17 +0000 (00:00 +1000)]
Draw Manager: use pose bone theme and constraint colors

4 years agoCycles: Split kernel - sort shaders
Hristo Gueorguiev [Wed, 3 May 2017 13:30:45 +0000 (15:30 +0200)]
Cycles: Split kernel - sort shaders

Reduce thread divergence in kernel_shader_eval.

Rays are sorted in blocks of 2048 according to shader->id.

On R9 290 Classroom is ~30% faster, and Pabellon Barcelone is ~8% faster.

No sorting for CUDA split kernel.

Reviewers: sergey, maiself

Reviewed By: maiself

Differential Revision:

4 years agoCode Style: Don't add padding in a function call
Dalai Felinto [Wed, 3 May 2017 12:32:16 +0000 (14:32 +0200)]
Code Style: Don't add padding in a function call

4 years agoMove GPU compositing out of draw-manager off-screen drawing
Campbell Barton [Wed, 3 May 2017 12:13:57 +0000 (22:13 +1000)]
Move GPU compositing out of draw-manager off-screen drawing

Also no need to use VP_legacy_ prefix here.

4 years agoCycles: Fix OpenCL compilation failure after recent color changes
Sergey Sharybin [Wed, 3 May 2017 12:11:19 +0000 (14:11 +0200)]
Cycles: Fix OpenCL compilation failure after recent color changes

It is really confusing to have some functions available in some devices
and not on another devices.

4 years agoCleanup: move off-screen drawing to view3d_draw.c
Campbell Barton [Wed, 3 May 2017 11:59:03 +0000 (21:59 +1000)]
Cleanup: move off-screen drawing to view3d_draw.c

Since offscreen drawing now uses draw engine, this doesn't need to be
considered legacy.

Note that there are some calls into view3d_draw_legacy.c from view3d_draw.c
this is generally not accepted, so its only dont where there are checks
for new/old engine.
Functions exposed to do this use a VP_deprecated prefix.

4 years agoUpdate comment
Campbell Barton [Wed, 3 May 2017 10:13:27 +0000 (20:13 +1000)]
Update comment

4 years agoDraw Manager: Enable Pose engine as part of the weight paint mode
Dalai Felinto [Wed, 3 May 2017 10:38:40 +0000 (12:38 +0200)]
Draw Manager: Enable Pose engine as part of the weight paint mode

We still need to bring pose bone drawing for the pose engine.

Note: In the future, once we get face-widget selection, we will need to
make sure the pose engien only draws then if "weight paint mode" is not
enabled too.

4 years agoDraw Manager: Fix pose mode not working well.
Dalai Felinto [Wed, 3 May 2017 10:10:51 +0000 (12:10 +0200)]
Draw Manager: Fix pose mode not working well.

In the future this will allow us to implement things like face manipulators.

For now however, this is getting on the way of using pose mode
(mesh objects are drawn green).

NOTE: pose engine should also be the one taking care of pose bones

(and for that matter, X-Ray armature option should/could be a property
of the Pose engine even).

4 years agoCycles: Use render visibility for duplis when Render Layer option in viewport is...
Sergey Sharybin [Wed, 3 May 2017 10:05:52 +0000 (12:05 +0200)]
Cycles: Use render visibility for duplis when Render Layer option in viewport is used

Previously the logic was different for duplis and regular objects: regular objects
were using render visibility when Render Layer option is enabled which duplis were
always using viewport visibility when rendering from the viewport.

This was quite confusing because caused different results in viewport and render
when artists were expecting them to match 1:1.

4 years agoEevee: Fix Lamp Roughness.
Clément Foucault [Tue, 2 May 2017 18:33:59 +0000 (20:33 +0200)]
Eevee: Fix Lamp Roughness.

4 years agoGPUMaterial: Force old outputs to fail with EEVEE.
Clément Foucault [Tue, 2 May 2017 17:56:44 +0000 (19:56 +0200)]
GPUMaterial: Force old outputs to fail with EEVEE.

Workaround waiting for compatibility bit / or PyNodes.

4 years agoNodeTree: Add eevee default shader tree.
Clément Foucault [Tue, 2 May 2017 17:55:02 +0000 (19:55 +0200)]
NodeTree: Add eevee default shader tree.

4 years agoEevee: Add "uber" Shader Output Nodes.
Clément Foucault [Tue, 2 May 2017 17:25:25 +0000 (19:25 +0200)]
Eevee: Add "uber" Shader Output Nodes.

Include Metallic and Specular workflow.
Clearcoat and are not implemented yet.

4 years agoDraw Manager: Introduce a foreach function for all shgroups in a pass.
Clément Foucault [Tue, 2 May 2017 17:04:55 +0000 (19:04 +0200)]
Draw Manager: Introduce a foreach function for all shgroups in a pass.

4 years agoFix draw manager w/ cycles
Campbell Barton [Wed, 3 May 2017 10:09:17 +0000 (20:09 +1000)]
Fix draw manager w/ cycles

8b2640f08 introduced the error,
caused by external-engine needing depth mask to be disabled,
which happened to be the case before changing state changing logic.

4 years agoValidate collection properties at readile
Dalai Felinto [Wed, 3 May 2017 09:38:17 +0000 (11:38 +0200)]
Validate collection properties at readile

The alternative would be to do version bump + doversioning every
time a new property is added.

4 years agoMake IDP_MergeGroup recursive
Dalai Felinto [Wed, 3 May 2017 09:37:24 +0000 (11:37 +0200)]
Make IDP_MergeGroup recursive

With this we also do not need IDP_MergeGroupValues anymore.
If this causes problems in the future we can always make recursion an
option (like overwrite is).

4 years agoCycles: Simplify code in SVM image by using new utility function
Sergey Sharybin [Wed, 3 May 2017 09:22:27 +0000 (11:22 +0200)]
Cycles: Simplify code in SVM image by using new utility function

Can not measure any performance difference, so seems the code is identical
and just shorter.

4 years agoCycles: Add utility function to convert float4 color from srgb to linear
Sergey Sharybin [Wed, 3 May 2017 09:19:40 +0000 (11:19 +0200)]
Cycles: Add utility function to convert float4 color from srgb to linear

It will use SSE2 optimized version when is possible.

4 years agoFix crash loading files where outliner treestore isn't set
Campbell Barton [Wed, 3 May 2017 08:10:18 +0000 (18:10 +1000)]
Fix crash loading files where outliner treestore isn't set

4 years agoAdd BBone and Wire Armature draw types to DrawManager.
Bastien Montagne [Wed, 3 May 2017 06:34:24 +0000 (08:34 +0200)]
Add BBone and Wire Armature draw types to DrawManager.

Most of this was copying/adapting code from octahedral existing draw
code, tough part was to get BBone matrices to behave as expected, they
are using a fairly specific setup...

Addresses T51365 and T51362.

4 years agoDraw Manager: fix draw-state switching logic
Campbell Barton [Tue, 2 May 2017 22:20:11 +0000 (08:20 +1000)]
Draw Manager: fix draw-state switching logic

Changing states didn't properly reset between shading groups
causing the GL state to be wrong based on draw order.

States are now only set when changed.

4 years agoCleanup: typedef for empty list
Campbell Barton [Tue, 2 May 2017 19:20:58 +0000 (05:20 +1000)]
Cleanup: typedef for empty list

Without this the intent isn't clear.

4 years agoWorkaround external engines with OpenGL rendering
Campbell Barton [Tue, 2 May 2017 18:59:15 +0000 (04:59 +1000)]
Workaround external engines with OpenGL rendering

For now just do the OpenGL render and don't render using the engine.
This is a slightly odd-use case since it makes more sense to do a regular render.

4 years agoCycles: Remove extra clFinish from driver workaround
Mai Lavelle [Tue, 2 May 2017 17:56:05 +0000 (13:56 -0400)]
Cycles: Remove extra clFinish from driver workaround

These were causing problems with Nvidia OpenCL.

4 years agoCycles: Output split state element size
Mai Lavelle [Sat, 8 Apr 2017 05:35:32 +0000 (01:35 -0400)]
Cycles: Output split state element size

4 years agoCycles: Branched path tracing for the split kernel
Mai Lavelle [Tue, 21 Mar 2017 02:31:54 +0000 (22:31 -0400)]
Cycles: Branched path tracing for the split kernel

This implements branched path tracing for the split kernel.

General approach is to store the ray state at a branch point, trace the
branched ray as normal, then restore the state as necessary before iterating
to the next part of the path. A state machine is used to advance the indirect
loop state, which avoids the need to add any new kernels. Each iteration the
state machine recreates as much state as possible from the stored ray to keep
overall storage down.

Its kind of hard to keep all the different integration loops in sync, so this
needs lots of testing to make sure everything is working correctly. We should
probably start trying to deduplicate the integration loops more now.

Nonbranched BMW is ~2% slower, while classroom is ~2% faster, other scenes
could use more testing still.

Reviewers: sergey, nirved

Reviewed By: nirved

Subscribers: Blendify, bliblubli

Differential Revision:

4 years agoBGE: Fix silly typo that invalidates negative scaling camera feature.
Benoit Bolsee [Tue, 2 May 2017 18:11:02 +0000 (20:11 +0200)]
BGE: Fix silly typo that invalidates negative scaling camera feature.

Negative scale on camera is a nice trick to invert render image on one
axis at no extra CPU cost. It was implemented in the Decklink branch but
I introduced a typo when porting it to master. It is now fixed.

4 years agoCleanup: consistent arg order
Campbell Barton [Tue, 2 May 2017 17:06:37 +0000 (03:06 +1000)]
Cleanup: consistent arg order

4 years agoDraw Manager: OpenGL render support
Campbell Barton [Tue, 2 May 2017 16:50:29 +0000 (02:50 +1000)]
Draw Manager: OpenGL render support

Works for clay-engine but doesn't draw objects with eevee.

4 years agoDraw Manager: split DRW_draw_view into 2 functions
Campbell Barton [Tue, 2 May 2017 14:45:10 +0000 (00:45 +1000)]
Draw Manager: split DRW_draw_view into 2 functions

Needed for offscreen render

4 years agoCleanup: use depsgraph for scene/layer access
Campbell Barton [Tue, 2 May 2017 14:05:57 +0000 (00:05 +1000)]
Cleanup: use depsgraph for scene/layer access

4 years agoMerge branch 'master' into blender2.8
Sergey Sharybin [Tue, 2 May 2017 13:40:23 +0000 (15:40 +0200)]
Merge branch 'master' into blender2.8

4 years agoCycles: Fix missing type declaration in OpenCL image
Sergey Sharybin [Tue, 2 May 2017 13:39:18 +0000 (15:39 +0200)]
Cycles: Fix missing type declaration in OpenCL image

Spotted by Mai in IRC, thanks!

4 years agoRevert "Depsgraph: Link from material to object shading"
Sergey Sharybin [Tue, 2 May 2017 13:31:49 +0000 (15:31 +0200)]
Revert "Depsgraph: Link from material to object shading"

The change was initially needed for Blender 2.8 branch but the actual
function was reverted in there. So no reason to keep dead unused
placeholder in the dependency graph.

This reverts commit fd69ba225540cde5e4c1fa651fb02df21ea0a143.

4 years agoMerge branch 'master' into blender2.8
Sergey Sharybin [Tue, 2 May 2017 13:29:00 +0000 (15:29 +0200)]
Merge branch 'master' into blender2.8

4 years agoDraw Manager: No need of glScissor for external engines
Dalai Felinto [Tue, 2 May 2017 13:26:18 +0000 (15:26 +0200)]
Draw Manager: No need of glScissor for external engines

4 years agoCycles integration with Draw Manager
Dalai Felinto [Mon, 1 May 2017 12:55:59 +0000 (14:55 +0200)]
Cycles integration with Draw Manager

We can now use object and other modes on top of Cycles.
Since we are now always on "render_to_view" (old Rendered mode), the
pause button is always visible.