diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/gpu/GPU_framebuffer.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/gpu/GPU_framebuffer.h')
-rw-r--r-- | source/blender/gpu/GPU_framebuffer.h | 130 |
1 files changed, 75 insertions, 55 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index 77573b80a1b..3cc972fabfb 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -31,14 +31,14 @@ extern "C" { struct GPUTexture; typedef struct GPUAttachment { - struct GPUTexture *tex; - int mip, layer; + struct GPUTexture *tex; + int mip, layer; } GPUAttachment; typedef enum eGPUFrameBufferBits { - GPU_COLOR_BIT = (1 << 0), - GPU_DEPTH_BIT = (1 << 1), - GPU_STENCIL_BIT = (1 << 2), + GPU_COLOR_BIT = (1 << 0), + GPU_DEPTH_BIT = (1 << 1), + GPU_STENCIL_BIT = (1 << 2), } eGPUFrameBufferBits; typedef struct GPUFrameBuffer GPUFrameBuffer; @@ -63,25 +63,24 @@ bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256]); GPUFrameBuffer *GPU_framebuffer_active_get(void); -#define GPU_FRAMEBUFFER_FREE_SAFE(fb) do { \ - if (fb != NULL) { \ - GPU_framebuffer_free(fb); \ - fb = NULL; \ - } \ -} while (0) +#define GPU_FRAMEBUFFER_FREE_SAFE(fb) \ + do { \ + if (fb != NULL) { \ + GPU_framebuffer_free(fb); \ + fb = NULL; \ + } \ + } while (0) /* Framebuffer setup : You need to call GPU_framebuffer_bind for theses * to be effective. */ -void GPU_framebuffer_texture_attach( - GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int mip); +void GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int mip); void GPU_framebuffer_texture_layer_attach( - GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int layer, int mip); + GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int layer, int mip); void GPU_framebuffer_texture_cubeface_attach( - GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int face, int mip); + GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int face, int mip); void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, struct GPUTexture *tex); -void GPU_framebuffer_texture_detach_slot( - GPUFrameBuffer *fb, struct GPUTexture *tex, int type); +void GPU_framebuffer_texture_detach_slot(GPUFrameBuffer *fb, struct GPUTexture *tex, int type); /** * How to use #GPU_framebuffer_ensure_config(). @@ -102,79 +101,99 @@ void GPU_framebuffer_texture_detach_slot( * \note Make sure that the dimensions of your textures matches * otherwise you will have an invalid framebuffer error. */ -#define GPU_framebuffer_ensure_config(_fb, ...) do { \ - if (*(_fb) == NULL) { \ - *(_fb) = GPU_framebuffer_create(); \ - } \ - GPUAttachment config[] = __VA_ARGS__; \ - GPU_framebuffer_config_array(*(_fb), config, (sizeof(config) / sizeof(GPUAttachment))); \ -} while (0) +#define GPU_framebuffer_ensure_config(_fb, ...) \ + do { \ + if (*(_fb) == NULL) { \ + *(_fb) = GPU_framebuffer_create(); \ + } \ + GPUAttachment config[] = __VA_ARGS__; \ + GPU_framebuffer_config_array(*(_fb), config, (sizeof(config) / sizeof(GPUAttachment))); \ + } while (0) void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *config, int config_len); #define GPU_ATTACHMENT_NONE \ - { .tex = NULL, .layer = -1, .mip = 0, } + { \ + .tex = NULL, .layer = -1, .mip = 0, \ + } #define GPU_ATTACHMENT_LEAVE \ - { .tex = NULL, .layer = -1, .mip = -1, } + { \ + .tex = NULL, .layer = -1, .mip = -1, \ + } #define GPU_ATTACHMENT_TEXTURE(_tex) \ - { .tex = _tex, .layer = -1, .mip = 0, } + { \ + .tex = _tex, .layer = -1, .mip = 0, \ + } #define GPU_ATTACHMENT_TEXTURE_MIP(_tex, _mip) \ - { .tex = _tex, .layer = -1, .mip = _mip, } + { \ + .tex = _tex, .layer = -1, .mip = _mip, \ + } #define GPU_ATTACHMENT_TEXTURE_LAYER(_tex, _layer) \ - { .tex = _tex, .layer = _layer, .mip = 0, } + { \ + .tex = _tex, .layer = _layer, .mip = 0, \ + } #define GPU_ATTACHMENT_TEXTURE_LAYER_MIP(_tex, _layer, _mip) \ - { .tex = _tex, .layer = _layer, .mip = _mip, } + { \ + .tex = _tex, .layer = _layer, .mip = _mip, \ + } #define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_tex, _face) \ - { .tex = _tex, .layer = _face, .mip = 0, } + { \ + .tex = _tex, .layer = _face, .mip = 0, \ + } #define GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(_tex, _face, _mip) \ - { .tex = _tex, .layer = _face, .mip = _mip, } + { \ + .tex = _tex, .layer = _face, .mip = _mip, \ + } /* Framebuffer operations */ void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h); -void GPU_framebuffer_clear( - GPUFrameBuffer *fb, eGPUFrameBufferBits buffers, - const float clear_col[4], float clear_depth, unsigned int clear_stencil); +void GPU_framebuffer_clear(GPUFrameBuffer *fb, + eGPUFrameBufferBits buffers, + const float clear_col[4], + float clear_depth, + unsigned int clear_stencil); #define GPU_framebuffer_clear_color(fb, col) \ - GPU_framebuffer_clear(fb, GPU_COLOR_BIT, col, 0.0f, 0x00) + GPU_framebuffer_clear(fb, GPU_COLOR_BIT, col, 0.0f, 0x00) #define GPU_framebuffer_clear_depth(fb, depth) \ - GPU_framebuffer_clear(fb, GPU_DEPTH_BIT, NULL, depth, 0x00) + GPU_framebuffer_clear(fb, GPU_DEPTH_BIT, NULL, depth, 0x00) #define GPU_framebuffer_clear_color_depth(fb, col, depth) \ - GPU_framebuffer_clear(fb, GPU_COLOR_BIT | GPU_DEPTH_BIT, col, depth, 0x00) + GPU_framebuffer_clear(fb, GPU_COLOR_BIT | GPU_DEPTH_BIT, col, depth, 0x00) #define GPU_framebuffer_clear_stencil(fb, stencil) \ - GPU_framebuffer_clear(fb, GPU_STENCIL_BIT, NULL, 0.0f, stencil) + GPU_framebuffer_clear(fb, GPU_STENCIL_BIT, NULL, 0.0f, stencil) #define GPU_framebuffer_clear_depth_stencil(fb, depth, stencil) \ - GPU_framebuffer_clear(fb, GPU_DEPTH_BIT | GPU_STENCIL_BIT, NULL, depth, stencil) + GPU_framebuffer_clear(fb, GPU_DEPTH_BIT | GPU_STENCIL_BIT, NULL, depth, stencil) #define GPU_framebuffer_clear_color_depth_stencil(fb, col, depth, stencil) \ - GPU_framebuffer_clear(fb, GPU_COLOR_BIT | GPU_DEPTH_BIT | GPU_STENCIL_BIT, col, depth, stencil) + GPU_framebuffer_clear(fb, GPU_COLOR_BIT | GPU_DEPTH_BIT | GPU_STENCIL_BIT, col, depth, stencil) void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int w, int h, float *data); void GPU_framebuffer_read_color( - GPUFrameBuffer *fb, int x, int y, int w, int h, int channels, int slot, float *data); + GPUFrameBuffer *fb, int x, int y, int w, int h, int channels, int slot, float *data); -void GPU_framebuffer_blit( - GPUFrameBuffer *fb_read, int read_slot, - GPUFrameBuffer *fb_write, int write_slot, - eGPUFrameBufferBits blit_buffers); +void GPU_framebuffer_blit(GPUFrameBuffer *fb_read, + int read_slot, + GPUFrameBuffer *fb_write, + int write_slot, + eGPUFrameBufferBits blit_buffers); -void GPU_framebuffer_recursive_downsample( - GPUFrameBuffer *fb, int max_lvl, - void (*callback)(void *userData, int level), void *userData); +void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb, + int max_lvl, + void (*callback)(void *userData, int level), + void *userData); /* GPU OffScreen * - wrapper around framebuffer and texture for simple offscreen drawing */ GPUOffScreen *GPU_offscreen_create( - int width, int height, int samples, - bool depth, bool high_bitdepth, char err_out[256]); + int width, int height, int samples, bool depth, bool high_bitdepth, char err_out[256]); void GPU_offscreen_free(GPUOffScreen *ofs); void GPU_offscreen_bind(GPUOffScreen *ofs, bool save); void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore); @@ -184,9 +203,10 @@ int GPU_offscreen_width(const GPUOffScreen *ofs); int GPU_offscreen_height(const GPUOffScreen *ofs); struct GPUTexture *GPU_offscreen_color_texture(const GPUOffScreen *ofs); -void GPU_offscreen_viewport_data_get( - GPUOffScreen *ofs, - GPUFrameBuffer **r_fb, struct GPUTexture **r_color, struct GPUTexture **r_depth); +void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs, + GPUFrameBuffer **r_fb, + struct GPUTexture **r_color, + struct GPUTexture **r_depth); void GPU_clear_color(float red, float green, float blue, float alpha); void GPU_clear(eGPUFrameBufferBits flags); @@ -195,4 +215,4 @@ void GPU_clear(eGPUFrameBufferBits flags); } #endif -#endif /* __GPU_FRAMEBUFFER_H__ */ +#endif /* __GPU_FRAMEBUFFER_H__ */ |