summaryrefslogtreecommitdiff
path: root/gfx/gl/shader-source.h
blob: f22cc3bd059b01fe62ce92bb0c490814260cb366 (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
27
#ifndef SHADER_SOURCE_H
#define SHADER_SOURCE_H

#include <GL/glew.h>
#include <glRef.hpp>

struct GLsource {
	using ShaderRef = glRef<GLuint, __glewCreateShader, __glewDeleteShader>;

	const GLchar * text;
	GLint len;
	GLuint type;

	[[nodiscard]] ShaderRef compile() const;
};

constexpr auto
constexpr_strlen(const GLchar * const s)
{
	std::size_t ch {};
	while (s[ch]) {
		ch++;
	}
	return ch;
}

#endif