gfx-blur-*: Add debug markers for performance tracking

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-04-25 11:36:19 +02:00
parent 4947d46aa1
commit 6e8135dc98
5 changed files with 43 additions and 15 deletions

View file

@ -245,7 +245,9 @@ double_t gfx::blur::box_linear::get_step_scale_y()
std::shared_ptr<::gs::texture> gfx::blur::box_linear::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Box Linear Blur");
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
@ -273,7 +275,8 @@ std::shared_ptr<::gs::texture> gfx::blur::box_linear::render()
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
{
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Horizontal");
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -285,7 +288,8 @@ std::shared_ptr<::gs::texture> gfx::blur::box_linear::render()
effect.get_parameter("pImageTexel").set_float2(0., float_t(1.f / height));
{
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Vertical");
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -322,7 +326,9 @@ void gfx::blur::box_linear_directional::set_angle(double_t angle)
std::shared_ptr<::gs::texture> gfx::blur::box_linear_directional::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Box Linear Directional Blur");
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());

View file

@ -253,7 +253,9 @@ double_t gfx::blur::box::get_step_scale_y()
std::shared_ptr<::gs::texture> gfx::blur::box::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Box Blur");
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
@ -281,7 +283,8 @@ std::shared_ptr<::gs::texture> gfx::blur::box::render()
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
{
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Horizontal");
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -293,7 +296,8 @@ std::shared_ptr<::gs::texture> gfx::blur::box::render()
effect.get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
{
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Vertical");
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -330,7 +334,9 @@ void gfx::blur::box_directional::set_angle(double_t angle)
std::shared_ptr<::gs::texture> gfx::blur::box_directional::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Box Directional Blur");
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
@ -400,7 +406,9 @@ void gfx::blur::box_rotational::set_angle(double_t angle)
std::shared_ptr<::gs::texture> gfx::blur::box_rotational::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Box Rotational Blur");
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
@ -461,7 +469,9 @@ void gfx::blur::box_zoom::get_center(double_t& x, double_t& y)
std::shared_ptr<::gs::texture> gfx::blur::box_zoom::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Box Zoom Blur");
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());

View file

@ -222,7 +222,9 @@ void gfx::blur::dual_filtering::get_step_scale(double_t&, double_t&) {}
std::shared_ptr<::gs::texture> gfx::blur::dual_filtering::render()
{
auto gctx = gs::context();
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Dual-Filtering Blur");
auto effect = _data->get_effect();
if (!effect) {
return _input_texture;

View file

@ -292,6 +292,7 @@ double_t gfx::blur::gaussian_linear::get_step_scale_y()
std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear::render()
{
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Gaussian Linear Blur");
gs::effect effect = _data->get_effect();
auto kernel = _data->get_kernel(size_t(_size));
@ -327,7 +328,8 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear::render()
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
{
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Horizontal");
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -343,7 +345,8 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear::render()
effect.get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
{
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Vertical");
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -385,6 +388,7 @@ void gfx::blur::gaussian_linear_directional::set_angle(double_t angle)
std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear_directional::render()
{
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Gaussian Linear Directional Blur");
gs::effect effect = _data->get_effect();
auto kernel = _data->get_kernel(size_t(_size));

View file

@ -298,6 +298,7 @@ double_t gfx::blur::gaussian::get_step_scale_y()
std::shared_ptr<::gs::texture> gfx::blur::gaussian::render()
{
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Gaussian Blur");
gs::effect effect = _data->get_effect();
auto kernel = _data->get_kernel(size_t(_size));
@ -333,7 +334,8 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian::render()
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
{
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Horizontal");
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -349,7 +351,8 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian::render()
effect.get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
{
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Vertical");
auto op = _rendertarget2->render(uint32_t(width), uint32_t(height));
gs_ortho(0, 1., 0, 1., 0, 1.);
while (gs_effect_loop(effect.get_object(), "Draw")) {
gs_draw_sprite(nullptr, 0, 1, 1);
@ -391,6 +394,7 @@ void gfx::blur::gaussian_directional::set_angle(double_t angle)
std::shared_ptr<::gs::texture> gfx::blur::gaussian_directional::render()
{
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Gaussian Directional Blur");
gs::effect effect = _data->get_effect();
auto kernel = _data->get_kernel(size_t(_size));
@ -445,6 +449,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_directional::render()
std::shared_ptr<::gs::texture> gfx::blur::gaussian_rotational::render()
{
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Gaussian Rotational Blur");
gs::effect effect = _data->get_effect();
auto kernel = _data->get_kernel(size_t(_size));
@ -522,6 +527,7 @@ void gfx::blur::gaussian_rotational::set_angle(double_t angle)
std::shared_ptr<::gs::texture> gfx::blur::gaussian_zoom::render()
{
auto gctx = gs::context();
auto gdmp = gs::debug_marker(gs::debug_color_azure_radiance, "Gaussian Zoom Blur");
gs::effect effect = _data->get_effect();
auto kernel = _data->get_kernel(size_t(_size));