Commit Graph

29 Commits

Author SHA1 Message Date
Campbell Barton 2e4f1b592f Cleanup: use eGPU prefix for GPU enum types 2019-01-23 14:16:03 +11:00
Clément Foucault c92cffb56d DRW: Instance: Makes it possible to have instances of a non-init batch 2018-12-18 13:08:17 +01:00
Clément Foucault 7ac49a07c6 Mesh Batch Cache: Port Texture paint batches to new batch request 2018-12-17 17:05:57 +01:00
Clément Foucault c09913e9dd GPUBatch: Add GPU_batch_clear to clear batches without freeing 2018-12-14 16:17:29 +01:00
Campbell Barton 40f45a7eac Cleanup: redundant NULL checks
Also use unsigned shifting for values not in int range.
2018-12-01 19:36:57 +11:00
Dalai Felinto f436e0acab Cleanup: GPU_BATCH_DISCARD_ARRAY_SAFE (deduplicate existing code) 2018-08-30 17:49:05 -03:00
Campbell Barton 428743a9b0 Cleanup: style for GPU module 2018-07-18 23:10:31 +10:00
Clément Foucault 8cd7828792 GWN: Port to GPU module: Replace GWN prefix by GPU 2018-07-18 11:49:15 +02:00
Clément Foucault 247ad2034d GWN: Port to GPU module: Move files to GPU
This does not include all the struct and type renaming. Only files were
renamed.

gwn_batch.c/h was fusioned with GPU_batch.c/h
gwn_immediate.c/h was fusioned with GPU_immediate.c/h
gwn_imm_util.c/h was fusioned with GPU_immediate_util.c/h
2018-07-18 00:17:57 +02:00
Campbell Barton 09431033e9 Cleanup: split GPU_batch
Split out presets and utilities for creating batches.
These functions are quite specialized and not related to typical usage.
2018-07-15 10:51:49 +02:00
Campbell Barton 02f28da187 Cleanup: trailing spaces
Applied to newly added files in 2.8
2018-04-22 08:45:52 +02:00
Clément Foucault cadef79a52 GPUBatch: Change preset managment system.
Now use a list of preset batches with a function to add new ones to this
list.

This removes the need of new functions all over the place to reset/exit.
2018-04-05 16:08:46 +02:00
Clément Foucault ab9adf9cdc BLF: Use Batch API instead of IMM.
This is not a perfect win just yet. It's now calling glBufferSubData for
every call (instead of using glMapBufferRange which is almost faster), but
with this system we will be able to batch drawcalls together.

See next commit.
2018-03-30 20:09:26 +02:00
Clément Foucault fa7e4cc685 WM/GPU: Clear VAO cache of batch preset when switching context.
This is needed for multiple windows to draw the batch presets.
This will not be needed once we use only one context for UI.
2018-02-26 19:49:06 +01:00
Clément Foucault 13261304a3 DRW: Add new Draw Manager OpenGL Context.
This separate context allows two things:
- It allows viewports in multi-windows configuration.
- F12 render can use this context in a separate thread and do a non-blocking render.

The downside is that the context cannot be used while rendering so a request to refresh a viewport will lock the UI. This is something that will be adressed in the future.

Under the hood what does that mean:
- Not adding more mess with VAOs management in gawain.
- Doing depth only draw for operators / selection needs to be done in an offscreen buffer.
- The 3D cursor "autodis" operator is still reading the backbuffer so we need to copy the result to it.
- All FBOs needed by the drawmanager must to be created/destroyed with its context active.
- We cannot use batches created for UI in the DRW context and vice-versa. There is a clear separation of resources that enables the use of safe multi-threading.
2018-02-26 19:41:17 +01:00
Campbell Barton a3716f5945 GPU_batch: Add GPU_batch_wire_from_poly_2d_encoded
Draws wire around polygon shapes:
better visibility w/ any background color.
2018-01-20 18:45:27 +11:00
Campbell Barton 7ba07b7e64 GPU_batch_from_poly_2d_encoded: optional rctf arg
Also use compiler attributes
2018-01-16 00:16:54 +11:00
Campbell Barton bfada6cc4a GPU_batch: Add utility to create 2D shapes
Shapes are represented by compact byte array,
encoded by 'make_shape_2d_from_blend.py' in the tools repo.
2018-01-15 20:38:06 +11:00
Campbell Barton b1ac7571a8 Cleanup: split GPU_batch_presets into own file
Mixing other batch code in this file easily shadowed existing variables.
Keep presets separate (we may have more, 2D & 3D presets)
2018-01-15 16:24:02 +11:00
Campbell Barton adfbf276a1 Cleanup: style, duplicate includes 2017-10-07 15:57:14 +11:00
Campbell Barton 90aa02290a Cleanup: rename GPU gawain functions
Were using Batch_ prefix still
2017-08-16 20:32:42 +10:00
Campbell Barton b6308d79e5 Cleanup: use 'gwn' prefix for gawain filenames
Looking up names project wide or setting breakpoints wasn't so.
Names like common.h or element.h are also too generic.
2017-08-16 00:25:47 +10:00
Campbell Barton b4d053efc7 Gawain API naming refactor
Use consistent prefix for gawain API names as well as
some abbreviations to avoid over-long names, see: D2678
2017-06-19 20:18:04 +10:00
Campbell Barton ffa63d2de6 Use regular header guards in GPU 2017-04-13 19:11:55 +10:00
Mike Erwin 4452bea2f1 move Gawain library to intern
Before now it lived in source/blender/gpu for convenience. Only a few files in the gpu module use Gawain directly.

Tested on Mac, time to push and test on Windows.

Todo: some CMake magic to make it easy to
#include "gawain/some_header.h"
from any C or H file. Main problem here is the many editors that include GPU_immediate.h which includes Gawain's immediate.h -- is there a way to avoid changing every editor's CMakeLists?
2017-03-16 23:32:35 -04:00
Clément Foucault 583373f049 OpenGL: Object bound drawing. 2017-03-06 20:57:16 +01:00
Clément Foucault dfadb45254 OpenGL immediate mode: gluSphere replacement
Updated interface_draw.c to use the new sphere batch.
2017-02-11 00:39:17 +01:00
Mike Erwin 5eddb80513 Extend Gawain to use Blender's built-in shaders
Was already done for immediate mode, but rearranged code to make a clean separation. Cleaned up #includes for code that uses this feature.

Added same for batched rendering.
2016-09-15 18:41:28 +02:00
Mike Erwin ddb1d5648d Gawain: geometry batches (unfinished)
Vertex Buffer to store vertex attribute data.
Element List (AKA Index Buffer) to select which vertices to use.
Batch combines these into an object that can be built once then drawn
many times.

Porting over from the C++ version… Most of this C code is compiled but
unused. Some of it is not even compiled. Committing now in case I’m
lost at sea.
2016-09-13 02:41:43 -04:00