mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_Backend/DirectGLES): Fix wrong buffer data in sync.
This commit is contained in:
@@ -69,7 +69,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
|
|
||||||
MGLOG_D("Syncing buffer data (glBufferData) for object with ID : %u", m_backendBufferId);
|
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();
|
SizeT size = stateBufferObject->GetSize();
|
||||||
GLenum usage = MG_Util::ConvertBufferUsageToGLEnum(stateBufferObject->GetUsage());
|
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);
|
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();
|
auto range = stateBufferObject->GetDirtyRange();
|
||||||
// dirty range: [range.start, range.end)
|
// dirty range: [range.start, range.end)
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
void* mappedData = MG_External::GLES::glMapBufferRange(
|
void* mappedData = MG_External::GLES::glMapBufferRange(
|
||||||
TempBufferTarget, range.start, range.end - range.start,
|
TempBufferTarget, range.start, range.end - range.start,
|
||||||
(invalidate ? GL_MAP_INVALIDATE_BUFFER_BIT : 0) | GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
(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) {
|
if (mappedData) {
|
||||||
Memcpy(reinterpret_cast<const void*>(reinterpret_cast<const char*>(data) + range.start), mappedData,
|
Memcpy(reinterpret_cast<const void*>(reinterpret_cast<const char*>(data) + range.start), mappedData,
|
||||||
range.end - range.start);
|
range.end - range.start);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPtr<Data> BufferObject::GetDataReadOnly() const {
|
const SharedPtr<Data> BufferObject::GetDataReadOnly() const {
|
||||||
return m_dataPtr;
|
return m_dataPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace MobileGL {
|
|||||||
BufferUsage GetUsage() const;
|
BufferUsage GetUsage() const;
|
||||||
Range1D GetDirtyRange() const;
|
Range1D GetDirtyRange() const;
|
||||||
Range1D GetMappedRange() const;
|
Range1D GetMappedRange() const;
|
||||||
SharedPtr<Data> GetDataReadOnly() const;
|
const SharedPtr<Data> GetDataReadOnly() const;
|
||||||
Flags<BufferMappingAccessBit> GetMappingAccess() const;
|
Flags<BufferMappingAccessBit> GetMappingAccess() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user