Blender  V2.93
GPU_viewport.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include <stdbool.h>
27 
28 #include "DNA_scene_types.h"
29 #include "DNA_vec_types.h"
30 
31 #include "GPU_framebuffer.h"
32 #include "GPU_texture.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define GPU_INFO_SIZE 512 /* IMA_MAX_RENDER_TEXT */
39 #define GLA_PIXEL_OFS 0.375f
40 
41 typedef struct GHash GHash;
42 typedef struct GPUViewport GPUViewport;
43 
44 struct GPUFrameBuffer;
45 
46 /* Contains memory pools information */
47 typedef struct ViewportMemoryPool {
64 
65 /* All FramebufferLists are just the same pointers with different names */
66 typedef struct FramebufferList {
69 
70 typedef struct TextureList {
71  struct GPUTexture *textures[0];
73 
74 typedef struct PassList {
75  struct DRWPass *passes[0];
77 
78 typedef struct StorageList {
79  void *storage[0]; /* custom structs from the engine */
81 
82 typedef struct ViewportEngineData {
83  void *engine_type;
84 
89  char info[GPU_INFO_SIZE];
90 
93  /* we may want to put this elsewhere */
95 
96  /* Profiling data */
97  double init_time;
98  double render_time;
101 
102 typedef struct ViewportEngineData_Info {
103  int fbl_len;
104  int txl_len;
105  int psl_len;
106  int stl_len;
108 
111 void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect);
113 void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect);
115  int view,
116  const rcti *rect,
117  bool display_colorspace,
118  bool do_overlay_merge);
119 void GPU_viewport_free(GPUViewport *viewport);
120 
122  ColorManagedViewSettings *view_settings,
123  ColorManagedDisplaySettings *display_settings,
124  float dither);
125 
126 void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs);
128  struct GPUOffScreen *ofs,
129  bool display_colorspace,
130  bool do_overlay_merge);
131 
134 
135 void *GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type);
136 void *GPU_viewport_engine_data_get(GPUViewport *viewport, void *engine_handle);
138 void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format);
140 void GPU_viewport_size_get(const GPUViewport *viewport, int size[2]);
141 void GPU_viewport_size_set(GPUViewport *viewport, const int size[2]);
142 void GPU_viewport_active_view_set(GPUViewport *viewport, int view);
143 
144 /* Profiling */
145 double *GPU_viewport_cache_time_get(GPUViewport *viewport);
146 
147 void GPU_viewport_tag_update(GPUViewport *viewport);
148 bool GPU_viewport_do_update(GPUViewport *viewport);
149 
151 
152 /* Texture pool */
154  GPUViewport *viewport, void *engine, int width, int height, int format);
155 
156 bool GPU_viewport_engines_data_validate(GPUViewport *viewport, void **engine_handle_array);
158 
161 
162 #ifdef __cplusplus
163 }
164 #endif
unsigned int uint
Definition: BLI_sys_types.h:83
static AppView * view
struct GPUFrameBuffer GPUFrameBuffer
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
struct GPUUniformBuf GPUUniformBuf
double * GPU_viewport_cache_time_get(GPUViewport *viewport)
Definition: gpu_viewport.c:351
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
Definition: gpu_viewport.c:495
struct ViewportEngineData_Info ViewportEngineData_Info
GPUTexture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
Definition: gpu_viewport.c:917
void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
Definition: gpu_viewport.c:867
void GPU_viewport_active_view_set(GPUViewport *viewport, int view)
Definition: gpu_viewport.c:321
void GPU_viewport_colorspace_set(GPUViewport *viewport, ColorManagedViewSettings *view_settings, ColorManagedDisplaySettings *display_settings, float dither)
Definition: gpu_viewport.c:557
void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, bool display_colorspace, bool do_overlay_merge)
Definition: gpu_viewport.c:805
void * GPU_viewport_engine_data_get(GPUViewport *viewport, void *engine_handle)
Definition: gpu_viewport.c:294
struct DRWInstanceDataList * GPU_viewport_instance_data_list_get(GPUViewport *viewport)
Definition: gpu_viewport.c:311
GPUTexture * GPU_viewport_texture_pool_query(GPUViewport *viewport, void *engine, int width, int height, int format)
Definition: gpu_viewport.c:360
struct GPUFrameBuffer * GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport)
bool GPU_viewport_engines_data_validate(GPUViewport *viewport, void **engine_handle_array)
Definition: gpu_viewport.c:428
GPUViewport * GPU_viewport_create(void)
Definition: gpu_viewport.c:144
struct PassList PassList
bool GPU_viewport_do_update(GPUViewport *viewport)
Definition: gpu_viewport.c:137
void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs, bool display_colorspace, bool do_overlay_merge)
Definition: gpu_viewport.c:875
GPUViewport * GPU_viewport_stereo_create(void)
Definition: gpu_viewport.c:156
struct FramebufferList FramebufferList
void * GPU_viewport_texture_list_get(GPUViewport *viewport)
Definition: gpu_viewport.c:331
void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs)
Definition: gpu_viewport.c:536
void GPU_viewport_free(GPUViewport *viewport)
Definition: gpu_viewport.c:978
struct GPUFrameBuffer * GPU_viewport_framebuffer_default_get(GPUViewport *viewport)
void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format)
Definition: gpu_viewport.c:604
void GPU_viewport_size_set(GPUViewport *viewport, const int size[2])
Definition: gpu_viewport.c:346
void GPU_viewport_tag_update(GPUViewport *viewport)
Definition: gpu_viewport.c:132
void * GPU_viewport_framebuffer_list_get(GPUViewport *viewport)
Definition: gpu_viewport.c:326
void GPU_viewport_cache_release(GPUViewport *viewport)
Definition: gpu_viewport.c:439
void GPU_viewport_unbind(GPUViewport *viewport)
struct ViewportEngineData ViewportEngineData
struct ViewportMemoryPool ViewportMemoryPool
struct StorageList StorageList
void * GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type)
Definition: gpu_viewport.c:222
ViewportMemoryPool * GPU_viewport_mempool_get(GPUViewport *viewport)
Definition: gpu_viewport.c:306
struct TextureList TextureList
void GPU_viewport_size_get(const GPUViewport *viewport, int size[2])
Definition: gpu_viewport.c:336
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
format
Definition: logImageCore.h:47
struct GPUFrameBuffer * framebuffers[0]
Definition: GPU_viewport.h:67
struct DRWPass * passes[0]
Definition: GPU_viewport.h:75
void * storage[0]
Definition: GPU_viewport.h:79
struct GPUTexture * textures[0]
Definition: GPU_viewport.h:71
TextureList * txl
Definition: GPU_viewport.h:86
FramebufferList * fbl
Definition: GPU_viewport.h:85
StorageList * stl_stereo
Definition: GPU_viewport.h:92
StorageList * stl
Definition: GPU_viewport.h:88
TextureList * txl_stereo
Definition: GPU_viewport.h:91
struct DRWTextStore * text_draw_cache
Definition: GPU_viewport.h:94
char info[GPU_INFO_SIZE]
Definition: GPU_viewport.h:89
struct BLI_memblock * commands_small
Definition: GPU_viewport.h:49
struct BLI_memblock * obmats
Definition: GPU_viewport.h:51
struct BLI_memblock * cullstates
Definition: GPU_viewport.h:53
struct BLI_memblock * views
Definition: GPU_viewport.h:56
struct GPUUniformBuf ** matrices_ubo
Definition: GPU_viewport.h:59
struct BLI_memblock * obinfos
Definition: GPU_viewport.h:52
struct BLI_memblock * passes
Definition: GPU_viewport.h:57
struct BLI_memblock * images
Definition: GPU_viewport.h:58
struct GHash * obattrs_ubo_pool
Definition: GPU_viewport.h:61
struct BLI_memblock * callbuffers
Definition: GPU_viewport.h:50
struct BLI_memblock * shgroups
Definition: GPU_viewport.h:54
struct BLI_memblock * commands
Definition: GPU_viewport.h:48
struct GPUUniformBuf ** obinfos_ubo
Definition: GPU_viewport.h:60
struct BLI_memblock * uniforms
Definition: GPU_viewport.h:55