Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jbakker>2020-10-19 09:08:49 +0300
committerJeroen Bakker <jeroen@blender.org>2020-10-19 09:14:07 +0300
commit1ceb91d1b3947fda67a70a2eff785a964e625ca2 (patch)
tree1a5dec250336f208496248cfc84c8f4f97f9aedb /source/blender/draw/intern/draw_cache_extract_mesh.c
parentb2e067d98ccf43657404b917b13ad5275f1c96e2 (diff)
Fix T81167: Texture Painting with Paint mask enabled, (de)selecting faces causes a mess with texture slots
Issue caused by {9582797d4b50} in b2.90. The surface per material used an index buffer owned by the batch. These index buffers are created at the same time the surface tris index buffer was created. When a material per batch buffer was invalidated it used the surface tris index buffer rendering all materials on all surfaces making the last draw command render succeed. This patch stores the surface tris per material in the cache so they can be reused. There is also no need to use the `saved_elem_ranges` anymore as they are now part of the cache. The ugly bit of the implementation is that in `extract_tris_finish` the MeshBufferCache is retrieved. But as this part was already documented as a hack and it is something that is only used for final meshes. Other solutions would impact performance or made the fix not condensed (passing parameters that shouldn't be used). Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D9136
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh.c')
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c
index 0d0fadee1a4..c1f1c8b77e3 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -901,19 +901,19 @@ 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]) {
+ MeshBufferCache *mbc = &cache->final;
for (int i = 0; i < mr->mat_len; i++) {
/* 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];
const int start = mat_start * 3;
const int len = (mat_end - mat_start) * 3;
- GPUIndexBuf *sub_ibo = GPU_indexbuf_create_subrange(ibo, start, len);
- /* WARNING: We modify the #GPUBatch here! */
- GPU_batch_elembuf_set(cache->surface_per_mat[i], sub_ibo, true);
+ GPU_indexbuf_create_subrange_in_place(mbc->tris_per_mat[i], ibo, start, len);
}
}
MEM_freeN(data->tri_mat_start);