[Feat|Fix] (MG_State/BufferState): Implement more functions.

Implemented:
    BufferObject: ReleaseMemory, FlushMemoryRange, UploadSubData, CopyDataFrom, ClearDirty

Fixed:
    BufferObject: AcquireMemory, AcquireMemoryRange
    Range1D: UnionUpdate
This commit is contained in:
BZLZHH
2025-07-20 02:30:53 +08:00
parent 46da761dcf
commit 6c920ce5dc
3 changed files with 121 additions and 27 deletions
+4 -12
View File
@@ -73,18 +73,9 @@ namespace MobileGL {
// represents a range of [start, end)
struct Range1D {
// const SizeT maxEnd;
// const SizeT minStart;
SizeT start = 0;
SizeT end = 0;
// Range1D(SizeT minStart_, SizeT maxEnd_)
// : minStart(minStart_), maxEnd(maxEnd_), start(minStart_), end(minStart_) {
// if (minStart_ >= maxEnd_) {
// throw RuntimeError("Invalid range: minStart must be less than maxEnd");
// }
// }
void Update(SizeT newStart, SizeT newEnd) {
assert(newStart <= newEnd);
start = newStart;
@@ -92,10 +83,11 @@ namespace MobileGL {
}
void UnionUpdate(SizeT newStart, SizeT newEnd) {
// if (newStart < minStart || newEnd > maxEnd) {
// throw RuntimeError("Range exceeds bounds");
// }
assert(newStart <= newEnd);
if (start == end) {
Update(newStart, newEnd);
return;
}
start = std::min(start, newStart);
end = std::max(end, newEnd);
}