From 3748ff571fa0dbdb210d43d3e4bf91b3c8601cf8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 10 Dec 2023 12:53:21 +0200 Subject: [PATCH] Use the override specifier on overridden virtual functions --- source/animation/animatedobject.h | 4 +- source/animation/animation.h | 6 +- source/animation/animationplayer.h | 2 +- source/backends/opengl/texture1d_backend.h | 6 +- source/backends/opengl/texture2d_backend.h | 4 +- .../backends/opengl/texture2darray_backend.h | 2 +- .../opengl/texture2dmultisample_backend.h | 6 +- source/backends/opengl/texture3d_backend.h | 6 +- source/backends/opengl/texturecube_backend.h | 6 +- source/backends/opengl/windowview_backend.h | 4 +- source/backends/vulkan/swapchaintexture.h | 2 +- source/backends/vulkan/texture1d_backend.h | 10 +- source/backends/vulkan/texture2d_backend.h | 8 +- .../backends/vulkan/texture2darray_backend.h | 2 +- .../vulkan/texture2dmultisample_backend.h | 10 +- source/backends/vulkan/texture3d_backend.h | 10 +- source/backends/vulkan/texturecube_backend.h | 10 +- source/backends/vulkan/windowview_backend.h | 6 +- source/builders/box.h | 2 +- source/builders/capsule.h | 2 +- source/builders/cylinder.h | 2 +- source/builders/grid.h | 2 +- source/builders/meshbuilder.h | 8 +- source/builders/primitivebuilder.h | 2 +- source/builders/sequencetemplate.h | 10 +- source/builders/sphere.h | 4 +- source/builders/vertexarraybuilder.h | 2 +- source/core/batch.h | 6 +- source/core/mesh.h | 16 +- source/core/module.h | 8 +- source/core/program.h | 2 +- source/core/texture.h | 6 +- source/core/texture1d.h | 4 +- source/core/texture2d.cpp | 4 +- source/core/texture2d.h | 6 +- source/core/texture2dmultisample.h | 4 +- source/core/texture3d.h | 4 +- source/core/texturecube.h | 4 +- source/core/uniformblock.h | 6 +- source/core/vertexarray.h | 4 +- source/effects/ambientocclusion.h | 6 +- source/effects/bloom.h | 8 +- source/effects/colorcurve.h | 6 +- source/effects/effect.h | 12 +- source/effects/environmentmap.h | 12 +- source/effects/shadowmap.h | 14 +- source/effects/sky.h | 12 +- source/glsl/debug.h | 50 +++--- source/glsl/finalize.h | 48 ++--- source/glsl/generate.h | 32 ++-- source/glsl/optimize.h | 164 +++++++++--------- source/glsl/output.h | 46 ++--- source/glsl/reflect.h | 50 +++--- source/glsl/resolve.h | 62 +++---- source/glsl/spirv.h | 42 ++--- source/glsl/syntax.h | 108 ++++++------ source/glsl/validate.h | 82 ++++----- source/glsl/visitor.h | 50 +++--- source/materials/basicmaterial.h | 8 +- source/materials/directionallight.h | 6 +- source/materials/light.h | 6 +- source/materials/lighting.h | 2 +- source/materials/material.h | 4 +- source/materials/pbrmaterial.h | 10 +- source/materials/pointlight.h | 6 +- source/materials/rendermethod.h | 4 +- source/materials/splatmaterial.h | 18 +- source/materials/technique.h | 2 +- source/materials/unlitmaterial.h | 8 +- source/render/camera.h | 2 +- source/render/instancearray.h | 8 +- source/render/object.h | 14 +- source/render/objectinstance.h | 4 +- source/render/occludedscene.h | 10 +- source/render/offscreenview.h | 2 +- source/render/orderedscene.h | 10 +- source/render/placeable.h | 2 +- source/render/scene.h | 4 +- source/render/sequence.h | 8 +- source/render/simplescene.h | 10 +- source/render/slot.h | 10 +- source/render/text.h | 2 +- source/render/windowview.h | 4 +- source/render/zsortedscene.h | 10 +- source/resources/resourcemanager.h | 2 +- source/resources/resources.h | 2 +- tools/glslcompiler.cpp | 2 +- tools/viewer.cpp | 4 +- 88 files changed, 600 insertions(+), 600 deletions(-) diff --git a/source/animation/animatedobject.h b/source/animation/animatedobject.h index ead6231c..bb2cf490 100644 --- a/source/animation/animatedobject.h +++ b/source/animation/animatedobject.h @@ -43,9 +43,9 @@ public: DEPRECATED void set_uniform(const std::string &, const KeyFrame::AnimatedUniform &); - virtual const Matrix *get_matrix() const { return &matrix; } + const Matrix *get_matrix() const override { return &matrix; } - virtual void setup_render(Renderer &, Tag) const; + void setup_render(Renderer &, Tag) const override; }; } // namespace GL diff --git a/source/animation/animation.h b/source/animation/animation.h index d3ea724f..997d0d93 100644 --- a/source/animation/animation.h +++ b/source/animation/animation.h @@ -36,7 +36,7 @@ public: Loader(Animation &, Collection &); private: Loader(Animation &, Collection *); - virtual void finish(); + void finish() override; void check_slopes_and_control(bool, bool); void add_kf(const KeyFrame *, bool, bool); @@ -92,8 +92,8 @@ private: public: ValueCurve(CurveTarget, int, const std::vector &); - virtual void apply(float, Matrix &) const; - virtual void apply(float, KeyFrame::AnimatedUniform &) const; + void apply(float, Matrix &) const override; + void apply(float, KeyFrame::AnimatedUniform &) const override; }; struct ExtractComponent diff --git a/source/animation/animationplayer.h b/source/animation/animationplayer.h index 4947a8c9..eccd8bd3 100644 --- a/source/animation/animationplayer.h +++ b/source/animation/animationplayer.h @@ -40,7 +40,7 @@ private: Target(Placeable &); - virtual void animation_event(Placeable *, const std::string &, const Variant &); + void animation_event(Placeable *, const std::string &, const Variant &) override; }; std::map objects; diff --git a/source/backends/opengl/texture1d_backend.h b/source/backends/opengl/texture1d_backend.h index 4dd60654..54ceed58 100644 --- a/source/backends/opengl/texture1d_backend.h +++ b/source/backends/opengl/texture1d_backend.h @@ -16,9 +16,9 @@ protected: void sub_image(unsigned, int, unsigned, const void *); public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using Texture1DBackend = OpenGLTexture1D; diff --git a/source/backends/opengl/texture2d_backend.h b/source/backends/opengl/texture2d_backend.h index d1f4735e..c7d0fa5f 100644 --- a/source/backends/opengl/texture2d_backend.h +++ b/source/backends/opengl/texture2d_backend.h @@ -32,8 +32,8 @@ protected: void sub_image(unsigned, int, int, unsigned, unsigned, const void *); public: - virtual std::size_t get_data_size() const; - virtual void unload(); + std::size_t get_data_size() const override; + void unload() override; }; using Texture2DBackend = OpenGLTexture2D; diff --git a/source/backends/opengl/texture2darray_backend.h b/source/backends/opengl/texture2darray_backend.h index 3b8859ef..f08af76c 100644 --- a/source/backends/opengl/texture2darray_backend.h +++ b/source/backends/opengl/texture2darray_backend.h @@ -13,7 +13,7 @@ protected: OpenGLTexture2DArray(); public: - virtual std::size_t get_data_size() const; + std::size_t get_data_size() const override; }; using Texture2DArrayBackend = OpenGLTexture2DArray; diff --git a/source/backends/opengl/texture2dmultisample_backend.h b/source/backends/opengl/texture2dmultisample_backend.h index a2ca6aa6..17fb8411 100644 --- a/source/backends/opengl/texture2dmultisample_backend.h +++ b/source/backends/opengl/texture2dmultisample_backend.h @@ -15,9 +15,9 @@ protected: void allocate(); public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using Texture2DMultisampleBackend = OpenGLTexture2DMultisample; diff --git a/source/backends/opengl/texture3d_backend.h b/source/backends/opengl/texture3d_backend.h index 5a66142c..fc17fb89 100644 --- a/source/backends/opengl/texture3d_backend.h +++ b/source/backends/opengl/texture3d_backend.h @@ -19,9 +19,9 @@ protected: bool is_array() const; public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using Texture3DBackend = OpenGLTexture3D; diff --git a/source/backends/opengl/texturecube_backend.h b/source/backends/opengl/texturecube_backend.h index a2424434..b75acf8c 100644 --- a/source/backends/opengl/texturecube_backend.h +++ b/source/backends/opengl/texturecube_backend.h @@ -16,9 +16,9 @@ protected: void sub_image(unsigned, unsigned, int, int, unsigned, unsigned, const void *); public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using TextureCubeBackend = OpenGLTextureCube; diff --git a/source/backends/opengl/windowview_backend.h b/source/backends/opengl/windowview_backend.h index 2160a0df..e22503da 100644 --- a/source/backends/opengl/windowview_backend.h +++ b/source/backends/opengl/windowview_backend.h @@ -15,8 +15,8 @@ protected: OpenGLWindowView() = default; - virtual void render(); - virtual const Framebuffer &get_target() const { return sys_framebuf; } + void render() override; + const Framebuffer &get_target() const override { return sys_framebuf; } void resize_framebuffer(unsigned, unsigned); }; diff --git a/source/backends/vulkan/swapchaintexture.h b/source/backends/vulkan/swapchaintexture.h index f9fc7cd9..a3d26efb 100644 --- a/source/backends/vulkan/swapchaintexture.h +++ b/source/backends/vulkan/swapchaintexture.h @@ -14,7 +14,7 @@ private: SwapChainTexture(PixelFormat, unsigned, unsigned, VkImage); public: SwapChainTexture(SwapChainTexture &&) = default; - ~SwapChainTexture(); + ~SwapChainTexture() override; }; } // namespace GL diff --git a/source/backends/vulkan/texture1d_backend.h b/source/backends/vulkan/texture1d_backend.h index 48ae32df..9d807f71 100644 --- a/source/backends/vulkan/texture1d_backend.h +++ b/source/backends/vulkan/texture1d_backend.h @@ -12,14 +12,14 @@ class MSPGL_API VulkanTexture1D: public Texture protected: VulkanTexture1D(); - virtual void fill_image_info(void *) const; + void fill_image_info(void *) const override; void sub_image(unsigned, int, unsigned, const void *); - virtual void fill_mipmap_blit(unsigned, void *); + void fill_mipmap_blit(unsigned, void *) override; public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using Texture1DBackend = VulkanTexture1D; diff --git a/source/backends/vulkan/texture2d_backend.h b/source/backends/vulkan/texture2d_backend.h index ccc41c26..a01d8791 100644 --- a/source/backends/vulkan/texture2d_backend.h +++ b/source/backends/vulkan/texture2d_backend.h @@ -23,13 +23,13 @@ protected: VulkanTexture2D(); - virtual void fill_image_info(void *) const; + void fill_image_info(void *) const override; void sub_image(unsigned, int, int, unsigned, unsigned, const void *); - virtual void fill_mipmap_blit(unsigned, void *); + void fill_mipmap_blit(unsigned, void *) override; public: - virtual std::size_t get_data_size() const; - virtual void unload(); + std::size_t get_data_size() const override; + void unload() override; }; using Texture2DBackend = VulkanTexture2D; diff --git a/source/backends/vulkan/texture2darray_backend.h b/source/backends/vulkan/texture2darray_backend.h index bac9efff..4acf3a4c 100644 --- a/source/backends/vulkan/texture2darray_backend.h +++ b/source/backends/vulkan/texture2darray_backend.h @@ -12,7 +12,7 @@ class MSPGL_API VulkanTexture2DArray: public Texture3D protected: VulkanTexture2DArray(); - virtual void fill_image_info(void *) const; + void fill_image_info(void *) const override; }; using Texture2DArrayBackend = VulkanTexture2DArray; diff --git a/source/backends/vulkan/texture2dmultisample_backend.h b/source/backends/vulkan/texture2dmultisample_backend.h index d898ede5..108acda7 100644 --- a/source/backends/vulkan/texture2dmultisample_backend.h +++ b/source/backends/vulkan/texture2dmultisample_backend.h @@ -12,14 +12,14 @@ class MSPGL_API VulkanTexture2DMultisample: public Texture protected: VulkanTexture2DMultisample(); - virtual void fill_image_info(void *) const; + void fill_image_info(void *) const override; virtual void generate_mipmap(); - virtual void fill_mipmap_blit(unsigned, void *) { } + void fill_mipmap_blit(unsigned, void *) override { } public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using Texture2DMultisampleBackend = VulkanTexture2DMultisample; diff --git a/source/backends/vulkan/texture3d_backend.h b/source/backends/vulkan/texture3d_backend.h index 421eca3a..dc52829f 100644 --- a/source/backends/vulkan/texture3d_backend.h +++ b/source/backends/vulkan/texture3d_backend.h @@ -13,16 +13,16 @@ protected: VulkanTexture3D(); VulkanTexture3D(unsigned); - virtual void fill_image_info(void *) const; + void fill_image_info(void *) const override; void sub_image(unsigned, int, int, int, unsigned, unsigned, unsigned, const void *); - virtual void fill_mipmap_blit(unsigned, void *); + void fill_mipmap_blit(unsigned, void *) override; bool is_array() const; public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using Texture3DBackend = VulkanTexture3D; diff --git a/source/backends/vulkan/texturecube_backend.h b/source/backends/vulkan/texturecube_backend.h index 91c4b7ec..9d824411 100644 --- a/source/backends/vulkan/texturecube_backend.h +++ b/source/backends/vulkan/texturecube_backend.h @@ -12,14 +12,14 @@ class MSPGL_API VulkanTextureCube: public Texture protected: VulkanTextureCube(); - virtual void fill_image_info(void *) const; + void fill_image_info(void *) const override; void sub_image(unsigned, unsigned, int, int, unsigned, unsigned, const void *); - virtual void fill_mipmap_blit(unsigned, void *); + void fill_mipmap_blit(unsigned, void *) override; public: - virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; } - virtual std::size_t get_data_size() const; - virtual void unload() { } + AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override { return nullptr; } + std::size_t get_data_size() const override; + void unload() override { } }; using TextureCubeBackend = VulkanTextureCube; diff --git a/source/backends/vulkan/windowview_backend.h b/source/backends/vulkan/windowview_backend.h index 9ca2cbba..f98a6563 100644 --- a/source/backends/vulkan/windowview_backend.h +++ b/source/backends/vulkan/windowview_backend.h @@ -21,10 +21,10 @@ protected: unsigned frame_index = 0; VulkanWindowView() = default; - ~VulkanWindowView(); + ~VulkanWindowView() override; - virtual void render(); - virtual const Framebuffer &get_target() const { return *current_target; } + void render() override; + const Framebuffer &get_target() const override { return *current_target; } void resize_framebuffer(unsigned, unsigned); }; diff --git a/source/builders/box.h b/source/builders/box.h index dec6ffa5..5efcfc38 100644 --- a/source/builders/box.h +++ b/source/builders/box.h @@ -19,7 +19,7 @@ public: BoxBuilder(const Vector3 &, const Vector3 &); using GeometryBuilder::build; - virtual void build(PrimitiveBuilder &) const; + void build(PrimitiveBuilder &) const override; private: void build_face(PrimitiveBuilder &, const Vector3 &, const Vector3 &, const Vector3 &) const; }; diff --git a/source/builders/capsule.h b/source/builders/capsule.h index 49ff3a5f..0b6ba21c 100644 --- a/source/builders/capsule.h +++ b/source/builders/capsule.h @@ -19,7 +19,7 @@ public: CapsuleBuilder(float, float, unsigned = 16, unsigned = 9); using GeometryBuilder::build; - virtual void build(PrimitiveBuilder &) const; + void build(PrimitiveBuilder &) const override; }; } // namepace GL diff --git a/source/builders/cylinder.h b/source/builders/cylinder.h index 85e66bdc..4cbbfb7c 100644 --- a/source/builders/cylinder.h +++ b/source/builders/cylinder.h @@ -18,7 +18,7 @@ public: CylinderBuilder(float, float, unsigned = 16); using GeometryBuilder::build; - virtual void build(PrimitiveBuilder &) const; + void build(PrimitiveBuilder &) const override; }; } // namespace GL diff --git a/source/builders/grid.h b/source/builders/grid.h index a731aa0f..bfecae56 100644 --- a/source/builders/grid.h +++ b/source/builders/grid.h @@ -28,7 +28,7 @@ private: public: using GeometryBuilder::build; - virtual void build(PrimitiveBuilder &) const; + void build(PrimitiveBuilder &) const override; }; } // namespace GL diff --git a/source/builders/meshbuilder.h b/source/builders/meshbuilder.h index e94b6eff..ff52ee68 100644 --- a/source/builders/meshbuilder.h +++ b/source/builders/meshbuilder.h @@ -18,13 +18,13 @@ private: public: MeshBuilder(Mesh &); - ~MeshBuilder(); + ~MeshBuilder() override; void auto_offset(); private: - virtual void begin_(); - virtual void end_(); - virtual void element_(unsigned); + void begin_() override; + void end_() override; + void element_(unsigned) override; }; } // namespace GL diff --git a/source/builders/primitivebuilder.h b/source/builders/primitivebuilder.h index 1e2fda4b..74987cfc 100644 --- a/source/builders/primitivebuilder.h +++ b/source/builders/primitivebuilder.h @@ -34,7 +34,7 @@ public: void element(unsigned); PrimitiveType get_type() const; protected: - virtual void vertex_(const Vector4 &); + void vertex_(const Vector4 &) override; virtual void begin_() = 0; virtual void end_() = 0; virtual void element_(unsigned) = 0; diff --git a/source/builders/sequencetemplate.h b/source/builders/sequencetemplate.h index 12b4f717..b5601a68 100644 --- a/source/builders/sequencetemplate.h +++ b/source/builders/sequencetemplate.h @@ -32,7 +32,7 @@ private: TemplateLoader(typename DataFile::DynamicObjectLoader::Collection &c): DataFile::DynamicObjectLoader(&c) { } private: - virtual typename DataFile::DynamicObjectLoader::TypeRegistry &get_type_registry() const { return get_registry(); } + typename DataFile::DynamicObjectLoader::TypeRegistry &get_type_registry() const override { return get_registry(); } }; template @@ -47,7 +47,7 @@ public: public: Loader(SequenceTemplate &, Collection &); private: - virtual void init_actions(); + void init_actions() override; void clear(); void effect(const std::string &); @@ -82,7 +82,7 @@ public: public: Loader(Step &, Collection &); private: - virtual void init_actions(); + void init_actions() override; public: void set_inline_base_name(const std::string &); @@ -119,7 +119,7 @@ private: public: ClearLoader(SequenceTemplate &); private: - virtual void init_actions(); + void init_actions() override; void color(float, float, float, float); void depth(float); @@ -134,7 +134,7 @@ private: public: SequenceLoader(Renderable &); private: - virtual void init_actions(); + void init_actions() override; void renderable(const std::string &, const std::string &); }; diff --git a/source/builders/sphere.h b/source/builders/sphere.h index f78994c6..dbb53095 100644 --- a/source/builders/sphere.h +++ b/source/builders/sphere.h @@ -18,7 +18,7 @@ public: UvSphereBuilder(float, unsigned, unsigned = 0); using GeometryBuilder::build; - virtual void build(PrimitiveBuilder &) const; + void build(PrimitiveBuilder &) const override; }; @@ -40,7 +40,7 @@ private: public: using GeometryBuilder::build; - virtual void build(PrimitiveBuilder &) const; + void build(PrimitiveBuilder &) const override; private: unsigned edge_vertex(unsigned, unsigned) const; diff --git a/source/builders/vertexarraybuilder.h b/source/builders/vertexarraybuilder.h index 19792980..56e12637 100644 --- a/source/builders/vertexarraybuilder.h +++ b/source/builders/vertexarraybuilder.h @@ -21,7 +21,7 @@ public: VertexArrayBuilder(VertexArray &); private: - virtual void vertex_(const Vector4 &); + void vertex_(const Vector4 &) override; template void store_attribute(char *, const Vector4 &, bool, unsigned); diff --git a/source/core/batch.h b/source/core/batch.h index 88ed613a..0bd176d0 100644 --- a/source/core/batch.h +++ b/source/core/batch.h @@ -74,9 +74,9 @@ public: private: void append_index(unsigned); - virtual std::size_t get_data_size() const { return data.size(); } - virtual const void *get_data_pointer() const { return &data[0]; } - virtual std::size_t get_alignment() const { return get_index_size(); } + std::size_t get_data_size() const override { return data.size(); } + const void *get_data_pointer() const override { return &data[0]; } + std::size_t get_alignment() const override { return get_index_size(); } public: std::size_t get_index_size() const { return get_type_size(index_type); } std::size_t size() const { return data.size()/get_index_size(); } diff --git a/source/core/mesh.h b/source/core/mesh.h index 70f3ba43..6d517f85 100644 --- a/source/core/mesh.h +++ b/source/core/mesh.h @@ -59,10 +59,10 @@ private: public: AsyncLoader(Mesh &, IO::Seekable &); - ~AsyncLoader(); + ~AsyncLoader() override; - virtual bool needs_sync() const; - virtual bool process(); + bool needs_sync() const override; + bool process() override; }; enum BufferMask @@ -85,7 +85,7 @@ public: Mesh() = default; Mesh(const VertexFormat &); Mesh(Mesh &&); - ~Mesh(); + ~Mesh() override; /** Sets the vertex format for the mesh. It cannot be changed once set. */ void storage(const VertexFormat &); @@ -124,10 +124,10 @@ private: void resize_buffers() const; public: - virtual int get_load_priority() const { return 1; } - virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = nullptr); - virtual std::uint64_t get_data_size() const; - virtual void unload(); + int get_load_priority() const override { return 1; } + Resource::AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override; + std::uint64_t get_data_size() const override; + void unload() override; void set_debug_name(const std::string &); }; diff --git a/source/core/module.h b/source/core/module.h index 9e313632..9c8d5e0b 100644 --- a/source/core/module.h +++ b/source/core/module.h @@ -75,10 +75,10 @@ private: SL::SourceMap source_map; public: - virtual Format get_format() const { return GLSL; } + Format get_format() const override { return GLSL; } private: - virtual void compile(SL::Compiler &); + void compile(SL::Compiler &) override; public: const std::string &get_prepared_source() const { return prepared_source; } @@ -264,12 +264,12 @@ private: bool specializable = false; public: - virtual Format get_format() const { return SPIR_V; } + Format get_format() const override { return SPIR_V; } /** Loads a SPIR-V binary from a file or other I/O object. */ void load_code(IO::Base &); private: - virtual void compile(SL::Compiler &); + void compile(SL::Compiler &) override; void reflect(); public: diff --git a/source/core/program.h b/source/core/program.h index 892729f0..a664f9b5 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -44,7 +44,7 @@ private: SpecializationLoader(std::map &); private: - virtual void init_actions(); + void init_actions() override; void specialize_bool(const std::string &, bool); void specialize_int(const std::string &, int); diff --git a/source/core/texture.h b/source/core/texture.h index 106c478f..777845b2 100644 --- a/source/core/texture.h +++ b/source/core/texture.h @@ -43,7 +43,7 @@ protected: private: Loader(Texture &, Collection *); - virtual void finish(); + void finish() override; protected: void load_external_image(Graphics::Image &, const std::string &); @@ -66,7 +66,7 @@ public: GenericLoader(Collection &c): DynamicObjectLoader(&c) { } protected: - virtual const TypeRegistry &get_type_registry() const { return get_texture_registry(); } + const TypeRegistry &get_type_registry() const override { return get_texture_registry(); } }; protected: @@ -103,7 +103,7 @@ public: on the image's dimensions. */ virtual void image(const Graphics::Image &, unsigned = 0) = 0; - virtual std::size_t get_data_size() const { return 0; } + std::size_t get_data_size() const override { return 0; } using TextureBackend::set_debug_name; diff --git a/source/core/texture1d.h b/source/core/texture1d.h index 2efa95c3..03c96b93 100644 --- a/source/core/texture1d.h +++ b/source/core/texture1d.h @@ -36,14 +36,14 @@ public: cannot be changed once set. */ void storage(PixelFormat, unsigned wd, unsigned lv = 0); - virtual void image(unsigned level, const void *); + void image(unsigned level, const void *) override; /** Replaces a range of texels in the texture. Allocated storage must exist. The image data is interpreted according to the storage format and the range must be fully inside the selected mipmap level. */ void sub_image(unsigned level, unsigned x, unsigned wd, const void *); - virtual void image(const Graphics::Image &, unsigned = 0); + void image(const Graphics::Image &, unsigned = 0) override; unsigned get_width() const { return width; } diff --git a/source/core/texture2d.cpp b/source/core/texture2d.cpp index 4457dc0a..bf57b224 100644 --- a/source/core/texture2d.cpp +++ b/source/core/texture2d.cpp @@ -24,8 +24,8 @@ public: AsyncLoader(Texture2D &, IO::Seekable &); ~AsyncLoader(); - virtual bool needs_sync() const; - virtual bool process(); + bool needs_sync() const override; + bool process() override; }; diff --git a/source/core/texture2d.h b/source/core/texture2d.h index 7256e059..01b0c9cb 100644 --- a/source/core/texture2d.h +++ b/source/core/texture2d.h @@ -69,7 +69,7 @@ private: public: Texture2D() = default; Texture2D(Texture2D &&) = default; - virtual ~Texture2D(); + ~Texture2D() override; /** Sets storage format and dimensions and allocates memory for the texture. If lv is zero, a complete mipmap pyramid is automatically created. Storage @@ -85,7 +85,7 @@ public: AsyncTransfer sub_image_async(unsigned level, unsigned x, unsigned y, unsigned wd, unsigned ht); - virtual void image(const Graphics::Image &, unsigned = 0); + void image(const Graphics::Image &, unsigned = 0) override; unsigned get_width() const { return width; } unsigned get_height() const { return height; } @@ -95,7 +95,7 @@ private: LinAl::Vector get_level_size(unsigned) const; public: - virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = nullptr); + Resource::AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) override; }; } // namespace GL diff --git a/source/core/texture2dmultisample.h b/source/core/texture2dmultisample.h index 5c515111..ad8c8c5c 100644 --- a/source/core/texture2dmultisample.h +++ b/source/core/texture2dmultisample.h @@ -29,8 +29,8 @@ public: for the texture. */ void storage(PixelFormat, unsigned wd, unsigned ht, unsigned sm); - virtual void image(unsigned, const void *); - virtual void image(const Graphics::Image &, unsigned = 0); + void image(unsigned, const void *) override; + void image(const Graphics::Image &, unsigned = 0) override; unsigned get_width() const { return width; } unsigned get_height() const { return height; } diff --git a/source/core/texture3d.h b/source/core/texture3d.h index be1a0574..7981c2d3 100644 --- a/source/core/texture3d.h +++ b/source/core/texture3d.h @@ -45,7 +45,7 @@ public: /** Replaces contents of an entire mipmap level. Allocated storage must exist. The image data is interpreted according to the storage format and must have size matching the selected mipmap level. */ - void image(unsigned level, const void *); + void image(unsigned level, const void *) override; /** Replaces a cuboid-shaped region of the texture. Allocated storage must exist. The image data is interpreted according to the storage format and @@ -56,7 +56,7 @@ public: stack of square layers and its height must be divisible by its width. If storage has not been allocated yet, it will be set to match the image. Otherwise the image must be compatible with the existing storage. */ - virtual void image(const Graphics::Image &, unsigned = 0); + void image(const Graphics::Image &, unsigned = 0) override; unsigned get_width() const { return width; } unsigned get_height() const { return height; } diff --git a/source/core/texturecube.h b/source/core/texturecube.h index a3bdf138..1abc763d 100644 --- a/source/core/texturecube.h +++ b/source/core/texturecube.h @@ -59,7 +59,7 @@ public: cannot be changed once set. */ void storage(PixelFormat, unsigned size, unsigned lv = 0); - virtual void image(unsigned, const void *); + void image(unsigned, const void *) override; /** Replaces contents of a single face. Allocated storage must exist. The image data is interpreted according to the storage format and must have size @@ -77,7 +77,7 @@ public: stack of square layers and its height must be six times its width. If storage has not been allocated yet, it will be set to match the image. Otherwise the image must be compatible with the existing storage. */ - virtual void image(const Graphics::Image &, unsigned = 0); + void image(const Graphics::Image &, unsigned = 0) override; unsigned get_size() const { return size; } private: diff --git a/source/core/uniformblock.h b/source/core/uniformblock.h index c759d852..a869c1a8 100644 --- a/source/core/uniformblock.h +++ b/source/core/uniformblock.h @@ -29,10 +29,10 @@ private: public: UniformBlock(const ReflectData::BlockInfo &); - virtual std::size_t get_data_size() const { return data.size(); } - virtual const void *get_data_pointer() const { return &data[0]; } + std::size_t get_data_size() const override { return data.size(); } + const void *get_data_pointer() const override { return &data[0]; } private: - virtual std::size_t get_alignment() const; + std::size_t get_alignment() const override; public: void store(const ReflectData::UniformInfo &, std::size_t, const void *); diff --git a/source/core/vertexarray.h b/source/core/vertexarray.h index c146f9b7..1dd312a2 100644 --- a/source/core/vertexarray.h +++ b/source/core/vertexarray.h @@ -65,8 +65,8 @@ public: dirty. */ char *modify(std::size_t); private: - virtual std::size_t get_data_size() const; - virtual const void *get_data_pointer() const { return &data[0]; } + std::size_t get_data_size() const override; + const void *get_data_pointer() const override { return &data[0]; } public: std::size_t size() const { return data.size()/stride; } diff --git a/source/effects/ambientocclusion.h b/source/effects/ambientocclusion.h index 255f2d82..bdadc94e 100644 --- a/source/effects/ambientocclusion.h +++ b/source/effects/ambientocclusion.h @@ -32,7 +32,7 @@ public: float darkness = 1.0f; float edge_depth_threshold = 0.1f; - virtual AmbientOcclusion *create(unsigned, unsigned) const; + AmbientOcclusion *create(unsigned, unsigned) const override; }; private: @@ -60,9 +60,9 @@ public: void set_darkness(float); - virtual void render(Renderer &, const Texture2D &, const Texture2D &); + void render(Renderer &, const Texture2D &, const Texture2D &) override; - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; }; } // namespace GL diff --git a/source/effects/bloom.h b/source/effects/bloom.h index ef5a8600..51299a97 100644 --- a/source/effects/bloom.h +++ b/source/effects/bloom.h @@ -32,7 +32,7 @@ public: float radius = 2.0f; float strength = 0.2f; - virtual Bloom *create(unsigned, unsigned) const; + Bloom *create(unsigned, unsigned) const override; }; private: @@ -47,7 +47,7 @@ private: public: Bloom(unsigned, unsigned); - ~Bloom(); + ~Bloom() override; /** Sets the σ value of the gaussian blur. Values much larger than 4.0 are likely to cause artifacts. */ @@ -57,9 +57,9 @@ public: values mean more blurriness. */ void set_strength(float); - virtual void render(Renderer &, const Texture2D &, const Texture2D &); + void render(Renderer &, const Texture2D &, const Texture2D &) override; - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; }; } // namespace GL diff --git a/source/effects/colorcurve.h b/source/effects/colorcurve.h index 501eae10..8732c5df 100644 --- a/source/effects/colorcurve.h +++ b/source/effects/colorcurve.h @@ -43,7 +43,7 @@ public: float gamma = 1.0f; bool srgb = false; - virtual ColorCurve *create(unsigned, unsigned) const; + ColorCurve *create(unsigned, unsigned) const override; }; private: @@ -77,9 +77,9 @@ public: /// Sets output mapping to linear. This is equivalent to set_gamma(1). void set_linear(); - virtual void render(Renderer &, const Texture2D &, const Texture2D &); + void render(Renderer &, const Texture2D &, const Texture2D &) override; - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; }; } // namespace GL diff --git a/source/effects/effect.h b/source/effects/effect.h index 2d74d747..4d2d1839 100644 --- a/source/effects/effect.h +++ b/source/effects/effect.h @@ -34,7 +34,7 @@ public: public: Loader(Template &, Collection &); protected: - virtual void init_actions(); + void init_actions() override; private: void enable_for_method(const std::string &); @@ -56,17 +56,17 @@ protected: protected: Effect(Renderable &); public: - virtual ~Effect() { } + ~Effect() override { } void enable_for_method(Tag); void disable_for_method(Tag); bool is_enabled_for_method(Tag) const; - virtual const Matrix *get_matrix() const { return content.get_matrix(); } - virtual const Geometry::BoundingSphere *get_bounding_sphere() const { return content.get_bounding_sphere(); } + const Matrix *get_matrix() const override { return content.get_matrix(); } + const Geometry::BoundingSphere *get_bounding_sphere() const override { return content.get_bounding_sphere(); } - virtual void setup_frame(Renderer &r) { content.setup_frame(r); } - virtual void finish_frame() { content.finish_frame(); } + void setup_frame(Renderer &r) override { content.setup_frame(r); } + void finish_frame() override { content.finish_frame(); } virtual void set_debug_name(const std::string &) = 0; }; diff --git a/source/effects/environmentmap.h b/source/effects/environmentmap.h index 4f1f544b..5c48780f 100644 --- a/source/effects/environmentmap.h +++ b/source/effects/environmentmap.h @@ -41,7 +41,7 @@ public: public: Loader(Template &, Collection &); private: - virtual void init_actions(); + void init_actions() override; void fixed_position(float, float, float); }; @@ -55,7 +55,7 @@ public: float near_clip = 0.1f; float far_clip = 100.0f; - virtual EnvironmentMap *create(const std::map &) const; + EnvironmentMap *create(const std::map &) const override; }; protected: @@ -110,12 +110,12 @@ public: /** Request that the environment map is updated on the next frame. */ void queue_update(); - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; }; } // namespace GL diff --git a/source/effects/shadowmap.h b/source/effects/shadowmap.h index a4767b82..93963b52 100644 --- a/source/effects/shadowmap.h +++ b/source/effects/shadowmap.h @@ -45,7 +45,7 @@ public: public: Loader(Template &, Collection &); private: - virtual void init_actions(); + void init_actions() override; void light(const std::string &); void size_square(unsigned); @@ -62,7 +62,7 @@ public: public: Loader(ShadowedLight &); private: - virtual void init_actions(); + void init_actions() override; }; const Light *light = nullptr; @@ -79,7 +79,7 @@ public: float depth_bias = 4.0f; float darkness = 1.0f; - virtual ShadowMap *create(const std::map &) const; + ShadowMap *create(const std::map &) const override; }; private: @@ -163,12 +163,12 @@ public: const Texture2D &get_depth_texture() const { return depth_buf; } - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; }; } // namespace GL diff --git a/source/effects/sky.h b/source/effects/sky.h index 2b886d1c..043ce74c 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -56,12 +56,12 @@ public: public: Loader(Template &, Collection &); private: - virtual void init_actions(); + void init_actions() override; }; DirectionalLight *sun = nullptr; - virtual Sky *create(const std::map &) const; + Sky *create(const std::map &) const override; }; private: @@ -89,11 +89,11 @@ public: Color get_transmittance(const Vector3 &); - virtual void setup_frame(Renderer &); - virtual void finish_frame(); - virtual void render(Renderer &, Tag = Tag()) const; + void setup_frame(Renderer &) override; + void finish_frame() override; + void render(Renderer &, Tag = Tag()) const override; - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; }; } // namespace GL diff --git a/source/glsl/debug.h b/source/glsl/debug.h index f347aca5..4e3b5859 100644 --- a/source/glsl/debug.h +++ b/source/glsl/debug.h @@ -73,31 +73,31 @@ private: template typename T::const_iterator increment(typename T::const_iterator &, const T &); - virtual void visit(Block &); - virtual void visit(Literal &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(ExpressionStatement &); - virtual void visit(Import &); - virtual void visit(Precision &); - virtual void visit(Layout &); - virtual void visit(InterfaceLayout &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Passthrough &); - virtual void visit(Return &); - virtual void visit(Jump &); + void visit(Block &) override; + void visit(Literal &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(ExpressionStatement &) override; + void visit(Import &) override; + void visit(Precision &) override; + void visit(Layout &) override; + void visit(InterfaceLayout &) override; + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Passthrough &) override; + void visit(Return &) override; + void visit(Jump &) override; }; } // namespace SL diff --git a/source/glsl/finalize.h b/source/glsl/finalize.h index 45a1bdaa..fcacf774 100644 --- a/source/glsl/finalize.h +++ b/source/glsl/finalize.h @@ -18,8 +18,8 @@ public: void apply(Stage &s) { s.content.visit(*this); } private: - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; }; /** Assigns location and binding layout qualifiers to interface variables and @@ -56,8 +56,8 @@ private: void bind_uniform(RefPtr &, const std::string &, unsigned); bool visit_uniform(const std::string &, RefPtr &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &) { } + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override { } }; /** @@ -79,13 +79,13 @@ public: private: NodePtr create_conversion_statement(); - virtual void visit(Block &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(Assignment &); - virtual void visit(FunctionCall &); - virtual void visit(FunctionDeclaration &); + void visit(Block &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(Assignment &) override; + void visit(FunctionCall &) override; + void visit(FunctionDeclaration &) override; }; /** Generates default precision declarations or removes precision declarations @@ -102,9 +102,9 @@ public: void apply(Stage &); private: - virtual void visit(Block &); - virtual void visit(Precision &); - virtual void visit(VariableDeclaration &); + void visit(Block &) override; + void visit(Precision &) override; + void visit(VariableDeclaration &) override; }; /** Base class for feature converters. */ @@ -141,19 +141,19 @@ private: public: void apply(Stage &s, const Features &f) { FeatureConverter::apply(s, f); } private: - virtual void apply(); + void apply() override; - virtual void visit(Block &); - virtual void visit(RefPtr &); + void visit(Block &) override; + void visit(RefPtr &) override; bool supports_stage(Stage::Type) const; bool supports_unified_interface_syntax() const; - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Assignment &); + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Assignment &) override; bool supports_unified_sampling_functions() const; - virtual void visit(FunctionCall &); + void visit(FunctionCall &) override; bool supports_interface_blocks(const std::string &) const; - virtual void visit(VariableDeclaration &); + void visit(VariableDeclaration &) override; }; /** Converts qualifiers on variables and blocksto match a particular set of @@ -163,7 +163,7 @@ class QualifierConverter: private FeatureConverter public: void apply(Stage &s, const Features &f) { FeatureConverter::apply(s, f); } private: - virtual void apply(); + void apply() override; bool supports_interface_layouts() const; bool supports_stage_interface_layouts() const; @@ -172,7 +172,7 @@ private: bool supports_uniform_location() const; bool supports_binding() const; bool supports_interface_block_location() const; - virtual void visit(VariableDeclaration &); + void visit(VariableDeclaration &) override; }; } // namespace SL diff --git a/source/glsl/generate.h b/source/glsl/generate.h index 1eddfb16..e43c5bd6 100644 --- a/source/glsl/generate.h +++ b/source/glsl/generate.h @@ -23,7 +23,7 @@ public: void apply(Module &, const Features &); private: - virtual void visit(VariableDeclaration &); + void visit(VariableDeclaration &) override; }; /** Materializes implicitly declared interfaces. @@ -54,13 +54,13 @@ public: private: static std::string get_out_prefix(Stage::Type); std::string change_prefix(const std::string &, const std::string &) const; - virtual void visit(Block &); + void visit(Block &) override; VariableDeclaration *generate_interface(VariableDeclaration &, const std::string &, const std::string &); ExpressionStatement &insert_assignment(const std::string &, Expression *); - virtual void visit(VariableReference &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Passthrough &); + void visit(VariableReference &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Passthrough &) override; }; class LayoutDefaulter: private TraversingVisitor @@ -74,7 +74,7 @@ public: void apply(Stage &); private: - virtual void visit(InterfaceLayout &); + void visit(InterfaceLayout &) override; }; /** @@ -92,15 +92,15 @@ public: void apply(Stage &); private: - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression&); - virtual void visit(BinaryExpression &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(InterfaceLayout &); - virtual void visit(VariableDeclaration &); + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression&) override; + void visit(BinaryExpression &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(InterfaceLayout &) override; + void visit(VariableDeclaration &) override; }; } // namespace SL diff --git a/source/glsl/optimize.h b/source/glsl/optimize.h index 5f55e10c..30bc17e9 100644 --- a/source/glsl/optimize.h +++ b/source/glsl/optimize.h @@ -20,7 +20,7 @@ public: void apply(Stage &, const std::map &); private: - virtual void visit(VariableDeclaration &); + void visit(VariableDeclaration &) override; }; /** Finds functions which are candidates for inlining. Currently this means @@ -38,11 +38,11 @@ public: std::set apply(Stage &s) { s.content.visit(*this); return inlineable; } private: - virtual void visit(FunctionCall &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Return &); + void visit(FunctionCall &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Return &) override; }; /** Injects statements from one function into another. Local variables are @@ -70,10 +70,10 @@ public: std::string apply(Stage &, FunctionDeclaration &, Block &, const NodeList::iterator &, FunctionCall &); private: - virtual void visit(VariableReference &); - virtual void visit(FunctionCall &); - virtual void visit(VariableDeclaration &); - virtual void visit(Return &); + void visit(VariableReference &) override; + void visit(FunctionCall &) override; + void visit(VariableDeclaration &) override; + void visit(Return &) override; }; /** Inlines functions. Internally uses InlineableFunctionLocator to find @@ -94,11 +94,11 @@ public: bool apply(Stage &); private: - virtual void visit(RefPtr &); - virtual void visit(Block &); - virtual void visit(FunctionCall &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Iteration &); + void visit(RefPtr &) override; + void visit(Block &) override; + void visit(FunctionCall &) override; + void visit(FunctionDeclaration &) override; + void visit(Iteration &) override; }; /** Inlines variables into expressions. Variables with trivial values (those @@ -138,17 +138,17 @@ public: bool apply(Stage &); private: - virtual void visit(RefPtr &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(VariableDeclaration &); - virtual void visit(Iteration &); + void visit(RefPtr &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(VariableDeclaration &) override; + void visit(Iteration &) override; }; /** @@ -186,15 +186,15 @@ public: bool apply(Stage &); private: - virtual void visit(Block &); - virtual void visit(RefPtr &); - virtual void visit(VariableReference &); + void visit(Block &) override; + void visit(RefPtr &) override; + void visit(VariableReference &) override; void visit_composite(RefPtr &); - virtual void visit(MemberAccess &); - virtual void visit(BinaryExpression &); - virtual void visit(StructDeclaration &) { } - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(MemberAccess &) override; + void visit(BinaryExpression &) override; + void visit(StructDeclaration &) override { } + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; }; /** Replaces expressions consisting entirely of literals with the results of @@ -227,18 +227,18 @@ private: void convert_to_result(const Variant &); void set_result(const Variant &, bool = false); - virtual void visit(RefPtr &); - virtual void visit(Literal &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(VariableDeclaration &); - virtual void visit(Iteration &); + void visit(RefPtr &) override; + void visit(Literal &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(VariableDeclaration &) override; + void visit(Iteration &) override; }; /** Removes conditional statements and loops where the condition can be @@ -265,14 +265,14 @@ public: private: ConstantStatus check_constant_condition(const Expression &); - virtual void visit(Block &); - virtual void visit(RefPtr &); - virtual void visit(UnaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); + void visit(Block &) override; + void visit(RefPtr &) override; + void visit(UnaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; }; /** Removes code which is never executed due to flow control statements. */ @@ -286,12 +286,12 @@ public: virtual bool apply(Stage &); private: - virtual void visit(Block &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Return &) { reachable = false; } - virtual void visit(Jump &) { reachable = false; } + void visit(Block &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Return &) override { reachable = false; } + void visit(Jump &) override { reachable = false; } }; /** Removes types which are not used anywhere. */ @@ -304,12 +304,12 @@ public: bool apply(Stage &); private: - virtual void visit(RefPtr &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(RefPtr &) override; + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; }; /** Removes variable declarations with no references to them. Assignment @@ -353,23 +353,23 @@ public: private: void referenced(const Assignment::Target &, Node &); - virtual void visit(VariableReference &); + void visit(VariableReference &) override; void visit_composite(Expression &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; void record_assignment(const Assignment::Target &, Node &); - virtual void visit(ExpressionStatement &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(ExpressionStatement &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; void merge_variables(const BlockVariableMap &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; }; /** Removes function declarations with no references to them. */ @@ -383,8 +383,8 @@ public: bool apply(Stage &s); private: - virtual void visit(FunctionCall &); - virtual void visit(FunctionDeclaration &); + void visit(FunctionCall &) override; + void visit(FunctionDeclaration &) override; }; } // namespace SL diff --git a/source/glsl/output.h b/source/glsl/output.h index 57abed75..70e73c8a 100644 --- a/source/glsl/output.h +++ b/source/glsl/output.h @@ -30,30 +30,30 @@ private: void append(char); void set_source(unsigned, unsigned); - virtual void visit(Block &); + void visit(Block &) override; void visit_expression(Expression &, const Operator *, bool); - virtual void visit(Literal &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(ExpressionStatement &); - virtual void visit(Import &); - virtual void visit(Precision &); - virtual void visit(Layout &); - virtual void visit(InterfaceLayout &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Passthrough &); - virtual void visit(Return &); - virtual void visit(Jump &); + void visit(Literal &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(ExpressionStatement &) override; + void visit(Import &) override; + void visit(Precision &) override; + void visit(Layout &) override; + void visit(InterfaceLayout &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Passthrough &) override; + void visit(Return &) override; + void visit(Jump &) override; }; } // namespace SL diff --git a/source/glsl/reflect.h b/source/glsl/reflect.h index 13528c0d..59b5be23 100644 --- a/source/glsl/reflect.h +++ b/source/glsl/reflect.h @@ -30,16 +30,16 @@ private: void compare(Node &, Node &); template T *multi_visit(T &); - virtual void visit(Literal &); - virtual void visit(VariableReference &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(Literal &) override; + void visit(VariableReference &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; }; /** Determines the number of interface locations required by a variable. */ @@ -52,10 +52,10 @@ public: unsigned apply(VariableDeclaration &v) { v.visit(*this); return r_count; } private: - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; }; /** Determines the size and alignment of a variable or a type, in bytes. */ @@ -80,9 +80,9 @@ public: Result apply(TypeDeclaration &t) { t.visit(*this); return Result(r_size, r_alignment); } private: - virtual void visit(BasicTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(BasicTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; }; /** Collects dependencies of a function. This includes global variables, @@ -98,10 +98,10 @@ public: std::set apply(FunctionDeclaration &); private: - virtual void visit(VariableReference &); - virtual void visit(FunctionCall &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(VariableReference &) override; + void visit(FunctionCall &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; }; class AssignmentCollector: private TraversingVisitor @@ -114,10 +114,10 @@ public: std::set apply(Node &); private: - virtual void visit(VariableReference &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); + void visit(VariableReference &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; }; } // namespace SL diff --git a/source/glsl/resolve.h b/source/glsl/resolve.h index 43326cfb..5cb77c19 100644 --- a/source/glsl/resolve.h +++ b/source/glsl/resolve.h @@ -21,7 +21,7 @@ public: bool apply(Stage &s) { r_any_resolved = false; s.content.visit(*this); return r_any_resolved; } private: - virtual void enter(Block &); + void enter(Block &) override; }; /** Resolves types of variables and base types of other types. */ @@ -44,12 +44,12 @@ private: TypeDeclaration *get_or_create_array_type(TypeDeclaration &); TypeDeclaration *get_or_create_image_type(ImageTypeDeclaration &, const std::string &); void resolve_type(TypeDeclaration *&, const std::string &, bool, const Layout * = nullptr); - virtual void visit(Block &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(Block &) override; + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; }; /** Resolves variable references. */ @@ -69,17 +69,17 @@ public: bool apply(Stage &); private: - virtual void enter(Block &); - virtual void visit(RefPtr &); + void enter(Block &) override; + void visit(RefPtr &) override; void check_assignment_target(VariableDeclaration *); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; void merge_layouts(Layout &, const Layout &); void redeclare_builtin(VariableDeclaration &, VariableDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(VariableDeclaration &) override; }; /** Resolves types and lvalueness of expressions. */ @@ -118,22 +118,22 @@ private: bool truncate_vector(RefPtr &, unsigned); void resolve(Expression &, TypeDeclaration *, bool); - virtual void visit(Block &); - virtual void visit(Literal &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); + void visit(Block &) override; + void visit(Literal &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; void visit(BinaryExpression &, bool); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; void visit_constructor(FunctionCall &); - virtual void visit(FunctionCall &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Return &); + void visit(FunctionCall &) override; + void visit(BasicTypeDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Return &) override; using TraversingVisitor::visit; }; @@ -151,8 +151,8 @@ public: private: static bool can_convert_arguments(const FunctionCall &, const FunctionDeclaration &); - virtual void visit(FunctionCall &); - virtual void visit(FunctionDeclaration &); + void visit(FunctionCall &) override; + void visit(FunctionDeclaration &) override; }; } // namespace SL diff --git a/source/glsl/spirv.h b/source/glsl/spirv.h index af30212e..8436cf14 100644 --- a/source/glsl/spirv.h +++ b/source/glsl/spirv.h @@ -137,19 +137,19 @@ private: void write_deconstruct(Id, Id, Id *, unsigned); Id write_construct(Id, const Id *, unsigned); - virtual void visit(Block &); - virtual void visit(Literal &); - virtual void visit(VariableReference &); + void visit(Block &) override; + void visit(Literal &) override; + void visit(VariableReference &) override; void generate_composite_access(TypeDeclaration &); void visit_composite(Expression &, unsigned, TypeDeclaration &); void visit_isolated(Expression &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; void visit_constructor(FunctionCall &, const std::vector &, bool); void visit_builtin_matrix_comp_mult(FunctionCall &, const std::vector &); void visit_builtin_texture_query(FunctionCall &, const std::vector &); @@ -157,20 +157,20 @@ private: void visit_builtin_texture_fetch(FunctionCall &, const std::vector &); void visit_builtin_texture_store(FunctionCall &, const std::vector &); void visit_builtin_interpolate(FunctionCall &, const std::vector &); - virtual void visit(ExpressionStatement &); - virtual void visit(InterfaceLayout &); + void visit(ExpressionStatement &) override; + void visit(InterfaceLayout &) override; bool check_duplicate_type(TypeDeclaration &); bool check_standard_type(BasicTypeDeclaration &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; void visit_entry_point(FunctionDeclaration &, Id); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Return &); - virtual void visit(Jump &); + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Return &) override; + void visit(Jump &) override; }; } // namespace SL diff --git a/source/glsl/syntax.h b/source/glsl/syntax.h index b3932c6f..03c5b80d 100644 --- a/source/glsl/syntax.h +++ b/source/glsl/syntax.h @@ -119,7 +119,7 @@ struct FunctionDeclaration; struct Statement: Node { - virtual Statement *clone() const = 0; + Statement *clone() const override = 0; }; struct Block: Node @@ -133,8 +133,8 @@ struct Block: Node Block() = default; Block(const Block &); - virtual Block *clone() const { return new Block(*this); } - virtual void visit(NodeVisitor &); + Block *clone() const override { return new Block(*this); } + void visit(NodeVisitor &) override; }; struct Expression: Node @@ -144,7 +144,7 @@ struct Expression: Node TypeDeclaration *type = nullptr; bool lvalue = false; - virtual Expression *clone() const = 0; + Expression *clone() const override = 0; }; struct Literal: Expression @@ -152,8 +152,8 @@ struct Literal: Expression std::string token; Variant value; - virtual Literal *clone() const { return new Literal(*this); } - virtual void visit(NodeVisitor &); + Literal *clone() const override { return new Literal(*this); } + void visit(NodeVisitor &) override; }; struct VariableReference: Expression @@ -165,8 +165,8 @@ struct VariableReference: Expression VariableReference() = default; VariableReference(const VariableReference &); - virtual VariableReference *clone() const { return new VariableReference(*this); } - virtual void visit(NodeVisitor &); + VariableReference *clone() const override { return new VariableReference(*this); } + void visit(NodeVisitor &) override; }; struct MemberAccess: Expression @@ -180,8 +180,8 @@ struct MemberAccess: Expression MemberAccess() = default; MemberAccess(const MemberAccess &); - virtual MemberAccess *clone() const { return new MemberAccess(*this); } - virtual void visit(NodeVisitor &); + MemberAccess *clone() const override { return new MemberAccess(*this); } + void visit(NodeVisitor &) override; }; struct Swizzle: Expression @@ -191,16 +191,16 @@ struct Swizzle: Expression unsigned count = 0; std::uint8_t components[4] = { 0, 0, 0, 0 }; - virtual Swizzle *clone() const { return new Swizzle(*this); } - virtual void visit(NodeVisitor &); + Swizzle *clone() const override { return new Swizzle(*this); } + void visit(NodeVisitor &) override; }; struct UnaryExpression: Expression { NodePtr expression; - virtual UnaryExpression *clone() const { return new UnaryExpression(*this); } - virtual void visit(NodeVisitor &); + UnaryExpression *clone() const override { return new UnaryExpression(*this); } + void visit(NodeVisitor &) override; }; struct BinaryExpression: Expression @@ -208,8 +208,8 @@ struct BinaryExpression: Expression NodePtr left; NodePtr right; - virtual BinaryExpression *clone() const { return new BinaryExpression(*this); } - virtual void visit(NodeVisitor &); + BinaryExpression *clone() const override { return new BinaryExpression(*this); } + void visit(NodeVisitor &) override; }; struct Assignment: BinaryExpression @@ -239,8 +239,8 @@ struct Assignment: BinaryExpression Assignment() = default; Assignment(const Assignment &); - virtual Assignment *clone() const { return new Assignment(*this); } - virtual void visit(NodeVisitor &); + Assignment *clone() const override { return new Assignment(*this); } + void visit(NodeVisitor &) override; }; struct TernaryExpression: Expression @@ -249,8 +249,8 @@ struct TernaryExpression: Expression NodePtr true_expr; NodePtr false_expr; - virtual TernaryExpression *clone() const { return new TernaryExpression(*this); } - virtual void visit(NodeVisitor &); + TernaryExpression *clone() const override { return new TernaryExpression(*this); } + void visit(NodeVisitor &) override; }; struct FunctionCall: Expression @@ -264,24 +264,24 @@ struct FunctionCall: Expression FunctionCall() = default; FunctionCall(const FunctionCall &); - virtual FunctionCall *clone() const { return new FunctionCall(*this); } - virtual void visit(NodeVisitor &); + FunctionCall *clone() const override { return new FunctionCall(*this); } + void visit(NodeVisitor &) override; }; struct ExpressionStatement: Statement { NodePtr expression; - virtual ExpressionStatement *clone() const { return new ExpressionStatement(*this); } - virtual void visit(NodeVisitor &); + ExpressionStatement *clone() const override { return new ExpressionStatement(*this); } + void visit(NodeVisitor &) override; }; struct Import: Statement { std::string module; - virtual Import *clone() const { return new Import(*this); } - virtual void visit(NodeVisitor &); + Import *clone() const override { return new Import(*this); } + void visit(NodeVisitor &) override; }; struct Precision: Statement @@ -289,8 +289,8 @@ struct Precision: Statement std::string precision; std::string type; - virtual Precision *clone() const { return new Precision(*this); } - virtual void visit(NodeVisitor &); + Precision *clone() const override { return new Precision(*this); } + void visit(NodeVisitor &) override; }; struct Layout: Node @@ -307,8 +307,8 @@ struct Layout: Node std::vector qualifiers; - virtual Layout *clone() const { return new Layout(*this); } - virtual void visit(NodeVisitor &); + Layout *clone() const override { return new Layout(*this); } + void visit(NodeVisitor &) override; }; struct InterfaceLayout: Statement @@ -316,15 +316,15 @@ struct InterfaceLayout: Statement std::string interface; Layout layout; - virtual InterfaceLayout *clone() const { return new InterfaceLayout(*this); } - virtual void visit(NodeVisitor &); + InterfaceLayout *clone() const override { return new InterfaceLayout(*this); } + void visit(NodeVisitor &) override; }; struct TypeDeclaration: Statement { std::string name; - virtual TypeDeclaration *clone() const = 0; + TypeDeclaration *clone() const override = 0; }; struct BasicTypeDeclaration: TypeDeclaration @@ -352,8 +352,8 @@ struct BasicTypeDeclaration: TypeDeclaration BasicTypeDeclaration() = default; BasicTypeDeclaration(const BasicTypeDeclaration &); - virtual BasicTypeDeclaration *clone() const { return new BasicTypeDeclaration(*this); } - virtual void visit(NodeVisitor &); + BasicTypeDeclaration *clone() const override { return new BasicTypeDeclaration(*this); } + void visit(NodeVisitor &) override; }; struct ImageTypeDeclaration: TypeDeclaration @@ -377,8 +377,8 @@ struct ImageTypeDeclaration: TypeDeclaration TypeDeclaration *base_type = nullptr; ImageTypeDeclaration *base_image = nullptr; - virtual ImageTypeDeclaration *clone() const { return new ImageTypeDeclaration(*this); } - virtual void visit(NodeVisitor &); + ImageTypeDeclaration *clone() const override { return new ImageTypeDeclaration(*this); } + void visit(NodeVisitor &) override; }; struct StructDeclaration: TypeDeclaration @@ -392,8 +392,8 @@ struct StructDeclaration: TypeDeclaration StructDeclaration(); StructDeclaration(const StructDeclaration &); - virtual StructDeclaration *clone() const { return new StructDeclaration(*this); } - virtual void visit(NodeVisitor &); + StructDeclaration *clone() const override { return new StructDeclaration(*this); } + void visit(NodeVisitor &) override; }; struct VariableDeclaration: Statement @@ -416,10 +416,10 @@ struct VariableDeclaration: Statement VariableDeclaration() = default; VariableDeclaration(const VariableDeclaration &); - ~VariableDeclaration(); + ~VariableDeclaration() override; - virtual VariableDeclaration *clone() const { return new VariableDeclaration(*this); } - virtual void visit(NodeVisitor &); + VariableDeclaration *clone() const override { return new VariableDeclaration(*this); } + void visit(NodeVisitor &) override; }; struct FunctionDeclaration: Statement @@ -438,8 +438,8 @@ struct FunctionDeclaration: Statement FunctionDeclaration() = default; FunctionDeclaration(const FunctionDeclaration &); - virtual FunctionDeclaration *clone() const { return new FunctionDeclaration(*this); } - virtual void visit(NodeVisitor &); + FunctionDeclaration *clone() const override { return new FunctionDeclaration(*this); } + void visit(NodeVisitor &) override; }; struct Conditional: Statement @@ -448,8 +448,8 @@ struct Conditional: Statement Block body; Block else_body; - virtual Conditional *clone() const { return new Conditional(*this); } - virtual void visit(NodeVisitor &); + Conditional *clone() const override { return new Conditional(*this); } + void visit(NodeVisitor &) override; }; struct Iteration: Statement @@ -459,32 +459,32 @@ struct Iteration: Statement NodePtr loop_expression; Block body; - virtual Iteration *clone() const { return new Iteration(*this); } - virtual void visit(NodeVisitor &); + Iteration *clone() const override { return new Iteration(*this); } + void visit(NodeVisitor &) override; }; struct Passthrough: Statement { NodePtr subscript; - virtual Passthrough *clone() const { return new Passthrough(*this); } - virtual void visit(NodeVisitor &); + Passthrough *clone() const override { return new Passthrough(*this); } + void visit(NodeVisitor &) override; }; struct Return: Statement { NodePtr expression; - virtual Return *clone() const { return new Return(*this); } - virtual void visit(NodeVisitor &); + Return *clone() const override { return new Return(*this); } + void visit(NodeVisitor &) override; }; struct Jump: Statement { std::string keyword; - virtual Jump *clone() const { return new Jump(*this); } - virtual void visit(NodeVisitor &); + Jump *clone() const override { return new Jump(*this); } + void visit(NodeVisitor &) override; }; struct Stage diff --git a/source/glsl/validate.h b/source/glsl/validate.h index da1ed1c3..075f92f8 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -55,13 +55,13 @@ public: private: static const char *describe_variable(ScopeType); - virtual void visit(Layout &); - virtual void visit(InterfaceLayout &); - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(Layout &) override; + void visit(InterfaceLayout &) override; + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; }; /** Verifies that identifiers are unique or, in the case of functions, are @@ -86,11 +86,11 @@ private: void record_definition(const std::string &, Statement &); virtual void visit(TypeDeclaration &); - virtual void visit(BasicTypeDeclaration &t) { visit(static_cast(t)); } - virtual void visit(ImageTypeDeclaration &t) { visit(static_cast(t)); } - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(BasicTypeDeclaration &t) override { visit(static_cast(t)); } + void visit(ImageTypeDeclaration &t) override { visit(static_cast(t)); } + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; using Validator::visit; }; @@ -101,13 +101,13 @@ public: void apply(Stage &s) { stage = &s; s.content.visit(*this); } private: - virtual void visit(BasicTypeDeclaration &); - virtual void visit(ImageTypeDeclaration &); - virtual void visit(VariableReference &); - virtual void visit(MemberAccess &); - virtual void visit(FunctionCall &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); + void visit(BasicTypeDeclaration &) override; + void visit(ImageTypeDeclaration &) override; + void visit(VariableReference &) override; + void visit(MemberAccess &) override; + void visit(FunctionCall &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; }; /** Verifies that expressions are valid. In most cases an invalid expression @@ -130,18 +130,18 @@ public: void apply(Stage &s) { stage = &s; s.content.visit(*this); } private: - virtual void visit(VariableReference &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Return &); + void visit(VariableReference &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Return &) override; }; /** Verifies flow control constructs. Functions returning non-void must have @@ -155,12 +155,12 @@ public: void apply(Stage &s) { stage = &s; s.content.visit(*this); } private: - virtual void visit(Block &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Return &) { reachable = false; } - virtual void visit(Jump &) { reachable = false; } + void visit(Block &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Return &) override { reachable = false; } + void visit(Jump &) override { reachable = false; } }; /** Verifies that stage input and output interfaces are valid. Linked @@ -175,8 +175,8 @@ public: void apply(Stage &s) { stage = &s; s.content.visit(*this); } private: - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &) { } + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override { } }; /** Verifies that uniform interfaces are valid across the entire module. @@ -206,8 +206,8 @@ public: private: void check_uniform(const Uniform &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &) { } + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override { } }; } // namespace SL diff --git a/source/glsl/visitor.h b/source/glsl/visitor.h index 9a5aaff7..7cd5cb61 100644 --- a/source/glsl/visitor.h +++ b/source/glsl/visitor.h @@ -54,24 +54,24 @@ protected: public: virtual void enter(Block &) { } - virtual void visit(Block &); + void visit(Block &) override; virtual void visit(RefPtr &); - virtual void visit(MemberAccess &); - virtual void visit(Swizzle &); - virtual void visit(UnaryExpression &); - virtual void visit(BinaryExpression &); - virtual void visit(Assignment &); - virtual void visit(TernaryExpression &); - virtual void visit(FunctionCall &); - virtual void visit(ExpressionStatement &); - virtual void visit(InterfaceLayout &); - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Conditional &); - virtual void visit(Iteration &); - virtual void visit(Passthrough &); - virtual void visit(Return &); + void visit(MemberAccess &) override; + void visit(Swizzle &) override; + void visit(UnaryExpression &) override; + void visit(BinaryExpression &) override; + void visit(Assignment &) override; + void visit(TernaryExpression &) override; + void visit(FunctionCall &) override; + void visit(ExpressionStatement &) override; + void visit(InterfaceLayout &) override; + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Conditional &) override; + void visit(Iteration &) override; + void visit(Passthrough &) override; + void visit(Return &) override; using NodeVisitor::visit; }; @@ -89,14 +89,14 @@ private: template void remove_from_map(std::map &, const std::string &, T &); - virtual void visit(Block &); + void visit(Block &) override; void visit(TypeDeclaration &); - virtual void visit(BasicTypeDeclaration &t) { visit(static_cast(t)); } - virtual void visit(ImageTypeDeclaration &t) { visit(static_cast(t)); } - virtual void visit(StructDeclaration &); - virtual void visit(VariableDeclaration &); - virtual void visit(FunctionDeclaration &); - virtual void visit(Iteration &); + void visit(BasicTypeDeclaration &t) override { visit(static_cast(t)); } + void visit(ImageTypeDeclaration &t) override { visit(static_cast(t)); } + void visit(StructDeclaration &) override; + void visit(VariableDeclaration &) override; + void visit(FunctionDeclaration &) override; + void visit(Iteration &) override; using TraversingVisitor::visit; }; @@ -112,7 +112,7 @@ public: void apply(Stage &, Node &, const std::set &); private: - virtual void visit(Block &); + void visit(Block &) override; }; } // namespace SL diff --git a/source/materials/basicmaterial.h b/source/materials/basicmaterial.h index b5e04d72..60996f69 100644 --- a/source/materials/basicmaterial.h +++ b/source/materials/basicmaterial.h @@ -26,7 +26,7 @@ public: Loader(BasicMaterial &, Collection &); private: - virtual void init_actions(); + void init_actions() override; }; private: @@ -43,11 +43,11 @@ public: BasicMaterial(); protected: - virtual void fill_program_info(std::string &, std::map &) const; + void fill_program_info(std::string &, std::map &) const override; public: - virtual const Tag *get_texture_tags() const { return texture_tags; } - virtual const Texture *get_texture(Tag) const; + const Tag *get_texture_tags() const override { return texture_tags; } + const Texture *get_texture(Tag) const override; void set_diffuse(const Color &); void set_diffuse_map(const Texture *); diff --git a/source/materials/directionallight.h b/source/materials/directionallight.h index e1b816f5..0e5baae7 100644 --- a/source/materials/directionallight.h +++ b/source/materials/directionallight.h @@ -23,7 +23,7 @@ public: Loader(DirectionalLight &); private: - virtual void init_actions(); + void init_actions() override; void direction(float, float, float); }; @@ -37,7 +37,7 @@ private: public: /** Sets the light's direction from a matrix. The negative Z axis is used as the direction. Other axes and translation are ignored. */ - virtual void set_matrix(const Matrix &); + void set_matrix(const Matrix &) override; void set_direction(const Vector3 &); @@ -48,7 +48,7 @@ public: void set_transmittance(const Color &); protected: - virtual void update_shader_data(ProgramData &, const std::string &) const; + void update_shader_data(ProgramData &, const std::string &) const override; }; } // namespace GL diff --git a/source/materials/light.h b/source/materials/light.h index 3d7cbcc4..72ad748b 100644 --- a/source/materials/light.h +++ b/source/materials/light.h @@ -30,7 +30,7 @@ protected: protected: Loader(Light &); - virtual void init_actions(); + void init_actions() override; private: void color(float, float, float); @@ -45,7 +45,7 @@ public: GenericLoader(Collection &c): DynamicObjectLoader(&c) { } protected: - virtual const TypeRegistry &get_type_registry() const { return Light::get_light_registry(); } + const TypeRegistry &get_type_registry() const override { return Light::get_light_registry(); } }; protected: @@ -54,7 +54,7 @@ protected: Light() = default; public: - virtual ~Light() = default; + ~Light() override = default; /** Sets the color of the light. */ void set_color(const Color &); diff --git a/source/materials/lighting.h b/source/materials/lighting.h index 84f2f3af..6081965a 100644 --- a/source/materials/lighting.h +++ b/source/materials/lighting.h @@ -29,7 +29,7 @@ public: Loader(Lighting &, Collection &); private: - virtual void init_actions(); + void init_actions() override; void ambient(float, float, float); void fog_color(float, float, float); diff --git a/source/materials/material.h b/source/materials/material.h index f9ae8087..a1fd9cf9 100644 --- a/source/materials/material.h +++ b/source/materials/material.h @@ -25,7 +25,7 @@ private: protected: Loader(Material &, Collection &); - virtual void init_actions(); + void init_actions() override; private: void alpha_cutoff(float); @@ -70,7 +70,7 @@ public: GenericLoader(Collection &c): DynamicObjectLoader(&c) { } protected: - virtual const TypeRegistry &get_type_registry() const { return get_material_registry(); } + const TypeRegistry &get_type_registry() const override { return get_material_registry(); } }; protected: diff --git a/source/materials/pbrmaterial.h b/source/materials/pbrmaterial.h index d21bece3..0ffc52bd 100644 --- a/source/materials/pbrmaterial.h +++ b/source/materials/pbrmaterial.h @@ -29,7 +29,7 @@ public: Loader(PbrMaterial &, Collection &); private: - virtual void init_actions(); + void init_actions() override; }; private: @@ -51,12 +51,12 @@ public: static const Texture2D &get_or_create_fresnel_lookup(); protected: - virtual void fill_program_info(std::string &, std::map &) const; + void fill_program_info(std::string &, std::map &) const override; public: - virtual const Tag *get_texture_tags() const { return texture_tags; } - virtual const Texture *get_texture(Tag) const; - virtual const Sampler *get_sampler(Tag) const; + const Tag *get_texture_tags() const override { return texture_tags; } + const Texture *get_texture(Tag) const override; + const Sampler *get_sampler(Tag) const override; void set_base_color(const Color &); void set_base_color_map(const Texture *); diff --git a/source/materials/pointlight.h b/source/materials/pointlight.h index f94c9ca0..96dfbcbb 100644 --- a/source/materials/pointlight.h +++ b/source/materials/pointlight.h @@ -24,7 +24,7 @@ public: Loader(PointLight &); private: - virtual void init_actions(); + void init_actions() override; void attenuation(float, float, float); void position(float, float, float); @@ -39,7 +39,7 @@ private: public: /** Sets the light's position from a matrix. Only the translation part is used. */ - virtual void set_matrix(const Matrix &); + void set_matrix(const Matrix &) override; void set_position(const Vector3 &); const Vector3 &get_position(); @@ -51,7 +51,7 @@ public: const float *get_attenuation() const { return attenuation; } protected: - virtual void update_shader_data(ProgramData &, const std::string &) const; + void update_shader_data(ProgramData &, const std::string &) const override; }; } // namespace GL diff --git a/source/materials/rendermethod.h b/source/materials/rendermethod.h index e0356b82..14d7541a 100644 --- a/source/materials/rendermethod.h +++ b/source/materials/rendermethod.h @@ -37,13 +37,13 @@ public: public: Loader(RenderMethod &, Collection &); private: - virtual void init_actions(); + void init_actions() override; public: void set_inline_base_name(const std::string &); private: - virtual void finish(); + void finish() override; void blend(); void blend_factors(BlendFactor, BlendFactor); diff --git a/source/materials/splatmaterial.h b/source/materials/splatmaterial.h index 040ccf52..70662837 100644 --- a/source/materials/splatmaterial.h +++ b/source/materials/splatmaterial.h @@ -25,8 +25,8 @@ public: Loader(SplatMaterial &, Collection &); private: - virtual void init_actions(); - virtual void finish(); + void init_actions() override; + void finish() override; void map_storage(MapArray SplatMaterial::*, PixelFormat, unsigned, unsigned); void sub(); @@ -50,7 +50,7 @@ private: Loader(SubMaterial &); private: - virtual void init_actions(); + void init_actions() override; void base_color(float, float, float); void emission(float, float, float); @@ -97,15 +97,15 @@ private: public: SplatMaterial(); - ~SplatMaterial(); + ~SplatMaterial() override; protected: - virtual void fill_program_info(std::string &, std::map &) const; + void fill_program_info(std::string &, std::map &) const override; public: - virtual const Tag *get_texture_tags() const { return texture_tags; } - virtual const Texture *get_texture(Tag) const; - virtual const Sampler *get_sampler(Tag) const; + const Tag *get_texture_tags() const override { return texture_tags; } + const Texture *get_texture(Tag) const override; + const Sampler *get_sampler(Tag) const override; private: void set_sub_uniforms(unsigned); @@ -113,7 +113,7 @@ private: void upload_sub_map(DataFile::Collection &, unsigned, SubMap SubMaterial::*, MapArray &, const char *); public: - virtual void set_debug_name(const std::string &); + void set_debug_name(const std::string &) override; private: void set_array_debug_names(); }; diff --git a/source/materials/technique.h b/source/materials/technique.h index 49d916c1..8656770e 100644 --- a/source/materials/technique.h +++ b/source/materials/technique.h @@ -28,7 +28,7 @@ public: public: Loader(Technique &, Collection &); private: - virtual void init_actions(); + void init_actions() override; public: void set_inline_base_name(const std::string &); diff --git a/source/materials/unlitmaterial.h b/source/materials/unlitmaterial.h index a89e46ec..ac8dcbf1 100644 --- a/source/materials/unlitmaterial.h +++ b/source/materials/unlitmaterial.h @@ -23,7 +23,7 @@ public: Loader(UnlitMaterial &, Collection &); private: - virtual void init_actions(); + void init_actions() override; void texture(const std::string &); }; @@ -39,11 +39,11 @@ public: UnlitMaterial(); protected: - virtual void fill_program_info(std::string &, std::map &) const; + void fill_program_info(std::string &, std::map &) const override; public: - virtual const Tag *get_texture_tags() const { return texture_tags; } - virtual const Texture *get_texture(Tag) const; + const Tag *get_texture_tags() const override { return texture_tags; } + const Texture *get_texture(Tag) const override; void set_texture(const Texture *); void set_color(const Color &); diff --git a/source/render/camera.h b/source/render/camera.h index c55157b5..333b2cdf 100644 --- a/source/render/camera.h +++ b/source/render/camera.h @@ -102,7 +102,7 @@ public: const Vector3 &get_look_direction() const { return look_dir; } const Vector3 &get_up_direction() const { return up_dir; } - virtual void set_matrix(const Matrix &m) { set_object_matrix(m); } + void set_matrix(const Matrix &m) override { set_object_matrix(m); } /** Sets the position and orientation of the camera from an object matrix. */ void set_object_matrix(const Matrix &); diff --git a/source/render/instancearray.h b/source/render/instancearray.h index cd7b333b..bc89f570 100644 --- a/source/render/instancearray.h +++ b/source/render/instancearray.h @@ -28,7 +28,7 @@ protected: Loader(InstanceArrayBase &); private: - virtual void init_actions(); + void init_actions() override; protected: virtual void instance() = 0; @@ -70,7 +70,7 @@ private: protected: InstanceArrayBase(const Object &, std::size_t); - ~InstanceArrayBase(); + ~InstanceArrayBase() override; private: void add_block(std::size_t); @@ -93,7 +93,7 @@ protected: public: std::size_t size() const { return instance_count; } - virtual void render(Renderer &, Tag) const; + void render(Renderer &, Tag) const override; }; template @@ -166,7 +166,7 @@ private: public: InstanceArray(const Object &o): InstanceArrayBase(o, sizeof(Instance)) { } - ~InstanceArray() { destroy_all(); } + ~InstanceArray() override { destroy_all(); } T &append() { return *create(*this); } void remove(T &obj) { destroy(&obj); } diff --git a/source/render/object.h b/source/render/object.h index deb8d5d2..9fd788d1 100644 --- a/source/render/object.h +++ b/source/render/object.h @@ -56,7 +56,7 @@ public: public: Loader(Object &, Collection &); private: - virtual void finish(); + void finish() override; void bounding_sphere_hint(float, float, float, float); void level_of_detail(unsigned); @@ -80,7 +80,7 @@ public: Object(const Mesh *, const Technique *); Object(const Object &); Object(Object &&); - ~Object(); + ~Object() override; private: LevelOfDetail &get_lod(unsigned, const char *); @@ -111,10 +111,10 @@ public: const Technique *get_technique(unsigned = 0) const; unsigned get_n_lods() const { return lods.size(); } - virtual const Matrix *get_matrix() const { return &identity_matrix; } - virtual const Geometry::BoundingSphere *get_bounding_sphere() const { return &bounding_sphere; } + const Matrix *get_matrix() const override { return &identity_matrix; } + const Geometry::BoundingSphere *get_bounding_sphere() const override { return &bounding_sphere; } - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; /** Renders an instance of the object. The instance's hook functions are called before and after drawing the mesh. */ @@ -127,8 +127,8 @@ protected: private: const RenderMethod *get_method(Tag, unsigned) const; - virtual void resource_loaded(Resource &); - virtual void resource_removed(Resource &); + void resource_loaded(Resource &) override; + void resource_removed(Resource &) override; }; } // namespace GL diff --git a/source/render/objectinstance.h b/source/render/objectinstance.h index 9d815fb4..b096e54f 100644 --- a/source/render/objectinstance.h +++ b/source/render/objectinstance.h @@ -36,9 +36,9 @@ public: const Object &get_object() const { return object; } - virtual const Geometry::BoundingSphere *get_bounding_sphere() const { return object.get_bounding_sphere(); } + const Geometry::BoundingSphere *get_bounding_sphere() const override { return object.get_bounding_sphere(); } - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; /** Hook function, called from Object just before rendering the mesh. Renderer state will have been pushed before this is called. */ diff --git a/source/render/occludedscene.h b/source/render/occludedscene.h index 2a9f18a3..19c55ed9 100644 --- a/source/render/occludedscene.h +++ b/source/render/occludedscene.h @@ -49,17 +49,17 @@ private: public: OccludedScene(); - virtual void add(Renderable &); - virtual void remove(Renderable &); + void add(Renderable &) override; + void remove(Renderable &) override; private: void populate_cache() const; public: - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; }; } // namespace GL diff --git a/source/render/offscreenview.h b/source/render/offscreenview.h index bd2e22e2..a635cb4d 100644 --- a/source/render/offscreenview.h +++ b/source/render/offscreenview.h @@ -23,7 +23,7 @@ public: const Texture2D &get_target_texture(FrameAttachment a) const { return target.get_target_texture(a); } private: - virtual const Framebuffer &get_target() const { return target.get_framebuffer(); } + const Framebuffer &get_target() const override { return target.get_framebuffer(); } }; } // namespace GL diff --git a/source/render/orderedscene.h b/source/render/orderedscene.h index e3218cb3..3649b015 100644 --- a/source/render/orderedscene.h +++ b/source/render/orderedscene.h @@ -20,16 +20,16 @@ private: std::vector content; public: - virtual void add(Renderable &); - virtual void remove(Renderable &); + void add(Renderable &) override; + void remove(Renderable &) override; void prepend(Renderable &); void insert(unsigned, Renderable &); void insert_after(Renderable &, Renderable &); - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; }; } // namespace GL diff --git a/source/render/placeable.h b/source/render/placeable.h index 7d8df535..84d03554 100644 --- a/source/render/placeable.h +++ b/source/render/placeable.h @@ -40,7 +40,7 @@ protected: public: /* Reimplement to clear ambiguity between Renderable and Placeable. This overrides both base classes' implementations. */ - virtual const Matrix *get_matrix() const { return &matrix; } + const Matrix *get_matrix() const override { return &matrix; } }; } // namespace GL diff --git a/source/render/scene.h b/source/render/scene.h index 0e53e869..353aa048 100644 --- a/source/render/scene.h +++ b/source/render/scene.h @@ -57,13 +57,13 @@ public: GenericLoader(DataFile::Collection &c): DynamicObjectLoader(&c) { } protected: - virtual const TypeRegistry &get_type_registry() const { return get_scene_registry(); } + const TypeRegistry &get_type_registry() const override { return get_scene_registry(); } }; protected: Scene() = default; public: - virtual ~Scene() = default; + ~Scene() override = default; virtual void add(Renderable &) = 0; virtual void remove(Renderable &) = 0; diff --git a/source/render/sequence.h b/source/render/sequence.h index 9be14a43..805aa9e0 100644 --- a/source/render/sequence.h +++ b/source/render/sequence.h @@ -88,7 +88,7 @@ private: public: Sequence() = default; Sequence(unsigned, unsigned, const FrameFormat &); - ~Sequence(); + ~Sequence() override; unsigned get_width() const { return width; } unsigned get_height() const { return height; } @@ -116,10 +116,10 @@ public: void add_owned(T *p) { owned_data.push_back({ p, [](void *ptr){ delete static_cast(ptr); } }); } - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag tag = Tag()) const; + void render(Renderer &, Tag tag = Tag()) const override; void set_debug_name(const std::string &); }; diff --git a/source/render/simplescene.h b/source/render/simplescene.h index 9f3d3c12..f0314696 100644 --- a/source/render/simplescene.h +++ b/source/render/simplescene.h @@ -20,13 +20,13 @@ private: std::vector content; public: - virtual void add(Renderable &); - virtual void remove(Renderable &); + void add(Renderable &) override; + void remove(Renderable &) override; - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; }; } // namespace GL diff --git a/source/render/slot.h b/source/render/slot.h index 91dca7c1..b0947de2 100644 --- a/source/render/slot.h +++ b/source/render/slot.h @@ -20,11 +20,11 @@ public: void set(Renderable *); Renderable *get() const { return content; } - virtual const Matrix *get_matrix() const; - virtual const Geometry::BoundingSphere *get_bounding_sphere() const; - virtual void setup_frame(Renderer &); - virtual void finish_frame(); - virtual void render(Renderer &, Tag) const; + const Matrix *get_matrix() const override; + const Geometry::BoundingSphere *get_bounding_sphere() const override; + void setup_frame(Renderer &) override; + void finish_frame() override; + void render(Renderer &, Tag) const override; }; } // namespace GL diff --git a/source/render/text.h b/source/render/text.h index 812ab71f..433c5f21 100644 --- a/source/render/text.h +++ b/source/render/text.h @@ -85,7 +85,7 @@ public: float get_width() const { return width; } - virtual void setup_render(Renderer &, Tag) const; + void setup_render(Renderer &, Tag) const override; DEPRECATED operator const Object &() const { return object; } }; diff --git a/source/render/windowview.h b/source/render/windowview.h index f73d77fd..4db930f1 100644 --- a/source/render/windowview.h +++ b/source/render/windowview.h @@ -29,8 +29,8 @@ public: WindowView(Graphics::Window &); Graphics::Window &get_window() { return window; } - virtual unsigned get_width() const { return window.get_width(); } - virtual unsigned get_height() const { return window.get_height(); } + unsigned get_width() const override { return window.get_width(); } + unsigned get_height() const override { return window.get_height(); } using View::render; diff --git a/source/render/zsortedscene.h b/source/render/zsortedscene.h index 24267510..c686e612 100644 --- a/source/render/zsortedscene.h +++ b/source/render/zsortedscene.h @@ -54,8 +54,8 @@ private: mutable std::map > sorted_cache; public: - virtual void add(Renderable &); - virtual void remove(Renderable &); + void add(Renderable &) override; + void remove(Renderable &) override; /// Sets the sort order. Default is back to front. void set_order(SortOrder); @@ -63,10 +63,10 @@ public: /// Sets the reference point for sorting. Default is furthest from camera. void set_reference(DepthReference); - virtual void setup_frame(Renderer &); - virtual void finish_frame(); + void setup_frame(Renderer &) override; + void finish_frame() override; - virtual void render(Renderer &, Tag = Tag()) const; + void render(Renderer &, Tag = Tag()) const override; }; } // namespace GL diff --git a/source/resources/resourcemanager.h b/source/resources/resourcemanager.h index 97d60fd0..4aac2eb3 100644 --- a/source/resources/resourcemanager.h +++ b/source/resources/resourcemanager.h @@ -96,7 +96,7 @@ private: LoadingThread(); private: - virtual void main(); + void main() override; ManagedResource *front(std::deque &); diff --git a/source/resources/resources.h b/source/resources/resources.h index a0408844..cf9ad9f2 100644 --- a/source/resources/resources.h +++ b/source/resources/resources.h @@ -89,7 +89,7 @@ private: public: Resources(bool = true); - virtual ~Resources(); + ~Resources() override; static Resources &get_global(); static const DataFile::CollectionSource &get_builtins(); diff --git a/tools/glslcompiler.cpp b/tools/glslcompiler.cpp index f7bb2de9..dd5a6c6a 100644 --- a/tools/glslcompiler.cpp +++ b/tools/glslcompiler.cpp @@ -37,7 +37,7 @@ private: public: GlslCompiler(int, char **); - virtual int main(); + int main() override; }; using namespace std; diff --git a/tools/viewer.cpp b/tools/viewer.cpp index f4bb924d..0753ae25 100644 --- a/tools/viewer.cpp +++ b/tools/viewer.cpp @@ -92,9 +92,9 @@ private: public: ~Viewer(); - virtual int main(); + int main() override; private: - virtual void tick(); + void tick() override; void button_press(unsigned); void button_release(unsigned); -- 2.45.2