Campbell Barton
7a602fb525
Cleanup: spelling
2020-08-19 14:04:36 +10:00
Clément Foucault
33fde699e2
Cleanup: GPUState: Remove GPU_state_init()
2020-08-18 21:30:11 +02:00
Clément Foucault
e5796233c7
GPUState: Use GPU_viewport to set viewport state in GPU_framebuffer
...
also fix a small issue in GPU_texture_clear.
2020-08-18 21:30:11 +02:00
Clément Foucault
adca09b643
GPUState: Port default state to StateManager constructor
2020-08-18 21:30:11 +02:00
Clément Foucault
a9f2ebb215
Cleanup: DRW: Use GPUState instead of raw opengl calls
...
Should not break anything! Huh!
2020-08-18 21:30:10 +02:00
Clément Foucault
536c2e0ec9
GPUState: Only apply state before drawing
2020-08-18 21:30:10 +02:00
Clément Foucault
482a51aabf
Cleanup: GPUState: Remove stack from the state manager and rename it
2020-08-18 21:30:10 +02:00
Clément Foucault
d10f000322
GPUState: Remove gpuPushAttr/gpuPopAttr
...
And use manual save/restore mechanism.
The stack method is not used so much to be considered useful.
2020-08-18 21:30:10 +02:00
Clément Foucault
f30df15edc
GPUState: Make use of GPUStateStack class
...
This isolate most GL calls to the GL backend. Still a few remains.
2020-08-18 21:30:10 +02:00
Clément Foucault
298329554a
Cleanup: GPUState: remove double GPU_blend calls
2020-08-18 21:30:10 +02:00
Clément Foucault
bf1b622dd9
GPUState: GPU_blend final API renaming
...
We now use GPU_blend for enabling / disabling blending and explicitly
set the blend equation.
2020-08-18 21:30:10 +02:00
Clément Foucault
10558d6973
Cleanup: GPUState: remove use of GPU_blend_set_func
2020-08-18 21:30:10 +02:00
Clément Foucault
969bcf0793
Cleanup: GPUState: Replace blend func separate by enum
2020-08-18 21:30:10 +02:00
Clément Foucault
a1459b2f7a
Cleanup: GPU: Move towards an explicit Blend state
...
This make use of the GLStateStack functions for:
- `GPU_blend()`
- `GPU_blend_set_func()`
- `GPU_blend_set_func_separate()`
The goal is to unify them using an explicit state setting.
This will remove the need to use obscure blend functions
2020-08-18 21:30:10 +02:00
Clément Foucault
2ae1c895a2
GPUState: Add GL backend and state tracking but do not use it
...
This is just the backend work. It is not plugged in yet because it
needs more external cleanup/refactor.
2020-08-18 21:30:10 +02:00
Clément Foucault
2eddfa85e0
Cleanup: GPU: Remove uneeded depth precision getter.
...
We always use 24bit framebuffers nowadays.
2020-08-18 21:30:10 +02:00
Clément Foucault
0f292dc072
Cleanup: GPUState: remove float variant of GPU_scissor_get
2020-08-18 21:30:10 +02:00
Clément Foucault
c78ea96528
GPUShader: Add debug labels
...
This allow better debugging inside renderdoc.
2020-08-18 21:30:10 +02:00
Clément Foucault
ba3c18f4b2
GPUShader: Add back vertformat_from_shader()
2020-08-18 21:30:10 +02:00
Clément Foucault
e8c48ce075
GPUShader: Improve auto name
...
Use macro to get calling function name. Helps debugging shaders.
2020-08-18 21:30:10 +02:00
Clément Foucault
e43e9caf1b
GPUShader: Rewrite error printing
...
Now error printing only display the line related to the error.
We also put char marker if present.
Example:
```
-- Shader Compilation Errors : MAMaterial --
10414 | node_fresnel(, facingnormal, viewposition, tmp34);
| ^
| error: syntax error, unexpected ',', expecting ')'
----------------------------------
```
2020-08-18 21:30:10 +02:00
Clément Foucault
216d78687d
GPUShader: GL backend isolation
2020-08-18 21:30:09 +02:00
Clément Foucault
df28d2c27e
Cleanup: GPU: Replace Batch uniform by shader uniform using macro
...
This is a first step into removing uniforms from GPU_batch and Imm.
2020-08-18 21:30:09 +02:00
Clément Foucault
2e908156d0
Fix T77564: VSE (and compositor background) lost stereoscopy preview
...
Issue introduced on fe045b2b77 .
Since the stereoscopy compositing (anaglyph, ...) is only done for
viewports the VSE preview and compositor need to use viewports.
Reviewed by: dfelinto
Differential Revision: https://developer.blender.org/D8472
2020-08-18 15:39:27 +02:00
Clément Foucault
673b1930d8
Merge branch 'blender-v2.90-release'
2020-08-18 14:05:26 +02:00
Clément Foucault
aba46371a1
GPUTexture: Extend CUBE_MAP_ARRAY_ARB proxy workaround to all Apple gpus
...
Related to T79716
2020-08-18 14:01:14 +02:00
Clément Foucault
41235eed1d
GPU: Avoid invalid GL API usage
...
Drawing with 0 sized buffer is prohibited.
2020-08-18 13:53:07 +02:00
Clément Foucault
fe1827df82
Fix T79782 GPU: Crash cause by shadow batch reference
...
After drawing, the batch could be reset and draw again using other
parameters.
Avoid having to track references by setting the batch pointer to NULL after
drawing.
2020-08-18 13:53:07 +02:00
Clément Foucault
6a6cb83eb3
Fix T79568 EEVEE: Film transparent not working
...
Since world shader use the same standard output and are considered opaque,
we need to set alpha as holdout.
2020-08-18 12:26:22 +02:00
Campbell Barton
9a4c019255
Cleanup: header order, trailing space
2020-08-17 12:39:08 +10:00
Campbell Barton
9762c3892e
Cleanup: spelling
2020-08-17 12:34:05 +10:00
Clément Foucault
a6447ca72d
GPU: Fix MSVC warning
2020-08-13 14:20:24 +02:00
Clément Foucault
d52f28380b
GPU: Fix issue with MDI and recent refactor
2020-08-13 14:20:24 +02:00
Clément Foucault
f349ea5508
GPUDrawList: Fix gl error with drawing without the correct VAO bound
2020-08-13 14:20:24 +02:00
Clément Foucault
985070b1ce
GPUShader: Add more uniform functions
2020-08-13 14:20:24 +02:00
Clément Foucault
ac60a67b3f
Cleanup: GPU: Remove Batch vao cache reset
...
This is done at drawtime automatically.
2020-08-13 14:20:24 +02:00
Clément Foucault
efc97b3919
GPUBatch: GL backend isolation
...
This changes the drawing paradigm a bit. The VAO configuration is done
JIT-style and depends on context active shader.
This is to allow more flexibility for implementations to do optimization
at lower level.
The vao cache is now its own class to isolate the concept. It is this
class that is reference by the GLContext for ownership of the containing
VAO ids.
2020-08-13 14:20:24 +02:00
Clément Foucault
47bfb0f7ad
GPUBatch: Move allocator to backend
2020-08-13 14:20:24 +02:00
Clément Foucault
9443da6166
GPUBatch: Merge phase and ownership flags and cleanup there usage
...
Also add new flags to communicate specific behavior to future backend.
2020-08-13 14:20:24 +02:00
Clément Foucault
e0f5f95e66
DRW: InstanceData: Remove hacks of batch freeing callback
...
We instead use a handle reference counter on the GPUVertBufs used by
the instancing batches. This make sure that if an update happens on the
GPUVertBuf used to contruct the batch, they will never have the same
memory address than the previously allocated ones (since they are still
pending deletion thanks to the refcounter).
This avoid the linear search to update the GPUBatch in the case a
batch is deleted (which was even a bad option since they could be only
cleared)
2020-08-13 14:20:24 +02:00
Clément Foucault
157f2a20e6
GPU: Use GPU_vertbuf_create & GPU_indexbuf_calloc instead of manual alloc
2020-08-13 14:20:23 +02:00
Clément Foucault
00a3c297d2
GPUVertBuf: Add handle refcount
...
A handle refcount is here to avoid freeing of the GPUVertBuf datablock
if it is still referenced somewhere else.
This does not prevent deleting the actual data. This is to avoid too
much zombie data usage.
This is in order to avoid most hacks inside `draw_instance_data.c`.
2020-08-13 14:20:23 +02:00
Clément Foucault
93165cbf47
GPUBatch: Remove most use of GPU_batch_draw_advanced()
...
This is in order to better encapsulate / isolate the drawing code.
2020-08-13 14:20:23 +02:00
Clément Foucault
de4eb115ac
Cleanup: GPUBatch: Remove GL functions from uniform assignment
2020-08-13 14:20:23 +02:00
Clément Foucault
b0f30bd684
Cleanup: GPUBatch: Move gpu_batch_private.h to CPP header
2020-08-13 14:20:23 +02:00
Clément Foucault
16b28ff974
Cleanup: GPUShader: Remove unused code
2020-08-13 14:20:23 +02:00
Clément Foucault
854c999d82
GPUShader: Change shader state tracking to be part of the GPUContext
...
This remove the use of batch->program and replace it with batch->shader.
This will allow GL abstraction latter.
2020-08-13 14:20:23 +02:00
Clément Foucault
186abf7d3b
GPUBatch: Remove usage of gl_prim_type outside of GPU module
2020-08-13 14:20:23 +02:00
Clément Foucault
38ef35b1ed
GPUDrawList: GL backend isolation
2020-08-13 14:20:23 +02:00
Campbell Barton
357547b010
Cleanup: spelling
2020-08-13 16:21:10 +10:00