Skip to content

Commit

Permalink
Add BLEND_MODE_NONE
Browse files Browse the repository at this point in the history
  • Loading branch information
RenfengLiu committed Aug 14, 2024
1 parent 87ba0b1 commit a72e6a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/ppx/grfx/grfx_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ struct BlendAttachmentState
grfx::ColorComponentFlags colorWriteMask = grfx::ColorComponentFlags::RGBA();

// These are best guesses based on random formulas off of the internet.
// Correct later when authorative literature is found.
// Correct later when authoritative literature is found.
//
static grfx::BlendAttachmentState BlendModeNone();
static grfx::BlendAttachmentState BlendModeAdditive();
static grfx::BlendAttachmentState BlendModeAlpha();
static grfx::BlendAttachmentState BlendModeOver();
Expand Down
10 changes: 9 additions & 1 deletion src/ppx/grfx/grfx_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ namespace grfx {
// -------------------------------------------------------------------------------------------------
// BlendAttachmentState
// -------------------------------------------------------------------------------------------------
grfx::BlendAttachmentState BlendAttachmentState::BlendModeNone()
{
grfx::BlendAttachmentState state = {};
state.colorWriteMask = grfx::ColorComponentFlags::RGBA();

return state;
}

grfx::BlendAttachmentState BlendAttachmentState::BlendModeAdditive()
{
grfx::BlendAttachmentState state = {};
Expand Down Expand Up @@ -171,7 +179,7 @@ void FillOutGraphicsPipelineCreateInfo(
for (uint32_t i = 0; i < pDstCreateInfo->colorBlendState.blendAttachmentCount; ++i) {
switch (pSrcCreateInfo->blendModes[i]) {
case grfx::BLEND_MODE_NONE: {
pDstCreateInfo->colorBlendState.blendAttachments[i].colorWriteMask = grfx::ColorComponentFlags::RGBA();
pDstCreateInfo->colorBlendState.blendAttachments[i] = grfx::BlendAttachmentState::BlendModeNone();
break;
}

Expand Down

0 comments on commit a72e6a7

Please sign in to comment.