Blender V4.5
gpu_capabilities.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11
12#include "DNA_userdef_types.h" /* For `U.glreslimit`. */
13
14#include "GPU_capabilities.hh"
15
17
19
20namespace blender::gpu {
21
23
24}
25
26using namespace blender::gpu;
27
28/* -------------------------------------------------------------------- */
31
33{
34 return GCaps.max_texture_size;
35}
36
38{
39 return GCaps.max_texture_3d_size;
40}
41
43{
45 int reslimit = (U.glreslimit != 0) ? min_ii(U.glreslimit, size) : size;
46 return min_ii(reslimit, res);
47}
48
50{
51 return GCaps.max_texture_layers;
52}
53
55{
56 return GCaps.max_textures_vert;
57}
58
60{
61 return GCaps.max_textures_geom;
62}
63
65{
66 return GCaps.max_textures_frag;
67}
68
70{
71 return GCaps.max_textures;
72}
73
75{
76 return GCaps.max_images;
77}
78
80{
81 return GCaps.max_work_group_count[index];
82}
83
85{
86 return GCaps.max_work_group_size[index];
87}
88
90{
91 return GCaps.max_uniforms_vert;
92}
93
95{
96 return GCaps.max_uniforms_frag;
97}
98
100{
101 return GCaps.max_batch_indices;
102}
103
105{
106 return GCaps.max_batch_vertices;
107}
108
110{
111 return GCaps.max_vertex_attribs;
112}
113
115{
116 return GCaps.max_varying_floats;
117}
118
120{
121 return GCaps.extensions_len;
122}
123
124const char *GPU_extension_get(int i)
125{
126 return GCaps.extension_get ? GCaps.extension_get(i) : "\0";
127}
128
130{
131 return GCaps.max_samplers;
132}
133
135{
136 return GCaps.use_subprocess_shader_compilations;
137}
138
140{
141 return GCaps.max_parallel_compilations;
142}
143
145{
146 return GCaps.mip_render_workaround;
147}
148
150{
151 return GCaps.depth_blitting_workaround;
152}
153
155{
156 return GCaps.use_main_context_workaround;
157}
158
160{
161 /* Currently are the same drivers with the `unused_fb_slot` problem. */
162 return GCaps.broken_amd_driver;
163}
164
166{
167 return GCaps.use_hq_normals_workaround;
168}
169
171{
172 return GCaps.stencil_clasify_buffer_workaround;
173}
174
176{
177 return GCaps.node_link_instancing_workaround;
178}
179
181{
182 return GCaps.render_pass_workaround;
183}
184
186{
187 return GCaps.geometry_shader_support;
188}
189
191{
192 return GCaps.shader_draw_parameters_support;
193}
194
196{
197 return GCaps.hdr_viewport_support;
198}
199
201{
202 return GCaps.stencil_export_support;
203}
204
206{
207 return GCaps.clip_control_support;
208}
209
211{
212 return GCaps.max_shader_storage_buffer_bindings;
213}
214
216{
217 return GCaps.max_compute_shader_storage_blocks;
218}
219
221{
222 return GCaps.minimum_per_vertex_stride;
223}
224
226{
227 return GCaps.max_storage_buffer_size;
228}
229
231{
232 return GCaps.storage_buffer_alignment;
233}
234
236
237/* -------------------------------------------------------------------- */
240
242{
243 return GCaps.mem_stats_support;
244}
245
246void GPU_mem_stats_get(int *r_totalmem, int *r_freemem)
247{
248 Context::get()->memory_statistics_get(r_totalmem, r_freemem);
249}
250
252{
253 return Context::get()->front_right != nullptr;
254}
255
257
258/* -------------------------------------------------------------------- */
261
263{
264 BLI_assert(GCaps.max_parallel_compilations == -1);
265 GCaps.max_parallel_compilations = count;
266}
267
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE int min_ii(int a, int b)
#define U
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
static Context * get()
virtual void memory_statistics_get(int *r_total_mem, int *r_free_mem)=0
int GPU_max_batch_indices()
int GPU_minimum_per_vertex_stride()
int GPU_max_textures()
int GPU_max_samplers()
bool GPU_hdr_support()
int GPU_max_work_group_size(int index)
bool GPU_clip_control_support()
bool GPU_crappy_amd_driver()
int GPU_max_texture_3d_size()
int GPU_max_parallel_compilations()
int GPU_max_texture_layers()
void GPU_mem_stats_get(int *r_totalmem, int *r_freemem)
int GPU_max_images()
int GPU_max_uniforms_vert()
int GPU_max_shader_storage_buffer_bindings()
int GPU_texture_size_with_limit(int res)
bool GPU_geometry_shader_support()
bool GPU_depth_blitting_workaround()
int GPU_max_work_group_count(int index)
bool GPU_stencil_export_support()
bool GPU_mem_stats_supported()
bool GPU_stereo_quadbuffer_support()
int GPU_max_textures_geom()
bool GPU_use_main_context_workaround()
int GPU_max_textures_frag()
bool GPU_vulkan_render_pass_workaround()
bool GPU_use_subprocess_compilation()
size_t GPU_storage_buffer_alignment()
int GPU_max_vertex_attribs()
bool GPU_use_hq_normals_workaround()
const char * GPU_extension_get(int i)
size_t GPU_max_storage_buffer_size()
int GPU_max_varying_floats()
int GPU_max_compute_shader_storage_blocks()
bool GPU_node_link_instancing_workaround()
int GPU_max_batch_vertices()
int GPU_extensions_len()
int GPU_max_uniforms_frag()
bool GPU_stencil_clasify_buffer_workaround()
bool GPU_mip_render_workaround()
int GPU_max_texture_size()
bool GPU_shader_draw_parameters_support()
void GPU_compilation_subprocess_override_set(int count)
int GPU_max_textures_vert()
int count
GPUCapabilities GCaps
i
Definition text_draw.cc:230