aboutsummaryrefslogtreecommitdiff
path: root/src/shader/wrap/compute_shader.h
blob: f2ab182cf89ade8e2d9701829b3bf00bf6e6049a (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
#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, float x, float y) const;
	GLuint setUniform(const std::string& name, unsigned int value) const;

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

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