Implement GPU depthMode register

This controls the depth range used by the shader, hades already has support for the necessary patching so we only need to pass the current mode over to it and it'll do the necessary work.
This commit is contained in:
Billy Laws 2022-03-16 20:51:49 +00:00 committed by PixelyIon
parent 7e088ca465
commit fc2c123ae2
4 changed files with 15 additions and 0 deletions

View File

@ -1152,6 +1152,10 @@ namespace skyline::gpu::interconnect {
rasterizerState.get<vk::PipelineRasterizationStateCreateInfo>().depthBiasSlopeFactor = factor; rasterizerState.get<vk::PipelineRasterizationStateCreateInfo>().depthBiasSlopeFactor = factor;
} }
void SetDepthMode(maxwell3d::DepthMode mode) {
UpdateRuntimeInformation(runtimeInfo.convert_depth_mode, mode == maxwell3d::DepthMode::MinusOneToOne, maxwell3d::PipelineStage::Vertex, maxwell3d::PipelineStage::Geometry);
}
/* Color Blending */ /* Color Blending */
private: private:
std::array<vk::PipelineColorBlendAttachmentState, maxwell3d::RenderTargetCount> commonRtBlendState{}, independentRtBlendState{}; //!< Per-RT blending state for common/independent blending for trivial toggling behavior std::array<vk::PipelineColorBlendAttachmentState, maxwell3d::RenderTargetCount> commonRtBlendState{}, independentRtBlendState{}; //!< Per-RT blending state for common/independent blending for trivial toggling behavior

View File

@ -761,5 +761,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d::type {
} format; } format;
}; };
enum class DepthMode : u32 {
MinusOneToOne = 0,
ZeroToOne = 1
};
#pragma pack(pop) #pragma pack(pop)
} }

View File

@ -668,6 +668,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
BOOST_PP_REPEAT(16, CBUF_UPDATE_CALLBACKS, 0) BOOST_PP_REPEAT(16, CBUF_UPDATE_CALLBACKS, 0)
#undef CBUF_UPDATE_CALLBACKS #undef CBUF_UPDATE_CALLBACKS
MAXWELL3D_CASE(depthMode, {
context.SetDepthMode(depthMode);
})
default: default:
break; break;
} }

View File

@ -66,6 +66,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
Register<0x35D, u32> drawVertexFirst; //!< The first vertex to draw Register<0x35D, u32> drawVertexFirst; //!< The first vertex to draw
Register<0x35E, u32> drawVertexCount; //!< The amount of vertices to draw, calling this method triggers non-indexed drawing Register<0x35E, u32> drawVertexCount; //!< The amount of vertices to draw, calling this method triggers non-indexed drawing
Register<0x35F, type::DepthMode> depthMode;
Register<0x360, std::array<u32, 4>> clearColorValue; Register<0x360, std::array<u32, 4>> clearColorValue;
Register<0x364, float> clearDepthValue; Register<0x364, float> clearDepthValue;
Register<0x368, u32> clearStencilValue; Register<0x368, u32> clearStencilValue;