Skip to content

Commit 0882d92

Browse files
committed
Nuked attachmentEnabled in BlendParams
1 parent 5a64236 commit 0882d92

File tree

6 files changed

+17
-32
lines changed

6 files changed

+17
-32
lines changed

examples_tests/06.MeshLoaders/main.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ class MeshLoadersApp : public ApplicationBase
201201
for (size_t i = 0ull; i < meshRaw->getMeshBuffers().size(); ++i)
202202
{
203203
auto& meshBuffer = meshRaw->getMeshBuffers().begin()[i];
204-
205-
for (size_t i = 0ull; i < nbl::asset::SBlendParams::MAX_COLOR_ATTACHMENT_COUNT; i++)
206-
meshBuffer->getPipeline()->getBlendParams().blendParams[i].attachmentEnabled = (i == 0ull);
207-
208204
meshBuffer->getPipeline()->getRasterizationParams().frontFaceIsCCW = false;
209205
}
210206

examples_tests/22.RaytracedAO/Renderer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,6 @@ void Renderer::initSceneNonAreaLights(Renderer::InitializationData& initData)
674674
SBlendParams blendParams = {};
675675
blendParams.logicOpEnable = false;
676676
blendParams.logicOp = ELO_NO_OP;
677-
blendParams.blendParams[0].attachmentEnabled = true;
678677
blendParams.blendParams[0].blendEnable = true;
679678
blendParams.blendParams[0].srcColorFactor = asset::EBF_ONE;
680679
blendParams.blendParams[0].dstColorFactor = asset::EBF_ONE;

include/nbl/asset/IRenderpassIndependentPipeline.h

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ enum E_BLEND_OP : uint8_t
396396
struct SColorAttachmentBlendParams
397397
{
398398
SColorAttachmentBlendParams() :
399-
attachmentEnabled(true),
400399
blendEnable(false),
401400
srcColorFactor(EBF_ONE),
402401
dstColorFactor(EBF_ZERO),
@@ -407,37 +406,35 @@ struct SColorAttachmentBlendParams
407406
colorWriteMask(0xfu)
408407
{}
409408

410-
uint8_t attachmentEnabled : 1;
411-
uint8_t blendEnable : 1;
412-
uint8_t srcColorFactor : 5;
409+
uint64_t blendEnable : 1;
410+
uint64_t srcColorFactor : 5;
413411

414-
uint8_t dstColorFactor : 5;
412+
uint64_t dstColorFactor : 5;
415413

416-
uint8_t colorBlendOp : 6;
414+
uint64_t colorBlendOp : 6;
417415

418-
uint8_t srcAlphaFactor : 5;
416+
uint64_t srcAlphaFactor : 5;
419417

420-
uint8_t dstAlphaFactor : 5;
418+
uint64_t dstAlphaFactor : 5;
421419

422-
uint8_t alphaBlendOp : 2;
420+
uint64_t alphaBlendOp : 2;
423421
//RGBA, LSB is R, MSB is A
424-
uint8_t colorWriteMask : 4;
422+
uint64_t colorWriteMask : 4;
425423

426424
constexpr static size_t serializedSize() { return 5ull; }
427425

428426
void serialize(void* _mem) const
429427
{
430428
auto* bf_dst = reinterpret_cast<uint8_t*>(_mem);
431429
uint64_t bf = 0;
432-
bf = core::bitfieldInsert<uint64_t>(bf, attachmentEnabled, 0, 1);
433-
bf = core::bitfieldInsert<uint64_t>(bf, blendEnable, 1, 1);
434-
bf = core::bitfieldInsert<uint64_t>(bf, srcColorFactor, 2, 5);
435-
bf = core::bitfieldInsert<uint64_t>(bf, dstColorFactor, 7, 5);
436-
bf = core::bitfieldInsert<uint64_t>(bf, colorBlendOp, 12, 6);
437-
bf = core::bitfieldInsert<uint64_t>(bf, srcAlphaFactor, 18, 5);
438-
bf = core::bitfieldInsert<uint64_t>(bf, dstAlphaFactor, 23, 5);
439-
bf = core::bitfieldInsert<uint64_t>(bf, alphaBlendOp, 28, 2);
440-
bf = core::bitfieldInsert<uint64_t>(bf, colorWriteMask, 30, 4);
430+
bf = core::bitfieldInsert<uint64_t>(bf, blendEnable, 0, 1);
431+
bf = core::bitfieldInsert<uint64_t>(bf, srcColorFactor, 1, 5);
432+
bf = core::bitfieldInsert<uint64_t>(bf, dstColorFactor, 6, 5);
433+
bf = core::bitfieldInsert<uint64_t>(bf, colorBlendOp, 11, 6);
434+
bf = core::bitfieldInsert<uint64_t>(bf, srcAlphaFactor, 17, 5);
435+
bf = core::bitfieldInsert<uint64_t>(bf, dstAlphaFactor, 22, 5);
436+
bf = core::bitfieldInsert<uint64_t>(bf, alphaBlendOp, 27, 2);
437+
bf = core::bitfieldInsert<uint64_t>(bf, colorWriteMask, 29, 4);
441438

442439
memcpy(bf_dst, &bf, serializedSize());
443440
}

include/nbl/ext/FullScreenTriangle/FullScreenTriangle.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ namespace nbl
5858
auto& blendParams = std::get<asset::SBlendParams>(protoPipeline);
5959
blendParams.logicOpEnable = false;
6060
blendParams.logicOp = nbl::asset::ELO_NO_OP;
61-
for (size_t i = 0ull; i < nbl::asset::SBlendParams::MAX_COLOR_ATTACHMENT_COUNT; i++)
62-
blendParams.blendParams[i].attachmentEnabled = (i == 0ull);
6361

6462
auto& rasterParams = std::get<asset::SRasterizationParams>(protoPipeline);
6563
rasterParams.faceCullingMode = nbl::asset::EFCM_NONE;

src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ core::smart_refctd_ptr<ICPURenderpassIndependentPipeline> CGraphicsPipelineLoade
179179
{
180180
SBlendParams blendParams;
181181

182-
for (size_t i = 0ull; i < SBlendParams::MAX_COLOR_ATTACHMENT_COUNT; i++)
183-
blendParams.blendParams[i].attachmentEnabled = (i == 0ull);
184-
185182
std::string cacheKey("nbl/builtin/renderpass_independent_pipeline/loader/mtl/");
186183
{
187184
const uint32_t illum = _mtl.params.extra&0xfu;

src/nbl/ext/DebugDraw/CDraw3DLine.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ CDraw3DLine::CDraw3DLine(const core::smart_refctd_ptr<video::ILogicalDevice>& de
6262
asset::SBlendParams blendParams;
6363
blendParams.logicOpEnable = false;
6464
blendParams.logicOp = nbl::asset::ELO_NO_OP;
65-
for (size_t i = 0ull; i < nbl::asset::SBlendParams::MAX_COLOR_ATTACHMENT_COUNT; i++)
66-
blendParams.blendParams[i].attachmentEnabled = (i == 0ull);
67-
65+
6866
m_rpindependent_pipeline = m_device->createGPURenderpassIndependentPipeline(nullptr, core::smart_refctd_ptr(layout), shaders, shaders + 2, vtxinput, blendParams, primitive, raster);
6967
assert(m_rpindependent_pipeline);
7068
}

0 commit comments

Comments
 (0)