本文整理汇总了C++中Pipeline::begin_gpu_query方法的典型用法代码示例。如果您正苦于以下问题:C++ Pipeline::begin_gpu_query方法的具体用法?C++ Pipeline::begin_gpu_query怎么用?C++ Pipeline::begin_gpu_query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipeline
的用法示例。
在下文中一共展示了Pipeline::begin_gpu_query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ctx
void NormalizationSubRenderer::
render_sub_pass(Pipeline& pipe, PipelinePassDescription const& desc,
gua::plod_shared_resources& shared_resources,
std::vector<node::Node*>& sorted_models,
std::unordered_map<node::PLodNode*, std::unordered_set<lamure::node_t> >& nodes_in_frustum_per_model,
lamure::context_t context_id,
lamure::view_t lamure_view_id
) {
RenderContext const& ctx(pipe.get_context());
auto& target = *pipe.current_viewstate().target;
scm::gl::context_all_guard context_guard(ctx.render_context);
_check_for_shader_program();
assert(shader_program_);
if(!fullscreen_quad_) {
fullscreen_quad_.reset(new scm::gl::quad_geometry(ctx.render_device,
scm::math::vec2(-1.0f, -1.0f), scm::math::vec2(1.0f, 1.0f )));
}
bool write_depth = true;
target.bind(ctx, write_depth);
std::string const gpu_query_name_normalization_pass = "GPU: Camera uuid: " + std::to_string(pipe.current_viewstate().viewpoint_uuid) + " / PLodRenderer::NormalizationPass";
pipe.begin_gpu_query(ctx, gpu_query_name_normalization_pass);
shader_program_->use(ctx);
{
_upload_normalization_pass_uniforms(ctx, shared_resources);
ctx.render_context->apply();
fullscreen_quad_->draw(ctx.render_context);
}
shader_program_->unuse(ctx);
target.unbind(ctx);
pipe.end_gpu_query(ctx, gpu_query_name_normalization_pass);
}
示例2: current_material
void LowQualitySplattingSubRenderer::
render_sub_pass(Pipeline& pipe, PipelinePassDescription const& desc,
gua::plod_shared_resources& shared_resources,
std::vector<node::Node*>& sorted_models,
std::unordered_map<node::PLodNode*, std::unordered_set<lamure::node_t> >& nodes_in_frustum_per_model,
lamure::context_t context_id,
lamure::view_t lamure_view_id
)
{
auto const& camera = pipe.current_viewstate().camera;
RenderContext const& ctx(pipe.get_context());
auto& target = *pipe.current_viewstate().target;
scm::gl::context_all_guard context_guard(ctx.render_context);
ctx.render_context->set_rasterizer_state(no_backface_culling_rasterizer_state_);
bool write_depth = true;
target.bind(ctx, write_depth);
target.set_viewport(ctx);
MaterialShader* current_material(nullptr);
std::shared_ptr<ShaderProgram> current_material_program;
bool program_changed = false;
std::string const gpu_query_name_depth_pass = "GPU: Camera uuid: " + std::to_string(pipe.current_viewstate().viewpoint_uuid) + " / PLodRenderer::DepthPass";
pipe.begin_gpu_query(ctx, gpu_query_name_depth_pass);
int view_id(camera.config.get_view_id());
//loop through all models and render depth pass
for (auto const& object : sorted_models) {
auto plod_node(reinterpret_cast<node::PLodNode*>(object));
current_material = plod_node->get_material()->get_shader();
current_material_program = _get_material_dependent_shader_program(current_material,
current_material_program,
program_changed);
lamure::ren::controller* controller = lamure::ren::controller::get_instance();
lamure::model_t model_id = controller->deduce_model_id(plod_node->get_geometry_description());
std::unordered_set<lamure::node_t>& nodes_in_frustum = nodes_in_frustum_per_model[plod_node];
auto const& plod_resource = plod_node->get_geometry();
if (plod_resource && current_material_program) {
if (program_changed) {
current_material_program->unuse(ctx);
current_material_program->use(ctx);
current_material_program->set_uniform(ctx, target.get_depth_buffer()->get_handle(ctx), "gua_gbuffer_depth");
}
plod_node->get_material()->apply_uniforms(ctx, current_material_program.get(), view_id);
_upload_model_dependent_uniforms(current_material_program, ctx, plod_node, pipe);
ctx.render_context->apply();
plod_resource->draw(ctx,
context_id,
lamure_view_id,
model_id,
controller->get_context_memory(context_id, lamure::ren::bvh::primitive_type::POINTCLOUD, ctx.render_device),
nodes_in_frustum,
scm::gl::primitive_topology::PRIMITIVE_POINT_LIST);
program_changed = false;
}
else {
Logger::LOG_WARNING << "PLodRenderer::render(): Cannot find ressources for node: " << plod_node->get_name() << std::endl;
}
}
target.unbind(ctx);
pipe.end_gpu_query(ctx, gpu_query_name_depth_pass);
}
示例3: ctx
void LogToLinSubRenderer::
render_sub_pass(Pipeline& pipe, PipelinePassDescription const& desc,
gua::plod_shared_resources& shared_resources,
std::vector<node::Node*>& sorted_models,
std::unordered_map<node::PLodNode*, std::unordered_set<lamure::node_t> >& nodes_in_frustum_per_model,
lamure::context_t context_id,
lamure::view_t lamure_view_id
) {
RenderContext const& ctx(pipe.get_context());
auto& target = *pipe.current_viewstate().target;
auto const& camera = pipe.current_viewstate().camera;
scm::math::vec2ui const& render_target_dims = camera.config.get_resolution();
scm::gl::context_all_guard context_guard(ctx.render_context);
auto& gua_depth_buffer = target.get_depth_buffer();
_check_for_shader_program();
assert(shader_program_);
std::string const gpu_query_name_depth_conversion = "GPU: Camera uuid: " + std::to_string(pipe.current_viewstate().viewpoint_uuid) + " / PLodRenderer::LogToLinConversionPass";
pipe.begin_gpu_query(ctx, gpu_query_name_depth_conversion);
if( !custom_FBO_ptr_ ) {
custom_FBO_ptr_ = ctx.render_device->create_frame_buffer();
}
if(!fullscreen_quad_) {
fullscreen_quad_.reset(new scm::gl::quad_geometry(ctx.render_device,
scm::math::vec2(-1.0f, -1.0f), scm::math::vec2(1.0f, 1.0f )));
}
shader_program_->use(ctx);
if(!no_depth_test_with_writing_depth_stencil_state_) {
no_depth_test_with_writing_depth_stencil_state_ = ctx.render_device
->create_depth_stencil_state(true, true, scm::gl::COMPARISON_ALWAYS);
}
if( !nearest_sampler_state_ ) {
nearest_sampler_state_ = ctx.render_device
->create_sampler_state(scm::gl::FILTER_MIN_MAG_NEAREST, scm::gl::WRAP_CLAMP_TO_EDGE);
}
ctx.render_context
->set_depth_stencil_state(no_depth_test_with_writing_depth_stencil_state_);
custom_FBO_ptr_
->attach_depth_stencil_buffer(shared_resources.attachments_[plod_shared_resources::AttachmentID::DEPTH_PASS_LIN_DEPTH]);
ctx.render_context
->set_frame_buffer( custom_FBO_ptr_ );
ctx.render_context
->bind_texture(gua_depth_buffer, nearest_sampler_state_, 0);
shader_program_->apply_uniform(ctx,
"gua_log_depth_buffer", 0);
float width = render_target_dims[0];
float height = render_target_dims[1];
shader_program_->apply_uniform(ctx,
"win_width",
(width));
shader_program_->apply_uniform(ctx,
"win_height",
(height));
ctx.render_context->apply();
fullscreen_quad_->draw(ctx.render_context);
shader_program_->unuse(ctx);
pipe.end_gpu_query(ctx, gpu_query_name_depth_conversion);
}