Cleanup: make remaining gpu headers work in C++

This commit is contained in:
Jacques Lucke 2020-03-02 15:28:47 +01:00
parent 360443a483
commit f48b46860b
16 changed files with 130 additions and 2 deletions

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -26,6 +26,10 @@
#include <stddef.h>
#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

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__