Commit Graph

1370 Commits

Author SHA1 Message Date
Mike Erwin
3fdffc1e95 Gawain: fix for MSVC 2013
<stddef.h> defines offsetof. For some reason MSVC 2015 does not need this. Mystery!
2017-03-03 14:50:35 -05:00
Julian Eisel
2a82162618 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/armature/pose_select.c
	source/blender/editors/include/ED_armature.h
2017-03-03 12:55:35 +01:00
Campbell Barton
c0d0ef142f Cleanup: GPU_select never took NULL rect 2017-03-03 22:24:08 +11:00
Campbell Barton
25de610876 Cleanup: redundant header, use const, short -> bool 2017-03-03 22:24:08 +11:00
Mike Erwin
8cf524cec9 plug ShaderInterface into GPUShader
Renamed existing getter/setter that only FX shaders use. We could convert FX code to use the richer new interface or leave it as is.

Removed unused GPUShader fields. ShaderInterface tracks the same information.
2017-03-02 21:46:54 -05:00
Mike Erwin
c2baf3e486 OpenGL: draw PBVH bounding box with new imm mode
It wasn't using old immediate mode, but was using
- client vertex arrays (obsolete)
- quads (obsolete)
- state attrib stack (obsolete)
- polygon mode (still allowed, but gross)
2017-03-02 21:40:13 -05:00
Mike Erwin
e0a2bd43dd Gawain: add ShaderInterface for GLSL introspection
After a GLSL program is linked we can get all its inputs & never have to ask it again.

Several uniforms are considered "built-in". Nothing special about these to OpenGL itself, they just follow conventions of our built-in shaders.

This will help the matrix API, immediate & batch drawing APIs, and allow extra error/compatibility checking.
2017-03-02 21:28:28 -05:00
Mike Erwin
33758c7cb8 Gawain: move PRIM types to new file, classify by geometry
PrimitiveClass will help match shaders to draw calls & detect usage errors. For example a point sprite shader only makes sense with PRIM_POINTS.

Updated other files to include new primitive.h
2017-03-02 15:07:14 -05:00
Dalai Felinto
209021a703 Remove all instances of OBACT from drawobject.c and related changes 2017-03-02 17:09:24 +01:00
Mike Erwin
869f2940c2 Gawain: allow use of final 2 bits of 10_10_10_2 format
Requested by @fclem
2017-03-02 03:16:02 -05:00
Clément Foucault
b463cd2ab8 Edit Mode overlay: Moved Shaders to draw modules and resolved some draw issue.
We don't want to clutter gpu_shader.c with engine specific code
Added face's center dot
Simplified loose vert shader
2017-03-02 01:08:32 +01:00
Clément Foucault
aa102283da Edit Mode overlay: Added theme color via UBO. 2017-03-02 01:08:32 +01:00
Clément Foucault
043c90fdcd Edit Mode overlay: fast navigate 2017-03-02 01:08:32 +01:00
Clément Foucault
26fc6c71c4 Edit Mode overlays: separate multiple shaders for loose edges and verts 2017-03-02 01:08:32 +01:00
Campbell Barton
c1f43c9dc6 Cleanup: warnings 2017-03-02 00:36:33 +11:00
Clément Foucault
96d63d2232 Edit Mesh overlays: fix half cut vertices.
Artifacts still remained when 2 vertices were linedup in orthographic mode or with very acute vertex angles.

This commit fix that by adding even more geometry.
2017-02-28 15:00:16 +01:00
Clément Foucault
677f066634 Edit Mesh overlays: added looses edges and verts as triangle.
We loose a bit of memory for (more?) performance.
2017-02-28 14:31:16 +01:00
Mike Erwin
2de9bf1138 skip OpenGL debug logic on Apple
ifdef out most debugging code since Apple does not implement any debug extensions. We can revisit this if they ever do (don't expect that).

Changed output message so Mac users don't think --debug-gpu is broken.
2017-02-28 04:38:30 -05:00
Mike Erwin
811e90c957 OpenGL: enable use of AMD_debug_output
This extension is the best we have on some older supported GPU + OS combinations.

All the code was in place, just disabled.
2017-02-28 04:05:53 -05:00
Mike Erwin
08e654935c OpenGL: remove GPU_state_print function
I was removing deprecated/obsolete state from this function. About halfway through I started questioning the need for the whole thing.

GPU_state_print is not called anywhere, but is (was) available as a development aid.

External GL debugging tools are really good these days! We should use those to examine state & not roll our own.
2017-02-28 03:19:53 -05:00
Mike Erwin
8a76049e84 rename built-in point shaders, SMOOTH --> AA
Updated shader names and code that uses them.

All of these shaders produce round points that are anti-aliased and blended against the background.

These were initially named SMOOTH because they replace glEnable(GL_POINT_SMOOTH). But SMOOTH in shader-land refers to vertex attribute interpolation (like glShadeModel(GL_SMOOTH)).

Using SMOOTH to mean two things is confusing, so we now use AA to mean "the point is anti-aliased".
2017-02-28 02:18:52 -05:00
Mike Erwin
e7d57628c9 OpenGL: keyframe shape fixes
- Size parameter is total size of the shape, not its radius (half size). Updated hard-coded sizes to match this.
- Shader expands size to include outline.
- Fixed fringe between outline color and transparent background.
2017-02-28 01:21:27 -05:00
Clément Foucault
416bd1bbe8 Clay Engine: Edit Mesh overlay fix jaggy edges.
We do a strip of triangles around the triangle of interest and modify the variying vars to "trick" the fragment shader into rendering what we need.
This keeps the compatibility for both shaders.
Vertex still get half displayed when angle at the vertex is very acute.

This patch is only for the simple, no vert clipped case.

This is 2.5x slower than without the trick (on my hardware with 1million tris).
2017-02-27 17:41:35 +01:00
Clément Foucault
16b2005bfb Clay Engine: fix shader :/ 2017-02-26 21:33:29 +01:00
Clément Foucault
712530eb93 Clay Engine: Edit mesh overlays
Based on the previous overlay shader from merwin.
This shader takes care of clipped vertex cases and do all edit mode face info in one pass (except face centers).
As the shading is done one the triangle itself the visual can't go beyond the surface of the mesh. That leads to half displayed edges on the outline of the mesh.
This problem can be fixed by a second pass.

This is work in progress.
2017-02-26 21:12:56 +01:00
Brecht Van Lommel
2724fad582 OpenGL: replace gluProject and gluUnProject, and simplify surrounding code.
Part of T49042.
2017-02-26 00:16:46 +01:00
Brecht Van Lommel
e9011100f7 Fix compiler warnings on macOS / clang / c++11. 2017-02-26 00:16:21 +01:00
ianwill
bda0456933 OpenGL: wm_gesture uses new imm mode
D2376 by @ianwill, part of T49043
review by @merwin

Box select, circle select, etc. Introducing the dashed-line shader! See D2376 for more info.
2017-02-24 15:33:32 -05:00
Clément Foucault
1f453a8909 OpenColorIO: Update glsl implementation to be ready for ogl 3.3 core 2017-02-24 12:38:50 +01:00
Clément Foucault
45711c3fde OpenGL immediate mode: new shader image shuffle color
new shader to draw an image with one isolated channel
2017-02-24 01:26:44 +01:00
Clément Foucault
e5799d1389 OpenGL immediate mode: gpu_framebuffer.c
I had to make some changes to the sep_gaussian_blur shader to be compliant for gl 3.3 leap
2017-02-24 01:26:44 +01:00
Bastien Montagne
d751676cf3 Fix building full. 2017-02-23 11:03:56 +01:00
Dalai Felinto
53a9dec2bf Silence "defined but not used" warnings 2017-02-23 10:24:59 +01:00
Clément Foucault
48aeb0b640 Clay Engine: Renaming shader. 2017-02-22 12:50:03 +01:00
Clément Foucault
6dbc6dfc14 Clay Engine: Prepare for Armature drawing.
- Added runtime display matrices to EditBone and bPoseChannel
- Added Object space instance vertex shader and modified the simple lighting shader accordingly
2017-02-22 12:46:27 +01:00
Clément Foucault
446625c561 Clay Engine: Use G.debug_value to test cache performance
Use debug 666 for cache without instance buffer caching.
Use debug 667 for cache with instance buffer caching.
2017-02-19 14:31:02 +01:00
Mike Erwin
9f839a2ff5 OpenGL: fix MVP matrix order
Numbers were correct but names were mixed up.
2017-02-18 19:53:55 -05:00
Clément Foucault
50fb3ea3de Clay Engine: Separate mode drawing to different files/engines. 2017-02-17 17:30:15 +01:00
Luca Rood
ff53949145 Add diagonal stripe shader (GPU_SHADER_2D_DIAG_STRIPES)
Reviewed By: merwin

Differential Revision: https://developer.blender.org/D2512
2017-02-17 00:07:16 -02:00
Clément Foucault
268670cdee Clay Engine: Fix Axis Name shader 2017-02-16 16:22:44 +01:00
Clément Foucault
f9e4d8e93a Clay Engine: Replace Manual depth test by depth copy.
This avoid glitches due to float comparison precision.
2017-02-15 15:16:06 +01:00
Dalai Felinto
bdd3fd64e9 Bring rendering back (update all references to SETLOPPER) 2017-02-15 14:40:56 +01:00
Clément Foucault
9f03718a5b Clay Engine: drawaxis names drawn with shaders & instance 2017-02-15 12:28:26 +01:00
Clément Foucault
1f139beee3 Clay Engine: Added immUniform functions...
for vec3 arrays and matrix4.
2017-02-15 12:28:26 +01:00
Clément Foucault
22df54acb6 OpenGL immediate mode: drawarmature.c (cont)
All (except for stick and wire) are now rendered using batch or immediate API.
Using simple front facing lighting for now, waiting for gpu_basic_shader.c to be recoded.
2017-02-14 00:35:25 +01:00
Clément Foucault
0790976b6c OpenGL immediate mode: fix inverted normal in sphere batch 2017-02-14 00:35:25 +01:00
Clément Foucault
8c09fa3be2 OpenGL immediate mode: added gpuRotate3f to GPU_matrix 2017-02-14 00:35:25 +01:00
Clément Foucault
24703c97a1 GPU shaders / Clay engine : small renaming / cleanup 2017-02-11 21:15:46 +01:00
Clément Foucault
e05800d23b Clay Engine: converted Empties to the new instancing method 2017-02-11 20:36:20 +01:00
Clément Foucault
eb473143a8 Clay Engine: Convert Lamp to use new instancing feature. 2017-02-11 20:36:20 +01:00