diff options
Diffstat (limited to 'source/blender/gpu/GPU_framebuffer.h')
-rw-r--r-- | source/blender/gpu/GPU_framebuffer.h | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index fcbe3ef2a78..9dc07fefd4e 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -21,18 +21,17 @@ * \ingroup gpu */ -#ifndef __GPU_FRAMEBUFFER_H__ -#define __GPU_FRAMEBUFFER_H__ +#pragma once + +#include "GPU_texture.h" #ifdef __cplusplus extern "C" { #endif -struct GPUTexture; - typedef struct GPUAttachment { struct GPUTexture *tex; - int mip, layer; + int layer, mip; } GPUAttachment; typedef enum eGPUFrameBufferBits { @@ -41,6 +40,12 @@ typedef enum eGPUFrameBufferBits { GPU_STENCIL_BIT = (1 << 2), } eGPUFrameBufferBits; +typedef enum eGPUBackBuffer { + GPU_BACKBUFFER = 0, + GPU_BACKBUFFER_RIGHT, + GPU_BACKBUFFER_LEFT, +} eGPUBackBuffer; + typedef struct GPUFrameBuffer GPUFrameBuffer; typedef struct GPUOffScreen GPUOffScreen; @@ -114,35 +119,35 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *confi #define GPU_ATTACHMENT_NONE \ { \ - .tex = NULL, .layer = -1, .mip = 0, \ + NULL, -1, 0, \ } #define GPU_ATTACHMENT_LEAVE \ { \ - .tex = NULL, .layer = -1, .mip = -1, \ + NULL, -1, -1, \ } #define GPU_ATTACHMENT_TEXTURE(_tex) \ { \ - .tex = _tex, .layer = -1, .mip = 0, \ + _tex, -1, 0, \ } #define GPU_ATTACHMENT_TEXTURE_MIP(_tex, _mip) \ { \ - .tex = _tex, .layer = -1, .mip = _mip, \ + _tex, -1, _mip, \ } #define GPU_ATTACHMENT_TEXTURE_LAYER(_tex, _layer) \ { \ - .tex = _tex, .layer = _layer, .mip = 0, \ + _tex, _layer, 0, \ } #define GPU_ATTACHMENT_TEXTURE_LAYER_MIP(_tex, _layer, _mip) \ { \ - .tex = _tex, .layer = _layer, .mip = _mip, \ + _tex, _layer, _mip, \ } #define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_tex, _face) \ { \ - .tex = _tex, .layer = _face, .mip = 0, \ + _tex, _face, 0, \ } #define GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(_tex, _face, _mip) \ { \ - .tex = _tex, .layer = _face, .mip = _mip, \ + _tex, _face, _mip, \ } /* Framebuffer operations */ @@ -176,8 +181,15 @@ void GPU_framebuffer_clear(GPUFrameBuffer *fb, void GPU_framebuffer_multi_clear(GPUFrameBuffer *fb, const float (*clear_cols)[4]); 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); +void GPU_framebuffer_read_color(GPUFrameBuffer *fb, + int x, + int y, + int w, + int h, + int channels, + int slot, + eGPUDataFormat format, + void *data); void GPU_framebuffer_blit(GPUFrameBuffer *fb_read, int read_slot, @@ -199,7 +211,7 @@ GPUOffScreen *GPU_offscreen_create( void GPU_offscreen_free(GPUOffScreen *ofs); void GPU_offscreen_bind(GPUOffScreen *ofs, bool save); void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore); -void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels); +void GPU_offscreen_read_pixels(GPUOffScreen *ofs, eGPUDataFormat type, void *pixels); void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y); int GPU_offscreen_width(const GPUOffScreen *ofs); int GPU_offscreen_height(const GPUOffScreen *ofs); @@ -214,8 +226,11 @@ void GPU_clear_color(float red, float green, float blue, float alpha); void GPU_clear_depth(float depth); void GPU_clear(eGPUFrameBufferBits flags); +void GPU_frontbuffer_read_pixels( + int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data); + +void GPU_backbuffer_bind(eGPUBackBuffer buffer); + #ifdef __cplusplus } #endif - -#endif /* __GPU_FRAMEBUFFER_H__ */ |