diff options
| author | Adrian Kummerlaender | 2018-12-16 13:58:20 +0100 | 
|---|---|---|
| committer | Adrian Kummerlaender | 2018-12-16 13:58:20 +0100 | 
| commit | 2eb7f9925315989735b4fb746cbd7bda6c9bd5bb (patch) | |
| tree | 67e94d6898eac507a8a7c2c6cccf7f875f2979dc /src/shader/wrap | |
| parent | 44f5ac32a68a617f93704d44c4339f7db13b323e (diff) | |
| download | compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.tar compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.tar.gz compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.tar.bz2 compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.tar.lz compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.tar.xz compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.tar.zst compustream-2eb7f9925315989735b4fb746cbd7bda6c9bd5bb.zip | |
Parametrize lattice resolution
Diffstat (limited to 'src/shader/wrap')
| -rw-r--r-- | src/shader/wrap/compute_shader.cc | 12 | ||||
| -rw-r--r-- | src/shader/wrap/compute_shader.h | 3 | 
2 files changed, 12 insertions, 3 deletions
| diff --git a/src/shader/wrap/compute_shader.cc b/src/shader/wrap/compute_shader.cc index c90c370..ab5d4c4 100644 --- a/src/shader/wrap/compute_shader.cc +++ b/src/shader/wrap/compute_shader.cc @@ -40,12 +40,20 @@ GLuint ComputeShader::setUniform(const std::string& name, float x, float y) cons  	return id;  } +GLuint ComputeShader::setUniform(const std::string& name, unsigned int value) const { +	GLuint id = util::getUniform(_id, name); +	glUniform1ui(id, value); +	return id; +} +  void ComputeShader::workOn(GLuint bufferA, GLuint bufferB, GLuint bufferC) const {  	glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, bufferA);  	glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, bufferB);  	glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, bufferC);  } -void ComputeShader::dispatch() const { -	glDispatchCompute(128, 128, 1); +void ComputeShader::dispatch(GLuint nX, GLuint nY) const { +	setUniform("nX", nX); +	setUniform("nY", nY); +	glDispatchCompute(nX, nY, 1);  } diff --git a/src/shader/wrap/compute_shader.h b/src/shader/wrap/compute_shader.h index 74c8270..816b925 100644 --- a/src/shader/wrap/compute_shader.h +++ b/src/shader/wrap/compute_shader.h @@ -26,7 +26,8 @@ public:  	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(GLuint bufferA, GLuint bufferB, GLuint bufferC) const; -	void dispatch() const; +	void dispatch(GLuint nX, GLuint nY) const;  }; | 
