From d2e9de93b8d1d6cd45abce8164d0f92af8f636d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 8 Sep 2020 03:34:47 +0200 Subject: GPU: Cleanup implementation casts - Use the syntactic wrap/unwrap method to make code more readable. - Update comment about hidden struct behind opaque types. - Cleanup GPUDrawList type. --- source/blender/gpu/intern/gpu_shader_private.hh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/blender/gpu/intern/gpu_shader_private.hh') diff --git a/source/blender/gpu/intern/gpu_shader_private.hh b/source/blender/gpu/intern/gpu_shader_private.hh index fa086892760..b7acc0f9353 100644 --- a/source/blender/gpu/intern/gpu_shader_private.hh +++ b/source/blender/gpu/intern/gpu_shader_private.hh @@ -23,8 +23,8 @@ #include "BLI_span.hh" #include "GPU_shader.h" -#include "gpu_vertex_buffer_private.hh" #include "gpu_shader_interface.hh" +#include "gpu_vertex_buffer_private.hh" namespace blender { namespace gpu { @@ -73,6 +73,20 @@ class Shader { void print_errors(Span sources, char *log, const char *stage); }; +/* Syntacting suggar. */ +static inline GPUShader *wrap(Shader *vert) +{ + return reinterpret_cast(vert); +} +static inline Shader *unwrap(GPUShader *vert) +{ + return reinterpret_cast(vert); +} +static inline const Shader *unwrap(const GPUShader *vert) +{ + return reinterpret_cast(vert); +} + } // namespace gpu } // namespace blender -- cgit v1.2.3