Blender V4.3
draw_manager_texture.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "draw_manager_c.hh"
10#include "draw_texture_pool.hh"
11
12#ifndef NDEBUG
13/* Maybe `gpu_texture.cc` is a better place for this. */
15{
16 /* Some formats do not work with frame-buffers. */
17 switch (format) {
18 /* Only add formats that are COMPATIBLE with FB.
19 * Generally they are multiple of 16bit. */
20 case GPU_R8:
21 case GPU_R8UI:
22 case GPU_R16F:
23 case GPU_R16I:
24 case GPU_R16UI:
25 case GPU_R16:
26 case GPU_R32F:
27 case GPU_R32UI:
28 case GPU_RG8:
29 case GPU_RG16:
30 case GPU_RG16F:
31 case GPU_RG16I:
32 case GPU_RG32F:
33 case GPU_RGB10_A2:
35 case GPU_RGBA8:
36 case GPU_RGBA16:
37 case GPU_RGBA16F:
38 case GPU_RGBA32F:
43 return true;
44 default:
45 return false;
46 }
47}
48#endif
49
68
71 eGPUTextureUsage usage,
72 DRWTextureFlag flags,
73 const float *fpixels)
74{
75 int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
76 GPUTexture *tex = GPU_texture_create_1d(__func__, w, mip_len, format, usage, fpixels);
78
79 return tex;
80}
81
82GPUTexture *DRW_texture_create_1d(int w,
84 DRWTextureFlag flags,
85 const float *fpixels)
86{
88}
89
91 int h,
93 eGPUTextureUsage usage,
94 DRWTextureFlag flags,
95 const float *fpixels)
96{
97 int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
98 GPUTexture *tex = GPU_texture_create_2d(__func__, w, h, mip_len, format, usage, fpixels);
100
101 return tex;
102}
103
105 int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
106{
107 return DRW_texture_create_2d_ex(w, h, format, GPU_TEXTURE_USAGE_GENERAL, flags, fpixels);
108}
109
111 int h,
112 int d,
114 eGPUTextureUsage usage,
115 DRWTextureFlag flags,
116 const float *fpixels)
117{
118 int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
119 GPUTexture *tex = GPU_texture_create_2d_array(
120 __func__, w, h, d, mip_len, format, usage, fpixels);
122
123 return tex;
124}
125
127 int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
128{
130 w, h, d, format, GPU_TEXTURE_USAGE_GENERAL, flags, fpixels);
131}
132
134 int h,
135 int d,
137 eGPUTextureUsage usage,
138 DRWTextureFlag flags,
139 const float *fpixels)
140{
141 int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
142 GPUTexture *tex = GPU_texture_create_3d(__func__, w, h, d, mip_len, format, usage, fpixels);
144
145 return tex;
146}
147
149 int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
150{
151 return DRW_texture_create_3d_ex(w, h, d, format, GPU_TEXTURE_USAGE_GENERAL, flags, fpixels);
152}
153
156 eGPUTextureUsage usage,
157 DRWTextureFlag flags,
158 const float *fpixels)
159{
160 int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
161 GPUTexture *tex = GPU_texture_create_cube(__func__, w, mip_len, format, usage, fpixels);
163 return tex;
164}
165
168 DRWTextureFlag flags,
169 const float *fpixels)
170{
172}
173
175 int d,
177 eGPUTextureUsage usage,
178 DRWTextureFlag flags,
179 const float *fpixels)
180{
181 int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
182 GPUTexture *tex = GPU_texture_create_cube_array(__func__, w, d, mip_len, format, usage, fpixels);
184 return tex;
185}
186
188 int w, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
189{
191}
192
194 int w, int h, eGPUTextureFormat format, eGPUTextureUsage usage, DrawEngineType *engine_type)
195{
197 GPUTexture *tex = DRW_texture_pool_query(
198 DST.vmempool->texture_pool, w, h, format, usage, engine_type);
199
200 return tex;
201}
202
204 int h,
206 DrawEngineType *engine_type)
207{
209}
210
212 eGPUTextureUsage usage,
213 DrawEngineType *engine_type)
214{
215 const float *size = DRW_viewport_size_get();
216 return DRW_texture_pool_query_2d_ex(int(size[0]), int(size[1]), format, usage, engine_type);
217}
218
224
227 eGPUTextureUsage usage,
228 DRWTextureFlag flags)
229{
230 if (*(tex) == nullptr) {
231 const float *size = DRW_viewport_size_get();
232 *(tex) = DRW_texture_create_2d_ex(int(size[0]), int(size[1]), format, usage, flags, nullptr);
233 }
234}
235
242
244 int w,
245 int h,
247 eGPUTextureUsage usage,
248 DRWTextureFlag flags)
249{
250 if (*(tex) == nullptr) {
251 *(tex) = DRW_texture_create_2d_ex(w, h, format, usage, flags, nullptr);
252 }
253}
254
256 GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags)
257{
259}
260
265
266void DRW_texture_free(GPUTexture *tex)
267{
269}
#define BLI_assert(a)
Definition BLI_assert.h:50
DRWTextureFlag
@ DRW_TEX_MIPMAP
@ DRW_TEX_WRAP
@ DRW_TEX_FILTER
@ DRW_TEX_COMPARE
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
GPUTexture * GPU_texture_create_1d(const char *name, int width, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_free(GPUTexture *texture)
void GPU_texture_anisotropic_filter(GPUTexture *texture, bool use_aniso)
GPUTexture * GPU_texture_create_cube_array(const char *name, int width, int layer_len, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_compare_mode(GPUTexture *texture, bool use_compare)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
eGPUTextureUsage
@ GPU_TEXTURE_USAGE_GENERAL
@ GPU_SAMPLER_EXTEND_MODE_REPEAT
@ GPU_SAMPLER_EXTEND_MODE_EXTEND
GPUTexture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_mipmap_mode(GPUTexture *texture, bool use_mipmap, bool use_filter)
GPUTexture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
eGPUTextureFormat
@ GPU_R16UI
@ GPU_R16I
@ GPU_DEPTH24_STENCIL8
@ GPU_RGB10_A2
@ GPU_RG16I
@ GPU_RG8
@ GPU_R16
@ GPU_R8UI
@ GPU_RGBA16
@ GPU_RG32F
@ GPU_R8
@ GPU_DEPTH_COMPONENT24
@ GPU_DEPTH_COMPONENT32F
@ GPU_DEPTH_COMPONENT16
GPUTexture * GPU_texture_create_cube(const char *name, int width, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_update_mipmap_chain(GPUTexture *texture)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
additional_info("compositor_sum_float_shared") .push_constant(Type additional_info("compositor_sum_float_shared") .push_constant(Type GPU_RGBA32F
const float * DRW_viewport_size_get()
DRWManager DST
GPUTexture * DRW_texture_create_1d(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_create_1d_ex(int w, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_pool_query_fullscreen_ex(eGPUTextureFormat format, eGPUTextureUsage usage, DrawEngineType *engine_type)
void DRW_texture_generate_mipmaps(GPUTexture *tex)
void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags)
void DRW_texture_free(GPUTexture *tex)
GPUTexture * DRW_texture_create_cube_array(int w, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_create_3d_ex(int w, int h, int d, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags, const float *fpixels)
void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
GPUTexture * DRW_texture_create_2d_array(int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_create_3d(int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_pool_query_fullscreen(eGPUTextureFormat format, DrawEngineType *engine_type)
GPUTexture * DRW_texture_pool_query_2d(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type)
static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format)
GPUTexture * DRW_texture_create_cube_ex(int w, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_pool_query_2d_ex(int w, int h, eGPUTextureFormat format, eGPUTextureUsage usage, DrawEngineType *engine_type)
GPUTexture * DRW_texture_create_2d_array_ex(int w, int h, int d, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_create_2d(int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
void DRW_texture_ensure_2d_ex(GPUTexture **tex, int w, int h, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags)
void DRW_texture_ensure_fullscreen_2d_ex(GPUTexture **tex, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags)
void DRW_texture_ensure_2d(GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags)
GPUTexture * DRW_texture_create_cube_array_ex(int w, int d, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_create_2d_ex(int w, int h, eGPUTextureFormat format, eGPUTextureUsage usage, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_create_cube(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture * DRW_texture_pool_query(DRWTexturePool *pool, int width, int height, eGPUTextureFormat format, eGPUTextureUsage usage, void *user)
DOF_TILES_FLATTEN_GROUP_SIZE coc_tx GPU_R11F_G11F_B10F
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
out_radiance out_gbuf_normal out_gbuf_closure2 GPU_RG16
SHADOW_TILEMAP_RES tiles_buf[] statistics_buf render_view_buf[SHADOW_VIEW_MAX] GPU_R32UI
RAYTRACE_GROUP_SIZE additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "eevee_sampling_data", "eevee_utility_texture", "eevee_hiz_data", "draw_view") .specialization_constant(Type RAYTRACE_GROUP_SIZE in_sh_0_tx in_sh_2_tx screen_normal_tx GPU_RGBA8
format
DRWTexturePool * texture_pool
DRWData * vmempool