Blender  V2.93
gpu_capabilities.cc
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 
27 #include "DNA_userdef_types.h"
28 
29 #include "GPU_capabilities.h"
30 
31 #include "gpu_context_private.hh"
32 
34 
35 namespace blender::gpu {
36 
38 
39 }
40 
41 using namespace blender::gpu;
42 
43 /* -------------------------------------------------------------------- */
48 {
49  return GCaps.max_texture_size;
50 }
51 
52 int GPU_texture_size_with_limit(int res, bool limit_gl_texture_size)
53 {
54  int size = GPU_max_texture_size();
55  int reslimit = (limit_gl_texture_size && (U.glreslimit != 0)) ? min_ii(U.glreslimit, size) :
56  size;
57  return min_ii(reslimit, res);
58 }
59 
61 {
63 }
64 
66 {
67  return GCaps.max_textures_vert;
68 }
69 
71 {
72  return GCaps.max_textures_geom;
73 }
74 
76 {
77  return GCaps.max_textures_frag;
78 }
79 
81 {
82  return GCaps.max_textures;
83 }
84 
86 {
88 }
89 
91 {
93 }
94 
96 {
98 }
99 
101 {
102  /* Currently are the same drivers with the `unused_fb_slot` problem. */
103  return GCaps.broken_amd_driver;
104 }
105 
107 {
109 }
110 
112 {
114 }
115 
118 /* -------------------------------------------------------------------- */
123 {
124  return GCaps.mem_stats_support;
125 }
126 
127 void GPU_mem_stats_get(int *totalmem, int *freemem)
128 {
129  Context::get()->memory_statistics_get(totalmem, freemem);
130 }
131 
132 /* Return support for the active context + window. */
134 {
135  return Context::get()->front_right != nullptr;
136 }
137 
MINLINE int min_ii(int a, int b)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
static Context * get(void)
Definition: gpu_context.cc:88
virtual void memory_statistics_get(int *total_mem, int *free_mem)=0
int GPU_max_textures_vert(void)
bool GPU_shader_image_load_store_support(void)
int GPU_max_texture_size(void)
int GPU_max_textures_frag(void)
bool GPU_depth_blitting_workaround(void)
bool GPU_use_hq_normals_workaround(void)
bool GPU_stereo_quadbuffer_support(void)
int GPU_max_texture_layers(void)
int GPU_max_textures_geom(void)
void GPU_mem_stats_get(int *totalmem, int *freemem)
int GPU_max_textures(void)
int GPU_texture_size_with_limit(int res, bool limit_gl_texture_size)
bool GPU_use_main_context_workaround(void)
bool GPU_crappy_amd_driver(void)
bool GPU_mip_render_workaround(void)
bool GPU_mem_stats_supported(void)
GPUCapabilities GCaps