diff options
Diffstat (limited to 'source/blender/gpu/GPU_framebuffer.h')
-rw-r--r-- | source/blender/gpu/GPU_framebuffer.h | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index e1526bf50a6..61833a9a65f 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -19,6 +19,13 @@ /** \file * \ingroup gpu + * + * GPU Framebuffer + * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice + * multiple FBO's may be created. + * - actual FBO creation & config is deferred until GPU_framebuffer_bind or + * GPU_framebuffer_check_valid to allow creation & config while another + * opengl context is bound (since FBOs are not shared between ogl contexts). */ #pragma once @@ -41,9 +48,8 @@ typedef enum eGPUFrameBufferBits { } eGPUFrameBufferBits; typedef enum eGPUBackBuffer { - GPU_BACKBUFFER = 0, + GPU_BACKBUFFER_LEFT = 0, GPU_BACKBUFFER_RIGHT, - GPU_BACKBUFFER_LEFT, } eGPUBackBuffer; /** Opaque pointer hiding blender::gpu::FrameBuffer. */ @@ -53,15 +59,6 @@ typedef struct GPUFrameBuffer { typedef struct GPUOffScreen GPUOffScreen; -/* GPU Framebuffer - * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice - * multiple FBO's may be created, to get around limitations on the number - * of attached textures and the dimension requirements. - * - actual FBO creation & config is deferred until GPU_framebuffer_bind or - * GPU_framebuffer_check_valid to allow creation & config while another - * opengl context is bound (since FBOs are not shared between ogl contexts). - */ - GPUFrameBuffer *GPU_framebuffer_create(void); void GPU_framebuffer_free(GPUFrameBuffer *fb); void GPU_framebuffer_bind(GPUFrameBuffer *fb); @@ -72,6 +69,7 @@ bool GPU_framebuffer_bound(GPUFrameBuffer *fb); bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256]); GPUFrameBuffer *GPU_framebuffer_active_get(void); +GPUFrameBuffer *GPU_framebuffer_back_get(void); #define GPU_FRAMEBUFFER_FREE_SAFE(fb) \ do { \ @@ -84,13 +82,10 @@ GPUFrameBuffer *GPU_framebuffer_active_get(void); /* Framebuffer setup : You need to call GPU_framebuffer_bind for these * to be effective. */ -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); -void GPU_framebuffer_texture_cubeface_attach( - GPUFrameBuffer *fb, struct GPUTexture *tex, int slot, int face, int mip); +void GPU_framebuffer_texture_attach_ex(GPUFrameBuffer *gpu_fb, + GPUAttachment attachement, + int slot); void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, struct GPUTexture *tex); -void GPU_framebuffer_texture_detach_slot(GPUFrameBuffer *fb, struct GPUTexture *tex, int type); /** * How to use #GPU_framebuffer_ensure_config(). @@ -155,6 +150,16 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *confi _tex, _face, _mip, \ } +#define GPU_framebuffer_texture_attach(_fb, _texture, _slot, _mip) \ + GPU_framebuffer_texture_attach_ex( \ + _fb, (GPUAttachment)GPU_ATTACHMENT_TEXTURE_MIP(_texture, _mip), _slot) +#define GPU_framebuffer_texture_layer_attach(_fb, _texture, _slot, layer, _mip) \ + GPU_framebuffer_texture_attach_ex( \ + _fb, (GPUAttachment)GPU_ATTACHMENT_TEXTURE_LAYER_MIP(_texture, layer, _mip), _slot) +#define GPU_framebuffer_texture_cubeface_attach(_fb, _texture, _slot, face, _mip) \ + GPU_framebuffer_texture_attach_ex( \ + _fb, (GPUAttachment)GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(_texture, face, _mip), _slot) + /* Framebuffer operations */ void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h); |