projects
/
demo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8d1aef1
)
added vku_destroy for previous buffers when next allocation fails
author
Eleni Maria Stea
<estea@igalia.com>
Sun, 11 Mar 2018 18:56:40 +0000
(20:56 +0200)
committer
Eleni Maria Stea
<estea@igalia.com>
Sun, 11 Mar 2018 18:56:40 +0000
(20:56 +0200)
src/vulkan/mesh-vk.cc
patch
|
blob
|
history
diff --git
a/src/vulkan/mesh-vk.cc
b/src/vulkan/mesh-vk.cc
index
2c55013
..
b495ea2
100644
(file)
--- a/
src/vulkan/mesh-vk.cc
+++ b/
src/vulkan/mesh-vk.cc
@@
-57,12
+57,17
@@
bool MeshVK::update_vertex_data()
if(!(vk_normals = vku_create_buffer(normals.size() * sizeof(Vec3),
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) {
if(!(vk_normals = vku_create_buffer(normals.size() * sizeof(Vec3),
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) {
+ vku_destroy_buffer(vk_vertices);
+
fprintf(stderr, "Failed to create the buffer for the normals.\n");
return false;
}
if(!(vk_tex_coords = vku_create_buffer(tex_coords.size() * sizeof(Vec2),
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) {
fprintf(stderr, "Failed to create the buffer for the normals.\n");
return false;
}
if(!(vk_tex_coords = vku_create_buffer(tex_coords.size() * sizeof(Vec2),
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT))) {
+ vku_destroy_buffer(vk_vertices);
+ vku_destroy_buffer(vk_normals);
+
fprintf(stderr,
"Failed to create the buffer for the texture coordinates.\n");
return false;
fprintf(stderr,
"Failed to create the buffer for the texture coordinates.\n");
return false;
@@
-70,13
+75,20
@@
bool MeshVK::update_vertex_data()
if(!(vk_indices = vku_create_buffer(indices.size() * 2,
VK_BUFFER_USAGE_INDEX_BUFFER_BIT))) {
if(!(vk_indices = vku_create_buffer(indices.size() * 2,
VK_BUFFER_USAGE_INDEX_BUFFER_BIT))) {
+ vku_destroy_buffer(vk_vertices);
+ vku_destroy_buffer(vk_normals);
+ vku_destroy_buffer(vk_tex_coords);
+
fprintf(stderr, "Failed to create the indices buffer.\n");
return false;
}
fprintf(stderr, "Failed to create the indices buffer.\n");
return false;
}
- //TODO XXX
/* map the buffers */
/* map the buffers */
+ //TODO this is going to change when we allocate one mem block for all data,
+ //for the moment we map each buffer memory block and we set the data
+
+
return true;
}
return true;
}