1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 02:37:35 +00:00

LibGL: Implement glGetShaderiv

This commit is contained in:
Stephan Unverwerth 2022-08-28 16:19:42 +02:00 committed by Andrew Kaster
parent 69171e7a05
commit 424e0a2792
7 changed files with 87 additions and 0 deletions

View file

@ -28,4 +28,26 @@ ErrorOr<void> Shader::compile()
return {};
}
size_t Shader::info_log_length() const
{
if (!m_info_log.has_value())
return 0;
// Per the spec we return the size including the null terminator
return m_info_log.value().bytes().size() + 1;
}
size_t Shader::combined_source_length() const
{
if (m_sources.is_empty())
return 0;
size_t combined_size = 0;
for (auto source : m_sources)
combined_size += source.bytes().size();
// Per the spec we return the size including the null terminator
return combined_size + 1;
}
}

View file

@ -8,6 +8,7 @@
#include <AK/Error.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Optional.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
@ -27,6 +28,9 @@ public:
GLenum type() const { return m_type; }
bool compile_status() const { return m_compile_status; }
size_t info_log_length() const;
size_t combined_source_length() const;
private:
explicit Shader(GLenum shader_type)
: m_type { shader_type }
@ -36,6 +40,7 @@ private:
Vector<String> m_sources;
GLenum m_type;
bool m_compile_status { false };
Optional<String> m_info_log;
};
}