Implement Maxwell3D Vertex Buffer Limit

Sets the end of VBOs based on the `vertexArrayLimits` register array which provides an IOVA to the end of the VBO.
This commit is contained in:
PixelyIon 2021-11-16 16:12:30 +05:30
parent d8890f13e1
commit c2a6da6431
3 changed files with 26 additions and 7 deletions

View File

@ -766,7 +766,10 @@ namespace skyline::gpu::interconnect {
/* Vertex Buffers */ /* Vertex Buffers */
private: private:
std::array<IOVA, maxwell3d::VertexBufferCount> vertexBindingIovas{}; struct VertexBuffer {
IOVA start{}, end{}; //!< IOVAs covering a contiguous region in GPU AS with the vertex buffer
};
std::array<VertexBuffer, maxwell3d::VertexBufferCount> vertexBuffers{};
std::array<vk::VertexInputBindingDescription, maxwell3d::VertexBufferCount> vertexBindings{}; std::array<vk::VertexInputBindingDescription, maxwell3d::VertexBufferCount> vertexBindings{};
std::array<vk::VertexInputBindingDivisorDescriptionEXT, maxwell3d::VertexBufferCount> vertexBindingDivisors{}; std::array<vk::VertexInputBindingDivisorDescriptionEXT, maxwell3d::VertexBufferCount> vertexBindingDivisors{};
vk::StructureChain<vk::PipelineVertexInputStateCreateInfo, vk::PipelineVertexInputDivisorStateCreateInfoEXT> vertexState{ vk::StructureChain<vk::PipelineVertexInputStateCreateInfo, vk::PipelineVertexInputDivisorStateCreateInfoEXT> vertexState{
@ -788,12 +791,20 @@ namespace skyline::gpu::interconnect {
vertexBindings[index].inputRate = isPerInstance ? vk::VertexInputRate::eInstance : vk::VertexInputRate::eVertex; vertexBindings[index].inputRate = isPerInstance ? vk::VertexInputRate::eInstance : vk::VertexInputRate::eVertex;
} }
void SetVertexBufferIovaHigh(u32 index, u32 high) { void SetVertexBufferStartIovaHigh(u32 index, u32 high) {
vertexBindingIovas[index].high = high; vertexBuffers[index].start.high = high;
} }
void SetVertexBufferIovaLow(u32 index, u32 low) { void SetVertexBufferStartIovaLow(u32 index, u32 low) {
vertexBindingIovas[index].low = low; vertexBuffers[index].start.low = low;
}
void SetVertexBufferEndIovaHigh(u32 index, u32 high) {
vertexBuffers[index].end.high = high;
}
void SetVertexBufferEndIovaLow(u32 index, u32 low) {
vertexBuffers[index].end.low = low;
} }
void SetVertexBufferDivisor(u32 index, u32 divisor) { void SetVertexBufferDivisor(u32 index, u32 divisor) {

View File

@ -329,16 +329,22 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
context.SetVertexBufferStride(index, config.stride); \ context.SetVertexBufferStride(index, config.stride); \
}) \ }) \
MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, high, { \ MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, high, { \
context.SetVertexBufferIovaHigh(index, high); \ context.SetVertexBufferStartIovaHigh(index, high); \
}) \ }) \
MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, low, { \ MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, low, { \
context.SetVertexBufferIovaLow(index, low); \ context.SetVertexBufferStartIovaLow(index, low); \
}) \ }) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBuffers, index, divisor, { \ MAXWELL3D_ARRAY_STRUCT_CASE(vertexBuffers, index, divisor, { \
context.SetVertexBufferDivisor(index, divisor); \ context.SetVertexBufferDivisor(index, divisor); \
}) \ }) \
MAXWELL3D_ARRAY_CASE(isVertexInputRatePerInstance, index, { \ MAXWELL3D_ARRAY_CASE(isVertexInputRatePerInstance, index, { \
context.SetVertexBufferInputRate(index, isVertexInputRatePerInstance); \ context.SetVertexBufferInputRate(index, isVertexInputRatePerInstance); \
}) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBufferLimits, index, high, { \
context.SetVertexBufferEndIovaHigh(index, high); \
}) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBufferLimits, index, low, { \
context.SetVertexBufferEndIovaLow(index, low); \
}) })
BOOST_PP_REPEAT(16, VERTEX_BUFFER_CALLBACKS, 0) BOOST_PP_REPEAT(16, VERTEX_BUFFER_CALLBACKS, 0)

View File

@ -258,6 +258,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
}; };
Register<0x780, std::array<IndependentBlend, type::RenderTargetCount>> independentBlend; Register<0x780, std::array<IndependentBlend, type::RenderTargetCount>> independentBlend;
Register<0x7C0, std::array<type::Address, type::VertexBufferCount>> vertexBufferLimits; //!< A per-VBO IOVA denoting the end of the vertex buffer
Register<0x800, std::array<type::SetProgramInfo, type::StageCount>> setProgram; Register<0x800, std::array<type::SetProgramInfo, type::StageCount>> setProgram;
Register<0x8C0, u32[0x20]> firmwareCall; Register<0x8C0, u32[0x20]> firmwareCall;