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 | b11499939c7731e369be37c594142fd16e111ca7 (patch) | |
tree | fa2e40e3ef3b3428b3f535e11312539c0e538d4b /release/scripts | |
parent | 48fa029dd11bb09d4aca8e0a420781e3ec07a3a2 (diff) |
Python GPU: Replace part of the code that uses 'bgl' with 'gpu'
This is part of the process described in T80730.
The aim is to deprecate the bgl module.
Reviewed By: fclem, brecht, campbellbarton
Revision: D11147
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/bl_ui_utils/bug_report_url.py | 8 | ||||
-rw-r--r-- | release/scripts/modules/sys_info.py | 49 |
2 files changed, 20 insertions, 37 deletions
diff --git a/release/scripts/modules/bl_ui_utils/bug_report_url.py b/release/scripts/modules/bl_ui_utils/bug_report_url.py index 5676e0d6815..3fc57467dac 100644 --- a/release/scripts/modules/bl_ui_utils/bug_report_url.py +++ b/release/scripts/modules/bl_ui_utils/bug_report_url.py @@ -21,7 +21,7 @@ def url_prefill_from_blender(addon_info=None): import bpy - import bgl + import gpu import struct import platform import urllib.parse @@ -38,9 +38,9 @@ def url_prefill_from_blender(addon_info=None): ) fh.write( "Graphics card: %s %s %s\n" % ( - bgl.glGetString(bgl.GL_RENDERER), - bgl.glGetString(bgl.GL_VENDOR), - bgl.glGetString(bgl.GL_VERSION), + gpu.platform.renderer_get(), + gpu.platform.vendor_get(), + gpu.platform.version_get(), ) ) fh.write( diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 5116e0f0088..192fc1a201f 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -28,7 +28,7 @@ def write_sysinfo(filepath): import subprocess import bpy - import bgl + import gpu # pretty repr def prepr(v): @@ -190,46 +190,29 @@ def write_sysinfo(filepath): if bpy.app.background: output.write("\nOpenGL: missing, background mode\n") else: - output.write(title("OpenGL")) - version = bgl.glGetString(bgl.GL_RENDERER) - output.write("renderer:\t%r\n" % version) - output.write("vendor:\t\t%r\n" % (bgl.glGetString(bgl.GL_VENDOR))) - output.write("version:\t%r\n" % (bgl.glGetString(bgl.GL_VERSION))) + output.write(title("GPU")) + output.write("renderer:\t%r\n" % gpu.platform.renderer_get()) + output.write("vendor:\t\t%r\n" % gpu.platform.vendor_get()) + output.write("version:\t%r\n" % gpu.platform.version_get()) output.write("extensions:\n") - limit = bgl.Buffer(bgl.GL_INT, 1) - bgl.glGetIntegerv(bgl.GL_NUM_EXTENSIONS, limit) - - glext = [] - for i in range(limit[0]): - glext.append(bgl.glGetStringi(bgl.GL_EXTENSIONS, i)) - - glext = sorted(glext) + glext = sorted(gpu.capabilities.extensions_get()) for l in glext: output.write("\t%s\n" % l) - output.write(title("Implementation Dependent OpenGL Limits")) - bgl.glGetIntegerv(bgl.GL_MAX_ELEMENTS_VERTICES, limit) - output.write("Maximum DrawElements Vertices:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_ELEMENTS_INDICES, limit) - output.write("Maximum DrawElements Indices:\t%d\n" % limit[0]) + output.write(title("Implementation Dependent GPU Limits")) + output.write("Maximum Batch Vertices:\t%d\n" % gpu.capabilities.max_batch_vertices_get()) + output.write("Maximum Batch Indices:\t%d\n" % gpu.capabilities.max_batch_indices_get()) output.write("\nGLSL:\n") - bgl.glGetIntegerv(bgl.GL_MAX_VARYING_FLOATS, limit) - output.write("Maximum Varying Floats:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_VERTEX_ATTRIBS, limit) - output.write("Maximum Vertex Attributes:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_VERTEX_UNIFORM_COMPONENTS, limit) - output.write("Maximum Vertex Uniform Components:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, limit) - output.write("Maximum Fragment Uniform Components:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, limit) - output.write("Maximum Vertex Image Units:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_TEXTURE_IMAGE_UNITS, limit) - output.write("Maximum Fragment Image Units:\t%d\n" % limit[0]) - bgl.glGetIntegerv(bgl.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, limit) - output.write("Maximum Pipeline Image Units:\t%d\n" % limit[0]) + output.write("Maximum Varying Floats:\t%d\n" % gpu.capabilities.max_varying_floats_get()) + output.write("Maximum Vertex Attributes:\t%d\n" % gpu.capabilities.max_vertex_attribs_get()) + output.write("Maximum Vertex Uniform Components:\t%d\n" % gpu.capabilities.max_uniforms_vert_get()) + output.write("Maximum Fragment Uniform Components:\t%d\n" % gpu.capabilities.max_uniforms_frag_get()) + output.write("Maximum Vertex Image Units:\t%d\n" % gpu.capabilities.max_textures_vert_get()) + output.write("Maximum Fragment Image Units:\t%d\n" % gpu.capabilities.max_textures_frag_get()) + output.write("Maximum Pipeline Image Units:\t%d\n" % gpu.capabilities.max_textures_get()) if bpy.app.build_options.cycles: import cycles |