mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 22:28:32 +09:00
Merge remote-tracking branch 'origin/Feat/Rewriting' into Feat/Rewriting
This commit is contained in:
+1
-1
@@ -91,9 +91,9 @@ int __android_log_print(int prio, const char *tag, const char *fmt, ...);
|
|||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
||||||
#include "MG_Util/Miscellany/IndexGenerator.h"
|
|
||||||
#include "MG_Util/GLExtensions.h"
|
#include "MG_Util/GLExtensions.h"
|
||||||
#include "MG_Util/Types.h"
|
#include "MG_Util/Types.h"
|
||||||
|
#include "MG_Util/Miscellany/IndexGenerator.h"
|
||||||
#include "MG_Util/Debug/Log.h"
|
#include "MG_Util/Debug/Log.h"
|
||||||
#include "MG_Util/Converters/GLToStr/GLEnumConverter.h"
|
#include "MG_Util/Converters/GLToStr/GLEnumConverter.h"
|
||||||
#include "MG_Util/Converters/MGToStr/GLExtensionConverter.h"
|
#include "MG_Util/Converters/MGToStr/GLExtensionConverter.h"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace MobileGL {
|
|||||||
m_size = size;
|
m_size = size;
|
||||||
m_data.reserve(std::bit_ceil(size)); // power-of-2 reserve
|
m_data.reserve(std::bit_ceil(size)); // power-of-2 reserve
|
||||||
m_data.resize(size);
|
m_data.resize(size);
|
||||||
m_dirtyRange.Update(0, 0);
|
m_dirtyRange = { 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferObject::UploadData(DataPtr data, SizeT atOffset) {
|
void BufferObject::UploadData(DataPtr data, SizeT atOffset) {
|
||||||
@@ -40,7 +40,6 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_stagingData.clear();
|
m_stagingData.clear();
|
||||||
m_stagingData.shrink_to_fit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isMapped = false;
|
m_isMapped = false;
|
||||||
|
|||||||
@@ -48,19 +48,21 @@ TEST_F(BufferTest, PingPong) {
|
|||||||
|
|
||||||
Vector<Int> data { 1, 2, 3, 4, 5 };
|
Vector<Int> data { 1, 2, 3, 4, 5 };
|
||||||
|
|
||||||
SizeT byte_size = data.size() * sizeof(Int);
|
SizeT byteSize = data.size() * sizeof(Int);
|
||||||
// Write data
|
// Write data
|
||||||
bufWrite->Resize(byte_size);
|
bufWrite->Resize(byteSize);
|
||||||
DataPtr ptr { .data = data.data(), .size = byte_size };
|
DataPtr ptr { .data = data.data(), .size = byteSize };
|
||||||
bufWrite->UploadData(ptr, 0);
|
bufWrite->UploadData(ptr, 0);
|
||||||
|
|
||||||
// Readback
|
// Readback
|
||||||
auto bufRead = readSlot.GetBoundObject();
|
auto bufRead = readSlot.GetBoundObject();
|
||||||
void* p = bufRead->AcquireMemory(true, true, false);
|
void* p = bufRead->AcquireMemory(true, true, false);
|
||||||
ASSERT_TRUE(memcmp(data.data(), p, byte_size) == 0);
|
Vector<Int> bufdata(data.size());
|
||||||
|
memcpy(bufdata.data(), p, byteSize);
|
||||||
|
ASSERT_EQ(data, bufdata);
|
||||||
auto range = bufRead->GetDirtyRange();
|
auto range = bufRead->GetDirtyRange();
|
||||||
ASSERT_EQ(range.start, 0);
|
ASSERT_EQ(range.start, 0);
|
||||||
ASSERT_EQ(range.end, byte_size);
|
ASSERT_EQ(range.end, byteSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BufferTest, GenerateManyNames_NoPrematureCreation) {
|
TEST_F(BufferTest, GenerateManyNames_NoPrematureCreation) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace MobileGL {
|
|||||||
private:
|
private:
|
||||||
IndexType next_index_ = 0;
|
IndexType next_index_ = 0;
|
||||||
std::vector<IndexType> freed_indices_;
|
std::vector<IndexType> freed_indices_;
|
||||||
std::vector<UInt8> is_valid_;
|
std::vector<Uint8> is_valid_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user