16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

Change size arguments type to GLsizeiptr

This commit is contained in:
docentYT
2026-05-11 23:41:43 +02:00
parent 6542021253
commit 4878afbffc
4 changed files with 10 additions and 10 deletions

View File

@@ -61,19 +61,19 @@ gl::buffer::~buffer()
glDeleteBuffers(1, *this); glDeleteBuffers(1, *this);
} }
void gl::buffer::allocate(targets target, int size, GLenum hint) void gl::buffer::allocate(targets target, GLsizeiptr size, GLenum hint)
{ {
bind(target); bind(target);
glBufferData(glenum_target(target), size, nullptr, hint); glBufferData(glenum_target(target), size, nullptr, hint);
} }
void gl::buffer::upload(targets target, const void *data, int offset, int size) void gl::buffer::upload(targets target, const void *data, int offset, GLsizeiptr size)
{ {
bind(target); bind(target);
glBufferSubData(glenum_target(target), offset, size, data); glBufferSubData(glenum_target(target), offset, size, data);
} }
void gl::buffer::download(targets target, void *data, int offset, int size) void gl::buffer::download(targets target, void *data, int offset, GLsizeiptr size)
{ {
bind(target); bind(target);
if (GLAD_GL_VERSION_3_3) if (GLAD_GL_VERSION_3_3)

View File

@@ -39,8 +39,8 @@ namespace gl
static void unbind(targets target); static void unbind(targets target);
static void unbind(); static void unbind();
void allocate(targets target, int size, GLenum hint); void allocate(targets target, GLsizeiptr size, GLenum hint);
void upload(targets target, const void *data, int offset, int size); void upload(targets target, const void *data, int offset, GLsizeiptr size);
void download(targets target, void *data, int offset, int size); void download(targets target, void *data, int offset, GLsizeiptr size);
}; };
} }

View File

@@ -1,7 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ubo.h" #include "ubo.h"
gl::ubo::ubo(int size, int idx, GLenum hint) gl::ubo::ubo(size_t size, int idx, GLenum hint)
{ {
allocate(buffer::UNIFORM_BUFFER, size, hint); allocate(buffer::UNIFORM_BUFFER, size, hint);
index = idx; index = idx;
@@ -13,7 +13,7 @@ void gl::ubo::bind_uniform()
bind_base(buffer::UNIFORM_BUFFER, index); bind_base(buffer::UNIFORM_BUFFER, index);
} }
void gl::ubo::update(const uint8_t *data, int offset, int size) void gl::ubo::update(const uint8_t *data, int offset, GLsizeiptr size)
{ {
upload(buffer::UNIFORM_BUFFER, data, offset, size); upload(buffer::UNIFORM_BUFFER, data, offset, size);
} }

View File

@@ -13,11 +13,11 @@ namespace gl
int index; int index;
public: public:
ubo(int size, int index, GLenum hint = GL_DYNAMIC_DRAW); ubo(size_t size, int index, GLenum hint = GL_DYNAMIC_DRAW);
void bind_uniform(); void bind_uniform();
void update(const uint8_t *data, int offset, int size); void update(const uint8_t *data, int offset, GLsizeiptr size);
template <typename T> void update(const T &data, size_t offset = 0) template <typename T> void update(const T &data, size_t offset = 0)
{ {
update(reinterpret_cast<const uint8_t*>(&data), offset, sizeof(data)); update(reinterpret_cast<const uint8_t*>(&data), offset, sizeof(data));