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

reformat: use auto on certain types

This commit is contained in:
jerrrrycho
2026-07-04 05:22:52 +02:00
parent f61068ff89
commit 20e7a99516
118 changed files with 2118 additions and 2063 deletions

View File

@@ -82,7 +82,7 @@ void gl::buffer::download(targets target, void *data, int offset, GLsizeiptr siz
}
else
{
void *glbuf = glMapBufferRange(glenum_target(target), offset, size, GL_MAP_READ_BIT);
const void *glbuf = glMapBufferRange(glenum_target(target), offset, size, GL_MAP_READ_BIT);
memcpy(data, glbuf, size);
glUnmapBuffer(glenum_target(target));
}

View File

@@ -15,6 +15,6 @@ bool gl::fence::is_signalled()
{
// glClientWaitSync is faster than glGetSynciv. glGetSynciv probably tries to synchronize cpu and gpu
// https://stackoverflow.com/questions/34601376/which-to-use-for-opengl-client-side-waiting-glgetsynciv-vs-glclientwaitsync
GLenum r = glClientWaitSync(sync, GL_SYNC_FLUSH_COMMANDS_BIT, 1);
const GLenum r = glClientWaitSync(sync, GL_SYNC_FLUSH_COMMANDS_BIT, 1);
return r == GL_ALREADY_SIGNALED || r == GL_CONDITION_SATISFIED;
}

View File

@@ -87,7 +87,7 @@ void gl::framebuffer::blit(framebuffer *src, framebuffer *dst, int sx, int sy, i
if (mask & GL_COLOR_BUFFER_BIT)
{
int attachment_n = attachment - GL_COLOR_ATTACHMENT0;
const int attachment_n = attachment - GL_COLOR_ATTACHMENT0;
{
GLenum outputs[8] = { GL_NONE };
@@ -111,7 +111,7 @@ void gl::framebuffer::blit(framebuffer *src, framebuffer *dst, int sx, int sy, i
void gl::framebuffer::setup_drawing(int attachments)
{
bind();
GLenum a[8] =
const GLenum a[8] =
{
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,

View File

@@ -3,7 +3,7 @@
void gl::pbo::request_read(int x, int y, int lx, int ly, int pixsize, GLenum format, GLenum type)
{
int s = lx * ly * pixsize;
const int s = lx * ly * pixsize;
if (s != size)
allocate(PIXEL_PACK_BUFFER, s, GL_STREAM_DRAW);
size = s;
@@ -25,7 +25,7 @@ bool gl::pbo::read_data(int lx, int ly, void *data, int pixsize)
if (!data_ready)
return false;
int s = lx * ly * pixsize;
const int s = lx * ly * pixsize;
if (s != size)
return false;

View File

@@ -41,7 +41,7 @@ bool has_gl_extension(char const *name) {
GLint count = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &count);
for (GLint i = 0; i < count; ++i) {
auto ext = reinterpret_cast<char const *>(glGetStringi(GL_EXTENSIONS, i));
const auto ext = reinterpret_cast<char const *>(glGetStringi(GL_EXTENSIONS, i));
if (ext != nullptr && std::strcmp(ext, name) == 0) {
return true;
}
@@ -72,11 +72,11 @@ void gl::shader::expand_includes(std::string &str, const std::string &basedir)
{
size_t start_pos = 0;
std::string magic = "#include";
const std::string magic = "#include";
while ((start_pos = str.find(magic, start_pos)) != str.npos)
{
size_t fp = str.find('<', start_pos);
size_t fe = str.find('>', start_pos);
const size_t fp = str.find('<', start_pos);
const size_t fe = str.find('>', start_pos);
if (fp == str.npos || fe == str.npos)
return;
@@ -308,7 +308,7 @@ gl::shader::shader(const std::string &filename)
{
name = filename;
std::pair<GLuint, std::string> source = process_source(filename, "shaders/");
const std::pair<GLuint, std::string> source = process_source(filename, "shaders/");
const GLchar *cstr = source.second.c_str();
@@ -341,8 +341,8 @@ void gl::program::init()
for (auto it : texture_conf)
{
shader::texture_entry &e = it.second;
GLuint loc = glGetUniformLocation(*this, it.first.c_str());
const shader::texture_entry &e = it.second;
const GLuint loc = glGetUniformLocation(*this, it.first.c_str());
glUniform1i(loc, e.id);
}