mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[MG_Backend] (Disaggregated): resolve line-loop indices from wire storage
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user