Implement Maxwell3D Vertex Buffer Instance Rate

Implements the `isVertexInputRatePerInstance` register array which controls if the vertex input rate is either per-vertex or per-instance. This works in conjunction with the vertex attribute divisor for per-instance attribute repetition of attributes.
This commit is contained in:
PixelyIon 2021-11-16 15:28:05 +05:30
parent 476c070c7a
commit 612f324e78
3 changed files with 21 additions and 12 deletions

View File

@ -784,6 +784,10 @@ namespace skyline::gpu::interconnect {
vertexBindings[index].stride = stride;
}
void SetVertexBufferInputRate(u32 index, bool isPerInstance) {
vertexBindings[index].inputRate = isPerInstance ? vk::VertexInputRate::eInstance : vk::VertexInputRate::eVertex;
}
void SetVertexBufferIovaHigh(u32 index, u32 high) {
vertexBindingIovas[index].high = high;
}

View File

@ -324,18 +324,21 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
context.SetBlendLogicOpType(type);
})
#define VERTEX_BUFFER_CALLBACKS(z, index, data) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBuffers, index, config, { \
context.SetVertexBufferStride(index, config.stride); \
}) \
MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, high, { \
context.SetVertexBufferIovaHigh(index, high); \
}) \
MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, low, { \
context.SetVertexBufferIovaLow(index, low); \
}) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBuffers, index, divisor, { \
context.SetVertexBufferDivisor(index, divisor); \
#define VERTEX_BUFFER_CALLBACKS(z, index, data) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBuffers, index, config, { \
context.SetVertexBufferStride(index, config.stride); \
}) \
MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, high, { \
context.SetVertexBufferIovaHigh(index, high); \
}) \
MAXWELL3D_ARRAY_STRUCT_STRUCT_CASE(vertexBuffers, index, iova, low, { \
context.SetVertexBufferIovaLow(index, low); \
}) \
MAXWELL3D_ARRAY_STRUCT_CASE(vertexBuffers, index, divisor, { \
context.SetVertexBufferDivisor(index, divisor); \
}) \
MAXWELL3D_ARRAY_CASE(isVertexInputRatePerInstance, index, { \
context.SetVertexBufferInputRate(index, isVertexInputRatePerInstance); \
})
BOOST_PP_REPEAT(16, VERTEX_BUFFER_CALLBACKS, 0)

View File

@ -206,6 +206,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
Register<0x61F, float> depthBiasClamp;
Register<0x620, std::array<u32, type::VertexBufferCount>> isVertexInputRatePerInstance; //!< A per-VBO boolean denoting if the vertex input rate should be per vertex or per instance
Register<0x646, u32> cullFaceEnable;
Register<0x647, type::FrontFace> frontFace;
Register<0x648, type::CullFace> cullFace;