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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-08-18 00:49:55 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-08-18 00:54:47 +0300
commit40b367479c6fe23d6f2b6d822f2d5266485619f3 (patch)
tree9b1e4e1b5ecd103d0f7edac451685efaf3942c52 /intern/cycles/subd
parentc0161a1bab71331f518bd5c8c1b091df7ee12074 (diff)
Code cleanup to use array.data() rather than &array[0].
These latter can cause MSVC debug asserts if the array is empty. With C++11 we'll be able to do this for std::vector later. This hopefully fixes an assert in the Cycles subdivision code.
Diffstat (limited to 'intern/cycles/subd')
-rw-r--r--intern/cycles/subd/subd_dice.cpp2
-rw-r--r--intern/cycles/subd/subd_patch_table.cpp4
-rw-r--r--intern/cycles/subd/subd_patch_table.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp
index 36981a20f3c..a1bd349b167 100644
--- a/intern/cycles/subd/subd_dice.cpp
+++ b/intern/cycles/subd/subd_dice.cpp
@@ -57,7 +57,7 @@ void EdgeDice::reserve(int num_verts)
Attribute *attr_vN = mesh->attributes.add(ATTR_STD_VERTEX_NORMAL);
- mesh_P = &mesh->verts[0];
+ mesh_P = mesh->verts.data();
mesh_N = attr_vN->data_float3();
}
diff --git a/intern/cycles/subd/subd_patch_table.cpp b/intern/cycles/subd/subd_patch_table.cpp
index 68ec1b2c6a6..62572efa88a 100644
--- a/intern/cycles/subd/subd_patch_table.cpp
+++ b/intern/cycles/subd/subd_patch_table.cpp
@@ -214,7 +214,7 @@ void PackedPatchTable::pack(Far::PatchTable* patch_table, int offset)
}
table.resize(total_size());
- uint* data = &table[0];
+ uint* data = table.data();
uint* array = data;
uint* index = array + num_arrays * PATCH_ARRAY_SIZE;
@@ -259,7 +259,7 @@ void PackedPatchTable::pack(Far::PatchTable* patch_table, int offset)
void PackedPatchTable::copy_adjusting_offsets(uint* dest, int doffset)
{
- uint* src = &table[0];
+ uint* src = table.data();
/* arrays */
for(int i = 0; i < num_arrays; i++) {
diff --git a/intern/cycles/subd/subd_patch_table.h b/intern/cycles/subd/subd_patch_table.h
index c8c7ecf9e47..3166a1691d8 100644
--- a/intern/cycles/subd/subd_patch_table.h
+++ b/intern/cycles/subd/subd_patch_table.h
@@ -43,7 +43,7 @@ namespace Far { struct PatchTable; }
#define PATCH_NODE_SIZE 1
struct PackedPatchTable {
- vector<uint> table;
+ array<uint> table;
size_t num_arrays;
size_t num_indices;