mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -13,8 +13,7 @@ namespace
|
||||
{
|
||||
bool IsMapBufferSupported()
|
||||
{
|
||||
static bool const isSupported =
|
||||
GLFunctions::ExtensionsList.IsSupported(GLExtensionsList::MapBuffer);
|
||||
static bool const isSupported = GLFunctions::ExtensionsList.IsSupported(GLExtensionsList::MapBuffer);
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
@@ -27,8 +26,7 @@ glConst glTarget(GPUBuffer::Target t)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
GPUBuffer::GPUBuffer(Target t, void const * data, uint8_t elementSize, uint32_t capacity,
|
||||
uint64_t batcherHash)
|
||||
GPUBuffer::GPUBuffer(Target t, void const * data, uint8_t elementSize, uint32_t capacity, uint64_t batcherHash)
|
||||
: TBase(elementSize, capacity)
|
||||
, m_t(t)
|
||||
, m_mappingOffset(0)
|
||||
@@ -59,8 +57,7 @@ void GPUBuffer::UploadData(void const * data, uint32_t elementCount)
|
||||
|
||||
uint32_t currentSize = GetCurrentSize();
|
||||
uint8_t elementSize = GetElementSize();
|
||||
ASSERT(GetCapacity() >= elementCount + currentSize,
|
||||
("Not enough memory to upload ", elementCount, " elements"));
|
||||
ASSERT(GetCapacity() >= elementCount + currentSize, ("Not enough memory to upload ", elementCount, " elements"));
|
||||
Bind();
|
||||
|
||||
#if defined(CHECK_VBO_BOUNDS)
|
||||
@@ -69,8 +66,7 @@ void GPUBuffer::UploadData(void const * data, uint32_t elementCount)
|
||||
ASSERT_LESS_OR_EQUAL((elementCount + currentSize) * elementSize, size, ());
|
||||
#endif
|
||||
|
||||
GLFunctions::glBufferSubData(glTarget(m_t), elementCount * elementSize, data,
|
||||
currentSize * elementSize);
|
||||
GLFunctions::glBufferSubData(glTarget(m_t), elementCount * elementSize, data, currentSize * elementSize);
|
||||
TBase::UploadData(elementCount);
|
||||
|
||||
#if defined(TRACK_GPU_MEM)
|
||||
@@ -78,7 +74,10 @@ void GPUBuffer::UploadData(void const * data, uint32_t elementCount)
|
||||
#endif
|
||||
}
|
||||
|
||||
void GPUBuffer::Bind() { GLFunctions::glBindBuffer(m_bufferID, glTarget(m_t)); }
|
||||
void GPUBuffer::Bind()
|
||||
{
|
||||
GLFunctions::glBindBuffer(m_bufferID, glTarget(m_t));
|
||||
}
|
||||
|
||||
void * GPUBuffer::Map(uint32_t elementOffset, uint32_t elementCount)
|
||||
{
|
||||
@@ -96,12 +95,10 @@ void * GPUBuffer::Map(uint32_t elementOffset, uint32_t elementCount)
|
||||
uint32_t const elementSize = GetElementSize();
|
||||
uint32_t const byteOffset = elementOffset * elementSize;
|
||||
uint32_t const byteCount = elementCount * elementSize;
|
||||
return GLFunctions::glMapBufferRange(glTarget(m_t), byteOffset, byteCount,
|
||||
gl_const::GLWriteBufferBit);
|
||||
return GLFunctions::glMapBufferRange(glTarget(m_t), byteOffset, byteCount, gl_const::GLWriteBufferBit);
|
||||
}
|
||||
|
||||
void GPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOffset,
|
||||
uint32_t elementCount)
|
||||
void GPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOffset, uint32_t elementCount)
|
||||
{
|
||||
uint32_t const elementSize = GetElementSize();
|
||||
uint32_t const byteOffset = (elementOffset + m_mappingOffset) * elementSize;
|
||||
@@ -146,8 +143,7 @@ void GPUBuffer::Resize(void const * data, uint32_t elementCount)
|
||||
{
|
||||
TBase::Resize(elementCount);
|
||||
Bind();
|
||||
GLFunctions::glBufferData(glTarget(m_t), GetCapacity() * GetElementSize(), data,
|
||||
gl_const::GLDynamicDraw);
|
||||
GLFunctions::glBufferData(glTarget(m_t), GetCapacity() * GetElementSize(), data, gl_const::GLDynamicDraw);
|
||||
|
||||
// If we have set up data already (in glBufferData), we have to call SetDataSize.
|
||||
if (data != nullptr)
|
||||
|
||||
Reference in New Issue
Block a user