renderer.set_texture("rotate", &rotate_lookup, &nearest_sampler);
renderer.set_shader_program(&occlude_shader, &shdata);
+ renderer.set_pipeline_key(this);
renderer.set_framebuffer(&occlude_target.get_framebuffer());
renderer.clear(0);
quad.draw(renderer);
+ renderer.set_pipeline_key(this, 1);
renderer.set_framebuffer(out_fbo);
renderer.clear(0);
renderer.set_shader_program(&combine_shader);
for(unsigned i=0; i<2; ++i)
{
Renderer::Push push2(renderer);
+ renderer.set_pipeline_key(this, i);
renderer.set_framebuffer(&target[i]->get_framebuffer());
renderer.clear(0);
renderer.set_texture("source", (i ? &target[0]->get_target_texture(COLOR_ATTACHMENT) : &src), &nearest_sampler);
quad.draw(renderer);
}
+ renderer.set_pipeline_key(this, 2);
renderer.clear(0);
renderer.set_texture("source", &src, &nearest_sampler);
renderer.set_texture("blurred", &target[1]->get_target_texture(COLOR_ATTACHMENT), &linear_sampler);
void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Texture2D &)
{
Renderer::Push push(renderer);
+ renderer.set_pipeline_key(this);
renderer.clear(0);
renderer.set_shader_program(&shprog, &shdata);
renderer.set_texture("source", &color_buf, &nearest_sampler);
environment.render(renderer);
}
+ renderer.set_pipeline_key(this);
renderer.set_framebuffer(&irradiance_fbo);
renderer.set_shader_program(&irradiance_shprog, &prefilter_shdata);
renderer.set_texture("environment_map", &env_tex, 0, &sampler);
for(unsigned i=0; i<specular_fbos.size(); ++i)
{
prefilter_shdata.uniform("roughness", 1.0f-sqrt(1.0f-static_cast<float>(i+1)/specular_fbos.size()));
+ renderer.set_pipeline_key(this, 1+i);
renderer.set_framebuffer(&specular_fbos[i]);
fullscreen_mesh.draw(renderer);
}
if(transmittance_lookup_dirty)
{
transmittance_lookup_dirty = false;
+ renderer.set_pipeline_key(this);
renderer.set_framebuffer(&transmittance_lookup.get_framebuffer());
renderer.set_shader_program(&transmittance_shprog);
fullscreen_mesh.draw(renderer);
}
+ renderer.set_pipeline_key(this, 1);
renderer.set_framebuffer(&distant.get_framebuffer());
renderer.set_shader_program(&distant_shprog);
renderer.set_texture("transmittance_lookup", &transmittance_lookup.get_target_texture(0), &sampler);
Renderer::Push push(renderer);
+ renderer.set_pipeline_key(this, 2);
renderer.set_shader_program(&backdrop_shprog, &shdata);
renderer.set_texture("distant", &distant.get_target_texture(0), &wrap_sampler);
fullscreen_mesh.draw(renderer);
instance_buffer->storage(instance_data.get_required_buffer_size(), STREAMING);
Renderer::Push push(renderer);
+ renderer.set_pipeline_key(this, tag.id);
method->apply(renderer);
mesh->draw_instanced(renderer, vtx_setup, instances.size());
}
throw logic_error("no mesh");
Renderer::Push push(renderer);
+ renderer.set_pipeline_key(this, tag.id);
method->apply(renderer);
setup_render(renderer, tag);
throw logic_error("no mesh");
Renderer::Push push(renderer);
+ renderer.set_pipeline_key(this, tag.id);
method->apply(renderer);
setup_render(renderer, tag);
public:
void set_pipeline_key(std::uintptr_t);
+ void set_pipeline_key(const void *p) { set_pipeline_key(reinterpret_cast<uintptr_t>(p)); }
+
+ template<typename T>
+ void set_pipeline_key(std::uintptr_t k, T d)
+ { set_pipeline_key(k^(static_cast<uintptr_t>(d)<<((sizeof(std::uintptr_t)-sizeof(T))*std::numeric_limits<char>::digits))); }
+
+ template<typename T>
+ void set_pipeline_key(const void *p, T d) { set_pipeline_key(reinterpret_cast<uintptr_t>(p), d); }
/** Sets the camera to render from. The model matrix is reset to identity. */
void set_camera(const Camera &);