Transition rasterization state to pipeline cache key

This commit is contained in:
Billy Laws 2022-09-06 19:23:13 +01:00
parent 9a6efb091c
commit 1f844e2c18
2 changed files with 32 additions and 13 deletions

View File

@ -477,20 +477,27 @@ namespace skyline::gpu::interconnect::maxwell3d {
}
}
void RasterizationState::Flush() {
auto &rasterizationCreateInfo{rasterizationState.get<vk::PipelineRasterizationStateCreateInfo>()};
rasterizationCreateInfo.rasterizerDiscardEnable = !engine->rasterEnable;
rasterizationCreateInfo.polygonMode = ConvertPolygonMode(engine->frontPolygonMode);
void RasterizationState::Flush(Key &key) {
key.rasterizerDiscardEnable = !engine->rasterEnable;
key.SetPolygonMode(engine->frontPolygonMode);
if (engine->backPolygonMode != engine->frontPolygonMode)
Logger::Warn("Non-matching polygon modes!");
rasterizationCreateInfo.cullMode = engine->oglCullEnable ? ConvertCullMode(engine->oglCullFace) : vk::CullModeFlagBits::eNone;
if (engine->oglCullEnable) {
key.cullModeFront = engine->oglCullFace == engine::CullFace::Front || engine->oglCullFace == engine::CullFace::FrontAndBack;
key.cullModeBack = engine->oglCullFace == engine::CullFace::Back || engine->oglCullFace == engine::CullFace::FrontAndBack;
} else {
key.cullModeFront = key.cullModeBack = false;
}
// UpdateRuntimeInformation(runtimeInfo.y_negate, enabled, maxwell3d::PipelineStage::Vertex, maxwell3d::PipelineStage::Fragment);
key.flipYEnable = engine->windowOrigin.flipY;
bool origFrontFaceClockwise{engine->oglFrontFace == engine::FrontFace::CW};
rasterizationCreateInfo.frontFace = (engine->windowOrigin.flipY != origFrontFaceClockwise) ? vk::FrontFace::eClockwise : vk::FrontFace::eCounterClockwise;
rasterizationCreateInfo.depthBiasEnable = ConvertDepthBiasEnable(engine->polyOffset, engine->frontPolygonMode);
rasterizationState.get<vk::PipelineRasterizationProvokingVertexStateCreateInfoEXT>().provokingVertexMode = ConvertProvokingVertex(engine->provokingVertex.value);
key.frontFaceClockwise = (key.flipYEnable != origFrontFaceClockwise);
key.depthBiasEnable = ConvertDepthBiasEnable(engine->polyOffset, engine->frontPolygonMode);
key.provokingVertex = engine->provokingVertex.value;
}
/* Depth Stencil State */
@ -789,12 +796,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
vertexInput.Update(key);
directState.inputAssembly.Update(key);
tessellation.Update(key);
const auto &rasterizationState{rasterization.UpdateGet().rasterizationState};
vk::PipelineMultisampleStateCreateInfo multisampleState{
rasterization.Update(key);
/* vk::PipelineMultisampleStateCreateInfo multisampleState{
.rasterizationSamples = vk::SampleCountFlagBits::e1
};
}; */
const auto &depthStencilState{depthStencil.UpdateGet().depthStencilState};
const auto &colorBlendState{colorBlend.UpdateGet(ctx, colorAttachments.size()).colorBlendState};

View File

@ -17,6 +17,14 @@ namespace skyline::gpu::interconnect::maxwell3d {
engine::TessellationParameters::DomainType domainType : 2; //!< Use SetTessellationParameters
engine::TessellationParameters::Spacing spacing : 2; //!< Use SetTessellationParameters
engine::TessellationParameters::OutputPrimitives outputPrimitives : 2; //!< Use SetTessellationParameters
bool rasterizerDiscardEnable : 1;
u8 polygonMode : 2; //!< Use {Set, Get}PolygonMode
bool cullModeFront : 1;
bool cullModeBack : 1;
bool flipYEnable : 1;
bool frontFaceClockwise : 1; //!< With Y flip transformation already applied
bool depthBiasEnable : 1;
engine::ProvokingVertex::Value provokingVertex : 1;
};
struct VertexBinding {
@ -53,6 +61,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
spacing = parameters.spacing;
outputPrimitives = parameters.outputPrimitives;
}
void SetPolygonMode(engine::PolygonMode mode) {
polygonMode = static_cast<u8>(static_cast<u32>(mode) - 0x1B00);
}
};
class ColorRenderTargetState : dirty::ManualDirty {
@ -194,7 +206,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
RasterizationState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine);
void Flush();
void Flush(Key &key);
};
class DepthStencilState : dirty::ManualDirty {