diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp index c8da7771..e2fbc2f3 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp @@ -530,10 +530,14 @@ namespace skyline::gpu::interconnect::maxwell3d { boost::container::static_vector attachmentBlendStates; boost::container::static_vector colorAttachmentFormats; - for (u32 i{}; i < packedState.GetColorRenderTargetCount(); i++) { - attachmentBlendStates.push_back(packedState.GetAttachmentBlendState(i)); - texture::Format format{packedState.GetColorRenderTargetFormat(packedState.ctSelect[i])}; - colorAttachmentFormats.push_back(format ? format->vkFormat : vk::Format::eUndefined); + for (u32 i{}; i < engine::ColorTargetCount; i++) { + if (i < packedState.GetColorRenderTargetCount()) { + attachmentBlendStates.push_back(packedState.GetAttachmentBlendState(i)); + texture::Format format{packedState.GetColorRenderTargetFormat(packedState.ctSelect[i])}; + colorAttachmentFormats.push_back(format ? format->vkFormat : vk::Format::eUndefined); + } else { + colorAttachmentFormats.push_back(vk::Format::eUndefined); + } } vk::PipelineColorBlendStateCreateInfo colorBlendState{ diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.cpp index e12c15d1..1ba524a0 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.cpp @@ -300,19 +300,14 @@ namespace skyline::gpu::interconnect::maxwell3d { packedState.SetLogicOp(engine->logicOp.func); for (u32 i{}; i < engine::ColorTargetCount; i++) { - bool rtEnabled{packedState.IsColorRenderTargetEnabled(packedState.ctSelect[i])}; - enabledRts.set(i, rtEnabled); auto ctWrite{[&]() { - if (!rtEnabled) - return engine::CtWrite{}; - if (engine->singleCtWriteControl) return engine->ctWrites[0]; else return engine->ctWrites[i]; }()}; - bool enable{engine->blend.enable[i] != 0 && rtEnabled}; + bool enable{engine->blend.enable[i] != 0}; if (engine->blendStatePerTargetEnable) packedState.SetAttachmentBlendState(i, enable, ctWrite, engine->blendPerTargets[i]); @@ -321,14 +316,6 @@ namespace skyline::gpu::interconnect::maxwell3d { } } - bool ColorBlendState::Refresh(PackedPipelineState &packedState) { - for (u32 i{}; i < engine::ColorTargetCount; i++) - if (enabledRts.test(i) != packedState.IsColorRenderTargetEnabled(packedState.ctSelect[i])) - return true; - - return false; - } - /* Transform Feedback State */ void TransformFeedbackState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const { manager.Bind(handle, streamOutputEnable, streamOutControls, streamOutLayoutSelect); @@ -404,12 +391,16 @@ namespace skyline::gpu::interconnect::maxwell3d { } colorAttachments.clear(); - for (size_t i{}; i < ctSelect.count; i++) { - const auto &view{colorRenderTargets[ctSelect[i]].UpdateGet(ctx, packedState).view.get()}; - colorAttachments.push_back(view); + for (size_t i{}; i < engine::ColorTargetCount; i++) { + if (i < ctSelect.count) { + const auto &view{colorRenderTargets[ctSelect[i]].UpdateGet(ctx, packedState).view.get()}; + colorAttachments.push_back(view); - if (view) - ctx.executor.AttachTexture(view); + if (view) + ctx.executor.AttachTexture(view); + } else { + colorAttachments.push_back({}); + } } depthAttachment = depthRenderTarget.UpdateGet(ctx, packedState).view.get(); diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.h b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.h index 955b5a1a..5a3930de 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_state.h @@ -212,7 +212,7 @@ namespace skyline::gpu::interconnect::maxwell3d { void Flush(PackedPipelineState &packedState); }; - class ColorBlendState : dirty::RefreshableManualDirty { + class ColorBlendState : dirty::ManualDirty { public: struct EngineRegisters { const engine::LogicOp &logicOp; @@ -227,14 +227,11 @@ namespace skyline::gpu::interconnect::maxwell3d { private: dirty::BoundSubresource engine; - std::bitset enabledRts{}; public: ColorBlendState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine); void Flush(PackedPipelineState &packedState); - - bool Refresh(PackedPipelineState &packedState); }; class TransformFeedbackState : dirty::ManualDirty {