hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-20 02:19:29 +0200
committerhachem <im@hachem.wtf>2026-08-20 02:32:34 +0200
commit31f6a54d35dd13f0911f132dc60f5f0d851d7e43 (patch)
tree75b5410d785a5acc9e435d4147f3de4989278172 /src/platform
parent0f9483ce025b015b1197b7a7efc8ed983bedbb8e (diff)
refactor: trailing return types in the OpenGL and Metal backends
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/metal/metal_context.h4
-rw-r--r--src/platform/opengl/opengl_framebuffer.cpp12
-rw-r--r--src/platform/opengl/opengl_framebuffer.h16
-rw-r--r--src/platform/opengl/opengl_index_buffer.cpp4
-rw-r--r--src/platform/opengl/opengl_index_buffer.h6
-rw-r--r--src/platform/opengl/opengl_renderer_api.cpp32
-rw-r--r--src/platform/opengl/opengl_renderer_api.h16
-rw-r--r--src/platform/opengl/opengl_shader.cpp46
-rw-r--r--src/platform/opengl/opengl_shader.h50
-rw-r--r--src/platform/opengl/opengl_texture.cpp18
-rw-r--r--src/platform/opengl/opengl_texture.h26
-rw-r--r--src/platform/opengl/opengl_uniform_buffer.cpp4
-rw-r--r--src/platform/opengl/opengl_uniform_buffer.h4
-rw-r--r--src/platform/opengl/opengl_vertex_array.cpp8
-rw-r--r--src/platform/opengl/opengl_vertex_array.h8
-rw-r--r--src/platform/opengl/opengl_vertex_buffer.cpp6
-rw-r--r--src/platform/opengl/opengl_vertex_buffer.h10
17 files changed, 135 insertions, 135 deletions
diff --git a/src/platform/metal/metal_context.h b/src/platform/metal/metal_context.h
index 66e8ae2..7a206ea 100644
--- a/src/platform/metal/metal_context.h
+++ b/src/platform/metal/metal_context.h
@@ -2,7 +2,7 @@
namespace Donut
{
- bool metal_probe();
+ auto metal_probe() -> bool;
- bool metal_compute_self_test();
+ auto metal_compute_self_test() -> bool;
}
diff --git a/src/platform/opengl/opengl_framebuffer.cpp b/src/platform/opengl/opengl_framebuffer.cpp
index 9040994..c6e646a 100644
--- a/src/platform/opengl/opengl_framebuffer.cpp
+++ b/src/platform/opengl/opengl_framebuffer.cpp
@@ -109,7 +109,7 @@ namespace Donut
glDeleteTextures(1, &m_depth_attachment);
}
- void OpenGLFramebuffer::invalidate()
+ auto OpenGLFramebuffer::invalidate() -> void
{
if (m_renderer_id)
{
@@ -204,18 +204,18 @@ namespace Donut
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
- void OpenGLFramebuffer::bind()
+ auto OpenGLFramebuffer::bind() -> void
{
glBindFramebuffer(GL_FRAMEBUFFER, m_renderer_id);
glViewport(0, 0, m_specification.Width, m_specification.Height);
}
- void OpenGLFramebuffer::unbind()
+ auto OpenGLFramebuffer::unbind() -> void
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
- void OpenGLFramebuffer::resize(uint32_t width, uint32_t height)
+ auto OpenGLFramebuffer::resize(uint32_t width, uint32_t height) -> void
{
m_specification.Width = width;
m_specification.Height = height;
@@ -223,7 +223,7 @@ namespace Donut
invalidate();
}
- int OpenGLFramebuffer::read_pixel(uint32_t attachment_index, int x, int y)
+ auto OpenGLFramebuffer::read_pixel(uint32_t attachment_index, int x, int y) -> int
{
glReadBuffer(GL_COLOR_ATTACHMENT0 + attachment_index);
int pixel_data;
@@ -231,7 +231,7 @@ namespace Donut
return pixel_data;
}
- void OpenGLFramebuffer::clear_attachment(uint32_t attachment_index, int value)
+ auto OpenGLFramebuffer::clear_attachment(uint32_t attachment_index, int value) -> void
{
glBindFramebuffer(GL_FRAMEBUFFER, m_renderer_id);
glClearBufferiv(GL_COLOR, static_cast<GLint>(attachment_index), &value);
diff --git a/src/platform/opengl/opengl_framebuffer.h b/src/platform/opengl/opengl_framebuffer.h
index 7b07ddd..456d924 100644
--- a/src/platform/opengl/opengl_framebuffer.h
+++ b/src/platform/opengl/opengl_framebuffer.h
@@ -10,18 +10,18 @@ namespace Donut
OpenGLFramebuffer(const FramebufferSpecification& spec);
virtual ~OpenGLFramebuffer();
- void invalidate();
+ auto invalidate() -> void;
- virtual void bind() override;
- virtual void unbind() override;
+ virtual auto bind() -> void override;
+ virtual auto unbind() -> void override;
- virtual void resize(uint32_t width, uint32_t height) override;
- virtual int read_pixel(uint32_t attachment_index, int x, int y) override;
+ virtual auto resize(uint32_t width, uint32_t height) -> void override;
+ virtual auto read_pixel(uint32_t attachment_index, int x, int y) -> int override;
- virtual void clear_attachment(uint32_t attachment_index, int value) override;
- virtual uint32_t get_color_attachment_renderer_id(uint32_t index = 0) const override { return m_color_attachments[index]; }
+ virtual auto clear_attachment(uint32_t attachment_index, int value) -> void override;
+ virtual auto get_color_attachment_renderer_id(uint32_t index = 0) const -> uint32_t override{ return m_color_attachments[index]; }
- virtual const FramebufferSpecification& get_specification() const override { return m_specification; }
+ virtual auto get_specification() const -> const FramebufferSpecification& override{ return m_specification; }
private:
uint32_t m_renderer_id = 0;
FramebufferSpecification m_specification;
diff --git a/src/platform/opengl/opengl_index_buffer.cpp b/src/platform/opengl/opengl_index_buffer.cpp
index d8ecb1d..60b710d 100644
--- a/src/platform/opengl/opengl_index_buffer.cpp
+++ b/src/platform/opengl/opengl_index_buffer.cpp
@@ -16,12 +16,12 @@ namespace Donut
glDeleteBuffers(1, &m_renderer_id);
}
- void OpenGLIndexBuffer::bind() const
+ auto OpenGLIndexBuffer::bind() const -> void
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_renderer_id);
}
- void OpenGLIndexBuffer::unbind() const
+ auto OpenGLIndexBuffer::unbind() const -> void
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
diff --git a/src/platform/opengl/opengl_index_buffer.h b/src/platform/opengl/opengl_index_buffer.h
index 43a9d86..397da43 100644
--- a/src/platform/opengl/opengl_index_buffer.h
+++ b/src/platform/opengl/opengl_index_buffer.h
@@ -11,9 +11,9 @@ namespace Donut
OpenGLIndexBuffer(const uint32_t* indices, uint32_t count);
virtual ~OpenGLIndexBuffer();
- virtual void bind() const override;
- virtual void unbind() const override;
- virtual uint32_t get_count() const override { return m_count; }
+ virtual auto bind() const -> void override;
+ virtual auto unbind() const -> void override;
+ virtual auto get_count() const -> uint32_t override{ return m_count; }
private:
uint32_t m_renderer_id;
diff --git a/src/platform/opengl/opengl_renderer_api.cpp b/src/platform/opengl/opengl_renderer_api.cpp
index ed5ce78..07748e6 100644
--- a/src/platform/opengl/opengl_renderer_api.cpp
+++ b/src/platform/opengl/opengl_renderer_api.cpp
@@ -5,7 +5,7 @@
namespace Donut
{
- void OpenGLRendererAPI::init()
+ auto OpenGLRendererAPI::init() -> void
{
if (!glfwGetCurrentContext())
{
@@ -29,32 +29,32 @@ namespace Donut
glFrontFace(GL_CCW);
}
- void OpenGLRendererAPI::set_viewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
+ auto OpenGLRendererAPI::set_viewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) -> void
{
glViewport(x, y, width, height);
}
- void OpenGLRendererAPI::set_clear_color(const glm::vec4& color)
+ auto OpenGLRendererAPI::set_clear_color(const glm::vec4& color) -> void
{
glClearColor(color.r, color.g, color.b, color.a);
}
- void OpenGLRendererAPI::clear()
+ auto OpenGLRendererAPI::clear() -> void
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
- void OpenGLRendererAPI::enable_depth_test()
+ auto OpenGLRendererAPI::enable_depth_test() -> void
{
glEnable(GL_DEPTH_TEST);
}
- void OpenGLRendererAPI::disable_depth_test()
+ auto OpenGLRendererAPI::disable_depth_test() -> void
{
glDisable(GL_DEPTH_TEST);
}
- void OpenGLRendererAPI::set_face_culling(bool enabled)
+ auto OpenGLRendererAPI::set_face_culling(bool enabled) -> void
{
if (enabled)
{
@@ -66,42 +66,42 @@ namespace Donut
glDisable(GL_CULL_FACE);
}
- void OpenGLRendererAPI::enable_blending()
+ auto OpenGLRendererAPI::enable_blending() -> void
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- void OpenGLRendererAPI::disable_blending()
+ auto OpenGLRendererAPI::disable_blending() -> void
{
glDisable(GL_BLEND);
}
- void OpenGLRendererAPI::draw_indexed(const Ref<VertexArray>& vertex_array, uint32_t index_count)
+ auto OpenGLRendererAPI::draw_indexed(const Ref<VertexArray>& vertex_array, uint32_t index_count) -> void
{
uint32_t count = index_count ? index_count : vertex_array->get_index_buffer()->get_count();
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr);
glBindTexture(GL_TEXTURE_2D, 0);
}
- void OpenGLRendererAPI::draw_arrays(uint32_t vertex_count, uint32_t first)
+ auto OpenGLRendererAPI::draw_arrays(uint32_t vertex_count, uint32_t first) -> void
{
glDrawArrays(GL_TRIANGLES, first, vertex_count);
}
- void OpenGLRendererAPI::draw_lines(const Ref<VertexArray>& vertex_array, uint32_t index_count)
+ auto OpenGLRendererAPI::draw_lines(const Ref<VertexArray>& vertex_array, uint32_t index_count) -> void
{
uint32_t count = index_count ? index_count : vertex_array->get_index_buffer()->get_count();
glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, nullptr);
}
- void OpenGLRendererAPI::bind_texture(uint32_t texture_id, uint32_t slot)
+ auto OpenGLRendererAPI::bind_texture(uint32_t texture_id, uint32_t slot) -> void
{
glActiveTexture(GL_TEXTURE0 + slot);
glBindTexture(GL_TEXTURE_2D, texture_id);
}
- void OpenGLRendererAPI::bind_image_texture(uint32_t texture_id, uint32_t slot, bool read_only)
+ auto OpenGLRendererAPI::bind_image_texture(uint32_t texture_id, uint32_t slot, bool read_only) -> void
{
if (glBindImageTexture == nullptr)
return;
@@ -109,8 +109,8 @@ namespace Donut
read_only ? GL_READ_ONLY : GL_WRITE_ONLY, GL_RGBA8);
}
- void OpenGLRendererAPI::read_pixels(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- uint32_t format, uint32_t type, void* pixels)
+ auto OpenGLRendererAPI::read_pixels(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
+ uint32_t format, uint32_t type, void* pixels) -> void
{
glReadPixels(x, y, width, height, format, type, pixels);
}
diff --git a/src/platform/opengl/opengl_renderer_api.h b/src/platform/opengl/opengl_renderer_api.h
index 51985e0..02f18ab 100644
--- a/src/platform/opengl/opengl_renderer_api.h
+++ b/src/platform/opengl/opengl_renderer_api.h
@@ -13,16 +13,16 @@ namespace Donut
: public RendererAPI
{
public:
- virtual void init() override;
+ virtual auto init() -> void override;
virtual void set_viewport(uint32_t x, uint32_t y,
uint32_t width, uint32_t height) override;
- virtual void set_clear_color(const glm::vec4& color) override;
- virtual void clear() override;
- virtual void enable_depth_test() override;
- virtual void disable_depth_test() override;
- virtual void set_face_culling(bool enabled) override;
- virtual void enable_blending() override;
- virtual void disable_blending() override;
+ virtual auto set_clear_color(const glm::vec4& color) -> void override;
+ virtual auto clear() -> void override;
+ virtual auto enable_depth_test() -> void override;
+ virtual auto disable_depth_test() -> void override;
+ virtual auto set_face_culling(bool enabled) -> void override;
+ virtual auto enable_blending() -> void override;
+ virtual auto disable_blending() -> void override;
virtual void draw_indexed(const Ref<VertexArray>& vertex_array,
uint32_t index_count = 0) override;
diff --git a/src/platform/opengl/opengl_shader.cpp b/src/platform/opengl/opengl_shader.cpp
index e7c3d6a..c233bd6 100644
--- a/src/platform/opengl/opengl_shader.cpp
+++ b/src/platform/opengl/opengl_shader.cpp
@@ -71,7 +71,7 @@ namespace Donut
glDeleteProgram(m_renderer_id);
}
- std::string OpenGLShader::read_file(const std::string& filepath)
+ auto OpenGLShader::read_file(const std::string& filepath) -> std::string
{
std::string result;
std::ifstream in(filepath, std::ios::in |
@@ -91,7 +91,7 @@ namespace Donut
return result;
}
- std::unordered_map<uint32_t, std::string> OpenGLShader::pre_process(const std::string& source)
+ auto OpenGLShader::pre_process(const std::string& source) -> std::unordered_map<uint32_t, std::string>
{
std::unordered_map<uint32_t, std::string> shader_sources;
@@ -114,7 +114,7 @@ namespace Donut
return shader_sources;
}
- void OpenGLShader::compile(const std::unordered_map<uint32_t, std::string>& shader_sources)
+ auto OpenGLShader::compile(const std::unordered_map<uint32_t, std::string>& shader_sources) -> void
{
uint32_t program = glCreateProgram();
std::vector<uint32_t> glShaderIDs(shader_sources.size());
@@ -176,114 +176,114 @@ namespace Donut
}
}
- void OpenGLShader::bind() const
+ auto OpenGLShader::bind() const -> void
{
glUseProgram(m_renderer_id);
}
- void OpenGLShader::unbind() const
+ auto OpenGLShader::unbind() const -> void
{
glUseProgram(0);
}
- void OpenGLShader::set_int(const std::string& name, int value)
+ auto OpenGLShader::set_int(const std::string& name, int value) -> void
{
upload_uniform_int(name, value);
}
- void OpenGLShader::set_int_array(const std::string& name, int* values, uint32_t count)
+ auto OpenGLShader::set_int_array(const std::string& name, int* values, uint32_t count) -> void
{
upload_uniform_int_array(name, values, count);
}
- void OpenGLShader::set_float(const std::string& name, float value)
+ auto OpenGLShader::set_float(const std::string& name, float value) -> void
{
upload_uniform_float(name, value);
}
- void OpenGLShader::set_float2(const std::string& name, const glm::vec2& value)
+ auto OpenGLShader::set_float2(const std::string& name, const glm::vec2& value) -> void
{
upload_uniform_float2(name, value);
}
- void OpenGLShader::set_float3(const std::string& name, const glm::vec3& value)
+ auto OpenGLShader::set_float3(const std::string& name, const glm::vec3& value) -> void
{
upload_uniform_float3(name, value);
}
- void OpenGLShader::set_float4(const std::string& name, const glm::vec4& value)
+ auto OpenGLShader::set_float4(const std::string& name, const glm::vec4& value) -> void
{
upload_uniform_float4(name, value);
}
- void OpenGLShader::set_mat4(const std::string& name, const glm::mat4& value)
+ auto OpenGLShader::set_mat4(const std::string& name, const glm::mat4& value) -> void
{
upload_uniform_mat4(name, value);
}
- void OpenGLShader::upload_uniform_int(const std::string& name, int value)
+ auto OpenGLShader::upload_uniform_int(const std::string& name, int value) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniform1i(location, value);
}
- void OpenGLShader::upload_uniform_int_array(const std::string& name, int* values, uint32_t count)
+ auto OpenGLShader::upload_uniform_int_array(const std::string& name, int* values, uint32_t count) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniform1iv(location, count, values);
}
- void OpenGLShader::upload_uniform_float(const std::string& name, float value)
+ auto OpenGLShader::upload_uniform_float(const std::string& name, float value) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniform1f(location, value);
}
- void OpenGLShader::upload_uniform_float2(const std::string& name, const glm::vec2& value)
+ auto OpenGLShader::upload_uniform_float2(const std::string& name, const glm::vec2& value) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniform2f(location, value.x, value.y);
}
- void OpenGLShader::upload_uniform_float3(const std::string& name, const glm::vec3& value)
+ auto OpenGLShader::upload_uniform_float3(const std::string& name, const glm::vec3& value) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniform3f(location, value.x, value.y, value.z);
}
- void OpenGLShader::upload_uniform_float4(const std::string& name, const glm::vec4& value)
+ auto OpenGLShader::upload_uniform_float4(const std::string& name, const glm::vec4& value) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniform4f(location, value.x, value.y, value.z, value.w);
}
- void OpenGLShader::upload_uniform_mat3(const std::string& name, const glm::mat3& matrix)
+ auto OpenGLShader::upload_uniform_mat3(const std::string& name, const glm::mat3& matrix) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniformMatrix3fv(location, 1, m_is_slang ? GL_TRUE : GL_FALSE, glm::value_ptr(matrix));
}
- void OpenGLShader::upload_uniform_mat4(const std::string& name, const glm::mat4& matrix)
+ auto OpenGLShader::upload_uniform_mat4(const std::string& name, const glm::mat4& matrix) -> void
{
int location = glGetUniformLocation(m_renderer_id, name.c_str());
glUniformMatrix4fv(location, 1, m_is_slang ? GL_TRUE : GL_FALSE, glm::value_ptr(matrix));
}
- void OpenGLShader::dispatch(uint32_t x, uint32_t y, uint32_t z)
+ auto OpenGLShader::dispatch(uint32_t x, uint32_t y, uint32_t z) -> void
{
if (m_renderer_id == 0 || glDispatchCompute == nullptr)
return;
glDispatchCompute(x, y, z);
}
- void OpenGLShader::dispatch_indirect(uint32_t offset)
+ auto OpenGLShader::dispatch_indirect(uint32_t offset) -> void
{
if (m_renderer_id == 0 || glDispatchComputeIndirect == nullptr)
return;
glDispatchComputeIndirect(offset);
}
- void OpenGLShader::memory_barrier(uint32_t barriers)
+ auto OpenGLShader::memory_barrier(uint32_t barriers) -> void
{
if (glMemoryBarrier == nullptr)
return;
diff --git a/src/platform/opengl/opengl_shader.h b/src/platform/opengl/opengl_shader.h
index 978b56a..203a4a9 100644
--- a/src/platform/opengl/opengl_shader.h
+++ b/src/platform/opengl/opengl_shader.h
@@ -16,37 +16,37 @@ namespace Donut
OpenGLShader(const std::string& name, const std::string& compute_src);
virtual ~OpenGLShader();
- virtual void bind() const override;
- virtual void unbind() const override;
+ virtual auto bind() const -> void override;
+ virtual auto unbind() const -> void override;
- virtual void set_int( const std::string& name, int value) override;
- virtual void set_int_array(const std::string& name, int* values, uint32_t count) override;
- virtual void set_float( const std::string& name, float value) override;
- virtual void set_float2( const std::string& name, const glm::vec2& value) override;
- virtual void set_float3( const std::string& name, const glm::vec3& value) override;
- virtual void set_float4( const std::string& name, const glm::vec4& value) override;
- virtual void set_mat4( const std::string& name, const glm::mat4& value) override;
+ virtual auto set_int( const std::string& name, int value) -> void override;
+ virtual auto set_int_array(const std::string& name, int* values, uint32_t count) -> void override;
+ virtual auto set_float( const std::string& name, float value) -> void override;
+ virtual auto set_float2( const std::string& name, const glm::vec2& value) -> void override;
+ virtual auto set_float3( const std::string& name, const glm::vec3& value) -> void override;
+ virtual auto set_float4( const std::string& name, const glm::vec4& value) -> void override;
+ virtual auto set_mat4( const std::string& name, const glm::mat4& value) -> void override;
- virtual void dispatch(uint32_t x, uint32_t y = 1, uint32_t z = 1) override;
- virtual void dispatch_indirect(uint32_t offset = 0) override;
- virtual void memory_barrier(uint32_t barriers) override;
+ virtual auto dispatch(uint32_t x, uint32_t y = 1, uint32_t z = 1) -> void override;
+ virtual auto dispatch_indirect(uint32_t offset = 0) -> void override;
+ virtual auto memory_barrier(uint32_t barriers) -> void override;
- virtual const std::string& get_name() const override { return m_name; }
- virtual uint32_t get_renderer_id() const override { return m_renderer_id; }
+ virtual auto get_name() const -> const std::string& override{ return m_name; }
+ virtual auto get_renderer_id() const -> uint32_t override{ return m_renderer_id; }
- void upload_uniform_int( const std::string& name, int value);
- void upload_uniform_int_array(const std::string& name, int* values, uint32_t count);
- void upload_uniform_float( const std::string& name, float value);
- void upload_uniform_float2( const std::string& name, const glm::vec2& value);
- void upload_uniform_float3( const std::string& name, const glm::vec3& value);
- void upload_uniform_float4( const std::string& name, const glm::vec4& value);
- void upload_uniform_mat3( const std::string& name, const glm::mat3& matrix);
- void upload_uniform_mat4( const std::string& name, const glm::mat4& matrix);
+ auto upload_uniform_int( const std::string& name, int value) -> void;
+ auto upload_uniform_int_array(const std::string& name, int* values, uint32_t count) -> void;
+ auto upload_uniform_float( const std::string& name, float value) -> void;
+ auto upload_uniform_float2( const std::string& name, const glm::vec2& value) -> void;
+ auto upload_uniform_float3( const std::string& name, const glm::vec3& value) -> void;
+ auto upload_uniform_float4( const std::string& name, const glm::vec4& value) -> void;
+ auto upload_uniform_mat3( const std::string& name, const glm::mat3& matrix) -> void;
+ auto upload_uniform_mat4( const std::string& name, const glm::mat4& matrix) -> void;
private:
- std::string read_file(const std::string& filepath);
- std::unordered_map<uint32_t, std::string> pre_process(const std::string& source);
- void compile(const std::unordered_map<uint32_t, std::string>& shader_sources);
+ auto read_file(const std::string& filepath) -> std::string;
+ auto pre_process(const std::string& source) -> std::unordered_map<uint32_t, std::string>;
+ auto compile(const std::unordered_map<uint32_t, std::string>& shader_sources) -> void;
private:
uint32_t m_renderer_id = 0;
std::string m_name;
diff --git a/src/platform/opengl/opengl_texture.cpp b/src/platform/opengl/opengl_texture.cpp
index 13125a6..9c1decf 100644
--- a/src/platform/opengl/opengl_texture.cpp
+++ b/src/platform/opengl/opengl_texture.cpp
@@ -54,7 +54,7 @@ namespace Donut
glDeleteTextures(1, &m_renderer_id);
}
- void OpenGLTexture2D::set_data(void* data, uint32_t size)
+ auto OpenGLTexture2D::set_data(void* data, uint32_t size) -> void
{
uint32_t bpp = m_data_format == GL_RGBA ? 4 : 3;
if (size != m_width * m_height * bpp)
@@ -67,13 +67,13 @@ namespace Donut
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_width, m_height, m_data_format, GL_UNSIGNED_BYTE, data);
}
- void OpenGLTexture2D::bind(uint32_t slot) const
+ auto OpenGLTexture2D::bind(uint32_t slot) const -> void
{
glActiveTexture(GL_TEXTURE0 + slot);
glBindTexture(GL_TEXTURE_2D, m_renderer_id);
}
- void OpenGLTexture2D::bind_as_image(uint32_t slot, bool read_only) const
+ auto OpenGLTexture2D::bind_as_image(uint32_t slot, bool read_only) const -> void
{
if (glBindImageTexture == nullptr)
return;
@@ -126,7 +126,7 @@ namespace Donut
glDeleteTextures(1, &m_renderer_id);
}
- void OpenGLCubemapTexture::load_hdri(const std::string& path)
+ auto OpenGLCubemapTexture::load_hdri(const std::string& path) -> void
{
stbi_set_flip_vertically_on_load(true);
int width, height, channels;
@@ -157,7 +157,7 @@ namespace Donut
DONUT_INFO("Successfully loaded HDRI: {} ({}x{})", path, width, height);
}
- void OpenGLCubemapTexture::convert_equirectangular_to_cubemap(float* hdr_data, int width, int height)
+ auto OpenGLCubemapTexture::convert_equirectangular_to_cubemap(float* hdr_data, int width, int height) -> void
{
uint32_t capture_fbo, capture_rbo;
glGenFramebuffers(1, &capture_fbo);
@@ -242,18 +242,18 @@ namespace Donut
glDeleteRenderbuffers(1, &capture_rbo);
}
- void OpenGLCubemapTexture::set_data(void* data, uint32_t size)
+ auto OpenGLCubemapTexture::set_data(void* data, uint32_t size) -> void
{
- DONUT_WARN("SetData not implemented for cubemaps");
+ DONUT_WARN("set_data not implemented for cubemaps");
}
- void OpenGLCubemapTexture::bind(uint32_t slot) const
+ auto OpenGLCubemapTexture::bind(uint32_t slot) const -> void
{
glActiveTexture(GL_TEXTURE0 + slot);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_renderer_id);
}
- void OpenGLCubemapTexture::bind_as_image(uint32_t slot, bool read_only) const
+ auto OpenGLCubemapTexture::bind_as_image(uint32_t slot, bool read_only) const -> void
{
if (glBindImageTexture == nullptr)
return;
diff --git a/src/platform/opengl/opengl_texture.h b/src/platform/opengl/opengl_texture.h
index 5e5f6b2..236ab54 100644
--- a/src/platform/opengl/opengl_texture.h
+++ b/src/platform/opengl/opengl_texture.h
@@ -15,13 +15,13 @@ namespace Donut
OpenGLTexture2D(const std::string& path);
virtual ~OpenGLTexture2D();
- virtual uint32_t get_width() const override { return m_width; }
- virtual uint32_t get_height() const override { return m_height; }
- virtual uint32_t get_renderer_id() const override { return m_renderer_id; }
+ virtual auto get_width() const -> uint32_t override{ return m_width; }
+ virtual auto get_height() const -> uint32_t override{ return m_height; }
+ virtual auto get_renderer_id() const -> uint32_t override{ return m_renderer_id; }
- virtual void set_data(void* data, uint32_t size) override;
- virtual void bind(uint32_t slot = 0) const override;
- virtual void bind_as_image(uint32_t slot = 0, bool read_only = false) const override;
+ virtual auto set_data(void* data, uint32_t size) -> void override;
+ virtual auto bind(uint32_t slot = 0) const -> void override;
+ virtual auto bind_as_image(uint32_t slot = 0, bool read_only = false) const -> void override;
virtual bool operator==(const Texture& other) const override
{
@@ -43,13 +43,13 @@ namespace Donut
OpenGLCubemapTexture(const std::string& path);
virtual ~OpenGLCubemapTexture();
- virtual uint32_t get_width() const override { return m_width; }
- virtual uint32_t get_height() const override { return m_height; }
- virtual uint32_t get_renderer_id() const override { return m_renderer_id; }
+ virtual auto get_width() const -> uint32_t override{ return m_width; }
+ virtual auto get_height() const -> uint32_t override{ return m_height; }
+ virtual auto get_renderer_id() const -> uint32_t override{ return m_renderer_id; }
- virtual void set_data(void* data, uint32_t size) override;
- virtual void bind(uint32_t slot = 0) const override;
- virtual void bind_as_image(uint32_t slot = 0, bool read_only = false) const override;
+ virtual auto set_data(void* data, uint32_t size) -> void override;
+ virtual auto bind(uint32_t slot = 0) const -> void override;
+ virtual auto bind_as_image(uint32_t slot = 0, bool read_only = false) const -> void override;
virtual bool operator==(const Texture& other) const override
{
@@ -58,7 +58,7 @@ namespace Donut
private:
void load_hdri(const std::string& path);
- void convert_equirectangular_to_cubemap(float* hdr_data, int width, int height);
+ auto convert_equirectangular_to_cubemap(float* hdr_data, int width, int height) -> void;
std::string m_path;
uint32_t m_width, m_height;
diff --git a/src/platform/opengl/opengl_uniform_buffer.cpp b/src/platform/opengl/opengl_uniform_buffer.cpp
index ca7d3d2..9b3b6d2 100644
--- a/src/platform/opengl/opengl_uniform_buffer.cpp
+++ b/src/platform/opengl/opengl_uniform_buffer.cpp
@@ -16,13 +16,13 @@ namespace Donut
glDeleteBuffers(1, &m_renderer_id);
}
- void OpenGLUniformBuffer::set_data(const void* data, uint32_t size, uint32_t offset)
+ auto OpenGLUniformBuffer::set_data(const void* data, uint32_t size, uint32_t offset) -> void
{
glBindBuffer(GL_UNIFORM_BUFFER, m_renderer_id);
glBufferSubData(GL_UNIFORM_BUFFER, offset, size, data);
}
- void OpenGLUniformBuffer::bind(uint32_t binding)
+ auto OpenGLUniformBuffer::bind(uint32_t binding) -> void
{
glBindBufferBase(GL_UNIFORM_BUFFER, binding, m_renderer_id);
}
diff --git a/src/platform/opengl/opengl_uniform_buffer.h b/src/platform/opengl/opengl_uniform_buffer.h
index ae99a56..db137a0 100644
--- a/src/platform/opengl/opengl_uniform_buffer.h
+++ b/src/platform/opengl/opengl_uniform_buffer.h
@@ -11,8 +11,8 @@ namespace Donut
OpenGLUniformBuffer(uint32_t size, uint32_t binding);
virtual ~OpenGLUniformBuffer();
- virtual void set_data(const void* data, uint32_t size, uint32_t offset = 0) override;
- virtual void bind(uint32_t binding) override;
+ virtual auto set_data(const void* data, uint32_t size, uint32_t offset = 0) -> void override;
+ virtual auto bind(uint32_t binding) -> void override;
private:
uint32_t m_renderer_id = 0;
uint32_t m_size = 0;
diff --git a/src/platform/opengl/opengl_vertex_array.cpp b/src/platform/opengl/opengl_vertex_array.cpp
index f3347f4..a627224 100644
--- a/src/platform/opengl/opengl_vertex_array.cpp
+++ b/src/platform/opengl/opengl_vertex_array.cpp
@@ -16,17 +16,17 @@ namespace Donut
glDeleteVertexArrays(1, &m_renderer_id);
}
- void OpenGLVertexArray::bind() const
+ auto OpenGLVertexArray::bind() const -> void
{
glBindVertexArray(m_renderer_id);
}
- void OpenGLVertexArray::unbind() const
+ auto OpenGLVertexArray::unbind() const -> void
{
glBindVertexArray(0);
}
- void OpenGLVertexArray::add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer)
+ auto OpenGLVertexArray::add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer) -> void
{
glBindVertexArray(m_renderer_id);
vertex_buffer->bind();
@@ -47,7 +47,7 @@ namespace Donut
m_vertex_buffers.push_back(vertex_buffer);
}
- void OpenGLVertexArray::set_index_buffer(const Ref<IndexBuffer>& index_buffer)
+ auto OpenGLVertexArray::set_index_buffer(const Ref<IndexBuffer>& index_buffer) -> void
{
glBindVertexArray(m_renderer_id);
index_buffer->bind();
diff --git a/src/platform/opengl/opengl_vertex_array.h b/src/platform/opengl/opengl_vertex_array.h
index ff5cdd8..5115830 100644
--- a/src/platform/opengl/opengl_vertex_array.h
+++ b/src/platform/opengl/opengl_vertex_array.h
@@ -17,11 +17,11 @@ namespace Donut
OpenGLVertexArray();
virtual ~OpenGLVertexArray();
- virtual void bind() const override;
- virtual void unbind() const override;
+ virtual auto bind() const -> void override;
+ virtual auto unbind() const -> void override;
- virtual void add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer) override;
- virtual void set_index_buffer(const Ref<IndexBuffer>& index_buffer) override;
+ virtual auto add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer) -> void override;
+ virtual auto set_index_buffer(const Ref<IndexBuffer>& index_buffer) -> void override;
virtual const std::vector<Ref<VertexBuffer>>& get_vertex_buffers() const override
{
diff --git a/src/platform/opengl/opengl_vertex_buffer.cpp b/src/platform/opengl/opengl_vertex_buffer.cpp
index 643b315..edd2c96 100644
--- a/src/platform/opengl/opengl_vertex_buffer.cpp
+++ b/src/platform/opengl/opengl_vertex_buffer.cpp
@@ -17,17 +17,17 @@ namespace Donut
glDeleteBuffers(1, &m_renderer_id);
}
- void OpenGLVertexBuffer::bind() const
+ auto OpenGLVertexBuffer::bind() const -> void
{
glBindBuffer(GL_ARRAY_BUFFER, m_renderer_id);
}
- void OpenGLVertexBuffer::unbind() const
+ auto OpenGLVertexBuffer::unbind() const -> void
{
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
- void OpenGLVertexBuffer::set_data(const void* data, uint32_t size)
+ auto OpenGLVertexBuffer::set_data(const void* data, uint32_t size) -> void
{
glBindBuffer(GL_ARRAY_BUFFER, m_renderer_id);
glBufferSubData(GL_ARRAY_BUFFER, 0, size, data);
diff --git a/src/platform/opengl/opengl_vertex_buffer.h b/src/platform/opengl/opengl_vertex_buffer.h
index 678f0e0..df2e0e6 100644
--- a/src/platform/opengl/opengl_vertex_buffer.h
+++ b/src/platform/opengl/opengl_vertex_buffer.h
@@ -11,12 +11,12 @@ namespace Donut
OpenGLVertexBuffer(const void* data, uint32_t size);
virtual ~OpenGLVertexBuffer();
- virtual void bind() const override;
- virtual void unbind() const override;
- virtual void set_data(const void* data, uint32_t size) override;
+ virtual auto bind() const -> void override;
+ virtual auto unbind() const -> void override;
+ virtual auto set_data(const void* data, uint32_t size) -> void override;
- virtual const VertexBufferLayout& get_layout() const override { return m_layout; }
- virtual void set_layout(const VertexBufferLayout& layout) override { m_layout = layout; }
+ virtual auto get_layout() const -> const VertexBufferLayout& override{ return m_layout; }
+ virtual auto set_layout(const VertexBufferLayout& layout) -> void override{ m_layout = layout; }
private:
uint32_t m_renderer_id;