Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcase: Alpha blending #506

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions benchmarks/graphics_pipeline/GraphicsBenchmarkApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@ 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");

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)
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 8 additions & 1 deletion benchmarks/graphics_pipeline/GraphicsBenchmarkApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -231,6 +232,12 @@ static constexpr std::array<DropdownEntry<QuadViewportScale>, 3> kAvailableViewp
{"1/4", 0.25}, // scale to 1/4
}};

static constexpr std::array<DropdownEntry<grfx::BlendMode>, 3> kQuadBlendModes = {{
{"none", grfx::BLEND_MODE_NONE},
{"alpha", grfx::BLEND_MODE_ALPHA},
{"disable_output", grfx::BLEND_MODE_DISABLE_OUTPUT},
}};

class GraphicsBenchmarkApp
: public ppx::Application
{
Expand Down Expand Up @@ -544,9 +551,9 @@ class GraphicsBenchmarkApp

std::shared_ptr<KnobFlag<int>> pKnobAluCount;
std::shared_ptr<KnobFlag<int>> pKnobTextureCount;
std::shared_ptr<KnobCheckbox> pKnobDisablePsOutput;
std::shared_ptr<KnobDropdown<QuadViewportScale>> pKnobViewportHeightScale;
std::shared_ptr<KnobDropdown<QuadViewportScale>> pKnobViewportWidthScale;
std::shared_ptr<KnobDropdown<grfx::BlendMode>> pKnobQuadBlendMode;

private:
// =====================================================================
Expand Down
Loading