diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 20:06:12 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 20:10:59 +0300 |
commit | 489b484b7b66a2c7be09291ff0b0793367ec06b9 (patch) | |
tree | 3edbc8784f3e6578820e3f3c041cd49e51a4437a | |
parent | b42adab3a2b89eb02c5829a389eab9b2921f13b7 (diff) |
Cleanup: GPUShaderShared: Complete vector support
Move some declaration from `GPU_shader_shared.h` to the main
common file and add missing vector declarations.
-rw-r--r-- | source/blender/gpu/GPU_shader_shared.h | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_shared_utils.h | 25 |
2 files changed, 19 insertions, 13 deletions
diff --git a/source/blender/gpu/GPU_shader_shared.h b/source/blender/gpu/GPU_shader_shared.h index 334b974acd8..eeca7ee6caa 100644 --- a/source/blender/gpu/GPU_shader_shared.h +++ b/source/blender/gpu/GPU_shader_shared.h @@ -25,13 +25,6 @@ # include "intern/gpu_shader_shared_utils.h" #endif -#ifdef __cplusplus -using blender::float2; -using blender::float3; -using blender::float4; -using blender::float4x4; -#endif - struct NodeLinkData { float4 colors[3]; /* bezierPts Is actually a float2, but due to std140 each element needs to be aligned to 16 diff --git a/source/blender/gpu/intern/gpu_shader_shared_utils.h b/source/blender/gpu/intern/gpu_shader_shared_utils.h index 9287011ddda..0d283fb1e66 100644 --- a/source/blender/gpu/intern/gpu_shader_shared_utils.h +++ b/source/blender/gpu/intern/gpu_shader_shared_utils.h @@ -73,31 +73,44 @@ # define bool3 bvec3 # define bool4 bvec4 -#else /* C */ +#else /* C / C++ */ # pragma once # include "BLI_assert.h" # ifdef __cplusplus # include "BLI_float4x4.hh" -# else +# include "BLI_math_vec_types.hh" +using blender::float2; +using blender::float3; +using blender::float4; +using blender::float4x4; +using blender::int2; +using blender::int3; +using blender::int4; +using blender::uint2; +using blender::uint3; +using blender::uint4; +using bool1 = int; +using bool2 = blender::int2; +using bool3 = blender::int3; +using bool4 = blender::int4; + +# else /* C */ typedef float float2[2]; typedef float float3[3]; typedef float float4[4]; typedef float float4x4[4][4]; -# endif typedef int int2[2]; typedef int int3[2]; typedef int int4[4]; typedef uint uint2[2]; typedef uint uint3[3]; typedef uint uint4[4]; -typedef int int2[2]; -typedef int int3[2]; -typedef int int4[4]; typedef int bool1; typedef int bool2[2]; typedef int bool3[2]; typedef int bool4[4]; +# endif #endif |