diff options
author | Germano Cavalcante <mano-wii> | 2021-05-14 17:15:00 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-05-14 18:26:40 +0300 |
commit | 3f4f109646059ee0780bb40dbd65b3bc8c3a8f3f (patch) | |
tree | 73f81510dbed74a3e5048d3aaa366d91b14d6e9f /source/blender/gpu/opengl/gl_backend.cc | |
parent | 079f415debd85b44f9ceaca17edfb82517240448 (diff) |
Python GPU: New 'capabilities' module
This module exposes the capabilities defined in the GPU module in C.
This will be useful for porting existing code in `bgl` to `gpu`.
Reviewed By: fclem, brecht, campbellbarton
Maniphest Tasks: T80730
Part of D11147
Diffstat (limited to 'source/blender/gpu/opengl/gl_backend.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_backend.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index a04d4be0e52..89bad1c9a4b 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -142,9 +142,9 @@ void GLBackend::platform_init() GPG.support_level = GPU_SUPPORT_LEVEL_LIMITED; } } + GPG.create_key(GPG.support_level, vendor, renderer, version); + GPG.create_gpu_name(vendor, renderer, version); } - GPG.create_key(GPG.support_level, vendor, renderer, version); - GPG.create_gpu_name(vendor, renderer, version); } void GLBackend::platform_exit() @@ -204,6 +204,11 @@ static bool detect_mip_render_workaround() return enable_workaround; } +const char *gl_extension_get(int i) +{ + return (char *)glGetStringi(GL_EXTENSIONS, i); +} + static void detect_workarounds() { const char *vendor = (const char *)glGetString(GL_VENDOR); @@ -419,6 +424,16 @@ void GLBackend::capabilities_init() glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_vert); glGetIntegerv(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_geom); glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &GCaps.max_textures); + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &GCaps.max_uniforms_vert); + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &GCaps.max_uniforms_frag); + glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &GCaps.max_batch_indices); + glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &GCaps.max_batch_vertices); + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &GCaps.max_vertex_attribs); + glGetIntegerv(GL_MAX_VARYING_FLOATS, &GCaps.max_varying_floats); + + glGetIntegerv(GL_NUM_EXTENSIONS, &GCaps.extensions_len); + GCaps.extension_get = gl_extension_get; + GCaps.mem_stats_support = GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo; GCaps.shader_image_load_store_support = GLEW_ARB_shader_image_load_store; /* GL specific capabilities. */ |