1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

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.
This commit is contained in:
Stephan Unverwerth 2021-12-23 02:38:20 +01:00 committed by Brian Gianforcaro
parent 1a758d7bf2
commit 39995548e4
5 changed files with 40 additions and 7 deletions

View file

@ -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: