Implement Host Vertex Buffer Translation

Uses the buffer cache to retrieve an equivalent host vertex buffer for a corresponding guest vertex buffer.
This commit is contained in:
PixelyIon 2021-12-07 02:06:00 +05:30
parent b6ba770a27
commit 8989305637

View File

@ -1060,6 +1060,22 @@ namespace skyline::gpu::interconnect {
} }
} }
BufferView *GetVertexBuffer(size_t index) {
auto &vertexBuffer{vertexBuffers.at(index)};
if (vertexBuffer.disabled || vertexBuffer.start > vertexBuffer.end)
return nullptr;
else if (vertexBuffer.view)
return &*vertexBuffer.view;
if (vertexBuffer.guest.mappings.empty()) {
auto mappings{channelCtx.asCtx->gmmu.TranslateRange(vertexBuffer.start, (vertexBuffer.end + 1) - vertexBuffer.start)};
vertexBuffer.guest.mappings.assign(mappings.begin(), mappings.end());
}
vertexBuffer.view = gpu.buffer.FindOrCreate(vertexBuffer.guest);
return vertexBuffer.view.get();
}
/* Input Assembly */ /* Input Assembly */
private: private:
vk::PipelineInputAssemblyStateCreateInfo inputAssemblyState{}; vk::PipelineInputAssemblyStateCreateInfo inputAssemblyState{};