mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
~ | Shader hot reloading
This commit is contained in:
@ -115,3 +115,30 @@ void updateDataOnGPU(Scene &scene, std::vector<Buffer *> buffers)
|
||||
buffers[7]->update(&scene.getVolume(), sizeof(GPUVolume));
|
||||
buffers[8]->update(&scene.getDebug(), sizeof(GPUDebug));
|
||||
}
|
||||
|
||||
|
||||
void shaderDenoise(ShaderProgram &denoising_program, GPUDenoise &denoise, std::vector<GLuint> textures)
|
||||
{
|
||||
denoising_program.use();
|
||||
|
||||
denoising_program.set_vec2("u_resolution", glm::vec2(WIDTH, HEIGHT));
|
||||
denoising_program.set_float("u_c_phi", denoise.c_phi);
|
||||
denoising_program.set_float("u_p_phi", denoise.p_phi);
|
||||
denoising_program.set_float("u_n_phi", denoise.n_phi);
|
||||
|
||||
int output_texture = 0;
|
||||
int denoising_texture = 2;
|
||||
|
||||
for (int pass = 0; pass < denoise.pass ; ++pass)
|
||||
{
|
||||
glBindImageTexture(0, textures[output_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
glBindImageTexture(2, textures[denoising_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
|
||||
denoising_program.set_int("u_pass", pass);
|
||||
denoising_program.dispathCompute((WIDTH + 15) / 16, (HEIGHT + 15) / 16, 1);
|
||||
|
||||
std::swap(output_texture, denoising_texture);
|
||||
}
|
||||
|
||||
glBindImageTexture(0, textures[output_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
}
|
Reference in New Issue
Block a user