mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:07:44 +00:00
LibGL: Implement glGetShaderiv
This commit is contained in:
parent
69171e7a05
commit
424e0a2792
7 changed files with 87 additions and 0 deletions
|
@ -70,6 +70,48 @@ void GLContext::gl_compile_shader(GLuint shader)
|
|||
(void)it->value->compile();
|
||||
}
|
||||
|
||||
void GLContext::gl_get_shader(GLuint shader, GLenum pname, GLint* params)
|
||||
{
|
||||
RETURN_WITH_ERROR_IF(pname != GL_SHADER_TYPE
|
||||
&& pname != GL_DELETE_STATUS
|
||||
&& pname != GL_COMPILE_STATUS
|
||||
&& pname != GL_INFO_LOG_LENGTH
|
||||
&& pname != GL_SHADER_SOURCE_LENGTH,
|
||||
GL_INVALID_ENUM);
|
||||
|
||||
// FIXME: implement check "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."
|
||||
// FIXME: implement check "GL_INVALID_OPERATION is generated if pname is GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH, or GL_SHADER_SOURCE_LENGTH but a shader compiler is not supported."
|
||||
|
||||
auto it = m_allocated_shaders.find(shader);
|
||||
RETURN_WITH_ERROR_IF(it == m_allocated_shaders.end(), GL_INVALID_OPERATION);
|
||||
|
||||
switch (pname) {
|
||||
case GL_SHADER_TYPE:
|
||||
*params = it->value->type();
|
||||
break;
|
||||
|
||||
case GL_DELETE_STATUS:
|
||||
// FIXME: Return the actual delete status once we implement this missing feature
|
||||
*params = GL_FALSE;
|
||||
break;
|
||||
|
||||
case GL_COMPILE_STATUS:
|
||||
*params = it->value->compile_status() ? GL_TRUE : GL_FALSE;
|
||||
break;
|
||||
|
||||
case GL_INFO_LOG_LENGTH:
|
||||
*params = it->value->info_log_length();
|
||||
break;
|
||||
|
||||
case GL_SHADER_SOURCE_LENGTH:
|
||||
*params = it->value->combined_source_length();
|
||||
break;
|
||||
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
GLuint GLContext::gl_create_program()
|
||||
{
|
||||
GLuint program_name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue