diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-11-04 16:14:38 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-11-04 16:14:38 +0300 |
commit | 5af9b9f45be08368a7fa3965805f53f012401631 (patch) | |
tree | 9b44b9d69a635eda95d3da236c0ea05de4a73123 /source/blender/draw/intern | |
parent | 17ccda4fe1c4bcc206024af3244c44678791a685 (diff) | |
parent | 3ffa0452af9ac0a08b321e9504c9e080ab1ce47d (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh.c | 12 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 3 |
3 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 6f40e04ab7e..336e6e75659 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -347,6 +347,8 @@ typedef enum { /** Use dual source blending. WARNING: Only one color buffer allowed. */ DRW_STATE_BLEND_CUSTOM = (9 << 11), DRW_STATE_LOGIC_INVERT = (10 << 11), + DRW_STATE_BLEND_ALPHA_UNDER_PREMUL = (11 << 11), + DRW_STATE_IN_FRONT_SELECT = (1 << 27), DRW_STATE_SHADOW_OFFSET = (1 << 28), diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c index ff1efccd507..7766ce906b8 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh.c @@ -902,12 +902,16 @@ static void extract_tris_finish(const MeshRenderData *mr, MeshExtract_Tri_Data *data = _data; GPU_indexbuf_build_in_place(&data->elb, ibo); - /* HACK: Create ibo sub-ranges and assign them to each #GPUBatch. */ - /* The `surface_per_mat` tests are there when object shading type is set to Wire or Bounds. In - * these cases there isn't a surface per material. */ - if (mr->use_final_mesh && cache->surface_per_mat && cache->surface_per_mat[0]) { + /* Create ibo sub-ranges. Always do this to avoid error when the standard surface batch + * is created before the surfaces-per-material. */ + if (mr->use_final_mesh && cache->final.tris_per_mat) { MeshBufferCache *mbc = &cache->final; for (int i = 0; i < mr->mat_len; i++) { + /* Theses IBOs have not been queried yet but we create them just in case they are needed + * later since they are not tracked by mesh_buffer_cache_create_requested(). */ + if (mbc->tris_per_mat[i] == NULL) { + mbc->tris_per_mat[i] = GPU_indexbuf_calloc(); + } /* Multiply by 3 because these are triangle indices. */ const int mat_start = data->tri_mat_start[i]; const int mat_end = data->tri_mat_end[i]; diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 21bcaa2d2b2..749e9e6bafb 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -206,6 +206,9 @@ void drw_state_set(DRWState state) case DRW_STATE_LOGIC_INVERT: blend = GPU_BLEND_INVERT; break; + case DRW_STATE_BLEND_ALPHA_UNDER_PREMUL: + blend = GPU_BLEND_ALPHA_UNDER_PREMUL; + break; default: blend = GPU_BLEND_NONE; break; |