mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:47:35 +00:00
LibGL: Implement glIsTexture
Required by Xash3D for the r_showtextures command, where it shows every allocated texture on screen. Description of glIsTexture from the spec: "glIsTexture returns GL_TRUE if texture is currently the name of a texture. If texture is zero, or is a non-zero value that is not currently the name of a texture, or if an error occurs, glIsTexture returns GL_FALSE. A name returned by glGenTextures, but not yet associated with a texture by calling glBindTexture, is not the name of a texture." https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glIsTexture.xhtml
This commit is contained in:
parent
adfb0846d2
commit
1fc611877f
5 changed files with 22 additions and 0 deletions
|
@ -1801,6 +1801,20 @@ void SoftwareGLContext::gl_bind_texture(GLenum target, GLuint texture)
|
|||
m_sampler_config_is_dirty = true;
|
||||
}
|
||||
|
||||
GLboolean SoftwareGLContext::gl_is_texture(GLuint texture)
|
||||
{
|
||||
RETURN_VALUE_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION, GL_FALSE);
|
||||
|
||||
if (texture == 0)
|
||||
return GL_FALSE;
|
||||
|
||||
auto it = m_allocated_textures.find(texture);
|
||||
if (it == m_allocated_textures.end())
|
||||
return GL_FALSE;
|
||||
|
||||
return it->value.is_null() ? GL_FALSE : GL_TRUE;
|
||||
}
|
||||
|
||||
void SoftwareGLContext::gl_active_texture(GLenum texture)
|
||||
{
|
||||
RETURN_WITH_ERROR_IF(texture < GL_TEXTURE0 || texture > GL_TEXTURE31, GL_INVALID_ENUM);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue