[MG_Backend] (Disaggregated): resolve line-loop indices from wire storage

This commit is contained in:
2026-09-20 02:41:52 -04:00
parent 27f0e49e2f
commit 10f0ddcd1d
2 changed files with 23 additions and 2 deletions
@@ -936,7 +936,28 @@ namespace MobileGL::MG_Backend::DirectVulkan {
static Bool BuildClosedLineLoopIndices(GLsizei count, GLenum type, const void* indices,
Vector<Uint32>& outIndices) {
#if MOBILEGL_BUILD_DISAGGREGATED
RejectWireLegacyBuffer();
if (MG_Config::Transport != MG_Config::TransportMode::Monolith) {
const SizeT width = MG_Util::GetGLTypeSize(type);
if ((width != 1 && width != 2 && width != 4) || count < 2) return false;
const auto& bound = MG_Pipe::MGPipeApplier().IndexBuffer;
Vector<Uint8> owned;
const Uint8* bytes = static_cast<const Uint8*>(indices);
if (!MG_Pipe::MGPipeHandleIsNull(bound.Res)) {
owned.resize(static_cast<SizeT>(count) * width);
const Uint64 offset = bound.Offset + reinterpret_cast<Uint64>(indices);
if (offset < bound.Offset || !pVulkanRenderer->GetWireBufferManager().ReadWireBuffer(
bound.Res, offset, owned.size(), owned.data())) return false;
bytes = owned.data();
}
if (!bytes) return false;
outIndices.resize(static_cast<SizeT>(count) + 1);
for (GLsizei i = 0; i < count; ++i) {
outIndices[i] = 0;
Memcpy(&outIndices[i], bytes + static_cast<SizeT>(i) * width, width);
}
outIndices[count] = outIndices[0];
return true;
}
#endif
const SizeT indexSize = MG_Util::GetGLTypeSize(type);
if (indexSize == 0 || count < 2) {
@@ -562,7 +562,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT |
#if MOBILEGL_BUILD_DISAGGREGATED
(MG_Config::Transport != MG_Config::TransportMode::Monolith ? VK_BUFFER_USAGE_TRANSFER_DST_BIT : 0) |
(MG_Config::Transport != MG_Config::TransportMode::Monolith ? VkBufferUsageFlags{VK_BUFFER_USAGE_TRANSFER_DST_BIT} : 0u) |
#endif
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
.memoryUsage = m_initInfo.transientMemoryUsage,