From eda93b76f325358562258c60f8162a011ee6d9fb Mon Sep 17 00:00:00 2001 From: Robin Liu Date: Thu, 15 Aug 2024 14:58:56 -0400 Subject: [PATCH] Testcase: Alpha blending --- benchmarks/graphics_pipeline/GraphicsBenchmarkApp.cpp | 10 +++++----- benchmarks/graphics_pipeline/GraphicsBenchmarkApp.h | 9 ++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.cpp b/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.cpp index 0e5b0f965..1c347af6c 100644 --- a/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.cpp +++ b/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.cpp @@ -193,10 +193,6 @@ void GraphicsBenchmarkApp::InitKnobs() pKnobTextureCount->SetDisplayName("Number of texture to load in the shader"); pKnobTextureCount->SetFlagDescription("Select the number of texture to load in the shader."); - GetKnobManager().InitKnob(&pKnobDisablePsOutput, "disable-ps-output", false); - pKnobDisablePsOutput->SetDisplayName("Disable PS output"); - pKnobDisablePsOutput->SetFlagDescription("Disable PS output."); - GetKnobManager().InitKnob(&pKnobViewportHeightScale, "viewport_height_scale", 0, kAvailableViewportScales); pKnobViewportHeightScale->SetDisplayName("Scale viewport height"); pKnobViewportHeightScale->SetFlagDescription("Scale viewport height to 1, 1/2, 1/4"); @@ -204,6 +200,10 @@ void GraphicsBenchmarkApp::InitKnobs() GetKnobManager().InitKnob(&pKnobViewportWidthScale, "viewport_width_scale", 0, kAvailableViewportScales); pKnobViewportWidthScale->SetDisplayName("Scale viewport width"); pKnobViewportWidthScale->SetFlagDescription("Scale viewport width to 1, 1/2, 1/4"); + + GetKnobManager().InitKnob(&pKnobQuadBlendMode, "quad_blend_mode", 0, kQuadBlendModes); + pKnobQuadBlendMode->SetDisplayName("Blend mode for quad"); + pKnobQuadBlendMode->SetFlagDescription("Bend mode for quad to none, alpha, disable_output"); } void GraphicsBenchmarkApp::Config(ppx::ApplicationSettings& settings) @@ -787,7 +787,7 @@ Result GraphicsBenchmarkApp::CompilePipeline(const QuadPipelineKey& key) gpCreateInfo.frontFace = grfx::FRONT_FACE_CW; gpCreateInfo.depthReadEnable = false; gpCreateInfo.depthWriteEnable = false; - gpCreateInfo.blendModes[0] = pKnobDisablePsOutput->GetValue() ? grfx::BLEND_MODE_DISABLE_OUTPUT : grfx::BLEND_MODE_NONE; + gpCreateInfo.blendModes[0] = pKnobQuadBlendMode->GetValue(); gpCreateInfo.outputState.renderTargetCount = 1; gpCreateInfo.outputState.renderTargetFormats[0] = key.renderFormat; gpCreateInfo.outputState.depthStencilFormat = GetSwapchain()->GetDepthFormat(); diff --git a/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.h b/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.h index 2d1dc947f..5c8f2f46c 100644 --- a/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.h +++ b/benchmarks/graphics_pipeline/GraphicsBenchmarkApp.h @@ -19,6 +19,7 @@ #include "MultiDimensionalIndexer.h" #include "ppx/grfx/grfx_config.h" +#include "ppx/grfx/grfx_enums.h" #include "ppx/grfx/grfx_format.h" #include "ppx/knob.h" #include "ppx/math_config.h" @@ -231,6 +232,12 @@ static constexpr std::array, 3> kAvailableViewp {"1/4", 0.25}, // scale to 1/4 }}; +static constexpr std::array, 3> kQuadBlendModes = {{ + {"none", grfx::BLEND_MODE_NONE}, + {"alpha", grfx::BLEND_MODE_ALPHA}, + {"disable_output", grfx::BLEND_MODE_DISABLE_OUTPUT}, +}}; + class GraphicsBenchmarkApp : public ppx::Application { @@ -544,9 +551,9 @@ class GraphicsBenchmarkApp std::shared_ptr> pKnobAluCount; std::shared_ptr> pKnobTextureCount; - std::shared_ptr pKnobDisablePsOutput; std::shared_ptr> pKnobViewportHeightScale; std::shared_ptr> pKnobViewportWidthScale; + std::shared_ptr> pKnobQuadBlendMode; private: // =====================================================================