blob: 1e4a2ee5e98ae148eee96d6ca3704f47c91f5dd5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#pragma once
#include <glRef.h>
#include <glad/gl.h>
#include <string_view>
#include <thirdparty/ctre/include/ctre.hpp>
class Shader {
public:
using ShaderRef = glRef<GLuint, &glCreateShader, &glDeleteShader>;
constexpr Shader(const GLchar * text, GLuint type) :
text {text}, type {type}, lookups {ctre::search<R"(\bGL_[A-Z_]+\b)">(this->text)}
{
}
[[nodiscard]] ShaderRef compile() const;
private:
using Source = std::basic_string_view<GLchar>;
void checkShaderError(GLuint shader, GLuint flag, std::string_view errorMessage) const;
const Source text;
GLuint type;
bool lookups;
};
|