aboutsummaryrefslogtreecommitdiff
path: root/src/shader/wrap/compute_shader.h
blob: d7ef729facd8bee71f9bed248463bd6432792856 (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
28
29
30
31
32
33
34
35
36
#pragma once

#include <string>
#include <vector>

#include <GL/glew.h>

class ComputeShader {
private:
	const GLuint _id;

	bool _good;

public:
	struct Guard {
		const GLuint _id;

		Guard(GLuint id);
		~Guard();
	};

	Guard use() const;

	ComputeShader(const std::string& src);
	~ComputeShader();

	bool isGood() const;

	GLuint setUniform(const std::string& name, int value) const;
	GLuint setUniform(const std::string& name, GLuint value) const;
	GLuint setUniform(const std::string& name, float x, float y) const;

	void workOn(const std::vector<GLuint>& buffers) const;

	void dispatch(GLuint nX, GLuint nY) const;
};