Implement depth clamp rasterisation state

Used in SMO for shadows.
This commit is contained in:
Billy Laws 2022-10-21 21:57:12 +01:00
parent 1cfc4278f9
commit 90466b8830
4 changed files with 9 additions and 1 deletions

View File

@ -340,6 +340,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
// Vulkan enum values match 1-1 with hades
return static_cast<Shader::CompareFunction>(alphaFunc);
}
void PackedPipelineState::SetDepthClampEnable(engine::ViewportClipControl::GeometryClip clip) {
depthClampEnable = (clip != engine::ViewportClipControl::GeometryClip::Passthru) && (clip != engine::ViewportClipControl::GeometryClip::FrustrumXYZClip) && (clip != engine::ViewportClipControl::GeometryClip::FrustrumZClip);
}
}
#pragma clang diagnostic pop

View File

@ -57,6 +57,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
bool transformFeedbackEnable : 1;
u8 alphaFunc : 3; //!< Use {Set,Get}AlphaFunc
bool alphaTestEnable : 1;
bool depthClampEnable : 1; // Use SetDepthClampEnable
};
u32 patchSize;
@ -141,6 +142,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
Shader::CompareFunction GetAlphaFunc() const;
void SetDepthClampEnable(engine::ViewportClipControl::GeometryClip clip);
bool operator==(const PackedPipelineState &other) const {
// Only hash transform feedback state if it's enabled
if (other.transformFeedbackEnable && transformFeedbackEnable)

View File

@ -493,6 +493,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
rasterizationCreateInfo.cullMode = vk::CullModeFlags{packedState.cullMode};
rasterizationCreateInfo.frontFace = packedState.frontFaceClockwise ? vk::FrontFace::eClockwise : vk::FrontFace::eCounterClockwise;
rasterizationCreateInfo.depthBiasEnable = packedState.depthBiasEnable;
rasterizationCreateInfo.depthClampEnable = packedState.depthClampEnable;
rasterizationState.get<vk::PipelineRasterizationProvokingVertexStateCreateInfoEXT>().provokingVertexMode = ConvertProvokingVertex(packedState.provokingVertex);
constexpr vk::PipelineMultisampleStateCreateInfo multisampleState{
@ -651,7 +652,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
view.GetBuffer()->BlockSequencedCpuBackingWrites();
return view;
}

View File

@ -446,6 +446,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
packedState.provokingVertex = engine->provokingVertex.value;
packedState.pointSize = engine->pointSize;
packedState.openGlNdc = engine->zClipRange == engine::ZClipRange::NegativeWToPositiveW;
packedState.SetDepthClampEnable(engine->viewportClipControl.geometryClip);
}
/* Depth Stencil State */