Commit Graph

1881 Commits

Author SHA1 Message Date
Clément Foucault
b4df509f7b Cleanup: GPUMaterial: Remove unused struct members 2019-05-30 16:13:26 +02:00
Clément Foucault
092962cf72 GPU: Enforce Uniform buffer alignment to 16bytes
This seems to be a requirement and remove some errors in
renderdoc.
2019-05-30 13:42:21 +02:00
Clément Foucault
77f5210f22 GPU: Remove GPU_INDEX_U8
This type of indices is not natively supported on modern GPU and
gives warning on some implementation. The memory savings it
provides is also quite minimal and unlikely to be visible on
nowadays hardware.

This remove some uneeded struct members and makes primitive
restart always enabled by default. This can be broken by addons
if they are not careful enough but many other states have this
problem.

Also leverage GL_PRIMITIVE_RESTART_FIXED_INDEX if
ARB_ES3_compatibility is supported. This removes all API calls
to change restart index depending on indices length.
2019-05-30 13:42:21 +02:00
Campbell Barton
671827549a 3D View: Support light probe data clipping 2019-05-30 20:02:05 +10:00
Clément Foucault
2100dba34b Cleanup: GPU: Move program point size to GPU_state 2019-05-28 17:19:42 +02:00
Ray Molenkamp
70bb61ba97 Cleanup: Fix warnings in gpu_batch
Passing a const pointer to MEM_freeN/MEM_recallocN lead to

C4090	'function': different 'const' qualifiers

warnings with MSVC
2019-05-27 08:30:53 -06:00
Clément Foucault
4ad9d93fec Fix T65066 Armature and bone selection is broken on macOS 2019-05-27 13:38:06 +02:00
Clément Foucault
577d3498b4 Cleanup: DRW: Move WorldClipPlanes to builtin uniform 2019-05-27 12:58:14 +02:00
Clément Foucault
df7f69b873 Eevee: Fix SSS energy disapearing with alpha blended material 2019-05-23 15:32:05 +02:00
Clément Foucault
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
Clément Foucault
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
Clément Foucault
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
mano-wii
fa542237dd GPU_select_buffer_stride_realign: fix crash when one of the rect's dimensions is 0. 2019-05-21 20:57:03 -03:00
Brecht Van Lommel
24607a2940 Fix T64758: crash loading certain DDS textures 2019-05-21 13:00:43 +02:00
mano-wii
ee7093689f GPU: Use uint in GPU_batch_uniform_1ui. 2019-05-20 15:45:35 -03:00
Clément Foucault
b526221315 Eevee: Remove the Subsurface Render checkbox
This is to simplify the usage of SSS.

Now it automatically detect if there is any SSS material in the view and
allocate the needed buffer if any.
2019-05-17 13:38:42 +02:00
Clément Foucault
26beaa2d90 Cleanup: Eevee: Use SET_FLAG_FROM_TEST 2019-05-17 13:38:42 +02:00
Campbell Barton
469f2ec17a Cleanup: unused vars 2019-05-16 21:17:10 +10:00
Brecht Van Lommel
a9b393c367 Fix T64678: wrong DDS normal map rendering after recent changes 2019-05-16 12:52:04 +02:00
Campbell Barton
5005210f40 GPU: Add a matrix unproject function that takes an inverted matrix
This is normally already calculated so add a version that takes the
inverted matrix.
2019-05-15 14:16:35 +10:00
Jeroen Bakker
0dd5281ab2 GPU: Windows+Intel Selection Fix
On Windows 10 with a post Februari 2019 Intel driver, the box selection
is not working. It only detects the object centers, but not the drawn
triangles of the basic engine.

Reviewed By: fclem

Maniphest Tasks: T62947

Differential Revision: https://developer.blender.org/D4857
2019-05-14 14:55:12 +02:00
Clément Foucault
bf45a46f81 GPU: Fixup and add assert to GPU_VERT_ATTR_NAMES_BUF_LEN 2019-05-14 13:54:05 +02:00
Campbell Barton
6a4c5b67ec Cleanup: quiet warning 2019-05-14 20:21:22 +10:00
Clément Foucault
20421ef952 Cleanup: DRW: Move ModelMatrix declaration to common_view_lib 2019-05-14 10:57:04 +02:00
Clément Foucault
016fc7f0c2 GPUVertexFormat: Reduce size of structs
With this patch, the size of GPUVertFormat goes from 1240 to 388.
2019-05-14 10:57:04 +02:00
Clément Foucault
20d9cd3a1f GPU: Add GPU_vertbuf_discard and GPU_BATCH_UNUSED
GPU_vertbuf_discard to clear buffer containers in place.
GPU_BATCH_UNUSED to tag batch that are cleared and not immediatly usable.
2019-05-14 10:57:03 +02:00
Clément Foucault
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
Clément Foucault
2d28df783a GPU: Move Material index to nodetree evaluation
This removes the need to pass the Material* all over the place in the draw
manager. Cleanup comming right after.
2019-05-14 10:57:03 +02:00
Clément Foucault
b13e0568d3 GPU: Remove ModelViewMatrix and ModelViewMatrixInverse usage 2019-05-14 10:57:03 +02:00
Brecht Van Lommel
7ad802cf3a Cycles/Eevee: unified and improved texture image color space handling
Cycles now uses the color space on the image datablock, and uses OpenColorIO
to convert to scene linear as needed. Byte images do not take extra memory,
they are compressed in scene linear + sRGB transfer function which in common
cases is a no-op.

Eevee and workbench were changed to work similar. Float images are stored as
scene linear. Byte images are compressed as scene linear + sRGB and stored in
a GL_SRGB8_ALPHA8 texture. From the GLSL shader side this means they are read
as scene linear, simplifying the code and taking advantage of hardware support.

Further, OpenGL image textures are now all stored with premultiplied alpha.
Eevee texture sampling looks a little different now because interpolation
happens premultiplied and in scene linear space.

Overlays and grease pencil work in sRGB space so those now have an extra
conversion to sRGB after reading from image textures. This is not particularly
elegant but as long as engines use different conventions, one or the other
needs to do conversion.

This change breaks compatibility for cases where multiple image texture nodes
were using the same image with different color space node settings. However it
gives more predictable behavior for baking and texture painting if save, load
and image editing operations have a single color space to handle.

Differential Revision: https://developer.blender.org/D4807
2019-05-13 15:56:10 +02:00
Clément Foucault
60aede44ba Cleanup: DRW: Remove DRW_pass_free 2019-05-09 01:08:17 +02:00
Clément Foucault
e2d04229c3 DRW: Remove support for NormalMatrix 2019-05-09 00:27:11 +02:00
Clément Foucault
c995eb1f9f Cleanup: GPUShader: Remove unused edge fancy shader 2019-05-08 23:28:07 +02:00
Clément Foucault
7ec7888ff3 Eevee: Fix Tangent vectors using NormalMatrix and make them world space
Making them world space by default remove a lot of legacy conversion from
viewspace.
2019-05-08 23:28:06 +02:00
Clément Foucault
f2f62b184c DRW: Remove WorldNormalMatrix 2019-05-08 20:13:32 +02:00
Clément Foucault
7e380fd46a GPU: Remove GPU_INVERSE_NORMAL_MATRIX
The end goal for this is to lower the number of needed matrices.

This also cleanup some uneeded transformation.
2019-05-08 20:13:32 +02:00
Clément Foucault
3d759e2b09 Cleanup: DRW/GPU: Remove eye vector uniform 2019-05-08 17:52:49 +02:00
Clément Foucault
cca941f614 Cleanup: GPUShader: Use switch instead of ifs 2019-05-08 17:52:48 +02:00
Clément Foucault
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
Clément Foucault
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
Campbell Barton
ab9731ccea Cleanup: fallthrough attribute warning
Fall-through without label or default after it.
2019-05-05 12:34:24 +10:00
Clément Foucault
e474549da5 Cleanup: GPU_buffers: Remove obsolete debug drawing 2019-05-04 14:11:04 +02:00
Clément Foucault
1d8ed6dcd7 GPUBuffers: Save / expose material index per buffers 2019-05-04 14:11:04 +02:00
Clément Foucault
7f366c048a Fix T63435 Incorrect fresnel and normals for hair strands on EEVEE 2019-05-02 14:32:41 +02:00
Campbell Barton
909665a0d4 ClangFormat: run with ReflowComments on source/
Prepare for enabling ReflowComments.
2019-05-01 11:13:14 +10:00
Campbell Barton
14897fb653 Cleanup: spelling 2019-04-29 14:14:14 +10:00
Clément Foucault
d2f1705b15 Fix T63936 GPUSelect: Read depth in the end
fix T63936 introduced  in 86914e7133.

Reviewers: fclem

Reviewed By: fclem

Tags: #bf_blender

Maniphest Tasks: T63936

Differential Revision: https://developer.blender.org/D4750
2019-04-27 20:37:29 +02:00
Clément Foucault
86914e7133 GPUSelect: Don't read depth on every draw
If the draw uses the same id as the previous draw, there is no need to read the depth
buffer at this point, avoiding a CPU-GPU sync bubble.

Fixes T62511 Selection is significantly slower in production scenes.
With this patch glReadPixels is not the bottleneck. Regular drawing Is still very
slow so I would suggest fixing the regular drawing first before trying to
improve the selection algorithm.
2019-04-26 15:33:49 +02:00
Brecht Van Lommel
7e18aa4250 Fix T63524: crash selecting an object in texture coordinate node
Using mat4 in a uniform buffer object was not properly supported.
2019-04-25 12:13:26 +02:00
Clément Foucault
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