From 52a47ed302d636bf875e5038438f53d19a268ae4 Mon Sep 17 00:00:00 2001 From: Martin Opat Date: Thu, 9 Jan 2025 12:16:18 +0100 Subject: [PATCH] Fixed the newly defined math function to actually work with cuda --- src/linalg/mat.cu | 8 +------- src/linalg/mat.h | 6 +++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/linalg/mat.cu b/src/linalg/mat.cu index c42a8b3..c206cb1 100644 --- a/src/linalg/mat.cu +++ b/src/linalg/mat.cu @@ -53,10 +53,4 @@ __device__ float clamp(float value, float min, float max) { // Normalize a float to the range [0, 1] __device__ float normalize(float value, float min, float max) { return (value - min) / (max - min); -} - -// Interpolate between two values -template -__device__ T interpolate(T start, T end, float t) { - return start + t * (end - start); -} +} \ No newline at end of file diff --git a/src/linalg/mat.h b/src/linalg/mat.h index 559b8c5..4d2a1d5 100644 --- a/src/linalg/mat.h +++ b/src/linalg/mat.h @@ -10,8 +10,12 @@ __device__ unsigned int packUnorm4x8(float r, float g, float b, float a); __device__ float clamp(float value, float min, float max); __device__ float normalize(float value, float min, float max); +// Interpolate between two values template -__device__ float interpolate(T start, T end, float t); +__device__ T interpolate(T start, T end, float t) { + return start + t * (end - start); +} + #endif // MAT_H