4#include "testing/testing.h"
23struct LatticeDeformTestContext {
32static void test_lattice_deform_init(LatticeDeformTestContext *ctx,
33 RandomNumberGenerator *rng,
38 for (
uint32_t index = 0; index < num_items; index++) {
39 ctx->coords[index][0] = (rng->get_float() - 0.5f) * 10;
40 ctx->coords[index][1] = (rng->get_float() - 0.5f) * 10;
41 ctx->coords[index][2] = (rng->get_float() - 0.5f) * 10;
44 STRNCPY(ctx->lattice.id.name,
"LTLattice");
47 ctx->ob_lattice.data = &ctx->lattice;
51 ctx->ob_mesh.data = &ctx->mesh;
56static void test_lattice_deform(LatticeDeformTestContext *ctx,
int32_t num_items)
58 for (
int i = 0; i < num_items; i++) {
59 float *co = &ctx->coords[i][0];
64static void test_lattice_deform_free(LatticeDeformTestContext *ctx)
74TEST(lattice_deform_performance, performance_no_dvert_1)
77 LatticeDeformTestContext ctx = {dna::shallow_zero_initialize()};
78 RandomNumberGenerator rng;
79 test_lattice_deform_init(&ctx, &rng, num_items);
80 test_lattice_deform(&ctx, num_items);
81 test_lattice_deform_free(&ctx);
83TEST(lattice_deform_performance, performance_no_dvert_1000)
86 LatticeDeformTestContext ctx = {dna::shallow_zero_initialize()};
87 RandomNumberGenerator rng;
88 test_lattice_deform_init(&ctx, &rng, num_items);
89 test_lattice_deform(&ctx, num_items);
90 test_lattice_deform_free(&ctx);
92TEST(lattice_deform_performance, performance_no_dvert_10000)
94 const int32_t num_items = 10000;
95 LatticeDeformTestContext ctx = {dna::shallow_zero_initialize()};
96 RandomNumberGenerator rng;
97 test_lattice_deform_init(&ctx, &rng, num_items);
98 test_lattice_deform(&ctx, num_items);
99 test_lattice_deform_free(&ctx);
101TEST(lattice_deform_performance, performance_no_dvert_100000)
103 const int32_t num_items = 100000;
104 LatticeDeformTestContext ctx = {dna::shallow_zero_initialize()};
105 RandomNumberGenerator rng;
106 test_lattice_deform_init(&ctx, &rng, num_items);
107 test_lattice_deform(&ctx, num_items);
108 test_lattice_deform_free(&ctx);
110TEST(lattice_deform_performance, performance_no_dvert_1000000)
112 const int32_t num_items = 1000000;
113 LatticeDeformTestContext ctx = {dna::shallow_zero_initialize()};
114 RandomNumberGenerator rng;
115 test_lattice_deform_init(&ctx, &rng, num_items);
116 test_lattice_deform(&ctx, num_items);
117 test_lattice_deform_free(&ctx);
119TEST(lattice_deform_performance, performance_no_dvert_10000000)
121 const int32_t num_items = 10000000;
122 LatticeDeformTestContext ctx = {dna::shallow_zero_initialize()};
123 RandomNumberGenerator rng;
124 test_lattice_deform_init(&ctx, &rng, num_items);
125 test_lattice_deform(&ctx, num_items);
126 test_lattice_deform_free(&ctx);
LatticeDeformData * BKE_lattice_deform_data_create(const Object *oblatt, const Object *ob) ATTR_WARN_UNUSED_RESULT
void BKE_lattice_deform_data_destroy(LatticeDeformData *lattice_deform_data)
void BKE_lattice_deform_data_eval_co(LatticeDeformData *lattice_deform_data, float co[3], float weight)
#define STRNCPY(dst, src)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
draw_view in_light_buf[] float
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
TEST(action_groups, ReconstructGroupsWithReordering)
IDTypeInitDataFunction init_data
IDTypeFreeDataFunction free_data