/* * Copyright (c) 2022, Stephan Unverwerth * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include #include #include namespace GL { class Shader final : public RefCounted { public: static NonnullRefPtr create(GLenum shader_type); void clear_sources() { m_sources.clear(); } ErrorOr add_source(StringView source_code); ErrorOr compile(); GLenum type() const { return m_type; } bool compile_status() const { return m_compile_status; } GLSL::ObjectFile const* object_file() const { return m_object_file.ptr(); } size_t info_log_length() const; size_t combined_source_length() const; private: explicit Shader(GLenum shader_type) : m_type { shader_type } { } Vector m_sources; GLenum m_type; bool m_compile_status { false }; Optional m_info_log; OwnPtr m_object_file; }; }