mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-05 14:45:07 +01:00
Zero out blend state when disabled to avoid creating redundant pipelines
This commit is contained in:
parent
4052a93051
commit
7ad2d94345
@ -71,7 +71,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static u8 ConvertCompareFunc(engine::CompareFunc func) {
|
||||
if (func < engine::CompareFunc::D3DNever || func > engine::CompareFunc::OglAlways || (func > engine::CompareFunc::D3DAlways && func < engine::CompareFunc::OglNever))
|
||||
throw exception("Invalid comparision function: 0x{:X}", static_cast<u32>(func));
|
||||
@ -253,12 +252,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
static PackedPipelineState::AttachmentBlendState PackAttachmentBlendState(bool enable, engine::CtWrite writeMask, auto blend) {
|
||||
return {
|
||||
.colorWriteMask = ConvertColorWriteMask(writeMask),
|
||||
.colorBlendOp = ConvertBlendOp(blend.colorOp),
|
||||
.srcColorBlendFactor = ConvertBlendFactor(blend.colorSourceCoeff),
|
||||
.dstColorBlendFactor = ConvertBlendFactor(blend.colorDestCoeff),
|
||||
.alphaBlendOp = ConvertBlendOp(blend.alphaOp),
|
||||
.srcAlphaBlendFactor = ConvertBlendFactor(blend.alphaSourceCoeff),
|
||||
.dstAlphaBlendFactor = ConvertBlendFactor(blend.alphaDestCoeff),
|
||||
.colorBlendOp = enable ? ConvertBlendOp(blend.colorOp) : u8{0},
|
||||
.srcColorBlendFactor = enable ? ConvertBlendFactor(blend.colorSourceCoeff) : u8{0},
|
||||
.dstColorBlendFactor = enable ? ConvertBlendFactor(blend.colorDestCoeff) : u8{0},
|
||||
.alphaBlendOp = enable ? ConvertBlendOp(blend.alphaOp) : u8{0},
|
||||
.srcAlphaBlendFactor = enable ? ConvertBlendFactor(blend.alphaSourceCoeff) : u8{0},
|
||||
.dstAlphaBlendFactor = enable ? ConvertBlendFactor(blend.alphaDestCoeff) : u8{0},
|
||||
.blendEnable = enable
|
||||
};
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
float pointSize;
|
||||
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
||||
std::array<u8, engine::ColorTargetCount> colorRenderTargetFormats; //!< Use {Set, Get}ColorRenderTargetFormat
|
||||
std::bitset<8> activeColorTargets;
|
||||
std::array<u32, 8> postVtgShaderAttributeSkipMask;
|
||||
|
||||
struct VertexBinding {
|
||||
|
@ -439,8 +439,17 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
packedState.SetLogicOp(engine->logicOp.func);
|
||||
|
||||
for (u32 i{}; i < engine::ColorTargetCount; i++) {
|
||||
auto ctWrite{engine->singleCtWriteControl ? engine->ctWrites[0] : engine->ctWrites[i]};
|
||||
bool enable{engine->blend.enable[i] != 0};
|
||||
auto ctWrite{[&]() {
|
||||
if (!packedState.activeColorTargets.test(i))
|
||||
return engine::CtWrite{};
|
||||
|
||||
if (engine->singleCtWriteControl)
|
||||
return engine->ctWrites[0];
|
||||
else
|
||||
return engine->ctWrites[i];
|
||||
}()};
|
||||
|
||||
bool enable{engine->blend.enable[i] != 0 && packedState.activeColorTargets.test(i)};
|
||||
|
||||
if (engine->blendStatePerTargetEnable)
|
||||
packedState.SetAttachmentBlendState(i, enable, ctWrite, engine->blendPerTargets[i]);
|
||||
@ -502,9 +511,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
}
|
||||
|
||||
colorAttachments.clear();
|
||||
packedState.activeColorTargets.reset();
|
||||
for (size_t i{}; i < ctSelect.count; i++) {
|
||||
const auto &view{colorRenderTargets[ctSelect[i]].UpdateGet(ctx, packedState).view.get()};
|
||||
colorAttachments.push_back(view);
|
||||
packedState.activeColorTargets.set(i);
|
||||
|
||||
if (view)
|
||||
ctx.executor.AttachTexture(view);
|
||||
|
Loading…
Reference in New Issue
Block a user