From e053fade993204bbfaa98ced1b056e02226a3e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 15 May 2017 16:12:51 +0200 Subject: Mesh Batch Cache: get rid of the ORCO VBO data, and reconstruct it in shader. With only one MADD instruction we recover the orco data and reduce both the storage and the fetching cost of an attrib layer. --- source/blender/blenlib/BLI_math_vector.h | 1 + source/blender/blenlib/intern/math_vector_inline.c | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 3a34a199ba8..c1e5c1177cc 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -151,6 +151,7 @@ MINLINE void negate_v3_short(short r[3]); MINLINE void negate_v3_db(double r[3]); MINLINE void invert_v2(float r[2]); +MINLINE void invert_v3(float r[3]); MINLINE void abs_v2(float r[2]); MINLINE void abs_v2_v2(float r[2], const float a[2]); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 75bbfda3f5b..4f658ef015f 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -658,6 +658,14 @@ MINLINE void invert_v2(float r[2]) r[1] = 1.0f / r[1]; } +MINLINE void invert_v3(float r[3]) +{ + BLI_assert(!ELEM(0.0f, r[0], r[1], r[2])); + r[0] = 1.0f / r[0]; + r[1] = 1.0f / r[1]; + r[2] = 1.0f / r[2]; +} + MINLINE void abs_v2(float r[2]) { r[0] = fabsf(r[0]); -- cgit v1.2.3