From f48b46860b57b7caf3d804267952cd43ecec089a Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 2 Mar 2020 15:28:47 +0100 Subject: Cleanup: make remaining gpu headers work in C++ --- source/blender/gpu/GPU_attr_binding.h | 8 ++++++++ source/blender/gpu/GPU_batch.h | 8 ++++++++ source/blender/gpu/GPU_batch_presets.h | 8 ++++++++ source/blender/gpu/GPU_batch_utils.h | 12 ++++++++++-- source/blender/gpu/GPU_buffers.h | 8 ++++++++ source/blender/gpu/GPU_element.h | 8 ++++++++ source/blender/gpu/GPU_immediate.h | 8 ++++++++ source/blender/gpu/GPU_immediate_util.h | 8 ++++++++ source/blender/gpu/GPU_primitive.h | 8 ++++++++ source/blender/gpu/GPU_select.h | 8 ++++++++ source/blender/gpu/GPU_shader_interface.h | 8 ++++++++ source/blender/gpu/GPU_state.h | 8 ++++++++ source/blender/gpu/GPU_uniformbuffer.h | 8 ++++++++ source/blender/gpu/GPU_vertex_buffer.h | 8 ++++++++ source/blender/gpu/GPU_vertex_format.h | 8 ++++++++ source/blender/gpu/GPU_viewport.h | 8 ++++++++ 16 files changed, 130 insertions(+), 2 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/GPU_attr_binding.h b/source/blender/gpu/GPU_attr_binding.h index 2fa892bf805..8093e02cab6 100644 --- a/source/blender/gpu/GPU_attr_binding.h +++ b/source/blender/gpu/GPU_attr_binding.h @@ -28,6 +28,10 @@ #include "GPU_common.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct GPUAttrBinding { /** Store 4 bits for each of the 16 attributes. */ uint64_t loc_bits; @@ -35,4 +39,8 @@ typedef struct GPUAttrBinding { uint16_t enabled_bits; } GPUAttrBinding; +#ifdef __cplusplus +} +#endif + #endif /* __GPU_ATTR_BINDING_H__ */ diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index fc7dff5d99b..bc5f0ac1971 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -32,6 +32,10 @@ #include "GPU_shader_interface.h" #include "GPU_shader.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { GPU_BATCH_UNUSED, GPU_BATCH_READY_TO_FORMAT, @@ -241,4 +245,8 @@ void gpu_batch_exit(void); } \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* __GPU_BATCH_H__ */ diff --git a/source/blender/gpu/GPU_batch_presets.h b/source/blender/gpu/GPU_batch_presets.h index 55d2e461b30..ba8ad3c4990 100644 --- a/source/blender/gpu/GPU_batch_presets.h +++ b/source/blender/gpu/GPU_batch_presets.h @@ -30,6 +30,10 @@ #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /* gpu_batch_presets.c */ /* Replacement for gluSphere */ @@ -42,4 +46,8 @@ bool gpu_batch_presets_unregister(struct GPUBatch *preset_batch); void gpu_batch_presets_reset(void); void gpu_batch_presets_exit(void); +#ifdef __cplusplus +} +#endif + #endif /* __GPU_BATCH_PRESETS_H__ */ diff --git a/source/blender/gpu/GPU_batch_utils.h b/source/blender/gpu/GPU_batch_utils.h index 3d41b957a67..8f85ac59aa5 100644 --- a/source/blender/gpu/GPU_batch_utils.h +++ b/source/blender/gpu/GPU_batch_utils.h @@ -21,11 +21,15 @@ #ifndef __GPU_BATCH_UTILS_H__ #define __GPU_BATCH_UTILS_H__ -struct rctf; - #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" +#ifdef __cplusplus +extern "C" { +#endif + +struct rctf; + /* gpu_batch_utils.c */ struct GPUBatch *GPU_batch_tris_from_poly_2d_encoded( const uchar *polys_flat, uint polys_flat_len, const struct rctf *rect) ATTR_WARN_UNUSED_RESULT @@ -37,4 +41,8 @@ struct GPUBatch *GPU_batch_wire_from_poly_2d_encoded( /* Only use by draw manager. Use the presets function instead for interface. */ struct GPUBatch *gpu_batch_sphere(int lat_res, int lon_res) ATTR_WARN_UNUSED_RESULT; +#ifdef __cplusplus +} +#endif + #endif /* __GPU_BATCH_UTILS_H__ */ diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 2ed4ee44287..c4540cc1b1a 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -26,6 +26,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + struct BMesh; struct CCGElem; struct CCGKey; @@ -106,4 +110,8 @@ short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers); bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers); +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h index 996ade3e0f6..9aef8d6ed73 100644 --- a/source/blender/gpu/GPU_element.h +++ b/source/blender/gpu/GPU_element.h @@ -28,6 +28,10 @@ #include "GPU_primitive.h" +#ifdef __cplusplus +extern "C" { +#endif + #define GPU_TRACK_INDEX_RANGE 1 typedef enum { @@ -109,4 +113,8 @@ int GPU_indexbuf_primitive_len(GPUPrimType prim_type); } \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* __GPU_ELEMENT_H__ */ diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h index a8e5e9d0e04..39fa625f5cc 100644 --- a/source/blender/gpu/GPU_immediate.h +++ b/source/blender/gpu/GPU_immediate.h @@ -33,6 +33,10 @@ #include "GPU_immediate_util.h" #include "GPU_shader.h" +#ifdef __cplusplus +extern "C" { +#endif + /** Returns a cleared vertex format, ready for #add_attr. */ GPUVertFormat *immVertexFormat(void); @@ -146,4 +150,8 @@ void immActivate(void); void immDeactivate(void); void immDestroy(void); +#ifdef __cplusplus +} +#endif + #endif /* __GPU_IMMEDIATE_H__ */ diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h index 419c84c803e..1cf6475408f 100644 --- a/source/blender/gpu/GPU_immediate_util.h +++ b/source/blender/gpu/GPU_immediate_util.h @@ -23,6 +23,10 @@ #ifndef __GPU_IMMEDIATE_UTIL_H__ #define __GPU_IMMEDIATE_UTIL_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* Draw 2D rectangles (replaces glRect functions) */ /* caller is responsible for vertex format & shader */ void immRectf(uint pos, float x1, float y1, float x2, float y2); @@ -78,4 +82,8 @@ void imm_draw_cylinder_wire_3d( void imm_draw_cylinder_fill_3d( uint pos, float base, float top, float height, int slices, int stacks); +#ifdef __cplusplus +} +#endif + #endif /* __GPU_IMMEDIATE_UTIL_H__ */ diff --git a/source/blender/gpu/GPU_primitive.h b/source/blender/gpu/GPU_primitive.h index 0f4becc6bff..4cd6205c0d1 100644 --- a/source/blender/gpu/GPU_primitive.h +++ b/source/blender/gpu/GPU_primitive.h @@ -28,6 +28,10 @@ #include "GPU_common.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { GPU_PRIM_POINTS, GPU_PRIM_LINES, @@ -56,4 +60,8 @@ typedef enum { GPUPrimClass GPU_primtype_class(GPUPrimType); bool GPU_primtype_belongs_to_class(GPUPrimType, GPUPrimClass); +#ifdef __cplusplus +} +#endif + #endif /* __GPU_PRIMITIVE_H__ */ diff --git a/source/blender/gpu/GPU_select.h b/source/blender/gpu/GPU_select.h index c15d1b17448..41d580f9b6d 100644 --- a/source/blender/gpu/GPU_select.h +++ b/source/blender/gpu/GPU_select.h @@ -26,6 +26,10 @@ #include "BLI_sys_types.h" +#ifdef __cplusplus +extern "C" { +#endif + struct rcti; /* flags for mode of operation */ @@ -55,4 +59,8 @@ void GPU_select_cache_end(void); const uint *GPU_select_buffer_near(const uint *buffer, int hits); void GPU_select_buffer_stride_realign(const struct rcti *src, const struct rcti *dst, uint *r_buf); +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/gpu/GPU_shader_interface.h b/source/blender/gpu/GPU_shader_interface.h index e336aa53d24..c636135d75b 100644 --- a/source/blender/gpu/GPU_shader_interface.h +++ b/source/blender/gpu/GPU_shader_interface.h @@ -28,6 +28,10 @@ #include "GPU_common.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { GPU_UNIFORM_NONE = 0, /* uninitialized/unknown */ @@ -100,4 +104,8 @@ const GPUShaderInput *GPU_shaderinterface_attr(const GPUShaderInterface *, const void GPU_shaderinterface_add_batch_ref(GPUShaderInterface *, struct GPUBatch *); void GPU_shaderinterface_remove_batch_ref(GPUShaderInterface *, struct GPUBatch *); +#ifdef __cplusplus +} +#endif + #endif /* __GPU_SHADER_INTERFACE_H__ */ diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index efea02eb5a4..894ef22e963 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -21,6 +21,10 @@ #ifndef __GPU_STATE_H__ #define __GPU_STATE_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* These map directly to the GL_ blend functions, to minimize API add as needed*/ typedef enum eGPUBlendFunction { GPU_ONE, @@ -61,4 +65,8 @@ void GPU_finish(void); void GPU_logic_op_invert_set(bool enable); +#ifdef __cplusplus +} +#endif + #endif /* __GPU_STATE_H__ */ diff --git a/source/blender/gpu/GPU_uniformbuffer.h b/source/blender/gpu/GPU_uniformbuffer.h index 744bfd932dd..b221ae035d3 100644 --- a/source/blender/gpu/GPU_uniformbuffer.h +++ b/source/blender/gpu/GPU_uniformbuffer.h @@ -24,6 +24,10 @@ #ifndef __GPU_UNIFORMBUFFER_H__ #define __GPU_UNIFORMBUFFER_H__ +#ifdef __cplusplus +extern "C" { +#endif + struct ListBase; typedef struct GPUUniformBuffer GPUUniformBuffer; @@ -46,4 +50,8 @@ bool GPU_uniformbuffer_is_dirty(GPUUniformBuffer *ubo); #define GPU_UBO_BLOCK_NAME "nodeTree" +#ifdef __cplusplus +} +#endif + #endif /* __GPU_UNIFORMBUFFER_H__ */ diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h index 99d32f24cc3..fe45ec7b78b 100644 --- a/source/blender/gpu/GPU_vertex_buffer.h +++ b/source/blender/gpu/GPU_vertex_buffer.h @@ -28,6 +28,10 @@ #include "GPU_vertex_format.h" +#ifdef __cplusplus +extern "C" { +#endif + #define VRAM_USAGE 1 /** * How to create a #GPUVertBuf: @@ -138,4 +142,8 @@ uint GPU_vertbuf_get_memory_usage(void); } \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* __GPU_VERTEX_BUFFER_H__ */ diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h index b50665d0256..cbc20f37f27 100644 --- a/source/blender/gpu/GPU_vertex_format.h +++ b/source/blender/gpu/GPU_vertex_format.h @@ -30,6 +30,10 @@ #include "BLI_compiler_compat.h" #include "BLI_assert.h" +#ifdef __cplusplus +extern "C" { +#endif + #define GPU_VERT_ATTR_MAX_LEN 16 #define GPU_VERT_ATTR_MAX_NAMES 6 #define GPU_VERT_ATTR_NAMES_BUF_LEN 256 @@ -185,4 +189,8 @@ BLI_INLINE GPUPackedNormal GPU_normal_convert_i10_s3(const short data[3]) return n; } +#ifdef __cplusplus +} +#endif + #endif /* __GPU_VERTEX_FORMAT_H__ */ diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index 2d125032f47..986d9720ab9 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -31,6 +31,10 @@ #include "GPU_framebuffer.h" #include "GPU_texture.h" +#ifdef __cplusplus +extern "C" { +#endif + #define GPU_INFO_SIZE 512 /* IMA_MAX_RENDER_TEXT */ #define GLA_PIXEL_OFS 0.375f @@ -137,4 +141,8 @@ GPUTexture *GPU_viewport_texture_pool_query( bool GPU_viewport_engines_data_validate(GPUViewport *viewport, void **engine_handle_array); void GPU_viewport_cache_release(GPUViewport *viewport); +#ifdef __cplusplus +} +#endif + #endif // __GPU_VIEWPORT_H__ -- cgit v1.2.3