summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL/SoftwareGLContext.cpp
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2021-12-23 02:38:20 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-24 05:10:28 -0800
commit39995548e4bd6f95994c2a728ee00ccc5bff9adb (patch)
tree5c7fe93bdce5dd83e4fbb15a71ec93c4791d9044 /Userland/Libraries/LibGL/SoftwareGLContext.cpp
parent1a758d7bf23b32da2ab3e442e2dd58a5b7731f55 (diff)
downloadserenity-39995548e4bd6f95994c2a728ee00ccc5bff9adb.zip
LibGL+LibSoftGPU: Add method to query device info
This adds a method `info()` to SoftGPU that returns the name of the hardware vendor and device name, as well as the number of texture untis. LibGL uses the returned texture unit count to initialize its internal texture unit array.
Diffstat (limited to 'Userland/Libraries/LibGL/SoftwareGLContext.cpp')
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index a894283819..72da04c7cb 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -58,7 +58,10 @@ static constexpr size_t TEXTURE_MATRIX_STACK_LIMIT = 8;
SoftwareGLContext::SoftwareGLContext(Gfx::Bitmap& frontbuffer)
: m_frontbuffer(frontbuffer)
, m_rasterizer(frontbuffer.size())
+ , m_device_info(m_rasterizer.info())
{
+ m_texture_units.resize(m_device_info.num_texture_units);
+ m_active_texture_unit = &m_texture_units[0];
}
Optional<ContextParameter> SoftwareGLContext::get_context_parameter(GLenum name)
@@ -333,9 +336,9 @@ GLubyte* SoftwareGLContext::gl_get_string(GLenum name)
switch (name) {
case GL_VENDOR:
- return reinterpret_cast<GLubyte*>(const_cast<char*>("The SerenityOS Developers"));
+ return reinterpret_cast<GLubyte*>(const_cast<char*>(m_device_info.vendor_name.characters()));
case GL_RENDERER:
- return reinterpret_cast<GLubyte*>(const_cast<char*>("SerenityOS OpenGL"));
+ return reinterpret_cast<GLubyte*>(const_cast<char*>(m_device_info.device_name.characters()));
case GL_VERSION:
return reinterpret_cast<GLubyte*>(const_cast<char*>("1.5"));
case GL_EXTENSIONS: