[Bf-blender-cvs] [88e6cb1ec08] temp-pbvh-vbos: temp-pbvh-vbos: Fix uvs attribute gpu alias

Joseph Eagar noreply at git.blender.org
Fri Sep 16 03:48:55 CEST 2022


Commit: 88e6cb1ec0821707a0d284fa718010476a226d60
Author: Joseph Eagar
Date:   Thu Sep 15 18:48:30 2022 -0700
Branches: temp-pbvh-vbos
https://developer.blender.org/rB88e6cb1ec0821707a0d284fa718010476a226d60

temp-pbvh-vbos: Fix uvs attribute gpu alias

Also removed some debug printfs.

===================================================================

M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_pbvh.cc

===================================================================

diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 6537490c06c..c02b4e6e1fd 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3369,7 +3369,7 @@ void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format,
 
   /* Active render layer name. */
   if (is_active_render) {
-    GPU_vertformat_alias_add(format, base_name);
+    GPU_vertformat_alias_add(format, cl->type == CD_MLOOPUV ? "a" : base_name);
   }
 
   /* Active display layer name. */
diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc
index addc8d131b4..91fa6864826 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -325,23 +325,14 @@ struct PBVHBatches {
     int existing_num = GPU_vertbuf_get_vertex_len(vbo.vert_buf);
     void *existing_data = GPU_vertbuf_get_data(vbo.vert_buf);
 
-    printf("%p:%p: vbo.vert_buf: %p\n", args->node, this, vbo.vert_buf);
-
     if (existing_data == NULL || existing_num != vert_count) {
       /* Allocate buffer if not allocated yet or size changed. */
       GPU_vertbuf_data_alloc(vbo.vert_buf, vert_count);
     }
 
-    void *gpu_data = GPU_vertbuf_get_data(vbo.vert_buf);
     GPUVertBufRaw access;
     GPU_vertbuf_attr_get_raw_data(vbo.vert_buf, 0, &access);
 
-    if (!gpu_data || !args->totprim) {
-      printf("%s: eek!\n", __func__);
-    }
-
-    //        [&](std::function<void(int x, int y, CCGElem *grid, CCGElem *elems[4], int i)> func)
-    //        {
     if (vbo.type == CD_PBVH_CO_TYPE) {
       foreach ([&](int x, int y, int grid_index, CCGElem *elems[4], int i) {
         float *co = CCG_elem_co(&args->ccg_key, elems[i]);
@@ -509,21 +500,14 @@ struct PBVHBatches {
     int existing_num = GPU_vertbuf_get_vertex_len(vbo.vert_buf);
     void *existing_data = GPU_vertbuf_get_data(vbo.vert_buf);
 
-    printf("%p:%p: vbo.vert_buf: %p\n", args->node, this, vbo.vert_buf);
-
     if (existing_data == NULL || existing_num != totvert) {
       /* Allocate buffer if not allocated yet or size changed. */
       GPU_vertbuf_data_alloc(vbo.vert_buf, totvert);
     }
 
-    void *gpu_data = GPU_vertbuf_get_data(vbo.vert_buf);
     GPUVertBufRaw access;
     GPU_vertbuf_attr_get_raw_data(vbo.vert_buf, 0, &access);
 
-    if (!gpu_data || !args->totprim) {
-      printf("%s: eek!\n", __func__);
-    }
-
     if (vbo.type == CD_PBVH_CO_TYPE) {
       foreach ([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) {
         *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = args->mvert[vertex_i].co;
@@ -608,8 +592,6 @@ struct PBVHBatches {
 
   ATTR_NO_OPT void update(PBVH_GPU_Args *args)
   {
-    printf("vbos size: %d\n", (int)vbos.size());
-
     check_index_buffers(args);
 
     for (PBVHVbo &vbo : vbos) {
@@ -650,8 +632,6 @@ struct PBVHBatches {
     int existing_num = GPU_vertbuf_get_vertex_len(vbo.vert_buf);
     void *existing_data = GPU_vertbuf_get_data(vbo.vert_buf);
 
-    printf("%p:%p: vbo.vert_buf: %p\n", args->node, this, vbo.vert_buf);
-
     int vert_count = tris_count * 3;
 
     if (existing_data == nullptr || existing_num != vert_count) {
@@ -659,14 +639,9 @@ struct PBVHBatches {
       GPU_vertbuf_data_alloc(vbo.vert_buf, vert_count);
     }
 
-    void *gpu_data = GPU_vertbuf_get_data(vbo.vert_buf);
     GPUVertBufRaw access;
     GPU_vertbuf_attr_get_raw_data(vbo.vert_buf, 0, &access);
 
-    if (!gpu_data || !args->totprim) {
-      printf("%s: eek!\n", __func__);
-    }
-
     switch (vbo.type) {
       case CD_PBVH_CO_TYPE:
         foreach (



More information about the Bf-blender-cvs mailing list