[Fix] (MG_Backend/DirectGLES): Fix wrong buffer data in sync.

This commit is contained in:
BZLZHH
2025-10-26 09:50:05 +08:00
parent 21d659214f
commit d90e35d630
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -69,7 +69,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
MGLOG_D("Syncing buffer data (glBufferData) for object with ID : %u", m_backendBufferId);
const void* data = stateBufferObject->GetDataReadOnly().get();
const void* data = stateBufferObject->GetDataReadOnly()->data();
SizeT size = stateBufferObject->GetSize();
GLenum usage = MG_Util::ConvertBufferUsageToGLEnum(stateBufferObject->GetUsage());
@@ -85,7 +85,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
MGLOG_D("Syncing buffer sub-data (glBufferSubData) for object with ID : %u", m_backendBufferId);
const void* data = stateBufferObject->GetDataReadOnly().get();
const void* data = stateBufferObject->GetDataReadOnly()->data();
auto range = stateBufferObject->GetDirtyRange();
// dirty range: [range.start, range.end)
@@ -105,7 +105,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
void* mappedData = MG_External::GLES::glMapBufferRange(
TempBufferTarget, range.start, range.end - range.start,
(invalidate ? GL_MAP_INVALIDATE_BUFFER_BIT : 0) | GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
const void* data = stateBufferObject->GetDataReadOnly().get();
const void* data = stateBufferObject->GetDataReadOnly()->data();
if (mappedData) {
Memcpy(reinterpret_cast<const void*>(reinterpret_cast<const char*>(data) + range.start), mappedData,
range.end - range.start);
@@ -125,7 +125,7 @@ namespace MobileGL {
}
}
SharedPtr<Data> BufferObject::GetDataReadOnly() const {
const SharedPtr<Data> BufferObject::GetDataReadOnly() const {
return m_dataPtr;
}
@@ -71,7 +71,7 @@ namespace MobileGL {
BufferUsage GetUsage() const;
Range1D GetDirtyRange() const;
Range1D GetMappedRange() const;
SharedPtr<Data> GetDataReadOnly() const;
const SharedPtr<Data> GetDataReadOnly() const;
Flags<BufferMappingAccessBit> GetMappingAccess() const;
private: