From d47e565598f41ad9571e7ce112caaf9f776c0647 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 23 Jul 2015 16:05:00 +0200 Subject: Subsurf: Optimize edge drawing, now it uses VBOs. Also the refactor exposed an error where we requested too much memory from the video memory in general for all mesh types. Now we are back to normal :) --- source/blender/gpu/intern/gpu_buffers.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'source/blender/gpu/intern/gpu_buffers.c') diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 346e2292af9..7c71b32e5ca 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -613,24 +613,19 @@ static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type) { switch (type) { case GPU_BUFFER_VERTEX: - return sizeof(float) * gpu_buffer_type_settings[type].num_components * (dm->drawObject->tot_triangle_point + dm->drawObject->tot_loose_point); + return sizeof(float) * gpu_buffer_type_settings[type].num_components * (dm->drawObject->tot_loop_verts + dm->drawObject->tot_loose_point); case GPU_BUFFER_NORMAL: - return sizeof(short) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_triangle_point; + return sizeof(short) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts; case GPU_BUFFER_COLOR: - return sizeof(char) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_triangle_point; + return sizeof(char) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts; case GPU_BUFFER_UV: - return sizeof(float) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_triangle_point; + return sizeof(float) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts; case GPU_BUFFER_UV_TEXPAINT: - return sizeof(float) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_triangle_point; + return sizeof(float) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts; case GPU_BUFFER_EDGE: return sizeof(int) * gpu_buffer_type_settings[type].num_components * dm->drawObject->totedge; case GPU_BUFFER_UVEDGE: - /* each face gets 3 points, 3 edges per triangle, and - * each edge has its own, non-shared coords, so each - * tri corner needs minimum of 4 floats, quads used - * less so here we can over allocate and assume all - * tris. */ - return sizeof(int) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_triangle_point; + return sizeof(int) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts; case GPU_BUFFER_TRIANGLES: return sizeof(int) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_triangle_point; default: -- cgit v1.2.3