4 years agoGarwain: fix ShaderInterface buffer shrinking
Campbell Barton [Tue, 18 Apr 2017 12:04:00 +0000 (22:04 +1000)]
Garwain: fix ShaderInterface buffer shrinking

4 years agoEevee: Introduction of world preconvolved envmap.
Clément Foucault [Tue, 18 Apr 2017 10:50:09 +0000 (12:50 +0200)]
Eevee: Introduction of world preconvolved envmap.

For now only compute GGX convolution. The GGX LUT used for the split sum approximation (UE4) is merged with the LTX mag LUT that uses the same parameters (theta and roughness)

4 years agoGPUFramebuffer: Allow to bind a specific texture mip to framebuffer.
Clément Foucault [Tue, 18 Apr 2017 09:28:11 +0000 (11:28 +0200)]
GPUFramebuffer: Allow to bind a specific texture mip to framebuffer.

4 years agoGPUTexture: Fix Cubemap upload
Clément Foucault [Tue, 18 Apr 2017 09:21:58 +0000 (11:21 +0200)]
GPUTexture: Fix Cubemap upload

4 years agoGPUTexture: Add Mipmap Control functions.
Clément Foucault [Tue, 18 Apr 2017 09:21:17 +0000 (11:21 +0200)]
GPUTexture: Add Mipmap Control functions.

4 years agoRemove 4.1 pseudo-deprecated calls from gl-deprecated
Dalai Felinto [Tue, 18 Apr 2017 10:09:29 +0000 (12:09 +0200)]
Remove 4.1 pseudo-deprecated calls from gl-deprecated

First: we settle on core profile 3.3, not 4.1. Second, GL_CURRENT_PROGRAM still exists in 4.1 and 4.2. But it is recommented to use GL_ACTIVE_PROGRAM instead.

Following the logic of gl-deprecated.h we should define it to USE_GL_ACTIVE_PROGRAM instead. That said, removing it for now.

4 years agoGawain: fix missing NULL check
Campbell Barton [Tue, 18 Apr 2017 05:02:06 +0000 (15:02 +1000)]
Gawain: fix missing NULL check

Also shadowed variable warning

4 years agoOpenGL: Fix crash on start with Mesa drivers
Ines Almeida [Mon, 17 Apr 2017 20:31:56 +0000 (22:31 +0200)]
OpenGL: Fix crash on start with Mesa drivers

glFramebufferTexture() is only available from OGL 3.2, it is also not part of the ARB_framebuffer_object extension.
I don't know if there is a better way to check for mesa drivers or if using the 2D version will have issues with f2f16a256, but so far I had no problems

4 years agoGawain: fix for last commit
Mike Erwin [Mon, 17 Apr 2017 08:01:46 +0000 (04:01 -0400)]
Gawain: fix for last commit

Follow-up to 3bc6b831d82724578fc8150d863b54f334db2bf4

Initial code was getting the number of ShaderInterfaces that could fit between two pointers (which makes no sense). I really meant number of bytes.

Surprised it worked on Mac, glad I tested on Windows before bed  :D

4 years agoGawain: shrink ShaderInterface name buffer
Mike Erwin [Mon, 17 Apr 2017 05:45:21 +0000 (01:45 -0400)]
Gawain: shrink ShaderInterface name buffer

ShaderInterface stores names of custom uniforms and all attributes in an internal buffer, but it doesn't know how large to make this buffer until all inputs are scanned.

This commit shrinks the buffer to the exact size needed.

4 years agoGawain: look up uniforms by name quicker
Mike Erwin [Mon, 17 Apr 2017 05:19:28 +0000 (01:19 -0400)]
Gawain: look up uniforms by name quicker

ShaderInterface_uniform searches custom uniforms first, then builtin uniforms if needed.

This reduces the amount of string matching since you're almost certainly looking for one of those custom uniforms. Otherwise you would've called ShaderInterface_**builtin**_uniform.

4 years agoOpenGL: tweak GPU_texture_create_nD
Mike Erwin [Sun, 16 Apr 2017 19:11:38 +0000 (15:11 -0400)]
OpenGL: tweak GPU_texture_create_nD

- test for 2D textures first since it's the most common case
- declare variables close to where they're used
- fix compiler warning for proxy (uninitialized use)
- safe return if n != 1, 2, 3 (should never happen)
- white space

Mike Erwin [Sun, 16 Apr 2017 19:04:07 +0000 (15:04 -0400)]

The fragment shader expects a normal, but the vertex shader was not providing one.

Fix: added a new vertex shader that has normals + smooth color interpolation.

I also split gpu_shader_3D_vert in two:
- one with just position
- one with position + normal

For each of the builtin shaders, we should be able to look at the GLSL and tell exactly what it's doing. Using #defines and #ifdefs for rendering options makes the shaders hard to read and easy to break.

4 years agofix mistake from last commit
Mike Erwin [Sun, 16 Apr 2017 17:57:16 +0000 (13:57 -0400)]
fix mistake from last commit

I didn't build this BGE-related code before pushing. My bad!

fix for af61b5eb0c1bef93e8df1434b174944e2b40445d

4 years agocleanup use of immUniformColor
Mike Erwin [Sun, 16 Apr 2017 17:44:34 +0000 (13:44 -0400)]
cleanup use of immUniformColor

- use best function for the job
- don't specify alpha if 100%
- 'f' for floating point literals

4 years agoGawain: add immUniformColor3ubvAlpha
Mike Erwin [Sun, 16 Apr 2017 17:33:21 +0000 (13:33 -0400)]
Gawain: add immUniformColor3ubvAlpha

Convenience function for specifying colors with separate RGB and alpha. Alpha ranges from 0 to 255.

4 years agouse immUniformColor instead of immUniform("color"
Mike Erwin [Sun, 16 Apr 2017 16:25:42 +0000 (12:25 -0400)]
use immUniformColor instead of immUniform("color"

The specialized color functions are better in every way:
- faster lookup (don't have to match "color" string)
- flexible inputs (RGB with separate alpha)
- automatic alpha = 1.0 if not specified

Sort of related to T49043

4 years agoGawain: move AttribBinding funcs to private interface
Mike Erwin [Sun, 16 Apr 2017 15:21:45 +0000 (11:21 -0400)]
Gawain: move AttribBinding funcs to private interface

Other parts of Gawain uses these internally, but they're not part of the public API.

Part of T51219

4 years agoGawain: fix compiler warnings
Mike Erwin [Sun, 16 Apr 2017 15:08:26 +0000 (11:08 -0400)]
Gawain: fix compiler warnings

vertex_format.c implements both public and private functions, so needs to include the private header.

Follow-up to 7c57ca5109793c54f34adfd396c41b1be163d61f

4 years agoGawain: fix compilation on MSVC 2013
Mike Erwin [Sun, 16 Apr 2017 15:00:59 +0000 (11:00 -0400)]
Gawain: fix compilation on MSVC 2013

attrib_binding.c uses NULL, so include stddef.
Also swapped stdlib for stddef in vertex_format.c, since it only needs NULL.

Not sure why MSVC 2017 and clang/Mac work without this...

Thanks to @youle for reporting!

4 years agoOpenGL: minor cleanup & TODO
Mike Erwin [Sat, 15 Apr 2017 23:43:56 +0000 (19:43 -0400)]
OpenGL: minor cleanup & TODO

Just clearing out some old git stashes.

No point getting old GL light model to work on old Intel GPUs (both are obsolete for 2.8)

4 years agoGawain: look up builtin uniforms by enum, not by name
Mike Erwin [Sat, 15 Apr 2017 23:19:00 +0000 (19:19 -0400)]
Gawain: look up builtin uniforms by enum, not by name

This speeds up color and transformation matrix lookups at draw time (used by almost all shaders).

4 years agoGawain: use ShaderInterface to manage vertex attribs
Mike Erwin [Sat, 15 Apr 2017 22:06:54 +0000 (18:06 -0400)]
Gawain: use ShaderInterface to manage vertex attribs

This eliminates tons of glGetAttribLocation calls from the drawing loop. Vast majority of code can keep making the same function calls. They're just faster now!

4 years agoGawain: remove 2D matrix uniforms from ShaderInterface
Mike Erwin [Sat, 15 Apr 2017 21:07:29 +0000 (17:07 -0400)]
Gawain: remove 2D matrix uniforms from ShaderInterface

- remove 2D-specific variants of BuiltinUniform enum
- rename remaining builtins to exclude "_3D" since they can be used by 2D or 3D shaders

Follow up to D2626

4 years agoGawain: fix header comments
Mike Erwin [Sat, 15 Apr 2017 19:42:58 +0000 (15:42 -0400)]
Gawain: fix header comments

Missed this when splitting VertexBuffer from Batch -- they used to live in the same file.

4 years agoGawain: move some VertexFormat funcs to private interface
Mike Erwin [Sat, 15 Apr 2017 17:10:14 +0000 (13:10 -0400)]
Gawain: move some VertexFormat funcs to private interface

Other parts of Gawain uses these internally, but they're not part of the public API.

Part of T51219

4 years agoGawain: rename AttribBinding clear for consistency
Mike Erwin [Sat, 15 Apr 2017 17:06:43 +0000 (13:06 -0400)]
Gawain: rename AttribBinding clear for consistency

AttribBinding is only used internally by Gawain.

Part of T51219

4 years agoFix missing manipulator update after undo
Julian Eisel [Sat, 15 Apr 2017 13:58:49 +0000 (15:58 +0200)]
Fix missing manipulator update after undo

Steps to recreate the error were:
* Enter edit mode
* Change Vertex positions
* Undo -> Manipulator position isn't updated

4 years agoCleanup: lattice drawing had mesh include & names
Campbell Barton [Sat, 15 Apr 2017 07:52:42 +0000 (17:52 +1000)]
Cleanup: lattice drawing had mesh include & names

4 years agoCleanup: GPU header guards
Campbell Barton [Sat, 15 Apr 2017 07:51:08 +0000 (17:51 +1000)]
Cleanup: GPU header guards

4 years agoGPU matrix: add back type checks
Campbell Barton [Sat, 15 Apr 2017 07:43:48 +0000 (17:43 +1000)]
GPU matrix: add back type checks

Without this gpuGet functions would cast everything
(no type or size checks and override const variables).

4 years agoRemove redundant declaration
Campbell Barton [Sat, 15 Apr 2017 07:17:09 +0000 (17:17 +1000)]
Remove redundant declaration

4 years agoGPU Matrix API: clean up after 2D-3D unification
Mike Erwin [Sat, 15 Apr 2017 05:29:25 +0000 (01:29 -0400)]
GPU Matrix API: clean up after 2D-3D unification

See GPU_matrix.h & gpu_matrix.c for the important changes. Other files are mostly just updated to use the latest API.

- remove unused functions, defines, enums, comments
- remove "3D" from function names
- init to Identity transform (otherwise empty stack)
- gpuMatrixReset lets outside code return to initial state

Part of T49450
Follow up to D2626 and 49fc9cff3b90

4 years agoCleanup: Use doxy-groups for draw-cache
Campbell Barton [Sat, 15 Apr 2017 04:24:30 +0000 (14:24 +1000)]
Cleanup: Use doxy-groups for draw-cache

4 years agoCleanup: explicit names for return arguments and position last
Campbell Barton [Sat, 15 Apr 2017 04:07:57 +0000 (14:07 +1000)]
Cleanup: explicit names for return arguments and position last

4 years agoGPU Matrix API: Remove ModelView/Projection 3D suffix
Dalai Felinto [Fri, 14 Apr 2017 16:06:56 +0000 (18:06 +0200)]
GPU Matrix API: Remove ModelView/Projection 3D suffix

4 years agoGPU Matrix API refactor: Stick to a single 4x4 stack for 2D and 3D
Dalai Felinto [Fri, 14 Apr 2017 12:13:38 +0000 (14:13 +0200)]
GPU Matrix API refactor: Stick to a single 4x4 stack for 2D and 3D

* Brings us closer to core profile, all matrices are working, and apart
from a problem with text drawing, Blender is working fine.

* Reduce the coding overhead of having to setup/teardown when
alternating between 2D and 3D drawing sessions.

* Gives us fewer modes and states we need to keep track of.

Unfortunatelly this also "rejects a fundamental change" the original
design was trying to make - that 2D is different from 3D and
deserves its own best implementation.

That said, it is still aligned with the function API design as
originally implemented (i.e., it still uses gpuTranslate2D, ...).

Finally, if you build with core profile and this patch you get:

[The text glitch is an unrelated issue].

Reviewers: merwin, sergey, brecht

Differential Revision:

4 years agoAdd fatal error in CMake when trying to build WITH_GAMEENGINE but without WITH_LEGACY...
Bastien Montagne [Fri, 14 Apr 2017 15:16:15 +0000 (17:16 +0200)]
Add fatal error in CMake when trying to build WITH_GAMEENGINE but without WITH_LEGACY_OPENGL

This won't work currently.

4 years agoOpenGL: fix Mac crashing on startup
Mike Erwin [Fri, 14 Apr 2017 14:35:30 +0000 (10:35 -0400)]
OpenGL: fix Mac crashing on startup

On Apple we use OpenGL 2.1 + an ARB extension for framebuffers.

The glFramebufferTexture function is part of OpenGL 3.0 but not part of the ARB extension. This commit fills that gap.

All other platforms are using GL 3.0+ already so it's not an issue there. All platforms (Mac too) will use GL 3.3+ soon so this workaround will be removed.

4 years agoGawain: fix crash when drawing batches (e.g., scale manipulator)
Dalai Felinto [Fri, 14 Apr 2017 12:19:40 +0000 (14:19 +0200)]
Gawain: fix crash when drawing batches (e.g., scale manipulator)

Introduced in b02786ae6b

4 years agoMerge branch 'master' into blender2.8
Bastien Montagne [Fri, 14 Apr 2017 10:36:56 +0000 (12:36 +0200)]
Merge branch 'master' into blender2.8


4 years agoFix Blenderplayer (c)
Bastien Montagne [Thu, 13 Apr 2017 10:36:19 +0000 (12:36 +0200)]
Fix Blenderplayer (c)

4 years agoCleanup: triple quotes for docstrings
Campbell Barton [Fri, 14 Apr 2017 10:01:43 +0000 (20:01 +1000)]
Cleanup: triple quotes for docstrings

4 years agoBLF: avoid glyph cache use-after free
Campbell Barton [Fri, 14 Apr 2017 09:52:29 +0000 (19:52 +1000)]
BLF: avoid glyph cache use-after free

Causes crash if the font size isn't set after clearing (see T51200)

4 years agoBuildbot: Fix typos
Sergey Sharybin [Fri, 14 Apr 2017 08:03:30 +0000 (10:03 +0200)]
Buildbot: Fix typos

4 years agoBuildbot: Attempt to fix CUDA compilation on OSX
Sergey Sharybin [Fri, 14 Apr 2017 08:01:28 +0000 (10:01 +0200)]
Buildbot: Attempt to fix CUDA compilation on OSX

Stupid toolkit is really fragile about CLang version.

4 years agoOpenGL: use ShaderInterface to look up uniforms
Mike Erwin [Thu, 13 Apr 2017 22:37:26 +0000 (18:37 -0400)]
OpenGL: use ShaderInterface to look up uniforms

These were the last few glGetUniformLocation calls in source/blender.

The new system gets uniform information once when a shader is created, then uses this cached info every time after that.

4 years agoRevert "OpenGL core: add some missing gpuBegin to allow clay with no UI"
Dalai Felinto [Thu, 13 Apr 2017 16:49:16 +0000 (18:49 +0200)]
Revert "OpenGL core: add some missing gpuBegin to allow clay with no UI"

This reverts commit 1c01811cce00b799ee94aad24083ddf3954a5829.

It broke everything.

4 years agoUI: Add/Improve a few tooltips
Aaron Carlisle [Thu, 13 Apr 2017 22:07:10 +0000 (18:07 -0400)]
UI: Add/Improve a few tooltips

See T51061

4 years agoDraw Manager: lattice editmode drawing
Campbell Barton [Thu, 13 Apr 2017 13:29:45 +0000 (23:29 +1000)]
Draw Manager: lattice editmode drawing

4 years agoOpenGL core: add some missing gpuBegin to allow clay with no UI
Dalai Felinto [Thu, 13 Apr 2017 16:49:16 +0000 (18:49 +0200)]
OpenGL core: add some missing gpuBegin to allow clay with no UI

4 years agoOpenGL: do not support legacy matrix when using core profile
Dalai Felinto [Thu, 13 Apr 2017 14:49:39 +0000 (16:49 +0200)]
OpenGL: do not support legacy matrix when using core profile

4 years agoRemove deprecated opengl stuff from opensubdiv
Luca Rood [Thu, 13 Apr 2017 14:52:13 +0000 (16:52 +0200)]
Remove deprecated opengl stuff from opensubdiv

This removes glGetBooleanv queries for GL_LIGHTING. This has been #ifdef'd
out with legacy opengl disabled. Thus a false positive still shows up in
the gl queries. Also, note that this removes support for wireframes in
opensubdiv, when desabling legacy opengl, which should be fixed later.

Part of T49043

4 years agoRemove some elbeem debug functions
Luca Rood [Wed, 12 Apr 2017 13:24:42 +0000 (15:24 +0200)]
Remove some elbeem debug functions

Some elbeem debug functions had old gl drawing calls. I removed the
functions instead of converting, because Blender doesn't even build
with them enabled anymore, because some elbeem debug libs got removed
at some point.

Part of T49043

4 years agoAlembic export: unified code of exploreTransform and exploreObject.
Sybren A. Stüvel [Tue, 11 Apr 2017 12:59:48 +0000 (14:59 +0200)]
Alembic export: unified code of exploreTransform and exploreObject.

4 years agoAlembic export: added support for writing dupli-groups
Sybren A. Stüvel [Wed, 12 Apr 2017 10:35:09 +0000 (12:35 +0200)]
Alembic export: added support for writing dupli-groups

This supports our common character animation workflow, where a character,
its rig, and the custom bone shapes are all part of a group. This group
is then linked into the scene, the rig is proxified and animated. Such
a group can now be exported. Use "Renderable objects only" to prevent
writing the custom bone shapes to the Alembic file.

4 years agoUnittests for depsgraph layer collection render settings evaluation
Dalai Felinto [Thu, 13 Apr 2017 14:28:47 +0000 (16:28 +0200)]
Unittests for depsgraph layer collection render settings  evaluation

Some of the tests are failing at the moment.
Those problems were introduced in eba09b1520

4 years agoFix Surface Deform crash with missing or freed DM
Luca Rood [Thu, 13 Apr 2017 13:39:16 +0000 (15:39 +0200)]
Fix Surface Deform crash with missing or freed DM

4 years agoUpdate despsgraph when set/unset variables
Dalai Felinto [Thu, 13 Apr 2017 13:38:35 +0000 (15:38 +0200)]
Update despsgraph when set/unset variables

4 years agoLayer collection settings API
Dalai Felinto [Thu, 13 Apr 2017 13:38:15 +0000 (15:38 +0200)]
Layer collection settings API

This way we can set a property via RNA, and also force an update of scene layer (which I am using for unittesting)

4 years agoCycles: Make vectorized types constructor from register explicit
Sergey Sharybin [Thu, 13 Apr 2017 13:07:07 +0000 (15:07 +0200)]
Cycles: Make vectorized types constructor from register explicit

This is not a cheap operation which we dont' want to happen silently.

4 years agoCycles: Remove unused function
Sergey Sharybin [Thu, 13 Apr 2017 13:01:55 +0000 (15:01 +0200)]
Cycles: Remove unused function

It was quite wrong actually by doing some __m128 to flaot4 round trips.

4 years agoAlembic import: fixed off-by-one error in start/end frame
Sybren A. Stüvel [Thu, 13 Apr 2017 12:50:02 +0000 (14:50 +0200)]
Alembic import: fixed off-by-one error in start/end frame

static_cast<int> truncates, so a computed end frame of 99.999999999998
would result in 99, instead of the correct 100.

4 years agoDraw Manager: initial lattice support
Campbell Barton [Thu, 13 Apr 2017 12:09:59 +0000 (22:09 +1000)]
Draw Manager: initial lattice support

Still misses support for edit-mode selection & weight drawing.

4 years agoCleanup: minor changes to logic for outline drawing
Campbell Barton [Thu, 13 Apr 2017 11:44:24 +0000 (21:44 +1000)]
Cleanup: minor changes to logic for outline drawing

Use brace placement following code-style too.

4 years agoTask scheduler: Fix typo in TLS for pools created from non-main thread
Sergey Sharybin [Thu, 13 Apr 2017 11:32:39 +0000 (13:32 +0200)]
Task scheduler: Fix typo in TLS for pools created from non-main thread

Did a mistake which started to use same TLS for all threads for such pools.

Also added some extra asserts to help catching the bugs.

4 years agoFix Blenderplayer (c)
Bastien Montagne [Thu, 13 Apr 2017 10:36:19 +0000 (12:36 +0200)]
Fix Blenderplayer (c)

4 years agoFix RNA LayerCollectionEngineSettingsClay not inheriting from LayerCollectionSettings.
Bastien Montagne [Thu, 13 Apr 2017 10:16:32 +0000 (12:16 +0200)]
Fix RNA LayerCollectionEngineSettingsClay not inheriting from LayerCollectionSettings.

Was hence missing the 'name' property, which broke the 'dict-like'
behavior of Scene.collection_properties.

4 years agoMerge branch 'master' into blender2.8
Alexander Romanov [Thu, 13 Apr 2017 10:02:39 +0000 (13:02 +0300)]
Merge branch 'master' into blender2.8

4 years agoAdd red alert in UI controls for datablock pointer properties
Alexander Romanov [Thu, 13 Apr 2017 09:59:04 +0000 (12:59 +0300)]
Add red alert in UI controls for datablock pointer properties

4 years agoDraw Engine: Draw sets recursively
Campbell Barton [Thu, 13 Apr 2017 09:42:43 +0000 (19:42 +1000)]
Draw Engine: Draw sets recursively

Matchers regular viewport behavior

4 years agoDatablock ID Properties
Alexander Romanov [Thu, 13 Apr 2017 09:30:03 +0000 (12:30 +0300)]
Datablock ID Properties

The absence of datablock properties "will certainly be resolved soon as the need for them is becoming obvious" said the [[|Python Nodes release notes]]. So this patch allows Python scripts to create ID Properties which reference datablocks.
This functionality is implemented for `PointerProperty` and now such properties can be created with Python.

In addition to the standard update callback, `PointerProperty` can have a `poll` callback (standard RNA) which is useful for search menus. For details see the test included in this patch.

Original author: @artfunkel

Alexander (Blend4Web Team)

Reviewers: brecht, artfunkel, mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Subscribers: jta, sergey, campbellbarton, wisaac, poseidon4o, mont29, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov, fjuhec, sharlybg, cardboard, duarteframos, blueprintrandom, a.romanov, BYOB, disnel, aditiapratama, bliblubli, dfelinto, lukastoenne

Maniphest Tasks: T37754

Differential Revision:

4 years agoCycles: Header cleanup in BVH: move self header to be the first one
Sergey Sharybin [Thu, 13 Apr 2017 09:20:33 +0000 (11:20 +0200)]
Cycles: Header cleanup in BVH: move self header to be the first one

This makes us more sure that header files are more self-sufficient.

4 years agoUse regular header guards in GPU
Campbell Barton [Thu, 13 Apr 2017 09:10:55 +0000 (19:10 +1000)]
Use regular header guards in GPU

4 years agoCycles: Split BVH implementations into separate files
Sergey Sharybin [Thu, 13 Apr 2017 08:55:46 +0000 (10:55 +0200)]
Cycles: Split BVH implementations into separate files

4 years agoCycles: Use more explicit and commonly used names for BVH structures
Sergey Sharybin [Thu, 13 Apr 2017 08:29:14 +0000 (10:29 +0200)]
Cycles: Use more explicit and commonly used names for BVH structures

This renames BinaryBVH to BVH2 and QBVH to BVH8. There is no user measurable
difference, but allows us to add more types of BVH trees such as BVH8.

4 years agoOpenGL: implement 2D with 4x4 matrices
Mike Erwin [Thu, 13 Apr 2017 08:00:19 +0000 (04:00 -0400)]
OpenGL: implement 2D with 4x4 matrices

... even though 3x3 feels better.

This is a compromise to get core profile up & running sooner. Eventually I'd like to finish the original 3x3 plans, but this commit will let us get on with other tasks.

External API stays (almost) the same. Our GLSL shaders can use this without any changes.

Part of T49450 and T51164

4 years agouse new 3D matrix impl in draw manager
Mike Erwin [Thu, 13 Apr 2017 05:03:49 +0000 (01:03 -0400)]
use new 3D matrix impl in draw manager

These functions mark the beginning and end of 3D drawing, causing the matrix API to use our own implementation instead of legacy OpenGL.

Part of T49450

4 years agoGawain: look up array uniforms correctly
Mike Erwin [Thu, 13 Apr 2017 04:51:18 +0000 (00:51 -0400)]
Gawain: look up array uniforms correctly

Look up "name[0]" when asked for "name", since that marks the beginning of the array.

We're comparing to the name stored in ShaderInterface which comes from glGetActiveUniform.

4 years agocleanup image drawing setup
Mike Erwin [Wed, 12 Apr 2017 23:11:31 +0000 (19:11 -0400)]
cleanup image drawing setup

4 years agoGawain: use ShaderInterface to manage uniforms
Mike Erwin [Wed, 12 Apr 2017 22:55:32 +0000 (18:55 -0400)]
Gawain: use ShaderInterface to manage uniforms

This eliminates tons of glGetUniformLocation calls from the drawing loop. Vast majority of code can keep making the same function calls. They're just faster now!

- Batch_Uniform*
- immUniform*
- gpuBindMatrices
- and others

4 years agoGawain: add immUniform4iv
Mike Erwin [Wed, 12 Apr 2017 22:20:58 +0000 (18:20 -0400)]
Gawain: add immUniform4iv

Needed soon by OCIO.

4 years agoGawain: add (temp) legacy GLSL support to ShaderInterface
Mike Erwin [Wed, 12 Apr 2017 22:03:18 +0000 (18:03 -0400)]
Gawain: add (temp) legacy GLSL support to ShaderInterface

A temporary measure needed by GPU_basic_shader.

Part of T51164

4 years agoGawain: improve ShaderInterface
Mike Erwin [Wed, 12 Apr 2017 21:56:26 +0000 (17:56 -0400)]
Gawain: improve ShaderInterface

- builtin uniforms match what Blender needs
- set input counts in struct (stupid mistake)
- look up uniforms by name
- look up builtin uniforms by enum
- check attrib/uniform locations for error

4 years agoGLSL: rename edit_overlay -> edit_mesh_overlay
Campbell Barton [Thu, 13 Apr 2017 04:13:46 +0000 (14:13 +1000)]
GLSL: rename edit_overlay -> edit_mesh_overlay

Avoid confusion with overlays with non-mesh types

4 years agoUse 'safe' macros for common free operation
Campbell Barton [Thu, 13 Apr 2017 03:30:53 +0000 (13:30 +1000)]
Use 'safe' macros for common free operation

Same as MEM_SAFE_FREE macro,
checks for NULL, runs free then sets NULL.

Blocks of code that do this many times are noisy and likely
errors here wouldn't be noticed immediately.

Also NULL's static vars which were being left set.

4 years agofix drawing file column dividers (T51189)
Mike Erwin [Wed, 12 Apr 2017 18:16:43 +0000 (14:16 -0400)]
fix drawing file column dividers (T51189)

Problem was an edge case where vertex_ct logic and draw logic disagreed on how many dividers to draw.

Fix: copy draw logic to earlier vertex_ct

I also skip any drawing or setup if vertex_ct = 0, and set color attribute only for each line's provoking vertex. Small optimizations but these things add up.

4 years agoFix T51188 compilation errors in Windows
Dalai Felinto [Wed, 12 Apr 2017 16:58:38 +0000 (18:58 +0200)]
Fix T51188 compilation errors in Windows

4 years agoTask scheduler: Prevent race condition for the pools created from non-main thread
Sergey Sharybin [Wed, 12 Apr 2017 16:18:33 +0000 (18:18 +0200)]
Task scheduler: Prevent race condition for the pools created from non-main thread

We can not re-use anything for such pools, because we will know nothing about whether
the main thread is sleeping or not. So we identify such threads as 0, but we don't
use main thread's TLS.

This fixes dead-locks and crashes reported by Luca when doing playblasts.

4 years agoLayer / Outliner / Depsgraph: update depsgraph when running outliner operators
Dalai Felinto [Wed, 12 Apr 2017 14:55:04 +0000 (16:55 +0200)]
Layer / Outliner / Depsgraph: update depsgraph when running outliner operators

4 years agoFix T50227: Alembic uv export/load issue
Sybren A. Stüvel [Wed, 12 Apr 2017 14:33:40 +0000 (16:33 +0200)]
Fix T50227: Alembic uv export/load issue

Previously only a CD_MLOOPUV custom data layer was created. Now we also
create the accompanying CD_MTEXPOLY layer too.

4 years agoFix T51184: Crash of Blender when I try to join an object with one that has booleans...
Sergey Sharybin [Wed, 12 Apr 2017 14:12:28 +0000 (16:12 +0200)]
Fix T51184: Crash of Blender when I try to join an object with one that has booleans modifiers

4 years agoOutliner: Draw nested collections before objects of a collection
Julian Eisel [Wed, 12 Apr 2017 12:47:54 +0000 (14:47 +0200)]
Outliner: Draw nested collections before objects of a collection

Collections may contain a huge list of objects, would be annoying having
to scroll over it all the time to get to the nested collections.

4 years agoOutliner: Fix objects of master collection not showing up in 'Master Collection Tree'
Julian Eisel [Wed, 12 Apr 2017 12:45:42 +0000 (14:45 +0200)]
Outliner: Fix objects of master collection not showing up in 'Master Collection Tree'

4 years agoMerge branch 'master' into 28
Campbell Barton [Wed, 12 Apr 2017 10:23:30 +0000 (20:23 +1000)]
Merge branch 'master' into 28

4 years agoAlembic export: fixed exporting as "flat"
Sybren A. Stüvel [Wed, 12 Apr 2017 10:15:32 +0000 (12:15 +0200)]
Alembic export: fixed exporting as "flat"

This exports all objects in world coordinates without parenting.

4 years agoAlembic export: removed superfluous export_object() check.
Sybren A. Stüvel [Tue, 11 Apr 2017 12:07:26 +0000 (14:07 +0200)]
Alembic export: removed superfluous export_object() check.

The exploreTransform() function already does this check, and the check
isn't necessary when the object type isn't exported anyway.

4 years agoCleanup: use lowercase gpu prefix for static funcs
Campbell Barton [Wed, 12 Apr 2017 10:18:44 +0000 (20:18 +1000)]
Cleanup: use lowercase gpu prefix for static funcs

This was mostly followed already.

4 years agoDraw Engine: remove hard coded limit on array sizes
Campbell Barton [Wed, 12 Apr 2017 09:49:19 +0000 (19:49 +1000)]
Draw Engine: remove hard coded limit on array sizes


Actual memory saving isn't so important, it just means we don't need to
manually bump these based on changes to engines.

4 years agoRemove bool -> int cast
Campbell Barton [Wed, 12 Apr 2017 08:23:40 +0000 (18:23 +1000)]
Remove bool -> int cast

Wont work as expected on big endian systems