]> git.tdb.fi Git - libs/gl.git/commitdiff
Use nullptr instead of 0
authorMikko Rasa <tdb@tdb.fi>
Sun, 10 Dec 2023 09:05:34 +0000 (11:05 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 10 Dec 2023 21:59:16 +0000 (23:59 +0200)
156 files changed:
source/animation/animation.cpp
source/animation/animation.h
source/animation/animationplayer.cpp
source/animation/armature.cpp
source/animation/keyframe.h
source/animation/pose.h
source/backends/opengl/buffer_backend.cpp
source/backends/opengl/commands_backend.cpp
source/backends/opengl/commands_backend.h
source/backends/opengl/device_backend.h
source/backends/opengl/pipelinestate_backend.cpp
source/backends/opengl/pipelinestate_backend.h
source/backends/opengl/program_backend.cpp
source/backends/opengl/renderer_backend.cpp
source/backends/opengl/texture1d_backend.cpp
source/backends/opengl/texture1d_backend.h
source/backends/opengl/texture2d_backend.cpp
source/backends/opengl/texture2d_backend.h
source/backends/opengl/texture2dmultisample_backend.h
source/backends/opengl/texture3d_backend.cpp
source/backends/opengl/texture3d_backend.h
source/backends/opengl/texture_backend.cpp
source/backends/opengl/texturecube_backend.cpp
source/backends/opengl/texturecube_backend.h
source/backends/opengl/vertexsetup_backend.cpp
source/backends/vulkan/buffer_backend.cpp
source/backends/vulkan/buffer_backend.h
source/backends/vulkan/commands_backend.cpp
source/backends/vulkan/commands_backend.h
source/backends/vulkan/descriptorpool.cpp
source/backends/vulkan/destroyqueue.h
source/backends/vulkan/fence.cpp
source/backends/vulkan/framebuffer_backend.cpp
source/backends/vulkan/framebuffer_backend.h
source/backends/vulkan/memoryallocator.cpp
source/backends/vulkan/memoryallocator.h
source/backends/vulkan/module_backend.cpp
source/backends/vulkan/module_backend.h
source/backends/vulkan/pipelinecache.cpp
source/backends/vulkan/pipelinestate_backend.cpp
source/backends/vulkan/pipelinestate_backend.h
source/backends/vulkan/program_backend.cpp
source/backends/vulkan/program_backend.h
source/backends/vulkan/renderer_backend.cpp
source/backends/vulkan/renderer_backend.h
source/backends/vulkan/renderpass.h
source/backends/vulkan/sampler_backend.cpp
source/backends/vulkan/sampler_backend.h
source/backends/vulkan/structurebuilder.h
source/backends/vulkan/swapchain.cpp
source/backends/vulkan/swapchain.h
source/backends/vulkan/swapchaintexture.cpp
source/backends/vulkan/synchronizer.cpp
source/backends/vulkan/synchronizer.h
source/backends/vulkan/texture1d_backend.h
source/backends/vulkan/texture2dmultisample_backend.h
source/backends/vulkan/texture3d_backend.h
source/backends/vulkan/texture_backend.cpp
source/backends/vulkan/texture_backend.h
source/backends/vulkan/texturecube_backend.h
source/backends/vulkan/transferqueue.cpp
source/backends/vulkan/transferqueue.h
source/backends/vulkan/vertexsetup_backend.cpp
source/backends/vulkan/vulkan.h
source/backends/vulkan/windowview_backend.h
source/builders/font.h
source/builders/meshbuilder.cpp
source/builders/sequencebuilder.cpp
source/builders/sequencetemplate.h
source/core/buffer.cpp
source/core/buffer.h
source/core/bufferable.cpp
source/core/bufferable.h
source/core/device.cpp
source/core/framebuffer.cpp
source/core/framebuffer.h
source/core/mesh.cpp
source/core/mesh.h
source/core/module.cpp
source/core/module.h
source/core/pipelinestate.cpp
source/core/pipelinestate.h
source/core/program.cpp
source/core/program.h
source/core/reflectdata.h
source/core/texture.cpp
source/core/texture.h
source/core/texture2d.cpp
source/core/texture2d.h
source/core/vertexsetup.cpp
source/core/vertexsetup.h
source/effects/ambientocclusion.cpp
source/effects/bloom.cpp
source/effects/colorcurve.cpp
source/effects/shadowmap.cpp
source/effects/shadowmap.h
source/effects/sky.h
source/glsl/builtin.cpp
source/glsl/compiler.cpp
source/glsl/compiler.h
source/glsl/debug.h
source/glsl/finalize.cpp
source/glsl/finalize.h
source/glsl/generate.cpp
source/glsl/generate.h
source/glsl/optimize.cpp
source/glsl/optimize.h
source/glsl/output.h
source/glsl/parser.cpp
source/glsl/parser.h
source/glsl/reflect.cpp
source/glsl/reflect.h
source/glsl/resolve.cpp
source/glsl/resolve.h
source/glsl/spirv.cpp
source/glsl/spirv.h
source/glsl/spirvwriter.cpp
source/glsl/syntax.cpp
source/glsl/syntax.h
source/glsl/validate.cpp
source/glsl/validate.h
source/glsl/visitor.cpp
source/glsl/visitor.h
source/materials/basicmaterial.cpp
source/materials/material.h
source/materials/pbrmaterial.cpp
source/materials/programdata.cpp
source/materials/programdata.h
source/materials/rendermethod.cpp
source/materials/rendermethod.h
source/materials/splatmaterial.cpp
source/materials/splatmaterial.h
source/materials/technique.cpp
source/materials/unlitmaterial.cpp
source/materials/unlitmaterial.h
source/render/instancearray.h
source/render/object.cpp
source/render/occludedscene.cpp
source/render/occludedscene.h
source/render/renderable.h
source/render/renderer.cpp
source/render/renderer.h
source/render/scene.h
source/render/sequence.cpp
source/render/sequence.h
source/render/slot.cpp
source/render/slot.h
source/render/text.cpp
source/render/text.h
source/render/view.cpp
source/render/view.h
source/resources/resource.cpp
source/resources/resource.h
source/resources/resourcemanager.cpp
source/resources/resources.cpp
tools/viewer.cpp

index 1048cc9ef6747b57447aad8288cbe78aa2b5ba9a..1de1ff4eea07e668574195793d298aea428c4f2f 100644 (file)
@@ -452,7 +452,7 @@ Animation::Iterator &Animation::Iterator::operator+=(const Time::TimeDelta &t)
 void Animation::Iterator::dispatch_events(AnimationEventObserver &observer)
 {
        for(; (event_iter!=animation->events.end() && event_iter->time<=elapsed); ++event_iter)
-               observer.animation_event(0, event_iter->name, event_iter->value);
+               observer.animation_event(nullptr, event_iter->name, event_iter->value);
 }
 
 Matrix Animation::Iterator::get_matrix() const
@@ -487,7 +487,7 @@ Matrix Animation::Iterator::get_pose_matrix(unsigned link) const
 /* These shortcut constructors must be defined here to avoid an undefined
 reference to vftable. */
 Animation::Loader::Loader(Animation &a):
-       Loader(a, 0)
+       Loader(a, nullptr)
 { }
 
 Animation::Loader::Loader(Animation &a, Collection &c):
index 576cb9a5af8e1207590ea322cd27582bc8af3be2..d3ea724f4fc6de2f6625580127b80f44ca7a978c 100644 (file)
@@ -164,7 +164,7 @@ public:
        };
 
 private:
-       const Armature *armature = 0;
+       const Armature *armature = nullptr;
        std::vector<TimedKeyFrame> keyframes;
        std::vector<Event> events;
        bool looping = false;
index 44b8e466542b61fa573d9336ab5dc1f6724bfc6f..6da93d1c99e1f6e51c8c28080b403a001dafec16 100644 (file)
@@ -222,8 +222,8 @@ AnimationPlayer::PlayingAnimation::PlayingAnimation(const Animation &a, float s)
 
 AnimationPlayer::Target::Target(Placeable &p):
        placeable(p),
-       object(0),
-       armature(0),
+       object(nullptr),
+       armature(nullptr),
        stacked(false)
 { }
 
index acfffbf7b3cc2a53b9c1afb419842aac2b8e84c7..64e9dc441cc1ef9c73abc86fb19ae2a509b4f112 100644 (file)
@@ -40,7 +40,7 @@ unsigned Armature::get_max_link_index() const
 Armature::Link::Link(const string &n, unsigned i):
        name(n),
        index(i),
-       parent(0)
+       parent(nullptr)
 { }
 
 void Armature::Link::set_parent(const Link *p)
index e5067158df5526d278b5cf66f56a4307ba9c7775..55f8c341ec463c509032f6ecbad6518563617915 100644 (file)
@@ -24,7 +24,7 @@ public:
                std::string inline_base_name;
 
        public:
-               Loader(KeyFrame &k): Loader(k, 0) { }
+               Loader(KeyFrame &k): Loader(k, nullptr) { }
                Loader(KeyFrame &k, Collection &c): Loader(k, &c) { }
        private:
                Loader(KeyFrame &, Collection *);
@@ -68,7 +68,7 @@ public:
 private:
        Transform transform;
        UniformMap uniforms;
-       const Pose *pose = 0;
+       const Pose *pose = nullptr;
 
 public:
        void set_transform(const Transform &);
index b4ee9cf01be24f39f82c62289360f8295ce4d6ab..1c0cbf77f2b772e912a844248e275a57d7ec5cbf 100644 (file)
@@ -41,7 +41,7 @@ private:
                void rotation(float, float, float, float);
        };
 
-       const Armature *armature = 0;
+       const Armature *armature = nullptr;
        std::vector<Link> links;
 
 public:
index dc081b1c76517852a5b832a8918b06b7896b8990..5e794fba8aa362bfa5e5a79072c06bcec346b48d 100644 (file)
@@ -45,19 +45,19 @@ void OpenGLBuffer::allocate()
        {
                static const int flags = GL_MAP_READ_BIT|GL_MAP_WRITE_BIT|GL_DYNAMIC_STORAGE_BIT;
                if(ARB_direct_state_access)
-                       glNamedBufferStorage(id, size, 0, flags);
+                       glNamedBufferStorage(id, size, nullptr, flags);
                else
                {
                        bind_scratch();
-                       glBufferStorage(GL_ARRAY_BUFFER, size, 0, flags);
+                       glBufferStorage(GL_ARRAY_BUFFER, size, nullptr, flags);
                }
        }
        else if(ARB_direct_state_access)
-               glNamedBufferData(id, size, 0, GL_STATIC_DRAW);
+               glNamedBufferData(id, size, nullptr, GL_STATIC_DRAW);
        else
        {
                bind_scratch();
-               glBufferData(GL_ARRAY_BUFFER, size, 0, GL_STATIC_DRAW);
+               glBufferData(GL_ARRAY_BUFFER, size, nullptr, GL_STATIC_DRAW);
        }
 }
 
@@ -128,7 +128,7 @@ void OpenGLBuffer::unbind_scratch()
        if(scratch_binding)
        {
                glBindBuffer(GL_ARRAY_BUFFER, 0);
-               scratch_binding = 0;
+               scratch_binding = nullptr;
        }
 }
 
index 0a4416c69814bea21aa00fda272c09642743e55f..ac3692bdbf2283c3d9354f67bd93140a79f32031 100644 (file)
@@ -33,7 +33,7 @@ void OpenGLCommands::use_pipeline(const PipelineState *ps)
 
 void OpenGLCommands::clear(const ClearValue *values)
 {
-       const Framebuffer *target = (pipeline_state ? pipeline_state->get_framebuffer() : 0);
+       const Framebuffer *target = (pipeline_state ? pipeline_state->get_framebuffer() : nullptr);
        if(!target)
                throw invalid_operation("OpenGLCommands::clear");
 
@@ -92,7 +92,7 @@ void OpenGLCommands::dispatch(unsigned count_x, unsigned count_y, unsigned count
 
 void OpenGLCommands::resolve_multisample()
 {
-       const Framebuffer *framebuffer = (pipeline_state ? pipeline_state->get_framebuffer() : 0);
+       const Framebuffer *framebuffer = (pipeline_state ? pipeline_state->get_framebuffer() : nullptr);
        if(!framebuffer)
                throw invalid_operation("OpenGLCommands::resolve_multisample");
 
index 128d0ccf7ac9788d499484588a16aaf4c9b2eb70..0315c8669fd468799b24a36d45c7404de6adbbf2 100644 (file)
@@ -15,7 +15,7 @@ class QueryPool;
 class MSPGL_API OpenGLCommands
 {
 protected:
-       const PipelineState *pipeline_state = 0;
+       const PipelineState *pipeline_state = nullptr;
 
        OpenGLCommands() = default;
 
index ea526e1a01bf9b571d7108d9873555b2bb18af92..e81dcf7622465a9004c36d8db91f51b56e3f50e3 100644 (file)
@@ -15,15 +15,15 @@ class OpenGLTexture;
 
 struct OpenGLDeviceState
 {
-       const OpenGLPipelineState *last_pipeline = 0;
+       const OpenGLPipelineState *last_pipeline = nullptr;
        std::vector<int> bound_tex_targets;
        std::vector<char> bound_storage_textures;
        std::vector<char> bound_uniform_blocks;
        std::vector<char> bound_storage_buffers;
        unsigned restart_index = 0;
        unsigned n_clip_distances = 0;
-       const OpenGLBuffer *scratch_buffer = 0;
-       const OpenGLTexture *scratch_texture = 0;
+       const OpenGLBuffer *scratch_buffer = nullptr;
+       const OpenGLTexture *scratch_texture = nullptr;
 };
 
 class MSPGL_API OpenGLDevice: public NonCopyable
index af6584a785b841ba80b52cb659cefc3e93d4f37f..51be6151da148622f4e031b67f8cb1f3d29a1ba1 100644 (file)
@@ -37,7 +37,7 @@ namespace GL {
 OpenGLPipelineState::~OpenGLPipelineState()
 {
        if(applied_to)
-               applied_to->get_state().last_pipeline = 0;
+               applied_to->get_state().last_pipeline = nullptr;
 }
 
 void OpenGLPipelineState::apply() const
@@ -47,7 +47,7 @@ void OpenGLPipelineState::apply() const
 
        if(applied_to && applied_to!=&device)
        {
-               applied_to->get_state().last_pipeline = 0;
+               applied_to->get_state().last_pipeline = nullptr;
                changes = ~0U;
        }
 
@@ -58,7 +58,7 @@ void OpenGLPipelineState::apply() const
        if(this!=dev_state.last_pipeline)
        {
                if(dev_state.last_pipeline)
-                       dev_state.last_pipeline->applied_to = 0;
+                       dev_state.last_pipeline->applied_to = nullptr;
                changes = ~0U;
        }
 
@@ -330,8 +330,8 @@ void OpenGLPipelineState::clear()
                glDisable(GL_STENCIL_TEST);
                glDisable(GL_BLEND);
 
-               dev_state.last_pipeline->applied_to = 0;
-               dev_state.last_pipeline = 0;
+               dev_state.last_pipeline->applied_to = nullptr;
+               dev_state.last_pipeline = nullptr;
        }
 }
 
index 6da1375c248971286fdfaca63b50ce515f4db0f2..4f358295750a808ec91f874e461aedc41baa1587 100644 (file)
@@ -15,7 +15,7 @@ class MSPGL_API OpenGLPipelineState: public NonCopyable
        friend class OpenGLCommands;
 
 protected:
-       mutable Device *applied_to = 0;
+       mutable Device *applied_to = nullptr;
        mutable unsigned changes = 0;
 
        OpenGLPipelineState() = default;
index 35e2230b3eeacf57b1a49c7ac5d9359fa3184540..2bc438990c25de4cc67b79f847edcefdb509b7b1 100644 (file)
@@ -503,7 +503,7 @@ void OpenGLProgram::query_storage_blocks()
 
                GLenum prop = GL_BUFFER_BINDING;
                int value;
-               glGetProgramResourceiv(id, GL_SHADER_STORAGE_BLOCK, i, 1, &prop, 1, 0, &value);
+               glGetProgramResourceiv(id, GL_SHADER_STORAGE_BLOCK, i, 1, &prop, 1, nullptr, &value);
                info.bind_point = value;
        }
 }
@@ -518,7 +518,7 @@ void OpenGLProgram::finalize_uniforms()
                for(const ReflectData::UniformInfo *u: i->uniforms)
                        if(u->location>=0)
                        {
-                               UniformCall::FuncPtr func = 0;
+                               UniformCall::FuncPtr func = nullptr;
                                if(u->type==FLOAT)
                                        func = &uniform_wrapper<float, glUniform1fv>;
                                else if(u->type==FLOAT_VEC2)
index e49f6ce61add285b8716e617c95736da1682f6a5..6b32191ef5073db148e4d068a697f2918a183978 100644 (file)
@@ -6,7 +6,7 @@ namespace GL {
 
 void OpenGLRenderer::end()
 {
-       static_cast<Renderer *>(this)->commands.use_pipeline(0);
+       static_cast<Renderer *>(this)->commands.use_pipeline(nullptr);
 }
 
 } // namespace GL
index f7831dbd82fc45445d64bee853796fd71b62817d..93b92e56f240c1e80fc0df3dde4f5f37c2eb37de 100644 (file)
@@ -42,7 +42,7 @@ void OpenGLTexture1D::allocate()
                for(unsigned i=0; i<n_levels; ++i)
                {
                        unsigned lv_size = self.get_level_size(i);
-                       glTexImage1D(target, i, gl_fmt, lv_size, 0, comp, type, 0);
+                       glTexImage1D(target, i, gl_fmt, lv_size, 0, comp, type, nullptr);
                }
        }
 
index 754552b2a42ee2cc1bb2955add9afc4a89b43aa9..4dd606546284dd3dc248c1c686a51e4b88bb6189 100644 (file)
@@ -16,7 +16,7 @@ protected:
        void sub_image(unsigned, int, unsigned, const void *);
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index 9abfab545e1697173d65157a20a399b73cb270a9..88720c3c59f248257a952ae00cee941f9812c959 100644 (file)
@@ -44,7 +44,7 @@ void OpenGLTexture2D::allocate()
                for(unsigned i=0; i<n_levels; ++i)
                {
                        auto lv_size = self.get_level_size(i);
-                       glTexImage2D(target, i, gl_fmt, lv_size.x, lv_size.y, 0, comp, type, 0);
+                       glTexImage2D(target, i, gl_fmt, lv_size.x, lv_size.y, 0, comp, type, nullptr);
                }
        }
 
@@ -88,14 +88,14 @@ void OpenGLTexture2D::unload()
 OpenGLTexture2D::AsyncTransfer::AsyncTransfer(AsyncTransfer &&other):
        pixel_buffer(other.pixel_buffer)
 {
-       other.pixel_buffer = 0;
+       other.pixel_buffer = nullptr;
 }
 
 OpenGLTexture2D::AsyncTransfer &OpenGLTexture2D::AsyncTransfer::operator=(AsyncTransfer &&other)
 {
        delete pixel_buffer;
        pixel_buffer = other.pixel_buffer;
-       other.pixel_buffer = 0;
+       other.pixel_buffer = nullptr;
 
        return *this;
 }
@@ -121,7 +121,7 @@ void OpenGLTexture2D::AsyncTransfer::finalize()
        pixel_buffer->unmap();
 
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixel_buffer->id);
-       self.texture->OpenGLTexture2D::sub_image(self.level, self.x, self.y, self.width, self.height, 0);
+       self.texture->OpenGLTexture2D::sub_image(self.level, self.x, self.y, self.width, self.height, nullptr);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
 }
 
index 470884d36da8b648bae2ef3121128bf296c37caf..d1f4735e1d194047ef9647c3aff25bd662bdd454 100644 (file)
@@ -15,7 +15,7 @@ protected:
        class MSPGL_API AsyncTransfer: public NonCopyable
        {
        protected:
-               Buffer *pixel_buffer = 0;
+               Buffer *pixel_buffer = nullptr;
 
                AsyncTransfer() = default;
                AsyncTransfer(AsyncTransfer &&);
index 88a98fd4a6e819a8a1387258c152dbd5bb37678f..a2ca6aa64a52cf78481cf276546be0fccf8a1e3f 100644 (file)
@@ -15,7 +15,7 @@ protected:
        void allocate();
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index b71ad811ec752224f37c9ab16f2efc6a970ee778..3e1984a79dd33fd4686b673026a86721fee146bc 100644 (file)
@@ -46,7 +46,7 @@ void OpenGLTexture3D::allocate()
                for(unsigned i=0; i<n_levels; ++i)
                {
                        auto lv_size = self.get_level_size(i);
-                       glTexImage3D(target, i, gl_fmt, lv_size.x, lv_size.y, lv_size.z, 0, comp, type, 0);
+                       glTexImage3D(target, i, gl_fmt, lv_size.x, lv_size.y, lv_size.z, 0, comp, type, nullptr);
                }
                glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, n_levels-1);
        }
index c6ebd8154c6aef10ac220968d91eef4d0e8e3e63..5a66142c71e00862d1d86b7b7e34f368f72b5a77 100644 (file)
@@ -19,7 +19,7 @@ protected:
        bool is_array() const;
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index c96227d46ae7cc0a8435dbb6b17cac745e183341..229ef1ec316dcb59bf490b138ec0e2118980dc0b 100644 (file)
@@ -139,7 +139,7 @@ void OpenGLTexture::unbind_scratch()
        if(scratch_binding)
        {
                glBindTexture(scratch_binding->target, 0);
-               scratch_binding = 0;
+               scratch_binding = nullptr;
        }
 }
 
index 9b703c05c5425e6f62142089f343b71de1c418ca..18dab01cc767709c55406325da366fc562ec946d 100644 (file)
@@ -54,7 +54,7 @@ void OpenGLTextureCube::allocate()
                {
                        unsigned lv_size = static_cast<const TextureCube *>(this)->get_level_size(i);
                        for(unsigned j=0; j<6; ++j)
-                               glTexImage2D(get_gl_cube_face(j), i, gl_fmt, lv_size, lv_size, 0, comp, type, 0);
+                               glTexImage2D(get_gl_cube_face(j), i, gl_fmt, lv_size, lv_size, 0, comp, type, nullptr);
                }
                glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, n_levels-1);
        }
index 7434a4ef0aecc1b68270985197cf79ab65317723..a2424434174e5ec35f20728949d68ff006d67b08 100644 (file)
@@ -16,7 +16,7 @@ protected:
        void sub_image(unsigned, unsigned, int, int, unsigned, unsigned, const void *);
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index 59b5c66ed1c172c075a415c45c426b2b9a791d86..0f6e966f2988e33a7ba1c7f92bf0c6f1bac8b800 100644 (file)
@@ -141,14 +141,14 @@ void OpenGLVertexSetup::unload()
                        {
                                unsigned sem = get_attribute_semantic(a);
                                glDisableVertexAttribArray(sem);
-                               glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, 0);
+                               glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, nullptr);
                        }
                for(VertexAttribute a: self.inst_format)
                        if(!is_padding(a))
                        {
                                unsigned sem = get_attribute_semantic(a);
                                glDisableVertexAttribArray(sem);
-                               glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, 0);
+                               glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, nullptr);
                        }
 
                glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
index e83ccdac1a54a863a618df20f6ad538490f936cf..e9c7e41a482e2c0722feb9f911d3cbce26e15f28 100644 (file)
@@ -19,9 +19,9 @@ VulkanBuffer::VulkanBuffer(VulkanBuffer &&other):
        mapped_address(other.mapped_address),
        debug_name(move(other.debug_name))
 {
-       other.handle = 0;
+       other.handle = nullptr;
        other.memory_id = 0;
-       other.mapped_address = 0;
+       other.mapped_address = nullptr;
 }
 
 VulkanBuffer::~VulkanBuffer()
@@ -77,7 +77,7 @@ void *VulkanBuffer::map()
 bool VulkanBuffer::unmap()
 {
        device.get_allocator().unmap(memory_id);
-       mapped_address = 0;
+       mapped_address = nullptr;
        return true;
 }
 
index 55e24e69fa96ce426eb867d2ca853f07536b8b45..a265560a57f0f20535b58fe4fb364d7c3abc9713 100644 (file)
@@ -18,9 +18,9 @@ class MSPGL_API VulkanBuffer: public NonCopyable
 
 protected:
        Device &device;
-       VkBuffer handle = 0;
+       VkBuffer handle = nullptr;
        unsigned memory_id = 0;
-       void *mapped_address = 0;
+       void *mapped_address = nullptr;
        std::string debug_name;
 
        VulkanBuffer();
index 7f56c9845abf80dff8118ea36d16fc6c657a97fb..6921b9fbd75eb9230d75e5fcc1d044973fc81c79 100644 (file)
@@ -77,7 +77,7 @@ void VulkanCommands::begin_buffer(VkRenderPass render_pass)
        }
 
        vk.BeginCommandBuffer(buffer, begin_info);
-       last_pipeline = 0;
+       last_pipeline = nullptr;
 }
 
 void VulkanCommands::begin_render_pass(bool clear, const ClearValue *clear_values)
@@ -89,7 +89,7 @@ void VulkanCommands::begin_render_pass(bool clear, const ClearValue *clear_value
        viewport = pipeline_state->get_viewport();
 
        if(!primary_buffer)
-               begin_buffer(0);
+               begin_buffer(nullptr);
 
        fb_is_swapchain = framebuffer->is_presentable();
        framebuffer->refresh();
@@ -128,9 +128,9 @@ void VulkanCommands::end_render_pass()
        vkCmd.ExecuteCommands(1, &pass_buffer);
        vkCmd.EndRenderPass();
 
-       framebuffer = 0;
+       framebuffer = nullptr;
        viewport = Rect::max();
-       pass_buffer = 0;
+       pass_buffer = nullptr;
 }
 
 void VulkanCommands::begin_frame(unsigned fnum)
@@ -186,7 +186,7 @@ void VulkanCommands::submit_frame(Semaphore *wait_sem, Semaphore *signal_sem)
 
        vk.QueueSubmit(1, &submit_info, command_pools[frame_index].fence.handle);
 
-       primary_buffer = 0;
+       primary_buffer = nullptr;
 }
 
 void VulkanCommands::use_pipeline(const PipelineState *ps)
@@ -217,7 +217,7 @@ void VulkanCommands::draw_instanced(const Batch &batch, unsigned count)
                throw invalid_operation("VulkanCommands::draw_instanced");
 
        if(!framebuffer)
-                begin_render_pass(false, 0);
+                begin_render_pass(false, nullptr);
 
        VulkanCommandRecorder vkCmd(device.get_functions(), pass_buffer);
 
@@ -241,7 +241,7 @@ void VulkanCommands::dispatch(unsigned count_x, unsigned count_y, unsigned count
        pipeline_state->refresh();
        pipeline_state->synchronize_resources();
        device.get_synchronizer().barrier(vkCmd);
-       pipeline_state->apply(vkCmd, 0, frame_index, false);
+       pipeline_state->apply(vkCmd, nullptr, frame_index, false);
        vkCmd.Dispatch(count_x, count_y, count_z);
 }
 
@@ -284,7 +284,7 @@ VulkanCommands::CommandPool::CommandPool(CommandPool &&other):
        fence(move(other.fence)),
        in_use(other.in_use)
 {
-       other.pool = 0;
+       other.pool = nullptr;
 }
 
 VulkanCommands::CommandPool::~CommandPool()
index efc1dbd3f8b308356eb59c98084433f958c2ff2b..ae3eea02c517e20395c626e686c6db99b0e78b15 100644 (file)
@@ -31,7 +31,7 @@ protected:
        struct CommandPool
        {
                Device &device;
-               VkCommandPool pool = 0;
+               VkCommandPool pool = nullptr;
                CommandBuffers primary;
                CommandBuffers secondary;
                Fence fence;
@@ -46,11 +46,11 @@ protected:
        std::vector<CommandPool> command_pools;
        unsigned frame_number = 0;
        unsigned frame_index = 0;
-       VkCommandBuffer primary_buffer = 0;
-       VkCommandBuffer pass_buffer = 0;
-       const PipelineState *pipeline_state = 0;
-       const PipelineState *last_pipeline = 0;
-       const Framebuffer *framebuffer = 0;
+       VkCommandBuffer primary_buffer = nullptr;
+       VkCommandBuffer pass_buffer = nullptr;
+       const PipelineState *pipeline_state = nullptr;
+       const PipelineState *last_pipeline = nullptr;
+       const Framebuffer *framebuffer = nullptr;
        Rect viewport = Rect::max();
        bool fb_is_swapchain = false;
        bool discard_fb_contents = false;
index 5a9cd93e6faa6e2a2f47146c0dad210a48aaf0c7..46ee19278f51dc43b98d6f3ed13919ecbff3d7b8 100644 (file)
@@ -58,7 +58,7 @@ void DescriptorPool::begin_frame()
                add_pool(capacity);
 
                for(auto &s: sets)
-                       fill(s.begin(), s.end(), static_cast<VkDescriptorSet>(0));
+                       fill(s.begin(), s.end(), static_cast<VkDescriptorSet>(nullptr));
 
                used = Counts();
        }
@@ -77,7 +77,7 @@ unsigned DescriptorPool::get_descriptor_set_slot(const PipelineState &ps, unsign
                slot = next_slot++;
                slots.emplace(i, hash, slot);
                for(auto &s: sets)
-                       s.push_back(0);
+                       s.push_back(nullptr);
        }
 
        if(ps.is_descriptor_set_dynamic(index))
@@ -135,7 +135,7 @@ VkDescriptorSet DescriptorPool::get_descriptor_set(unsigned slot, const Pipeline
        for(unsigned i=0; i<n_writes; ++i)
                writes[i].dstSet = handle_cast<::VkDescriptorSet>(desc_set);
 
-       vk.UpdateDescriptorSets(n_writes, writes, 0, 0);
+       vk.UpdateDescriptorSets(n_writes, writes, 0, nullptr);
 
        return desc_set;
 }
index e8da7a0cd00a73f36968bb0299eea744fd2744e8..bf1de02549496575da9ab286b03a467007135626 100644 (file)
@@ -15,8 +15,8 @@ class DestroyQueue
 private:
        struct Entry
        {
-               void *handle = 0;
-               void (*destroy_func)(const VulkanFunctions &, void *) = 0;
+               void *handle = nullptr;
+               void (*destroy_func)(const VulkanFunctions &, void *) = nullptr;
                unsigned memory_id = 0;
                unsigned on_frame = 0;
        };
index f5b754423371824e89c7a9845c6c492c90555b82..7ba65e06712cf3781d150048c9c6253a1bc0311f 100644 (file)
@@ -24,7 +24,7 @@ Fence::Fence(Fence &&other):
        device(other.device),
        handle(other.handle)
 {
-       other.handle = 0;
+       other.handle = nullptr;
 }
 
 Fence::~Fence()
index c2ab2dfafa3ba0de3f5c838c52aebf0631ff01c8..52f874fafe9fb1ed3202180d35783c30b014b976 100644 (file)
@@ -20,7 +20,7 @@ VulkanFramebuffer::VulkanFramebuffer(VulkanFramebuffer &&other):
        handle(other.handle),
        debug_name(move(other.debug_name))
 {
-       other.handle = 0;
+       other.handle = nullptr;
 }
 
 VulkanFramebuffer::~VulkanFramebuffer()
index 729898a7ad8836d38c7f5f1ae5c1aa2e3803254e..6007cb66b115abb007b763587c61ae269e1e594d 100644 (file)
@@ -20,7 +20,7 @@ class MSPGL_API VulkanFramebuffer: public NonCopyable
 
 protected:
        Device &device;
-       mutable VkFramebuffer handle = 0;
+       mutable VkFramebuffer handle = nullptr;
        mutable std::vector<VkImageView> view_handles;
        std::string debug_name;
 
index 8dbe94eb5858b66d79f5723ecb314f02859b7b79..24ffa7c89c2c85f0f3d6e129d1d610247ce0a1a5 100644 (file)
@@ -388,7 +388,7 @@ void MemoryAllocator::unmap(unsigned id)
        {
                const VulkanFunctions &vk = device.get_functions();
                vk.UnmapMemory(region.memory);
-               region.mapped_address = 0;
+               region.mapped_address = nullptr;
        }
 }
 
index 6e3413f36d2ab199dae04abf62f98d79e46c366e..2bd2ab3a5f73eb17ed6dea48aa5817ce1adb7361 100644 (file)
@@ -43,9 +43,9 @@ private:
        {
                int pool = -1;
                bool direct = false;
-               VkDeviceMemory memory = 0;
+               VkDeviceMemory memory = nullptr;
                std::size_t size = 0;
-               void *mapped_address = 0;
+               void *mapped_address = nullptr;
                unsigned map_count = 0;
        };
 
index b0c39989a19295861e64e6ae90b0f7783e428702..b5e97b51cfca3919bd8e9a202ee7568a018bb599 100644 (file)
@@ -17,7 +17,7 @@ VulkanSpirVModule::VulkanSpirVModule(VulkanSpirVModule &&other):
        device(other.device),
        handle(other.handle)
 {
-       other.handle = 0;
+       other.handle = nullptr;
 }
 
 VulkanSpirVModule::~VulkanSpirVModule()
index d717b53d624ff6cf3defc6862f7cecc52f063ed1..f6be266a30359f56b4f85882474e77e37b3036b0 100644 (file)
@@ -15,7 +15,7 @@ class MSPGL_API VulkanSpirVModule
 
 protected:
        Device &device;
-       VkShaderModule handle = 0;
+       VkShaderModule handle = nullptr;
        std::string debug_name;
 
        VulkanSpirVModule();
index 618ddc9323b68d24678b372648a42ce3ec6530e6..fe30b67f80eb9bdaea24bb07de1744a3ff3d31d1 100644 (file)
@@ -61,12 +61,12 @@ VkPipeline PipelineCache::get_pipeline(const PipelineState &ps)
        if(type==VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO)
        {
                const VkComputePipelineCreateInfo *creation_info = reinterpret_cast<const VkComputePipelineCreateInfo *>(buffer.data());
-               vk.CreateComputePipelines(0, 1, creation_info, &pipeline);
+               vk.CreateComputePipelines(nullptr, 1, creation_info, &pipeline);
        }
        else
        {
                const VkGraphicsPipelineCreateInfo *creation_info = reinterpret_cast<const VkGraphicsPipelineCreateInfo *>(buffer.data());
-               vk.CreateGraphicsPipelines(0, 1, creation_info, &pipeline);
+               vk.CreateGraphicsPipelines(nullptr, 1, creation_info, &pipeline);
        }
 
        pipelines.insert(make_pair(key, pipeline));
index dd3b8347ff15a5eaa9a5897ac0e58a10f088cb7e..d0bae66340b1ccf1fdf96da52f4cf60321cc3232 100644 (file)
@@ -210,9 +210,9 @@ void VulkanPipelineState::fill_graphics_creation_info(vector<char> &buffer) cons
 
        viewport_info->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
        viewport_info->viewportCount = 1;
-       viewport_info->pViewports = 0;
+       viewport_info->pViewports = nullptr;
        viewport_info->scissorCount = 1;
-       viewport_info->pScissors = 0;
+       viewport_info->pScissors = nullptr;
 
        raster_info->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
        raster_info->depthClampEnable = VK_FALSE;
@@ -233,7 +233,7 @@ void VulkanPipelineState::fill_graphics_creation_info(vector<char> &buffer) cons
        multisample_info->rasterizationSamples = static_cast<VkSampleCountFlagBits>(get_vulkan_samples(format.get_samples()));
        multisample_info->sampleShadingEnable = VK_FALSE;
        multisample_info->minSampleShading = 1.0f;
-       multisample_info->pSampleMask = 0;
+       multisample_info->pSampleMask = nullptr;
        multisample_info->alphaToCoverageEnable = (format.get_samples()>1 && self.blend.alpha_to_coverage ? VK_TRUE : VK_FALSE);
        multisample_info->alphaToOneEnable = VK_FALSE;
 
@@ -279,7 +279,7 @@ void VulkanPipelineState::fill_graphics_creation_info(vector<char> &buffer) cons
        pipeline_info->sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
 
        pipeline_info->pInputAssemblyState = input_assembly_info;
-       pipeline_info->pTessellationState = (has_tessellation ? tessellation_info : 0);
+       pipeline_info->pTessellationState = (has_tessellation ? tessellation_info : nullptr);
        pipeline_info->pViewportState = viewport_info;
        pipeline_info->pRasterizationState = raster_info;
        pipeline_info->pMultisampleState = multisample_info;
@@ -320,7 +320,7 @@ uint64_t VulkanPipelineState::compute_descriptor_set_hash(unsigned index) const
 {
        const PipelineState &self = *static_cast<const PipelineState *>(this);
 
-       uint64_t result = hash<64>(0, 0);
+       uint64_t result = hash<64>(nullptr, 0);
        bool empty = true;
 
        auto i = lower_bound_member(self.resources, static_cast<int>(index)<<20, &PipelineState::BoundResource::binding);
@@ -550,7 +550,7 @@ void VulkanPipelineState::apply(const VulkanCommandRecorder &vkCmd, const Vulkan
                                self.descriptor_set_slots[i], self, i, frame));
 
                vkCmd.BindDescriptorSets(bind_point, self.shprog->layout_handle,
-                       first_changed_desc_set, descriptor_set_handles.size(), descriptor_set_handles.data(), 0, 0);
+                       first_changed_desc_set, descriptor_set_handles.size(), descriptor_set_handles.data(), 0, nullptr);
        }
 
        if(!self.shprog->is_compute() && (unapplied&(PipelineState::VIEWPORT|PipelineState::SCISSOR)))
index f59bc76068ce9715e4a25ab6584fad3a051488bc..a8624f42a2e0c42eabd8d1ce55e7523e2ddaa356 100644 (file)
@@ -21,7 +21,7 @@ protected:
        Device &device;
        mutable unsigned changes = 0;
        mutable unsigned unapplied = 0;
-       mutable VkPipeline handle = 0;
+       mutable VkPipeline handle = nullptr;
        mutable std::vector<unsigned> descriptor_set_slots;
        mutable unsigned first_changed_desc_set = 0;
        mutable std::uint32_t push_const_compat = 0;
index 73df3396b134d239428767ddd39dd7a795a90f65..b6ddb12de07b1b9fe190cc51b35fcdde07804ccb 100644 (file)
@@ -26,7 +26,7 @@ VulkanProgram::VulkanProgram(VulkanProgram &&other):
        debug_name(move(other.debug_name))
 {
        other.desc_set_layout_handles.clear();
-       other.layout_handle = 0;
+       other.layout_handle = nullptr;
 }
 
 VulkanProgram::~VulkanProgram()
@@ -114,7 +114,7 @@ void VulkanProgram::finalize_uniforms()
        const ReflectData &rd = static_cast<const Program *>(this)->reflect_data;
 
        auto i = find_member(rd.blocks, static_cast<int>(ReflectData::PUSH_CONSTANT), &ReflectData::BlockInfo::bind_point);
-       const ReflectData::BlockInfo *push_const_block = (i!=rd.blocks.end() ? &*i : 0);
+       const ReflectData::BlockInfo *push_const_block = (i!=rd.blocks.end() ? &*i : nullptr);
 
        desc_set_layout_handles.resize(rd.n_descriptor_sets);
        for(unsigned j=0; j<rd.n_descriptor_sets; ++j)
@@ -132,7 +132,7 @@ void VulkanProgram::finalize_uniforms()
                                        binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
                                binding.descriptorCount = 1;
                                binding.stageFlags = stage_flags;
-                               binding.pImmutableSamplers = 0;
+                               binding.pImmutableSamplers = nullptr;
                        }
 
                for(const ReflectData::UniformInfo &u: rd.uniforms)
@@ -147,7 +147,7 @@ void VulkanProgram::finalize_uniforms()
                                        binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
                                binding.descriptorCount = 1;
                                binding.stageFlags = stage_flags;
-                               binding.pImmutableSamplers = 0;
+                               binding.pImmutableSamplers = nullptr;
                        }
 
                VkDescriptorSetLayoutCreateInfo set_layout_info = { };
index 78d03a1237105ed794516a47336f31fd58d624e4..4d424587f2b621d2885cd6e4d8f127d3b7097e0e 100644 (file)
@@ -23,7 +23,7 @@ protected:
        unsigned stage_flags = 0;
        std::vector<char> creation_info;
        std::vector<VkDescriptorSetLayout> desc_set_layout_handles;
-       VkPipelineLayout layout_handle = 0;
+       VkPipelineLayout layout_handle = nullptr;
        std::string debug_name;
 
        VulkanProgram();
index 3b9281b5c609b8874539eac1f0b5467accd41464..166e66f3766422a392c614d455ef2140f6d9888a 100644 (file)
@@ -10,8 +10,8 @@ VulkanRenderer::VulkanRenderer():
 
 void VulkanRenderer::begin()
 {
-       begin_semaphore = 0;
-       end_semaphore = 0;
+       begin_semaphore = nullptr;
+       end_semaphore = nullptr;
 }
 
 void VulkanRenderer::begin(Semaphore &sem)
@@ -24,7 +24,7 @@ void VulkanRenderer::begin(Semaphore &sem)
 void VulkanRenderer::end()
 {
        Renderer &self = *static_cast<Renderer *>(this);
-       self.commands.use_pipeline(0);
+       self.commands.use_pipeline(nullptr);
        self.commands.submit_frame(begin_semaphore, end_semaphore);
 }
 
index 577d29a461c365201cf3b80c615081e6eae1aaef..dd9ec3a82b62ea0c20e386c5ee311e55c8d26730 100644 (file)
@@ -13,9 +13,9 @@ class MSPGL_API VulkanRenderer: public NonCopyable
 {
 protected:
        std::map<std::uintptr_t, PipelineState> pipeline_states;
-       PipelineState *current_pipeline = 0;
-       Semaphore *begin_semaphore = 0;
-       Semaphore *end_semaphore = 0;
+       PipelineState *current_pipeline = nullptr;
+       Semaphore *begin_semaphore = nullptr;
+       Semaphore *end_semaphore = nullptr;
 
        VulkanRenderer();
 
index e59dc164732d2d713bc9d9317af6598dfbc32be6..97299e8c6858d52ef3f2472551f2d8e2773af7c4 100644 (file)
@@ -13,13 +13,13 @@ union ClearValue;
 
 struct RenderPass
 {
-       const Framebuffer *framebuffer = 0;
+       const Framebuffer *framebuffer = nullptr;
        Rect render_area;
        bool clear = false;
-       const ClearValue *clear_values = 0;
+       const ClearValue *clear_values = nullptr;
        bool to_present = false;
        bool discard_fb_contents = false;
-       VkRenderPass handle = 0;
+       VkRenderPass handle = nullptr;
 
        void update(Device &);
 
index 134be91b018ea052601aab04d14adeafae13053e..2b54524b16f3b8a7cf749f6ae4e37d81b3eed267 100644 (file)
@@ -18,7 +18,7 @@ VulkanSampler::VulkanSampler(VulkanSampler &&other):
        handle(other.handle),
        debug_name(move(other.debug_name))
 {
-       other.handle = 0;
+       other.handle = nullptr;
 }
 
 VulkanSampler::~VulkanSampler()
index 2603d13ffe816f932c48848bf652f7c3cd3de0f9..5e2204d56ec6aeb24f90d1836134db282e1d385a 100644 (file)
@@ -15,7 +15,7 @@ class MSPGL_API VulkanSampler
 
 protected:
        Device &device;
-       mutable VkSampler handle = 0;
+       mutable VkSampler handle = nullptr;
        std::string debug_name;
 
        VulkanSampler();
index 1cb1e8ce54b39dcce23407b423437b3c6ee00469..dd8a04263f5a8e9063e4d970aa22d0c47c0d9cd1 100644 (file)
@@ -13,7 +13,7 @@ private:
        struct Part
        {
                std::size_t offset = 0;
-               void *pointer = 0;
+               void *pointer = nullptr;
        };
 
        std::vector<char> &storage;
index ba2d922b76ed1317ce77ed30e708c2d6b3f6bfeb..572a42fe90b71f60946da4afdfc1d7cd215f55e1 100644 (file)
@@ -40,7 +40,7 @@ SwapChain::SwapChain(unsigned w, unsigned h, unsigned n_images_min):
                surface_caps.supportedCompositeAlpha&~(surface_caps.supportedCompositeAlpha-1));
 
        uint32_t n_formats = 0;
-       vk.GetPhysicalDeviceSurfaceFormats(surface, n_formats, 0);
+       vk.GetPhysicalDeviceSurfaceFormats(surface, n_formats, nullptr);
        vector<VkSurfaceFormatKHR> surface_formats(n_formats);
        vk.GetPhysicalDeviceSurfaceFormats(surface, n_formats, surface_formats.data());
 
@@ -60,7 +60,7 @@ SwapChain::SwapChain(unsigned w, unsigned h, unsigned n_images_min):
                throw runtime_error("no suitable swapchain pixelformat");
 
        uint32_t n_present_modes = 0;
-       vk.GetPhysicalDeviceSurfacePresentModes(surface, n_present_modes, 0);
+       vk.GetPhysicalDeviceSurfacePresentModes(surface, n_present_modes, nullptr);
        vector<VkPresentModeKHR> present_modes(n_present_modes);
        vk.GetPhysicalDeviceSurfacePresentModes(surface, n_present_modes, present_modes.data());
 
@@ -72,7 +72,7 @@ SwapChain::SwapChain(unsigned w, unsigned h, unsigned n_images_min):
        vk.CreateSwapchain(swapchain_info, handle);
 
        uint32_t n_images = 0;
-       vk.GetSwapchainImages(handle, n_images, 0);
+       vk.GetSwapchainImages(handle, n_images, nullptr);
        vector<VkImage> image_handles(n_images);
        vk.GetSwapchainImages(handle, n_images, image_handles.data());
 
@@ -96,7 +96,7 @@ unsigned SwapChain::begin_frame(Semaphore &sem)
        const VulkanFunctions &vk = device.get_functions();
 
        uint32_t image_index;
-       vk.AcquireNextImage(handle, numeric_limits<uint64_t>::max(), sem.handle, 0, image_index);
+       vk.AcquireNextImage(handle, numeric_limits<uint64_t>::max(), sem.handle, nullptr, image_index);
 
        current_index = image_index;
 
index b34b487cc03e678ba597b6edebeca0f0f26682d4..88a95e6e3e0fee4b160b647a222f992745d9f7a2 100644 (file)
@@ -16,8 +16,8 @@ class SwapChain
 
 private:
        Device &device;
-       VkSwapchain handle = 0;
-       VkSurface surface = 0;
+       VkSwapchain handle = nullptr;
+       VkSurface surface = nullptr;
        unsigned width = 0;
        unsigned height = 0;
        std::vector<SwapChainTexture> images;
index c5ccf2f28617549f39b2cc59039eee1952653872..a037a233fcb8c9f5f02cdc360c9cb0d452609707 100644 (file)
@@ -11,7 +11,7 @@ SwapChainTexture::SwapChainTexture(PixelFormat f, unsigned w, unsigned h, VkImag
 
 SwapChainTexture::~SwapChainTexture()
 {
-       handle = 0;
+       handle = nullptr;
 }
 
 } // namespace GL
index 28488fd0d28ad81188fe882b7e2c81ede29ebc59..06bb470192ea7e435f9efae92cd0cbec30f34adb 100644 (file)
@@ -199,7 +199,7 @@ void Synchronizer::barrier(const VulkanCommandRecorder &vkCmd)
        if(!dst_stage)
                dst_stage = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
 
-       vkCmd.PipelineBarrier(src_stage, dst_stage, 0, 0, 0,
+       vkCmd.PipelineBarrier(src_stage, dst_stage, 0, 0, nullptr,
                buffer_barriers.size(), buffer_barriers.data(), image_barriers.size(), image_barriers.data());
 
        for(auto i=buffer_accesses.begin(); i!=buffer_accesses.end(); )
index 32a4d9793e303125a76e841aff368276ab791541..30dea564dd4736f94144823309f0cb71c2c5666b 100644 (file)
@@ -15,7 +15,7 @@ class Synchronizer
 private:
        struct ImageAccess
        {
-               VkImage image = 0;
+               VkImage image = nullptr;
                unsigned aspect;
                int level = -1;
                unsigned current_layout;
@@ -24,7 +24,7 @@ private:
 
        struct BufferAccess
        {
-               VkBuffer buffer = 0;
+               VkBuffer buffer = nullptr;
                std::size_t offset = 0;
                std::size_t size = 0;
                bool was_written = false;
index 691ccdb9318e84179453b53c48c56217ee2eb7d4..48ae32df36f9642dcd9872553d59f5e0a44fd3ff 100644 (file)
@@ -17,7 +17,7 @@ protected:
        virtual void fill_mipmap_blit(unsigned, void *);
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index b5931e19b041c0f419d35e55f480f86240c2b22d..d898ede5317f14847b9956eace6bdf36b04cfb42 100644 (file)
@@ -17,7 +17,7 @@ protected:
        virtual void fill_mipmap_blit(unsigned, void *) { }
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index 134f3d4d3592d4c5b3b52122c11fa739d341bba2..421eca3a85ac6f2aa5d40d8c3e47da920104de19 100644 (file)
@@ -20,7 +20,7 @@ protected:
        bool is_array() const;
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index b0ddb2ee2ef6268ea2682ea810752f41d7981f53..62c044918b36dc4ebde2b20df07c996120d002d3 100644 (file)
@@ -24,8 +24,8 @@ VulkanTexture::VulkanTexture(VulkanTexture &&other):
        view_type(other.view_type),
        debug_name(move(other.debug_name))
 {
-       other.handle = 0;
-       other.view_handle = 0;
+       other.handle = nullptr;
+       other.view_handle = nullptr;
        other.memory_id = 0;
 }
 
index ce4e540feeb31de2c02a11f2364970d166454751..69c456dd368dba4e7bd452f0619ef9bd1f30922c 100644 (file)
@@ -17,8 +17,8 @@ class MSPGL_API VulkanTexture: public NonCopyable
 
 protected:
        Device &device;
-       VkImage handle = 0;
-       VkImageView view_handle = 0;
+       VkImage handle = nullptr;
+       VkImageView view_handle = nullptr;
        mutable std::vector<VkImageView> mip_view_handles;
        unsigned memory_id = 0;
        unsigned view_type;
index 7fdb8189c4240c9f75e8de1eb339521a5dc39ca4..91c4b7ec5244ce36061cb646f6c6cff1bf9b9cb5 100644 (file)
@@ -17,7 +17,7 @@ protected:
        virtual void fill_mipmap_blit(unsigned, void *);
 
 public:
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) { return nullptr; }
        virtual std::size_t get_data_size() const;
        virtual void unload() { }
 };
index 95f170d4509086973967aa43910f27a856a8d4f3..df5c037c931af48e434c37ff785335d728134226 100644 (file)
@@ -93,7 +93,7 @@ void TransferQueue::dispatch_transfers(const VulkanCommandRecorder &vkCmd, unsig
 
                for(; i!=j; ++i)
                {
-                       VkBuffer buffer = (i->buffer_index>=0 ? buffers[i->buffer_index].buffer : 0);
+                       VkBuffer buffer = (i->buffer_index>=0 ? buffers[i->buffer_index].buffer : nullptr);
                        i->transfer(vkCmd, buffer, i->offset);
                        if(i->buffer_index>=0)
                                buffers[i->buffer_index].last_frame = current_frame;
@@ -137,9 +137,9 @@ TransferQueue::StagingBuffer::StagingBuffer(StagingBuffer &&other):
        used(other.used),
        mapped_address(other.mapped_address)
 {
-       other.buffer = 0;
+       other.buffer = nullptr;
        other.memory_id = 0;
-       other.mapped_address = 0;
+       other.mapped_address = nullptr;
 }
 
 TransferQueue::StagingBuffer::~StagingBuffer()
index 14654b760e143aca590ecd38244a244416c1b2e0..5d6c926c3d256a74af966a85a2901803c4c80d80 100644 (file)
@@ -18,11 +18,11 @@ private:
        struct StagingBuffer
        {
                Device &device;
-               VkBuffer buffer = 0;
+               VkBuffer buffer = nullptr;
                unsigned memory_id = 0;
                std::size_t size = 0;
                std::size_t used = 0;
-               void *mapped_address = 0;
+               void *mapped_address = nullptr;
                unsigned async_count = 0;
                unsigned last_frame = 0;
 
@@ -33,12 +33,12 @@ private:
 
        struct PendingTransfer
        {
-               const void *object = 0;
+               const void *object = nullptr;
                unsigned order = 0;
                int buffer_index = -1;
                std::size_t offset = 0;
                std::size_t size = 0;
-               void *staging_address = 0;
+               void *staging_address = nullptr;
                std::function<void()> synchronize;
                std::function<void(const VulkanCommandRecorder &, VkBuffer, std::size_t)> transfer;
        };
index 1ac823b55742559031c7dacd27b0ff1d98feda2e..035f3d306bcc790126011a97587cbaff349dc03e 100644 (file)
@@ -85,7 +85,7 @@ uint64_t VulkanVertexSetup::compute_hash() const
 {
        const VertexSetup &self = *static_cast<const VertexSetup *>(this);
 
-       uint64_t result = hash<64>(0, 0);
+       uint64_t result = hash<64>(nullptr, 0);
        for(VertexAttribute a: self.vertex_format)
                result = hash_update<64>(result, a);
        for(VertexAttribute a: self.inst_format)
index 6c3726f6024c32c289c991d0686105b657d469c7..b287b4dd4e2332afe63ee392ad8401fc80500468 100644 (file)
@@ -98,83 +98,83 @@ private:
        ::VkPhysicalDevice physicalDevice;
        ::VkQueue graphicsQueue;
 
-       PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties = 0;  // 5.1
-       PFN_vkCreateCommandPool vkCreateCommandPool = 0;  // 6.2
-       PFN_vkResetCommandPool vkResetCommandPool = 0;  // 6.2
-       PFN_vkDestroyCommandPool vkDestroyCommandPool = 0;  // 6.2
-       PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers = 0;  // 6.3
-       PFN_vkBeginCommandBuffer vkBeginCommandBuffer = 0;  // 6.4
-       PFN_vkEndCommandBuffer vkEndCommandBuffer = 0;  // 6.4
-       PFN_vkQueueSubmit vkQueueSubmit = 0;  // 6.5
-       PFN_vkCmdExecuteCommands vkCmdExecuteCommands = 0;  // 6.7
-       PFN_vkCreateFence vkCreateFence = 0;  // 7.3
-       PFN_vkDestroyFence vkDestroyFence = 0;  // 7.3
-       PFN_vkGetFenceStatus vkGetFenceStatus = 0;  // 7.3
-       PFN_vkResetFences vkResetFences = 0;  // 7.3
-       PFN_vkWaitForFences vkWaitForFences = 0;  // 7.3
-       PFN_vkCreateSemaphore vkCreateSemaphore = 0;  // 7.4
-       PFN_vkDestroySemaphore vkDestroySemaphore = 0;  // 7.4
-       PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier = 0;  // 7.6
-       PFN_vkQueueWaitIdle vkQueueWaitIdle = 0;  // 7.8
-       PFN_vkCreateRenderPass vkCreateRenderPass = 0;  // 8.1
-       PFN_vkCreateRenderPass2 vkCreateRenderPass2 = 0;  // 8.1
-       PFN_vkDestroyRenderPass vkDestroyRenderPass = 0;  // 8.1
-       PFN_vkCreateFramebuffer vkCreateFramebuffer = 0;  // 8.3
-       PFN_vkDestroyFramebuffer vkDestroyFramebuffer = 0;  // 8.3
-       PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass = 0;  // 8.4
-       PFN_vkCmdEndRenderPass vkCmdEndRenderPass = 0;  // 8.4
-       PFN_vkCreateShaderModule vkCreateShaderModule = 0;  // 9.1
-       PFN_vkDestroyShaderModule vkDestroyShaderModule = 0;  // 9.1
-       PFN_vkCreateComputePipelines vkCreateComputePipelines = 0;  // 10.1
-       PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines = 0;  // 10.2
-       PFN_vkDestroyPipeline vkDestroyPipeline = 0;  // 10.4
-       PFN_vkCmdBindPipeline vkCmdBindPipeline = 0;  // 10.10
-       PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties = 0;  // 11.2.1
-       PFN_vkAllocateMemory vkAllocateMemory = 0;  // 11.2.3
-       PFN_vkFreeMemory vkFreeMemory = 0;  // 11.2.8
-       PFN_vkMapMemory vkMapMemory = 0;  // 11.2.9
-       PFN_vkUnmapMemory vkUnmapMemory = 0;  // 11.2.9
-       PFN_vkCreateBuffer vkCreateBuffer = 0;  // 12.1
-       PFN_vkDestroyBuffer vkDestroyBuffer = 0;  // 12.1
-       PFN_vkCreateImage vkCreateImage = 0;  // 12.3
-       PFN_vkDestroyImage vkDestroyImage = 0;  // 12.3
-       PFN_vkCreateImageView vkCreateImageView = 0;  // 12.5
-       PFN_vkDestroyImageView vkDestroyImageView = 0;  // 12.5
-       PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements = 0;  // 12.7
-       PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements = 0;  // 12.7
-       PFN_vkBindBufferMemory vkBindBufferMemory = 0;  // 12.7
-       PFN_vkBindImageMemory vkBindImageMemory = 0;  // 12.7
-       PFN_vkCreateSampler vkCreateSampler = 0;  // 13
-       PFN_vkDestroySampler vkDestroySampler = 0;  // 13
-       PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout = 0;  // 14.2.1
-       PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout = 0;  // 14.2.1
-       PFN_vkCreatePipelineLayout vkCreatePipelineLayout = 0;  // 14.2.2
-       PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout = 0;  // 14.2.2
-       PFN_vkCreateDescriptorPool vkCreateDescriptorPool = 0;  // 14.2.3
-       PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool = 0;  // 14.2.3
-       PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets = 0;  // 14.2.3
-       PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets = 0;  // 14.2.4
-       PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets = 0;  // 14.2.7
-       PFN_vkCmdPushConstants vkCmdPushConstants = 0;  // 14.2.10
-       PFN_vkCmdCopyBuffer vkCmdCopyBuffer = 0;  // 19.2
-       PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage = 0;  // 19.4
-       PFN_vkCmdBlitImage vkCmdBlitImage = 0;  // 19.5
-       PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer = 0;  // 20.3
-       PFN_vkCmdDrawIndexed vkCmdDrawIndexed = 0;  // 20.3
-       PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers = 0;  // 21.2
-       PFN_vkCmdSetViewport vkCmdSetViewport = 0;  // 24.5
-       PFN_vkCmdSetScissor vkCmdSetScissor = 0;  // 26.1
-       PFN_vkCmdDispatch vkCmdDispatch = 0;  // 28
-       PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilities = 0;  // 30.5.1
-       PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormats = 0;  // 30.5.2
-       PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModes = 0;  // 30.5.3
-       PFN_vkCreateSwapchainKHR vkCreateSwapchain = 0;  // 30.8
-       PFN_vkDestroySwapchainKHR vkDestroySwapchain = 0;  // 30.8
-       PFN_vkGetSwapchainImagesKHR vkGetSwapchainImages = 0;  // 30.8
-       PFN_vkAcquireNextImageKHR vkAcquireNextImage = 0;  // 30.8
-       PFN_vkQueuePresentKHR vkQueuePresent = 0;  // 30.8
-       PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties = 0;  // 39.2
-       PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectName = 0;  // 45.1.1
+       PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties = nullptr;  // 5.1
+       PFN_vkCreateCommandPool vkCreateCommandPool = nullptr;  // 6.2
+       PFN_vkResetCommandPool vkResetCommandPool = nullptr;  // 6.2
+       PFN_vkDestroyCommandPool vkDestroyCommandPool = nullptr;  // 6.2
+       PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers = nullptr;  // 6.3
+       PFN_vkBeginCommandBuffer vkBeginCommandBuffer = nullptr;  // 6.4
+       PFN_vkEndCommandBuffer vkEndCommandBuffer = nullptr;  // 6.4
+       PFN_vkQueueSubmit vkQueueSubmit = nullptr;  // 6.5
+       PFN_vkCmdExecuteCommands vkCmdExecuteCommands = nullptr;  // 6.7
+       PFN_vkCreateFence vkCreateFence = nullptr;  // 7.3
+       PFN_vkDestroyFence vkDestroyFence = nullptr;  // 7.3
+       PFN_vkGetFenceStatus vkGetFenceStatus = nullptr;  // 7.3
+       PFN_vkResetFences vkResetFences = nullptr;  // 7.3
+       PFN_vkWaitForFences vkWaitForFences = nullptr;  // 7.3
+       PFN_vkCreateSemaphore vkCreateSemaphore = nullptr;  // 7.4
+       PFN_vkDestroySemaphore vkDestroySemaphore = nullptr;  // 7.4
+       PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier = nullptr;  // 7.6
+       PFN_vkQueueWaitIdle vkQueueWaitIdle = nullptr;  // 7.8
+       PFN_vkCreateRenderPass vkCreateRenderPass = nullptr;  // 8.1
+       PFN_vkCreateRenderPass2 vkCreateRenderPass2 = nullptr;  // 8.1
+       PFN_vkDestroyRenderPass vkDestroyRenderPass = nullptr;  // 8.1
+       PFN_vkCreateFramebuffer vkCreateFramebuffer = nullptr;  // 8.3
+       PFN_vkDestroyFramebuffer vkDestroyFramebuffer = nullptr;  // 8.3
+       PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass = nullptr;  // 8.4
+       PFN_vkCmdEndRenderPass vkCmdEndRenderPass = nullptr;  // 8.4
+       PFN_vkCreateShaderModule vkCreateShaderModule = nullptr;  // 9.1
+       PFN_vkDestroyShaderModule vkDestroyShaderModule = nullptr;  // 9.1
+       PFN_vkCreateComputePipelines vkCreateComputePipelines = nullptr;  // 10.1
+       PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines = nullptr;  // 10.2
+       PFN_vkDestroyPipeline vkDestroyPipeline = nullptr;  // 10.4
+       PFN_vkCmdBindPipeline vkCmdBindPipeline = nullptr;  // 10.10
+       PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties = nullptr;  // 11.2.1
+       PFN_vkAllocateMemory vkAllocateMemory = nullptr;  // 11.2.3
+       PFN_vkFreeMemory vkFreeMemory = nullptr;  // 11.2.8
+       PFN_vkMapMemory vkMapMemory = nullptr;  // 11.2.9
+       PFN_vkUnmapMemory vkUnmapMemory = nullptr;  // 11.2.9
+       PFN_vkCreateBuffer vkCreateBuffer = nullptr;  // 12.1
+       PFN_vkDestroyBuffer vkDestroyBuffer = nullptr;  // 12.1
+       PFN_vkCreateImage vkCreateImage = nullptr;  // 12.3
+       PFN_vkDestroyImage vkDestroyImage = nullptr;  // 12.3
+       PFN_vkCreateImageView vkCreateImageView = nullptr;  // 12.5
+       PFN_vkDestroyImageView vkDestroyImageView = nullptr;  // 12.5
+       PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements = nullptr;  // 12.7
+       PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements = nullptr;  // 12.7
+       PFN_vkBindBufferMemory vkBindBufferMemory = nullptr;  // 12.7
+       PFN_vkBindImageMemory vkBindImageMemory = nullptr;  // 12.7
+       PFN_vkCreateSampler vkCreateSampler = nullptr;  // 13
+       PFN_vkDestroySampler vkDestroySampler = nullptr;  // 13
+       PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout = nullptr;  // 14.2.1
+       PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout = nullptr;  // 14.2.1
+       PFN_vkCreatePipelineLayout vkCreatePipelineLayout = nullptr;  // 14.2.2
+       PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout = nullptr;  // 14.2.2
+       PFN_vkCreateDescriptorPool vkCreateDescriptorPool = nullptr;  // 14.2.3
+       PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool = nullptr;  // 14.2.3
+       PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets = nullptr;  // 14.2.3
+       PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets = nullptr;  // 14.2.4
+       PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets = nullptr;  // 14.2.7
+       PFN_vkCmdPushConstants vkCmdPushConstants = nullptr;  // 14.2.10
+       PFN_vkCmdCopyBuffer vkCmdCopyBuffer = nullptr;  // 19.2
+       PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage = nullptr;  // 19.4
+       PFN_vkCmdBlitImage vkCmdBlitImage = nullptr;  // 19.5
+       PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer = nullptr;  // 20.3
+       PFN_vkCmdDrawIndexed vkCmdDrawIndexed = nullptr;  // 20.3
+       PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers = nullptr;  // 21.2
+       PFN_vkCmdSetViewport vkCmdSetViewport = nullptr;  // 24.5
+       PFN_vkCmdSetScissor vkCmdSetScissor = nullptr;  // 26.1
+       PFN_vkCmdDispatch vkCmdDispatch = nullptr;  // 28
+       PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilities = nullptr;  // 30.5.1
+       PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormats = nullptr;  // 30.5.2
+       PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModes = nullptr;  // 30.5.3
+       PFN_vkCreateSwapchainKHR vkCreateSwapchain = nullptr;  // 30.8
+       PFN_vkDestroySwapchainKHR vkDestroySwapchain = nullptr;  // 30.8
+       PFN_vkGetSwapchainImagesKHR vkGetSwapchainImages = nullptr;  // 30.8
+       PFN_vkAcquireNextImageKHR vkAcquireNextImage = nullptr;  // 30.8
+       PFN_vkQueuePresentKHR vkQueuePresent = nullptr;  // 30.8
+       PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties = nullptr;  // 39.2
+       PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectName = nullptr;  // 45.1.1
 
 public:
        VulkanFunctions(const Graphics::VulkanContext &);
@@ -185,13 +185,13 @@ public:
 
        // Chapter 6: Command Buffers
        Result CreateCommandPool(const VkCommandPoolCreateInfo &rCreateInfo, VkCommandPool &rCommandPool) const
-       { return { vkCreateCommandPool(device, &rCreateInfo, 0, handle_cast<::VkCommandPool *>(&rCommandPool)), "vkCreateCommandPool" }; }
+       { return { vkCreateCommandPool(device, &rCreateInfo, nullptr, handle_cast<::VkCommandPool *>(&rCommandPool)), "vkCreateCommandPool" }; }
 
        Result ResetCommandPool(VkCommandPool commandPool, VkCommandPoolResetFlags flags) const
        { return { vkResetCommandPool(device, handle_cast<::VkCommandPool>(commandPool), flags), "vkResetCommandPool" }; }
 
        void DestroyCommandPool(VkCommandPool commandPool) const
-       { vkDestroyCommandPool(device, handle_cast<::VkCommandPool>(commandPool), 0); }
+       { vkDestroyCommandPool(device, handle_cast<::VkCommandPool>(commandPool), nullptr); }
 
        Result AllocateCommandBuffers(const VkCommandBufferAllocateInfo &rAllocateInfo, VkCommandBuffer *pCommandBuffers) const
        { return { vkAllocateCommandBuffers(device, &rAllocateInfo, handle_cast<::VkCommandBuffer *>(pCommandBuffers)), "vkAllocateCommandBuffers" }; }
@@ -210,10 +210,10 @@ public:
 
        // Chapter 7: Synchronization and Cache Control
        Result CreateFence(const VkFenceCreateInfo &rCreateInfo, VkFence &rFence) const
-       { return { vkCreateFence(device, &rCreateInfo, 0, handle_cast<::VkFence *>(&rFence)), "vkCreateFence" }; }
+       { return { vkCreateFence(device, &rCreateInfo, nullptr, handle_cast<::VkFence *>(&rFence)), "vkCreateFence" }; }
 
        void DestroyFence(VkFence fence) const
-       { vkDestroyFence(device, handle_cast<::VkFence>(fence), 0); }
+       { vkDestroyFence(device, handle_cast<::VkFence>(fence), nullptr); }
 
        Result GetFenceStatus(VkFence fence) const
        { return { vkGetFenceStatus(device, handle_cast<::VkFence>(fence)), "vkGetFenceStatus" }; }
@@ -225,10 +225,10 @@ public:
        { return { vkWaitForFences(device, fenceCount, handle_cast<const ::VkFence *>(pFences), waitAll, timeout), "vkWaitForFences" }; }
 
        Result CreateSemaphore(const VkSemaphoreCreateInfo &rCreateInfo, VkSemaphore &rSemaphore) const
-       { return { vkCreateSemaphore(device, &rCreateInfo, 0, handle_cast<::VkSemaphore *>(&rSemaphore)), "vkCreateSemaphore" }; }
+       { return { vkCreateSemaphore(device, &rCreateInfo, nullptr, handle_cast<::VkSemaphore *>(&rSemaphore)), "vkCreateSemaphore" }; }
 
        void DestroySemaphore(VkSemaphore semaphore) const
-       { vkDestroySemaphore(device, handle_cast<::VkSemaphore>(semaphore), 0); }
+       { vkDestroySemaphore(device, handle_cast<::VkSemaphore>(semaphore), nullptr); }
 
        void CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) const
        { vkCmdPipelineBarrier(handle_cast<::VkCommandBuffer>(commandBuffer), srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); }
@@ -238,19 +238,19 @@ public:
 
        // Chapter 8: Render Pass
        Result CreateRenderPass(const VkRenderPassCreateInfo &rCreateInfo, VkRenderPass &rRenderPass) const
-       { return { vkCreateRenderPass(device, &rCreateInfo, 0, handle_cast<::VkRenderPass *>(&rRenderPass)), "vkCreateRenderPass" }; }
+       { return { vkCreateRenderPass(device, &rCreateInfo, nullptr, handle_cast<::VkRenderPass *>(&rRenderPass)), "vkCreateRenderPass" }; }
 
        Result CreateRenderPass2(const VkRenderPassCreateInfo2 &rCreateInfo, VkRenderPass &rRenderPass) const
-       { return { vkCreateRenderPass2(device, &rCreateInfo, 0, handle_cast<::VkRenderPass *>(&rRenderPass)), "vkCreateRenderPass2" }; }
+       { return { vkCreateRenderPass2(device, &rCreateInfo, nullptr, handle_cast<::VkRenderPass *>(&rRenderPass)), "vkCreateRenderPass2" }; }
 
        void DestroyRenderPass(VkRenderPass renderPass) const
-       { vkDestroyRenderPass(device, handle_cast<::VkRenderPass>(renderPass), 0); }
+       { vkDestroyRenderPass(device, handle_cast<::VkRenderPass>(renderPass), nullptr); }
 
        Result CreateFramebuffer(const VkFramebufferCreateInfo &rCreateInfo, VkFramebuffer &rFramebuffer) const
-       { return { vkCreateFramebuffer(device, &rCreateInfo, 0, handle_cast<::VkFramebuffer *>(&rFramebuffer)), "vkCreateFramebuffer" }; }
+       { return { vkCreateFramebuffer(device, &rCreateInfo, nullptr, handle_cast<::VkFramebuffer *>(&rFramebuffer)), "vkCreateFramebuffer" }; }
 
        void DestroyFramebuffer(VkFramebuffer framebuffer) const
-       { vkDestroyFramebuffer(device, handle_cast<::VkFramebuffer>(framebuffer), 0); }
+       { vkDestroyFramebuffer(device, handle_cast<::VkFramebuffer>(framebuffer), nullptr); }
 
        void CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo &rRenderPassBegin, VkSubpassContents contents) const
        { vkCmdBeginRenderPass(handle_cast<::VkCommandBuffer>(commandBuffer), &rRenderPassBegin, contents); }
@@ -260,20 +260,20 @@ public:
 
        // Chapter 9: Shaders
        Result CreateShaderModule(const VkShaderModuleCreateInfo &rCreateInfo, VkShaderModule &rShaderModule) const
-       { return { vkCreateShaderModule(device, &rCreateInfo, 0, handle_cast<::VkShaderModule *>(&rShaderModule)), "vkCreateShaderModule" }; }
+       { return { vkCreateShaderModule(device, &rCreateInfo, nullptr, handle_cast<::VkShaderModule *>(&rShaderModule)), "vkCreateShaderModule" }; }
 
        void DestroyShaderModule(VkShaderModule shaderModule) const
-       { vkDestroyShaderModule(device, handle_cast<::VkShaderModule>(shaderModule), 0); }
+       { vkDestroyShaderModule(device, handle_cast<::VkShaderModule>(shaderModule), nullptr); }
 
        // Chapter 10: Pipelines
        Result CreateComputePipelines(VkPipelineCache pipelineCache, std::uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, VkPipeline *pPipelines) const
-       { return { vkCreateComputePipelines(device, handle_cast<::VkPipelineCache>(pipelineCache), createInfoCount, pCreateInfos, 0, handle_cast<::VkPipeline *>(pPipelines)), "vkCreateComputePipelines" }; }
+       { return { vkCreateComputePipelines(device, handle_cast<::VkPipelineCache>(pipelineCache), createInfoCount, pCreateInfos, nullptr, handle_cast<::VkPipeline *>(pPipelines)), "vkCreateComputePipelines" }; }
 
        Result CreateGraphicsPipelines(VkPipelineCache pipelineCache, std::uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, VkPipeline *pPipelines) const
-       { return { vkCreateGraphicsPipelines(device, handle_cast<::VkPipelineCache>(pipelineCache), createInfoCount, pCreateInfos, 0, handle_cast<::VkPipeline *>(pPipelines)), "vkCreateGraphicsPipelines" }; }
+       { return { vkCreateGraphicsPipelines(device, handle_cast<::VkPipelineCache>(pipelineCache), createInfoCount, pCreateInfos, nullptr, handle_cast<::VkPipeline *>(pPipelines)), "vkCreateGraphicsPipelines" }; }
 
        void DestroyPipeline(VkPipeline pipeline) const
-       { vkDestroyPipeline(device, handle_cast<::VkPipeline>(pipeline), 0); }
+       { vkDestroyPipeline(device, handle_cast<::VkPipeline>(pipeline), nullptr); }
 
        void CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) const
        { vkCmdBindPipeline(handle_cast<::VkCommandBuffer>(commandBuffer), pipelineBindPoint, handle_cast<::VkPipeline>(pipeline)); }
@@ -283,7 +283,7 @@ public:
        { vkGetPhysicalDeviceMemoryProperties(physicalDevice, &rMemoryProperties); }
 
        Result AllocateMemory(const VkMemoryAllocateInfo &rAllocateInfo, VkDeviceMemory &rMemory) const
-       { return { vkAllocateMemory(device, &rAllocateInfo, 0, handle_cast<::VkDeviceMemory *>(&rMemory)), "vkAllocateMemory" }; }
+       { return { vkAllocateMemory(device, &rAllocateInfo, nullptr, handle_cast<::VkDeviceMemory *>(&rMemory)), "vkAllocateMemory" }; }
 
        Result MapMemory(VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData) const
        { return { vkMapMemory(device, handle_cast<::VkDeviceMemory>(memory), offset, size, flags, ppData), "vkMapMemory" }; }
@@ -292,26 +292,26 @@ public:
        { vkUnmapMemory(device, handle_cast<::VkDeviceMemory>(memory)); }
 
        void FreeMemory(VkDeviceMemory memory) const
-       { vkFreeMemory(device, handle_cast<::VkDeviceMemory>(memory), 0); }
+       { vkFreeMemory(device, handle_cast<::VkDeviceMemory>(memory), nullptr); }
 
        // Chapter 12: Resource Creation
        Result CreateBuffer(const VkBufferCreateInfo &rCreateInfo, VkBuffer &rBuffer) const
-       { return { vkCreateBuffer(device, &rCreateInfo, 0, handle_cast<::VkBuffer *>(&rBuffer)), "vkCreateBuffer" }; }
+       { return { vkCreateBuffer(device, &rCreateInfo, nullptr, handle_cast<::VkBuffer *>(&rBuffer)), "vkCreateBuffer" }; }
 
        void DestroyBuffer(VkBuffer image) const
-       { vkDestroyBuffer(device, handle_cast<::VkBuffer>(image), 0); }
+       { vkDestroyBuffer(device, handle_cast<::VkBuffer>(image), nullptr); }
 
        Result CreateImage(const VkImageCreateInfo &rCreateInfo, VkImage &rImage) const
-       { return { vkCreateImage(device, &rCreateInfo, 0, handle_cast<::VkImage *>(&rImage)), "vkCreateImage" }; }
+       { return { vkCreateImage(device, &rCreateInfo, nullptr, handle_cast<::VkImage *>(&rImage)), "vkCreateImage" }; }
 
        void DestroyImage(VkImage image) const
-       { vkDestroyImage(device, handle_cast<::VkImage>(image), 0); }
+       { vkDestroyImage(device, handle_cast<::VkImage>(image), nullptr); }
 
        Result CreateImageView(const VkImageViewCreateInfo &rCreateInfo, VkImageView &rView) const
-       { return { vkCreateImageView(device, &rCreateInfo, 0, handle_cast<::VkImageView *>(&rView)), "vkCreateImageView" }; }
+       { return { vkCreateImageView(device, &rCreateInfo, nullptr, handle_cast<::VkImageView *>(&rView)), "vkCreateImageView" }; }
 
        void DestroyImageView(VkImageView imageView) const
-       { vkDestroyImageView(device, handle_cast<::VkImageView>(imageView), 0); }
+       { vkDestroyImageView(device, handle_cast<::VkImageView>(imageView), nullptr); }
 
        void GetBufferMemoryRequirements(VkBuffer image, VkMemoryRequirements &rMemoryRequirements) const
        { vkGetBufferMemoryRequirements(device, handle_cast<::VkBuffer>(image), &rMemoryRequirements); }
@@ -327,29 +327,29 @@ public:
 
        // Chapter 13: Samplers
        Result CreateSampler(const VkSamplerCreateInfo &rCreateInfo, VkSampler &rSampler) const
-       { return { vkCreateSampler(device, &rCreateInfo, 0, handle_cast<::VkSampler *>(&rSampler)), "vkCreateSampler" }; }
+       { return { vkCreateSampler(device, &rCreateInfo, nullptr, handle_cast<::VkSampler *>(&rSampler)), "vkCreateSampler" }; }
 
        void DestroySampler(VkSampler sampler) const
-       { vkDestroySampler(device, handle_cast<::VkSampler>(sampler), 0); }
+       { vkDestroySampler(device, handle_cast<::VkSampler>(sampler), nullptr); }
 
        // Chapter 14: Resource Descriptors
        Result CreateDescriptorSetLayout(const VkDescriptorSetLayoutCreateInfo &rCreateInfo, VkDescriptorSetLayout &rSetLayout) const
-       { return { vkCreateDescriptorSetLayout(device, &rCreateInfo, 0, handle_cast<::VkDescriptorSetLayout *>(&rSetLayout)), "vkCreateDescriptorSetLayout" }; }
+       { return { vkCreateDescriptorSetLayout(device, &rCreateInfo, nullptr, handle_cast<::VkDescriptorSetLayout *>(&rSetLayout)), "vkCreateDescriptorSetLayout" }; }
 
        void DestroyDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) const
-       { vkDestroyDescriptorSetLayout(device, handle_cast<::VkDescriptorSetLayout>(descriptorSetLayout), 0); }
+       { vkDestroyDescriptorSetLayout(device, handle_cast<::VkDescriptorSetLayout>(descriptorSetLayout), nullptr); }
 
        Result CreatePipelineLayout(const VkPipelineLayoutCreateInfo &rCreateInfo, VkPipelineLayout &rPipelineLayout) const
-       { return { vkCreatePipelineLayout(device, &rCreateInfo, 0, handle_cast<::VkPipelineLayout *>(&rPipelineLayout)), "vkCreatePipelineLayout" }; }
+       { return { vkCreatePipelineLayout(device, &rCreateInfo, nullptr, handle_cast<::VkPipelineLayout *>(&rPipelineLayout)), "vkCreatePipelineLayout" }; }
 
        void DestroyPipelineLayout(VkPipelineLayout pipelineLayout) const
-       { vkDestroyPipelineLayout(device, handle_cast<::VkPipelineLayout>(pipelineLayout), 0); }
+       { vkDestroyPipelineLayout(device, handle_cast<::VkPipelineLayout>(pipelineLayout), nullptr); }
 
        Result CreateDescriptorPool(const VkDescriptorPoolCreateInfo &rCreateInfo, VkDescriptorPool &rDescriptorPool) const
-       { return { vkCreateDescriptorPool(device, &rCreateInfo, 0, handle_cast<::VkDescriptorPool *>(&rDescriptorPool)), "vkCreateDescriptorPool" }; }
+       { return { vkCreateDescriptorPool(device, &rCreateInfo, nullptr, handle_cast<::VkDescriptorPool *>(&rDescriptorPool)), "vkCreateDescriptorPool" }; }
 
        void DestroyDescriptorPool(VkDescriptorPool descriptorPool) const
-       { vkDestroyDescriptorPool(device, handle_cast<::VkDescriptorPool>(descriptorPool), 0); }
+       { vkDestroyDescriptorPool(device, handle_cast<::VkDescriptorPool>(descriptorPool), nullptr); }
 
        Result AllocateDescriptorSets(const VkDescriptorSetAllocateInfo &rAllocateInfo, VkDescriptorSet *pDescriptorSets) const
        { return { vkAllocateDescriptorSets(device, &rAllocateInfo, handle_cast<::VkDescriptorSet *>(pDescriptorSets)), "vkAllocateDescriptorSets" }; }
@@ -407,10 +407,10 @@ public:
        { return { vkGetPhysicalDeviceSurfacePresentModes(physicalDevice, handle_cast<::VkSurfaceKHR>(surface), &rPresentModeCount, pPresentModes), "vkGetPhysicalDeviceSurfacePresentModes" }; }
 
        Result CreateSwapchain(const VkSwapchainCreateInfoKHR &rCreateInfo, VkSwapchain &rSwapchain) const
-       { return { vkCreateSwapchain(device, &rCreateInfo, 0, handle_cast<::VkSwapchainKHR *>(&rSwapchain)), "vkCreateSwapchain" }; }
+       { return { vkCreateSwapchain(device, &rCreateInfo, nullptr, handle_cast<::VkSwapchainKHR *>(&rSwapchain)), "vkCreateSwapchain" }; }
 
        void DestroySwapchain(VkSwapchain swapchain) const
-       { vkDestroySwapchain(device, handle_cast<::VkSwapchainKHR>(swapchain), 0); }
+       { vkDestroySwapchain(device, handle_cast<::VkSwapchainKHR>(swapchain), nullptr); }
 
        void GetSwapchainImages(VkSwapchain swapchain, std::uint32_t &rSwapchainImageCount, VkImage *pSwapchainImages) const
        { vkGetSwapchainImages(device, handle_cast<::VkSwapchainKHR>(swapchain), &rSwapchainImageCount, handle_cast<::VkImage *>(pSwapchainImages)); }
index f2658c2705864d10118f2cfd5f855cc13fc4ac2c..9ca2cbba1d9b307784924bd836a37a1d737e5766 100644 (file)
@@ -14,9 +14,9 @@ namespace GL {
 class MSPGL_API VulkanWindowView: public View
 {
 protected:
-       SwapChain *swap_chain = 0;
+       SwapChain *swap_chain = nullptr;
        std::vector<Framebuffer> framebuffers;
-       Framebuffer *current_target = 0;
+       Framebuffer *current_target = nullptr;
        Semaphore semaphores[MAX_FRAMES_IN_FLIGHT*2];
        unsigned frame_index = 0;
 
index 26af2cbb495631a25454e25dd484d9991e2a316c..fb51b2b0e1d07976bd4127fd05eef598d0c59cc6 100644 (file)
@@ -60,7 +60,7 @@ private:
        typedef std::map<CodePair, float> KerningMap;
        typedef std::map<CodePair, unsigned> LigatureMap;
 
-       const Texture2D *texture = 0;
+       const Texture2D *texture = nullptr;
        float native_size = 1.0f;
        float ascent = 1.0f;
        float descent = 0.0f;
index 79770725c62ceb910947fef247634733ba7be018..395827a43e375ff52726402755fa405dc12b615a 100644 (file)
@@ -9,7 +9,7 @@ namespace GL {
 MeshBuilder::MeshBuilder(Mesh &m):
        PrimitiveBuilder(m.vertices),
        mesh(m),
-       batch(0)
+       batch(nullptr)
 { }
 
 MeshBuilder::~MeshBuilder()
@@ -31,7 +31,7 @@ void MeshBuilder::end_()
 {
        mesh.add_batch(move(*batch));
        delete batch;
-       batch = 0;
+       batch = nullptr;
 }
 
 void MeshBuilder::element_(unsigned i)
index 4a2c6f63fba13313207f4fada49d4aa5170d3d2d..4947e252b711150a573bdfe817692a134477b697 100644 (file)
@@ -20,7 +20,7 @@ SequenceBuilder::SequenceBuilder(const SequenceTemplate &t):
                renderables[r.slot_name] = r.renderable;
        for(const SequenceTemplate::PostProcessor &p: tmpl.get_postprocessors())
                if(!p.slot_name.empty())
-                       postprocessors[p.slot_name] = 0;
+                       postprocessors[p.slot_name] = nullptr;
 }
 
 void SequenceBuilder::set_renderable(const string &name, Renderable &rend)
@@ -114,7 +114,7 @@ void SequenceBuilder::build(Sequence &sequence) const
 #endif
        for(const SequenceTemplate::PostProcessor &p: tmpl.get_postprocessors())
        {
-               PostProcessor *proc = 0;
+               PostProcessor *proc = nullptr;
                if(!p.slot_name.empty())
                        proc = get_item(postprocessors, p.slot_name);
                if(!proc)
index a1d841e874002e618233afb78b23b05578787b16..12b4f717dd6b012b451dd37c5ca40b61723f3a1e 100644 (file)
@@ -63,9 +63,9 @@ public:
 
        struct Renderable
        {
-               Effect::Template *effect_template = 0;
-               GL::Renderable *renderable = 0;
-               SequenceTemplate *sequence_template = 0;
+               Effect::Template *effect_template = nullptr;
+               GL::Renderable *renderable = nullptr;
+               SequenceTemplate *sequence_template = nullptr;
                std::map<std::string, std::string> sequence_renderables;
                std::string slot_name;
        };
@@ -96,7 +96,7 @@ public:
                };
 
                std::string tag;
-               const Lighting *lighting = 0;
+               const Lighting *lighting = nullptr;
                DepthTest depth_test;
                StencilTest stencil_test;
                std::string renderable_name;
@@ -107,7 +107,7 @@ public:
                GL::PostProcessor::Template *postprocessor_template;
                std::string slot_name;
 
-               PostProcessor(GL::PostProcessor::Template * = 0);
+               PostProcessor(GL::PostProcessor::Template * = nullptr);
        };
 
 private:
index 36ac440a54426c186c16ae238c51a337312445e8..ae72f78cc931c7e19d3c05157b3cf87a5d2850f0 100644 (file)
@@ -79,7 +79,7 @@ Buffer::AsyncTransfer::AsyncTransfer(Buffer &b, size_t o, size_t s):
        buffer(&b),
        offset(o),
        size(s),
-       dest_addr(0)
+       dest_addr(nullptr)
 {
        allocate();
 }
@@ -90,7 +90,7 @@ Buffer::AsyncTransfer::AsyncTransfer(AsyncTransfer &&other):
        size(other.size),
        dest_addr(other.dest_addr)
 {
-       other.dest_addr = 0;
+       other.dest_addr = nullptr;
 }
 
 Buffer::AsyncTransfer &Buffer::AsyncTransfer::operator=(AsyncTransfer &&other)
@@ -103,7 +103,7 @@ Buffer::AsyncTransfer &Buffer::AsyncTransfer::operator=(AsyncTransfer &&other)
        size = other.size;
        dest_addr = other.dest_addr;
 
-       other.dest_addr = 0;
+       other.dest_addr = nullptr;
 
        return *this;
 }
index 7dde1ac3d70dbcd3ad31783720e48762014c8e3e..f7bbf82ef2f5b2f7855b1cb2367e5b0f377b5623 100644 (file)
@@ -48,10 +48,10 @@ public:
                friend class Buffer;
 
        private:
-               Buffer *buffer = 0;
+               Buffer *buffer = nullptr;
                std::size_t offset = 0;
                std::size_t size = 0;
-               void *dest_addr = 0;
+               void *dest_addr = nullptr;
 
                AsyncTransfer(Buffer &, std::size_t, std::size_t);
        public:
index d8f3c9c43f9622602851e03f38dd72221031d0b3..0cfd04c6ea43309ecfaf8f78c7aa9c537608e28f 100644 (file)
@@ -15,9 +15,9 @@ Bufferable::Bufferable(Bufferable &&other):
        location_dirty(other.location_dirty),
        dirty(other.dirty)
 {
-       other.buffer = 0;
-       other.next_in_buffer = 0;
-       other.prev_in_buffer = 0;
+       other.buffer = nullptr;
+       other.next_in_buffer = nullptr;
+       other.prev_in_buffer = nullptr;
        if(next_in_buffer)
                next_in_buffer->prev_in_buffer = this;
        if(prev_in_buffer)
@@ -94,9 +94,9 @@ void Bufferable::unlink_from_buffer()
                next_in_buffer->prev_in_buffer = prev_in_buffer;
                next_in_buffer->update_offset();
        }
-       prev_in_buffer = 0;
-       next_in_buffer = 0;
-       buffer = 0;
+       prev_in_buffer = nullptr;
+       next_in_buffer = nullptr;
+       buffer = nullptr;
        offset = 0;
 }
 
index b3ebcdd7f6bac3dee4e26ccdc4ca8570c6e75479..3504972d0882890b3b5a1a3219879add766239e7 100644 (file)
@@ -37,10 +37,10 @@ public:
        };
 
 private:
-       Buffer *buffer = 0;
+       Buffer *buffer = nullptr;
        std::size_t offset = 0;
-       Bufferable *next_in_buffer = 0;
-       Bufferable *prev_in_buffer = 0;
+       Bufferable *next_in_buffer = nullptr;
+       Bufferable *prev_in_buffer = nullptr;
        mutable bool location_dirty = false;
        mutable uint8_t dirty = 0;
 
@@ -54,7 +54,7 @@ public:
        buffer, and this object is inserted after it.
 
        Data is not uploaded immediately, but only when refresh() is called. */
-       void use_buffer(Buffer *, Bufferable *prev = 0);
+       void use_buffer(Buffer *, Bufferable *prev = nullptr);
 
        /** Sets the buffer for the entire chain of objects. */
        void change_buffer(Buffer *);
@@ -64,11 +64,11 @@ public:
        std::size_t get_required_buffer_size(bool = false) const;
 
        /** Uploads new data into the buffer if necessary. */
-       void refresh(unsigned f) const { if(dirty) upload_data(f, 0); }
+       void refresh(unsigned f) const { if(dirty) upload_data(f, nullptr); }
 
        /** Returns an object which can be used to upload data to the buffer using
        mapped memory.  If data is not dirty, returns null. */
-       AsyncUpdater *refresh_async() const { return dirty ? create_async_updater() : 0; }
+       AsyncUpdater *refresh_async() const { return dirty ? create_async_updater() : nullptr; }
 
 private:
        void unlink_from_buffer();
index 3186015c73ebb9c887119ffdd618a2339804fe09..26be8952645b7c0568a1510ff1b5781a7c964bce 100644 (file)
@@ -4,7 +4,7 @@
 namespace Msp {
 namespace GL {
 
-Device *Device::current = 0;
+Device *Device::current = nullptr;
 
 Device::Device(Graphics::Window &w):
        Device(w, create_default_options())
@@ -22,7 +22,7 @@ Device::Device(Graphics::Window &w, const DeviceOptions &o):
 Device::~Device()
 {
        if(this==current)
-               current = 0;
+               current = nullptr;
 }
 
 Device &Device::get_current()
index 4f30dbb158b346a71d726fcd9f431da171193b9a..4e868082c2e47927159493184ab981d11e2d7c70 100644 (file)
@@ -127,7 +127,7 @@ void Framebuffer::set_attachment(FrameAttachment attch, Texture &tex, Texture *r
 
 void Framebuffer::attach(FrameAttachment attch, Texture2D &tex, unsigned level)
 {
-       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, 0, level, 0, 0);
+       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, nullptr, level, 0, 0);
 }
 
 void Framebuffer::attach(FrameAttachment attch, Texture2DMultisample &tex, Texture2D *res)
@@ -137,24 +137,24 @@ void Framebuffer::attach(FrameAttachment attch, Texture2DMultisample &tex, Textu
 
 void Framebuffer::attach(FrameAttachment attch, Texture3D &tex, unsigned layer, unsigned level)
 {
-       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, 0, level, layer, 0);
+       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, nullptr, level, layer, 0);
 }
 
 void Framebuffer::attach(FrameAttachment attch, TextureCube &tex, TextureCubeFace face, unsigned level)
 {
-       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, 0, level, face, 0);
+       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, nullptr, level, face, 0);
 }
 
 void Framebuffer::attach_layered(FrameAttachment attch, Texture3D &tex, unsigned level)
 {
        require_layered();
-       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, 0, level, -1, 0);
+       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, nullptr, level, -1, 0);
 }
 
 void Framebuffer::attach_layered(FrameAttachment attch, TextureCube &tex, unsigned level)
 {
        require_layered();
-       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, 0, level, -1, 0);
+       set_attachment(make_typed_attachment(attch, tex.get_format()), tex, nullptr, level, -1, 0);
 }
 
 void Framebuffer::detach(FrameAttachment attch)
@@ -174,29 +174,29 @@ void Framebuffer::detach(FrameAttachment attch)
 const Texture *Framebuffer::get_attachment(FrameAttachment attch) const
 {
        if(attachments.empty())
-               return 0;
+               return nullptr;
 
        int i = format.index(attch);
-       return (i>=0 ? attachments[i].tex : 0);
+       return (i>=0 ? attachments[i].tex : nullptr);
 }
 
 const Texture *Framebuffer::get_attachment(unsigned i) const
 {
-       return (i<attachments.size() ? attachments[i].tex : 0);
+       return (i<attachments.size() ? attachments[i].tex : nullptr);
 }
 
 const Texture *Framebuffer::get_resolve_attachment(FrameAttachment attch) const
 {
        if(attachments.empty())
-               return 0;
+               return nullptr;
 
        int i = format.index(attch);
-       return (i>=0 ? attachments[i].resolve : 0);
+       return (i>=0 ? attachments[i].resolve : nullptr);
 }
 
 const Texture *Framebuffer::get_resolve_attachment(unsigned i) const
 {
-       return (i<attachments.size() ? attachments[i].resolve : 0);
+       return (i<attachments.size() ? attachments[i].resolve : nullptr);
 }
 
 bool Framebuffer::has_resolve_attachments() const
@@ -232,7 +232,7 @@ void Framebuffer::Attachment::set(Texture &t, Texture *r, unsigned l, int z)
 
 void Framebuffer::Attachment::clear()
 {
-       tex = 0;
+       tex = nullptr;
 }
 
 } // namespace GL
index 106161753736d241d8ced069a534609dd8279cba..ed85820da60eea6453010e9ee2089b91bdc0d7e7 100644 (file)
@@ -43,8 +43,8 @@ class MSPGL_API Framebuffer: public FramebufferBackend
 protected:
        struct Attachment
        {
-               Texture *tex = 0;
-               Texture *resolve = 0;
+               Texture *tex = nullptr;
+               Texture *resolve = nullptr;
                unsigned level = 0;
                int layer = 0;
 
index 9e9b53762d70428f754a9b5931eab27155913170..d69178dd2b45f5ba26a4801bce667f76cc770785 100644 (file)
@@ -26,13 +26,13 @@ Mesh::Mesh(Mesh &&other):
        face_winding(other.face_winding),
        debug_name(move(other.debug_name))
 {
-       other.vbuf = 0;
-       other.ibuf = 0;
+       other.vbuf = nullptr;
+       other.ibuf = nullptr;
 }
 
 Mesh::~Mesh()
 {
-       set_manager(0);
+       set_manager(nullptr);
        batches.clear();
        delete vbuf;
        delete ibuf;
@@ -126,14 +126,14 @@ void Mesh::add_batch(Batch &&b)
                if(reallocate)
                {
                        for(auto i=batches.end(); i!=batches.begin(); )
-                               (--i)->use_buffer(0);
+                               (--i)->use_buffer(nullptr);
                }
 
                Batch *prev = &batches.back();
                batches.emplace_back(move(b));
                if(reallocate)
                {
-                       prev = 0;
+                       prev = nullptr;
                        for(Batch &a: batches)
                        {
                                a.use_buffer(ibuf, prev);
@@ -167,7 +167,7 @@ void Mesh::set_winding(FaceWinding w)
 
 void Mesh::draw(Renderer &renderer) const
 {
-       draw(renderer, 0, 0);
+       draw(renderer, nullptr, 0);
 }
 
 void Mesh::draw_instanced(Renderer &renderer, const VertexSetup &vs, unsigned count) const
@@ -235,13 +235,13 @@ uint64_t Mesh::get_data_size() const
 void Mesh::unload()
 {
        vertices.clear();
-       vertices.use_buffer(0);
+       vertices.use_buffer(nullptr);
        batches.clear();
        vtx_setup.unload();
        delete vbuf;
        delete ibuf;
-       vbuf = 0;
-       ibuf = 0;
+       vbuf = nullptr;
+       ibuf = nullptr;
 }
 
 void Mesh::set_debug_name(const string &name)
@@ -348,9 +348,9 @@ bool Mesh::AsyncLoader::process()
        else if(phase==3)
        {
                delete vertex_updater;
-               vertex_updater = 0;
+               vertex_updater = nullptr;
                delete index_updater;
-               index_updater = 0;
+               index_updater = nullptr;
        }
 
        ++phase;
index 717f7f935fe9b1123c52498ffb33f1116047499c..70f3ba431249515d786b21e8064e49fde194c0b7 100644 (file)
@@ -53,8 +53,8 @@ private:
        private:
                Mesh &mesh;
                IO::Seekable &io;
-               Bufferable::AsyncUpdater *vertex_updater = 0;
-               Bufferable::AsyncUpdater *index_updater = 0;
+               Bufferable::AsyncUpdater *vertex_updater = nullptr;
+               Bufferable::AsyncUpdater *index_updater = nullptr;
                unsigned phase = 0;
 
        public:
@@ -73,8 +73,8 @@ private:
 
        VertexArray vertices;
        std::vector<Batch> batches;
-       Buffer *vbuf = 0;
-       Buffer *ibuf = 0;
+       Buffer *vbuf = nullptr;
+       Buffer *ibuf = nullptr;
        VertexSetup vtx_setup;
        mutable unsigned short dirty = 0;
        bool disallow_rendering = false;
@@ -125,7 +125,7 @@ private:
 
 public:
        virtual int get_load_priority() const { return 1; }
-       virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
+       virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = nullptr);
        virtual std::uint64_t get_data_size() const;
        virtual void unload();
 
index 04a37fcc3d7bd25265160b9117c5975a734a1e42..e987c16569817369f6db832cde17f733cf8a91af 100644 (file)
@@ -81,7 +81,7 @@ void Module::load_source(IO::Base &io, Resources *res, const string &name)
 
 void Module::load_source(IO::Base &io, const string &name)
 {
-       load_source(io, 0, name);
+       load_source(io, nullptr, name);
 }
 
 SL::Features Module::create_features() const
@@ -176,7 +176,7 @@ void SpirVModule::reflect()
                        if(m.struct_type)
                        {
                                auto i = struct_indices.find(m.struct_type);
-                               m.struct_type = (i!=struct_indices.end() ? &structs[i->second] : 0);
+                               m.struct_type = (i!=struct_indices.end() ? &structs[i->second] : nullptr);
                        }
 
                const StructMember *last_member = &s.members.back();
@@ -215,7 +215,7 @@ void SpirVModule::reflect()
                if(v.struct_type)
                {
                        auto i = struct_indices.find(v.struct_type);
-                       v.struct_type = (i!=struct_indices.end() ? &structs[i->second] : 0);
+                       v.struct_type = (i!=struct_indices.end() ? &structs[i->second] : nullptr);
                }
 
        entry_points.reserve(reflection.entry_points.size());
@@ -226,7 +226,7 @@ void SpirVModule::reflect()
                for(const Variable *&v: entry.globals)
                {
                        auto i = var_indices.find(v);
-                       v = (i!=var_indices.end() ? &variables[i->second] : 0);
+                       v = (i!=var_indices.end() ? &variables[i->second] : nullptr);
                }
        }
 
@@ -241,20 +241,20 @@ void SpirVModule::reflect()
        for(InstructionBlock &b: blocks)
        {
                auto i = spec_indices.find(b.condition);
-               b.condition = (i!=spec_indices.end() ? &spec_constants[i->second] : 0);
+               b.condition = (i!=spec_indices.end() ? &spec_constants[i->second] : nullptr);
                if(b.condition)
                        specializable = true;
 
                for(const Variable *&v: b.accessed_variables)
                {
                        auto j = var_indices.find(v);
-                       v = (j!=var_indices.end() ? &variables[j->second] : 0);
+                       v = (j!=var_indices.end() ? &variables[j->second] : nullptr);
                }
 
                for(const InstructionBlock *&s: b.successors)
                {
                        auto j = block_indices.find(s);
-                       s = (j!=block_indices.end() ? &blocks[j->second] : 0);
+                       s = (j!=block_indices.end() ? &blocks[j->second] : nullptr);
                }
        }
 }
index 09d940761da8634dfd43b036451dd7842a1a5af4..9e313632284d341b0ceb4fa45fd8fb833930f2fd 100644 (file)
@@ -145,7 +145,7 @@ public:
        {
                std::string name;
                DataType type = VOID;
-               const Structure *struct_type = 0;
+               const Structure *struct_type = nullptr;
                unsigned offset = 0;
                unsigned array_size = 0;
                unsigned array_stride = 0;
@@ -166,7 +166,7 @@ public:
                std::string name;
                unsigned id = 0;
                DataType type = VOID;
-               const Structure *struct_type = 0;
+               const Structure *struct_type = nullptr;
                StorageClass storage = static_cast<StorageClass>(-1);
                unsigned array_size = 0;
                int location = -1;
@@ -194,7 +194,7 @@ public:
        {
                unsigned id = 0;
                bool negate_condition = false;
-               const Constant *condition = 0;
+               const Constant *condition = nullptr;
                std::vector<const Variable *> accessed_variables;
                std::vector<const InstructionBlock *> successors;
        };
@@ -203,7 +203,7 @@ private:
        struct TypeInfo
        {
                DataType type = VOID;
-               const Structure *struct_type = 0;
+               const Structure *struct_type = nullptr;
                unsigned array_size = 0;
                unsigned array_stride = 0;
                StorageClass storage = static_cast<StorageClass>(-1);
@@ -222,7 +222,7 @@ private:
                std::map<unsigned, InstructionBlock> blocks;
                std::map<unsigned, unsigned> access_chain_bases;
                Constant true_condition;
-               InstructionBlock *current_block = 0;
+               InstructionBlock *current_block = nullptr;
 
                static std::uint32_t get_opcode(std::uint32_t);
                static CodeIterator get_op_end(const CodeIterator &);
index fa6784f1f982f667f711453b63a76aff4406a850..719be0c14eac75a9c93686cb2bc268ffd3ea81e3 100644 (file)
@@ -13,19 +13,19 @@ namespace GL {
 
 void PipelineState::reset()
 {
-       set(framebuffer, static_cast<const Framebuffer *>(0), FRAMEBUFFER);
+       set(framebuffer, static_cast<const Framebuffer *>(nullptr), FRAMEBUFFER);
        set(viewport, Rect::max(), VIEWPORT);
        set(scissor, Rect::max(), SCISSOR);
-       set(shprog, static_cast<const Program *>(0), SHPROG);
+       set(shprog, static_cast<const Program *>(nullptr), SHPROG);
        for(BoundResource &r: resources)
        {
                r.changed = (r.type!=NO_RESOURCE);
                r.type = NO_RESOURCE;
                r.used = false;
-               r.block = 0;
-               r.buffer = 0;
+               r.block = nullptr;
+               r.buffer = nullptr;
        }
-       set(vertex_setup, static_cast<const VertexSetup *>(0), VERTEX_SETUP);
+       set(vertex_setup, static_cast<const VertexSetup *>(nullptr), VERTEX_SETUP);
        set(primitive_type, TRIANGLES, PRIMITIVE_TYPE);
        set(patch_size, 0U, PATCH_SIZE);
        set(front_face, COUNTERCLOCKWISE, FACE_CULL);
@@ -72,7 +72,7 @@ void PipelineState::set_uniform_block(int binding, const UniformBlock *block)
                i = resources.insert(i, BoundResource(binding));
 
        ResourceType type = (block ? UNIFORM_BLOCK : NO_RESOURCE);
-       const Buffer *buffer = (block ? block->get_buffer() : 0);
+       const Buffer *buffer = (block ? block->get_buffer() : nullptr);
        if(i->type!=type || block!=i->block || buffer!=i->buffer || binding<0)
        {
                i->type = type;
@@ -86,7 +86,7 @@ void PipelineState::set_uniform_block(int binding, const UniformBlock *block)
 
 void PipelineState::set_storage_block(unsigned binding, const Buffer *buffer)
 {
-       set_buffer_resource(binding, 0, buffer);
+       set_buffer_resource(binding, nullptr, buffer);
 }
 
 void PipelineState::set_texture(unsigned binding, const Texture *tex, const Sampler *samp)
@@ -96,7 +96,7 @@ void PipelineState::set_texture(unsigned binding, const Texture *tex, const Samp
 
 void PipelineState::set_texture(unsigned binding, const Texture *tex, int level, const Sampler *samp)
 {
-       if((tex!=0)!=(samp!=0))
+       if((tex!=nullptr)!=(samp!=nullptr))
                throw invalid_argument("PipelineState::set_texture");
        if(level>=0 && !can_bind_tex_level(level))
                throw invalid_operation("PipelineState::set_texture");
@@ -106,7 +106,7 @@ void PipelineState::set_texture(unsigned binding, const Texture *tex, int level,
 
 void PipelineState::set_storage_texture(unsigned binding, const Texture *tex)
 {
-       set_texture_resource(binding, tex, 0, 0);
+       set_texture_resource(binding, tex, 0, nullptr);
 }
 
 void PipelineState::set_buffer_resource(unsigned binding, const UniformBlock *block, const Buffer *buffer)
index eec44084294bbfb0d3266fe1b74a69b8cae0a0cf..0c0969a4a159112d2ca0c4739ff866582bd0ab2d 100644 (file)
@@ -60,7 +60,7 @@ private:
                };
                int mip_level = -1;
 
-               BoundResource(int b): binding(b), texture(0), sampler(0) { }
+               BoundResource(int b): binding(b), texture(nullptr), sampler(nullptr) { }
        };
 
        enum ChangeMask
@@ -79,12 +79,12 @@ private:
                PATCH_SIZE = 4096
        };
 
-       const Framebuffer *framebuffer = 0;
+       const Framebuffer *framebuffer = nullptr;
        Rect viewport = Rect::max();
        Rect scissor = Rect::max();
-       const Program *shprog = 0;
+       const Program *shprog = nullptr;
        std::vector<BoundResource> resources;
-       const VertexSetup *vertex_setup = 0;
+       const VertexSetup *vertex_setup = nullptr;
        PrimitiveType primitive_type = TRIANGLES;
        unsigned patch_size = 0;
        FaceWinding front_face = COUNTERCLOCKWISE;
index bbc420f8233861f7053e2f5619ec7ee5cc16122e..3c0022ad19481b3f9e2b2b754baa65cf7638faf2 100644 (file)
@@ -17,7 +17,7 @@ Program::Program(Program &&other):
        reflect_data(move(other.reflect_data)),
        specialized_spirv(other.specialized_spirv)
 {
-       other.specialized_spirv = 0;
+       other.specialized_spirv = nullptr;
 }
 
 Program::~Program()
index 0f47cb4b4aaf92df103e2aa2ed6d615c200b4692..892729f0809095b8e6475f2d9a29a4c6352e9e46 100644 (file)
@@ -51,7 +51,7 @@ private:
        };
 
        ReflectData reflect_data;
-       SpirVModule *specialized_spirv = 0;
+       SpirVModule *specialized_spirv = nullptr;
 
 public:
        /// Constructs an empty Program with no shader stages attached.
index 5b913c4028b86eeda95fe9a381a0e50d6f511b34..4b0cbd2ce82c65ecb96984898c462596564c4485 100644 (file)
@@ -28,7 +28,7 @@ struct ReflectData
        struct UniformInfo
        {
                std::string name;
-               const BlockInfo *block = 0;
+               const BlockInfo *block = nullptr;
                union
                {
                        int location = -1;
index a65715e716a26c6fbc283655c37c0382fc795010..407333e1fd780b83b27d2ab30c9964eed4b9df6c 100644 (file)
@@ -162,7 +162,7 @@ void Texture::Loader::generate_mipmap(bool gm)
 void Texture::Loader::image_data(const string &data)
 {
        if(obj.manager)
-               obj.set_manager(0);
+               obj.set_manager(nullptr);
 
        Graphics::Image img;
        IO::Memory mem(data.data(), data.size());
@@ -179,7 +179,7 @@ void Texture::Loader::mipmap_levels(unsigned l)
 void Texture::Loader::raw_data(const string &data)
 {
        if(obj.manager)
-               obj.set_manager(0);
+               obj.set_manager(nullptr);
 
        obj.image(0, data.data());
 }
index 6a9f62552e6f12bd607aca5cca5ce36469b309a9..106c478f03cef613661a166b55070bf7647f1c21 100644 (file)
@@ -38,7 +38,7 @@ protected:
                unsigned levels;
 
        public:
-               Loader(Texture &t): Loader(t, 0) { }
+               Loader(Texture &t): Loader(t, nullptr) { }
                Loader(Texture &t, Collection &c): Loader(t, &c) { }
        private:
                Loader(Texture &, Collection *);
index e38c99deb85e2dda60603b89e97405a013c763cd..4457dc0a3c3c1803c42e2db2564f74b0c8f05ba4 100644 (file)
@@ -15,8 +15,8 @@ private:
        IO::Seekable &io;
        Texture2D::AsyncTransfer transfer;
        Graphics::Image image;
-       Graphics::ImageLoader *img_loader = 0;
-       DataFile::RawData *raw_data = 0;
+       Graphics::ImageLoader *img_loader = nullptr;
+       DataFile::RawData *raw_data = nullptr;
        unsigned n_bytes = 0;
        int phase = 0;
 
@@ -31,7 +31,7 @@ public:
 
 Texture2D::~Texture2D()
 {
-       set_manager(0);
+       set_manager(nullptr);
 }
 
 void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned lv)
@@ -138,7 +138,7 @@ Texture2D::AsyncTransfer::AsyncTransfer(Texture2D &t, unsigned l, unsigned x_, u
        width(wd),
        height(ht),
        data_size(width*height*get_pixel_size(texture->storage_fmt)),
-       dest_addr(0)
+       dest_addr(nullptr)
 {
        dest_addr = allocate();
 }
@@ -154,7 +154,7 @@ Texture2D::AsyncTransfer::AsyncTransfer(AsyncTransfer &&other):
        data_size(other.data_size),
        dest_addr(other.dest_addr)
 {
-       other.dest_addr = 0;
+       other.dest_addr = nullptr;
 }
 
 Texture2D::AsyncTransfer &Texture2D::AsyncTransfer::operator=(AsyncTransfer &&other)
@@ -173,7 +173,7 @@ Texture2D::AsyncTransfer &Texture2D::AsyncTransfer::operator=(AsyncTransfer &&ot
        data_size = other.data_size;
        dest_addr = other.dest_addr;
 
-       other.dest_addr = 0;
+       other.dest_addr = nullptr;
 
        return *this;
 }
index 12803df2d7ecc0ae1a6704e2453afaa1b9e5143c..7256e0591f3ead9e2530268c9255104876c8465c 100644 (file)
@@ -38,14 +38,14 @@ public:
                friend class Texture2DBackend::AsyncTransfer;
 
        private:
-               Texture2D *texture = 0;
+               Texture2D *texture = nullptr;
                unsigned level = 0;
                unsigned x = 0;
                unsigned y = 0;
                unsigned width = 0;
                unsigned height = 0;
                std::size_t data_size = 0;
-               void *dest_addr = 0;
+               void *dest_addr = nullptr;
 
                AsyncTransfer(Texture2D &, unsigned, unsigned, unsigned, unsigned, unsigned);
        public:
@@ -95,7 +95,7 @@ private:
        LinAl::Vector<unsigned, 2> get_level_size(unsigned) const;
 
 public:
-       virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
+       virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = nullptr);
 };
 
 } // namespace GL
index 2994916e81e0503c29110d55882f60cccf258ea1..7df3b67b443e6a3a52e48270629bf8f304053ddf 100644 (file)
@@ -86,11 +86,11 @@ void VertexSetup::unload()
 {
        VertexSetupBackend::unload();
 
-       vertex_array = 0;
+       vertex_array = nullptr;
        vertex_format = VertexFormat();
-       inst_array = 0;
+       inst_array = nullptr;
        inst_format = VertexFormat();
-       index_buffer = 0;
+       index_buffer = nullptr;
 }
 
 } // namespace GL
index 2ea5dfdfce881c4caa728d26944925707e0c0f1b..11497c754f5c2e14fc377efa9672bba54d4e6215 100644 (file)
@@ -31,11 +31,11 @@ private:
        };
 
        mutable unsigned dirty = 0;
-       const VertexArray *vertex_array = 0;
+       const VertexArray *vertex_array = nullptr;
        VertexFormat vertex_format;
-       const VertexArray *inst_array = 0;
+       const VertexArray *inst_array = nullptr;
        VertexFormat inst_format;
-       const Buffer *index_buffer = 0;
+       const Buffer *index_buffer = nullptr;
        DataType index_type = UNSIGNED_SHORT;
 
 public:
index 780f0515bfd9c0df961c9451b7fcd2f838b31a4e..a50177fe972f8f47536ecefdad6ee38f0f56b4c5 100644 (file)
@@ -113,12 +113,12 @@ void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const
 
        renderer.set_pipeline_key(this);
        renderer.set_framebuffer(&occlude_target.get_framebuffer());
-       renderer.clear(0);
+       renderer.clear(nullptr);
        quad.draw(renderer);
 
        renderer.set_pipeline_key(this, 1);
        renderer.set_framebuffer(out_fbo);
-       renderer.clear(0);
+       renderer.clear(nullptr);
        renderer.set_shader_program(&combine_shader);
        quad.draw(renderer);
 }
index 2aec1838fcd3d1391a0f56baae8295b803459655..43a22b3e6ddff19a8665f9b286d60f662740cd9c 100644 (file)
@@ -71,14 +71,14 @@ void Bloom::render(Renderer &renderer, const Texture2D &src, const Texture2D &)
                Renderer::Push push2(renderer);
                renderer.set_pipeline_key(this, i);
                renderer.set_framebuffer(&target[i]->get_framebuffer());
-               renderer.clear(0);
+               renderer.clear(nullptr);
                renderer.set_texture("source", (i ? &target[0]->get_target_texture(COLOR_ATTACHMENT) : &src), &nearest_sampler);
                renderer.add_shader_data(blur_shdata[i]);
                quad.draw(renderer);
        }
 
        renderer.set_pipeline_key(this, 2);
-       renderer.clear(0);
+       renderer.clear(nullptr);
        renderer.set_texture("source", &src, &nearest_sampler);
        renderer.set_texture("blurred", &target[1]->get_target_texture(COLOR_ATTACHMENT), &linear_sampler);
        renderer.set_shader_program(&combine_shader);
index 2865743b4bb4d404c4d7181456eb95bc73407e6e..b1371794b83521598a105e64effd397d6fbd2bd6 100644 (file)
@@ -72,7 +72,7 @@ void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Te
 {
        Renderer::Push push(renderer);
        renderer.set_pipeline_key(this);
-       renderer.clear(0);
+       renderer.clear(nullptr);
        renderer.set_shader_program(&shprog, &shdata);
        renderer.set_texture("source", &color_buf, &nearest_sampler);
        renderer.set_texture("curve", &curve, &linear_sampler);
index 0c345d4e5497ab98d53c63c344d09efc168490ea..d9ee677e695a4666fb9c7bf8958d648dce8b4ffb 100644 (file)
@@ -40,7 +40,7 @@ ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &c, const Lighting *l):
 }
 
 ShadowMap::ShadowMap(unsigned s, Renderable &c, const DirectionalLight &l, Renderable &sc):
-       ShadowMap(s, s, c, 0)
+       ShadowMap(s, s, c, nullptr)
 {
        add_light(l, s, sc);
 }
index 980be57c96b3b81d61950e3fef635e202e0ef287..2d2d04dbae8ab3b444180dca42aa74385149e57e 100644 (file)
@@ -63,14 +63,14 @@ public:
                                virtual void init_actions();
                        };
 
-                       const Light *light = 0;
+                       const Light *light = nullptr;
                        unsigned size;
                        std::string shadow_caster_name;
                };
 
                unsigned width = 2048;
                unsigned height = 2048;
-               const Lighting *lighting = 0;
+               const Lighting *lighting = nullptr;
                std::vector<ShadowedLight> lights;
                Vector3 target;
                float radius = 1.0f;
index 64ab6f12c5db3298d2fe8de52371429cfa2290f0..8785f9f71eae389449f8a1972a9167aca6410d62 100644 (file)
@@ -58,7 +58,7 @@ public:
                        virtual void init_actions();
                };
 
-               DirectionalLight *sun = 0;
+               DirectionalLight *sun = nullptr;
 
                virtual Sky *create(const std::map<std::string, Renderable *> &) const;
        };
index 217509a20b74c61e83091feda6dc856dd9a3cfcc..d8540aaedfc5f4292bbf26d484bd45b99c0ca43a 100644 (file)
@@ -32,7 +32,7 @@ Module *get_builtins_module()
 
                RefPtr<IO::Seekable> io = Resources::get_builtins().open("_builtin.glsl");
                if(!io)
-                       return 0;
+                       return nullptr;
 
                builtins_module = new Module;
                add_builtin_type(builtins_module->shared, "void", BasicTypeDeclaration::VOID, 0, true);
@@ -43,12 +43,12 @@ Module *get_builtins_module()
 
                try
                {
-                       Parser parser(0);
+                       Parser parser(nullptr);
                        parser.parse(*builtins_module, *io, "<builtin>", BUILTIN_SOURCE);
                }
                catch(...)
                {
-                       builtins_module = 0;
+                       builtins_module = nullptr;
                        throw;
                }
        }
@@ -59,12 +59,12 @@ const Stage *get_builtins(Stage::Type type)
 {
        Module *module = get_builtins_module();
        if(!module)
-               return 0;
+               return nullptr;
 
        if(type==Stage::SHARED)
                return &module->shared;
        auto i = find_member(module->stages, type, &Stage::type);
-       return (i!=module->stages.end() ? &*i : 0);
+       return (i!=module->stages.end() ? &*i : nullptr);
 }
 
 } // namespace SL
index 7355321ea2bf5511602e03e3d61fc5e805d2ca34..e61cf10dd5307044ca7dd0fdc202c1b8d15529ac 100644 (file)
@@ -44,7 +44,7 @@ void Compiler::set_source(const string &source, const string &src_name)
 {
        clear();
        imported_names.push_back(src_name);
-       ModuleCache mod_cache(0);
+       ModuleCache mod_cache(nullptr);
        append_module(mod_cache.add_module(source, src_name), mod_cache);
 }
 
@@ -58,7 +58,7 @@ void Compiler::load_source(IO::Base &io, DataFile::Collection *res, const string
 
 void Compiler::load_source(IO::Base &io, const string &src_name)
 {
-       load_source(io, 0, src_name);
+       load_source(io, nullptr, src_name);
 }
 
 void Compiler::specialize(const map<string, int> &sv)
@@ -104,7 +104,7 @@ void Compiler::compile(Mode mode)
                        ++i;
        }
 
-       Stage *prev_stage = 0;
+       Stage *prev_stage = nullptr;
        for(auto i=module->stages.begin(); i!=module->stages.end(); )
        {
                if(i->functions.empty())
@@ -263,7 +263,7 @@ void Compiler::append_module(const Module &mod, ModuleCache &mod_cache)
 
 void Compiler::append_stage(const Stage &stage)
 {
-       Stage *target = 0;
+       Stage *target = nullptr;
        if(stage.type==Stage::SHARED)
                target = &module->shared;
        else
index 85be3013792915a348c8dcfcf01d58cec1147727..dde50841819731f8cca7241a1b34b73de62032da 100644 (file)
@@ -41,7 +41,7 @@ private:
        };
 
        Features features;
-       Module *module = 0;
+       Module *module = nullptr;
        std::vector<std::string> imported_names;
        bool compiled = false;
        bool specialized = false;
@@ -63,7 +63,7 @@ public:
 
        /** Loads source code from an I/O object.  If a collection is used, imports
        can be fetched from it. */
-       void load_source(IO::Base &, DataFile::Collection * = 0, const std::string & = "<file>");
+       void load_source(IO::Base &, DataFile::Collection * = nullptr, const std::string & = "<file>");
 
        /** Loads source code from an I/O object.  Only builtin imports are
        available. */
index b3682e7b30a98915ff219aaf09a03113beacc9c3..f347aca5b3250578190ffe4930bee63e5cda77a9 100644 (file)
@@ -27,8 +27,8 @@ private:
                std::string text;
                Node *node;
 
-               Branch(const char *t, Node *n = 0): text(t), node(n) { }
-               Branch(const std::string &t, Node *n = 0): text(t), node(n) { }
+               Branch(const char *t, Node *n = nullptr): text(t), node(n) { }
+               Branch(const std::string &t, Node *n = nullptr): text(t), node(n) { }
                Branch(Node *n): node(n) { }
        };
 
index 2c90237660e8157f063f0c9c5f4b615985f2033f..609f36e53f772996af0127c1a1a9d742f7a744cf 100644 (file)
@@ -22,7 +22,7 @@ void StructOrganizer::visit(VariableDeclaration &var)
 {
        if(offset>=0)
        {
-               int *layout_offset = 0;
+               int *layout_offset = nullptr;
                bool has_matrix_order = false;
                if(var.layout)
                {
@@ -501,11 +501,11 @@ void StructuralFeatureConverter::visit(Block &block)
 
 void StructuralFeatureConverter::visit(RefPtr<Expression> &expr)
 {
-       r_replaced_reference = 0;
+       r_replaced_reference = nullptr;
        expr->visit(*this);
        if(r_replaced_reference)
                expr = r_replaced_reference;
-       r_replaced_reference = 0;
+       r_replaced_reference = nullptr;
 }
 
 bool StructuralFeatureConverter::supports_stage(Stage::Type st) const
@@ -548,7 +548,7 @@ void StructuralFeatureConverter::visit(VariableReference &var)
        if(var.declaration==frag_out && !supports_unified_interface_syntax())
        {
                var.name = "gl_FragColor";
-               var.declaration = 0;
+               var.declaration = nullptr;
        }
 
        r_flattened_interface = nodes_to_remove.count(var.declaration);
@@ -570,7 +570,7 @@ void StructuralFeatureConverter::visit(Assignment &assign)
 {
        TraversingVisitor::visit(assign);
        if(assign.target.declaration==frag_out && !supports_unified_interface_syntax())
-               assign.target.declaration = 0;
+               assign.target.declaration = nullptr;
 }
 
 bool StructuralFeatureConverter::supports_unified_sampling_functions() const
@@ -805,7 +805,7 @@ void QualifierConverter::visit(VariableDeclaration &var)
                }
 
                if(var.layout->qualifiers.empty())
-                       var.layout = 0;
+                       var.layout = nullptr;
                else if(!check_version(Version(1, 40)))
                        unsupported("Layout qualifiers require GLSL 1.40");
        }
index 7b47e8ec5a24aa492218e32036f61f065a5d68e1..45a1bdaacd7df3169269851d429f99a58947cd5f 100644 (file)
@@ -93,7 +93,7 @@ according to the requirements of the target API. */
 class PrecisionConverter: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        std::set<std::string> have_default;
        NodeList<Statement>::iterator insert_point;
        std::set<Node *> nodes_to_remove;
@@ -111,7 +111,7 @@ private:
 class FeatureConverter: protected TraversingVisitor
 {
 protected:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        Features features;
 
        FeatureConverter() = default;
@@ -132,7 +132,7 @@ features. */
 class StructuralFeatureConverter: public FeatureConverter
 {
 private:
-       VariableDeclaration *frag_out = 0;
+       VariableDeclaration *frag_out = nullptr;
        NodeList<Statement>::iterator uniform_insert_point;
        std::set<Node *> nodes_to_remove;
        RefPtr<Expression> r_replaced_reference;
index ff43b99f164c3e8da7df4055175b2fd0deb1f3ba..4c1039bd212bef18ecf16858d4b863f62760675b 100644 (file)
@@ -99,10 +99,10 @@ string InterfaceGenerator::change_prefix(const string &name, const string &prefi
 VariableDeclaration *InterfaceGenerator::generate_interface(VariableDeclaration &var, const string &iface, const string &name)
 {
        if(stage->content.variables.count(name))
-               return 0;
+               return nullptr;
 
        if(stage->type==Stage::GEOMETRY && var.interface=="out" && var.array)
-               return 0;
+               return nullptr;
 
        VariableDeclaration* iface_var = new VariableDeclaration;
        iface_var->sampling = var.sampling;
@@ -234,7 +234,7 @@ void InterfaceGenerator::visit(VariableDeclaration &var)
        {
                /* For output variables in function scope, generate a global interface
                and replace the local declaration with an assignment. */
-               VariableDeclaration *out_var = 0;
+               VariableDeclaration *out_var = nullptr;
                if(function_scope && (out_var=generate_interface(var, "out", var.name)))
                {
                        out_var->source = var.source;
@@ -415,9 +415,9 @@ void ArraySizer::visit(VariableReference &var)
 
 void ArraySizer::visit(MemberAccess &memacc)
 {
-       r_declaration = 0;
+       r_declaration = nullptr;
        TraversingVisitor::visit(memacc);
-       VariableDeclaration *member_declaration = 0;
+       VariableDeclaration *member_declaration = nullptr;
        if(r_declaration)
                if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(r_declaration->type_declaration))
                {
@@ -431,13 +431,13 @@ void ArraySizer::visit(MemberAccess &memacc)
 void ArraySizer::visit(Swizzle &swizzle)
 {
        TraversingVisitor::visit(swizzle);
-       r_declaration = 0;
+       r_declaration = nullptr;
 }
 
 void ArraySizer::visit(UnaryExpression &unary)
 {
        TraversingVisitor::visit(unary);
-       r_declaration = 0;
+       r_declaration = nullptr;
 }
 
 void ArraySizer::visit(BinaryExpression &binary)
@@ -446,7 +446,7 @@ void ArraySizer::visit(BinaryExpression &binary)
                if(const Literal *literal_index = dynamic_cast<const Literal *>(binary.right.get()))
                        if(literal_index->value.has_type<int>())
                        {
-                               r_declaration = 0;
+                               r_declaration = nullptr;
                                binary.left->visit(*this);
                                if(r_declaration)
                                {
@@ -461,13 +461,13 @@ void ArraySizer::visit(BinaryExpression &binary)
 void ArraySizer::visit(TernaryExpression &ternary)
 {
        TraversingVisitor::visit(ternary);
-       r_declaration = 0;
+       r_declaration = nullptr;
 }
 
 void ArraySizer::visit(FunctionCall &call)
 {
        TraversingVisitor::visit(call);
-       r_declaration = 0;
+       r_declaration = nullptr;
 }
 
 void ArraySizer::visit(InterfaceLayout &layout)
index aba2c353f827239f7f4aaf3b2d2d73560d680db2..1eddfb162db88a834113489664539f80a43d8350 100644 (file)
@@ -37,13 +37,13 @@ Unresolved variables are looked up in the previous stage's out variables. */
 class InterfaceGenerator: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        std::string in_prefix;
        std::string out_prefix;
        bool function_scope = false;
        bool copy_block = false;
        std::vector<VariableDeclaration *> declared_inputs;
-       Block *iface_target_block = 0;
+       Block *iface_target_block = nullptr;
        NodeList<Statement>::iterator iface_insert_point;
        NodeList<Statement>::iterator assignment_insert_point;
        std::set<Node *> nodes_to_remove;
@@ -66,7 +66,7 @@ private:
 class LayoutDefaulter: private TraversingVisitor
 {
 private:
-       InterfaceLayout *in_iface = 0;
+       InterfaceLayout *in_iface = nullptr;
        bool need_winding = true;
        bool need_spacing = true;
 
index e914ad03f7f2d775f30689561523fc3123af3d2c..d35b4351de857fb44070e7e3d5d6fba31fb03a5e 100644 (file)
@@ -29,7 +29,7 @@ void ConstantSpecializer::visit(VariableDeclaration &var)
                        specializable = true;
                        qualifiers.erase(i);
                        if(qualifiers.empty())
-                               var.layout = 0;
+                               var.layout = nullptr;
                }
        }
 
@@ -148,7 +148,7 @@ string InlineContentInjector::apply(Stage &stage, FunctionDeclaration &target_fu
 
        for(const RefPtr<Statement> &s: source_func->body.body)
        {
-               r_inlined_statement = 0;
+               r_inlined_statement = nullptr;
                s->visit(*this);
                if(!r_inlined_statement)
                        r_inlined_statement = s->clone();
@@ -256,14 +256,14 @@ bool FunctionInliner::apply(Stage &s)
 
 void FunctionInliner::visit(RefPtr<Expression> &ptr)
 {
-       r_inline_result = 0;
+       r_inline_result = nullptr;
        ptr->visit(*this);
        if(r_inline_result)
        {
                ptr = r_inline_result;
                r_any_inlined = true;
        }
-       r_inline_result = 0;
+       r_inline_result = nullptr;
 }
 
 void FunctionInliner::visit(Block &block)
@@ -351,7 +351,7 @@ bool ExpressionInliner::apply(Stage &s)
 
 void ExpressionInliner::visit(RefPtr<Expression> &expr)
 {
-       r_ref_info = 0;
+       r_ref_info = nullptr;
        expr->visit(*this);
        if(r_ref_info && r_ref_info->expression)
        {
@@ -377,7 +377,7 @@ void ExpressionInliner::visit(RefPtr<Expression> &expr)
                r_ref_info->uses.push_back(use);
        }
        r_oper = expr->oper;
-       r_ref_info = 0;
+       r_ref_info = nullptr;
 }
 
 void ExpressionInliner::visit(VariableReference &var)
@@ -426,7 +426,7 @@ void ExpressionInliner::visit(Assignment &assign)
                SetFlag set_write(access_write);
                visit(assign.left);
        }
-       r_oper = 0;
+       r_oper = nullptr;
        r_trivial = true;
        visit(assign.right);
 
@@ -478,7 +478,7 @@ void ExpressionInliner::visit(FunctionCall &call)
 
 void ExpressionInliner::visit(VariableDeclaration &var)
 {
-       r_oper = 0;
+       r_oper = nullptr;
        r_trivial = true;
        TraversingVisitor::visit(var);
 
@@ -582,7 +582,7 @@ void AggregateDismantler::visit(Block &block)
 
 void AggregateDismantler::visit(RefPtr<Expression> &expr)
 {
-       r_aggregate_ref = 0;
+       r_aggregate_ref = nullptr;
        expr->visit(*this);
        if(r_aggregate_ref && r_reference.chain_len==1)
        {
@@ -596,7 +596,7 @@ void AggregateDismantler::visit(RefPtr<Expression> &expr)
                        referenced. */
                        r_aggregate_ref->referenced = true;
        }
-       r_aggregate_ref = 0;
+       r_aggregate_ref = nullptr;
 }
 
 void AggregateDismantler::visit(VariableReference &var)
@@ -631,10 +631,10 @@ void AggregateDismantler::visit(MemberAccess &memacc)
        if(r_reference.declaration && r_reference.chain_len==1)
        {
                auto i = aggregates.find(r_reference.declaration);
-               r_aggregate_ref = (i!=aggregates.end() ? &i->second : 0);
+               r_aggregate_ref = (i!=aggregates.end() ? &i->second : nullptr);
        }
        else
-               r_aggregate_ref = 0;
+               r_aggregate_ref = nullptr;
 }
 
 void AggregateDismantler::visit(BinaryExpression &binary)
@@ -656,10 +656,10 @@ void AggregateDismantler::visit(BinaryExpression &binary)
                if(r_reference.declaration && r_reference.chain_len==1)
                {
                        auto i = aggregates.find(r_reference.declaration);
-                       r_aggregate_ref = (i!=aggregates.end() ? &i->second : 0);
+                       r_aggregate_ref = (i!=aggregates.end() ? &i->second : nullptr);
                }
                else
-                       r_aggregate_ref = 0;
+                       r_aggregate_ref = nullptr;
        }
        else
        {
@@ -1029,7 +1029,7 @@ void ConstantFolder::visit(Iteration &iter)
        /* The iteration variable is not normally inlined into expressions, so we
        process it specially here.  If the initial value causes the loop condition
        to evaluate to false, then the expression can be folded. */
-       iteration_var = 0;
+       iteration_var = nullptr;
        if(iter.init_statement)
        {
                SetFlag set_init(iteration_init);
@@ -1047,7 +1047,7 @@ void ConstantFolder::visit(Iteration &iter)
                        iter.condition = literal;
                }
        }
-       iteration_var = 0;
+       iteration_var = nullptr;
 
        iter.body.visit(*this);
        if(iter.loop_expression)
@@ -1082,11 +1082,11 @@ void ConstantConditionEliminator::visit(Block &block)
 
 void ConstantConditionEliminator::visit(RefPtr<Expression> &expr)
 {
-       r_ternary_result = 0;
+       r_ternary_result = nullptr;
        expr->visit(*this);
        if(r_ternary_result)
                expr = r_ternary_result;
-       r_ternary_result = 0;
+       r_ternary_result = nullptr;
 }
 
 void ConstantConditionEliminator::visit(UnaryExpression &unary)
@@ -1116,7 +1116,7 @@ void ConstantConditionEliminator::visit(TernaryExpression &ternary)
        if(result!=NOT_CONSTANT)
                r_ternary_result = (result==CONSTANT_TRUE ? ternary.true_expr : ternary.false_expr);
        else
-               r_ternary_result = 0;
+               r_ternary_result = nullptr;
 }
 
 void ConstantConditionEliminator::visit(FunctionCall &call)
@@ -1435,7 +1435,7 @@ void UnusedVariableRemover::record_assignment(const Assignment::Target &target,
 
 void UnusedVariableRemover::visit(ExpressionStatement &expr)
 {
-       r_assignment = 0;
+       r_assignment = nullptr;
        r_side_effects = false;
        TraversingVisitor::visit(expr);
        if(r_assignment && r_assignment->target.declaration)
index 807b7a89ac90feb4c8f2d57afbeb2e2f5bb17596..5f55e10c970f9f3d269c7ee036d4558626a0d419 100644 (file)
@@ -14,7 +14,7 @@ constants. */
 class ConstantSpecializer: private TraversingVisitor
 {
 private:
-       const std::map<std::string, int> *values = 0;
+       const std::map<std::string, int> *values = nullptr;
 
 public:
        void apply(Stage &, const std::map<std::string, int> &);
@@ -31,7 +31,7 @@ class InlineableFunctionLocator: private TraversingVisitor
 private:
        std::map<FunctionDeclaration *, unsigned> refcounts;
        std::set<FunctionDeclaration *> inlineable;
-       FunctionDeclaration *current_function = 0;
+       FunctionDeclaration *current_function = nullptr;
        unsigned return_count = 0;
 
 public:
@@ -58,7 +58,7 @@ private:
                RENAME
        };
 
-       FunctionDeclaration *source_func = 0;
+       FunctionDeclaration *source_func = nullptr;
        Block staging_block;
        Pass pass = REFERENCED;
        RefPtr<Statement> r_inlined_statement;
@@ -82,9 +82,9 @@ are inlined. */
 class FunctionInliner: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        std::set<FunctionDeclaration *> inlineable;
-       FunctionDeclaration *current_function = 0;
+       FunctionDeclaration *current_function = nullptr;
        NodeList<Statement>::iterator insert_point;
        RefPtr<Expression> r_inline_result;
        bool r_any_inlined = false;
@@ -109,8 +109,8 @@ class ExpressionInliner: private TraversingVisitor
 private:
        struct ExpressionUse
        {
-               RefPtr<Expression> *reference = 0;
-               Block *ref_scope = 0;
+               RefPtr<Expression> *reference = nullptr;
+               Block *ref_scope = nullptr;
                bool blocked = false;
        };
 
@@ -118,7 +118,7 @@ private:
        {
                Assignment::Target target;
                RefPtr<Expression> expression;
-               Block *assign_scope = 0;
+               Block *assign_scope = nullptr;
                std::vector<ExpressionUse> uses;
                bool trivial = false;
                bool blocked = false;
@@ -126,13 +126,13 @@ private:
 
        std::list<ExpressionInfo> expressions;
        std::map<Assignment::Target, ExpressionInfo *> assignments;
-       ExpressionInfo *r_ref_info = 0;
+       ExpressionInfo *r_ref_info = nullptr;
        bool r_trivial = false;
        bool access_read = true;
        bool access_write = false;
        bool iteration_init = false;
-       Block *iteration_body = 0;
-       const Operator *r_oper = 0;
+       Block *iteration_body = nullptr;
+       const Operator *r_oper = nullptr;
 
 public:
        bool apply(Stage &);
@@ -160,7 +160,7 @@ class AggregateDismantler: public TraversingVisitor
 private:
        struct AggregateMember
        {
-               const VariableDeclaration *declaration = 0;
+               const VariableDeclaration *declaration = nullptr;
                unsigned index = 0;
                RefPtr<Expression> initializer;
                std::vector<RefPtr<Expression> *> references;
@@ -168,8 +168,8 @@ private:
 
        struct Aggregate
        {
-               VariableDeclaration *declaration = 0;
-               Block *decl_scope = 0;
+               VariableDeclaration *declaration = nullptr;
+               Block *decl_scope = nullptr;
                NodeList<Statement>::iterator insert_point;
                std::vector<AggregateMember> members;
                bool referenced = false;
@@ -180,7 +180,7 @@ private:
        std::map<Statement *, Aggregate> aggregates;
        bool composite_reference = false;
        Assignment::Target r_reference;
-       Aggregate *r_aggregate_ref = 0;
+       Aggregate *r_aggregate_ref = nullptr;
 
 public:
        bool apply(Stage &);
@@ -202,7 +202,7 @@ evaluating the expression.*/
 class ConstantFolder: private TraversingVisitor
 {
 private:
-       VariableDeclaration *iteration_var = 0;
+       VariableDeclaration *iteration_var = nullptr;
        Variant iter_init_value;
        Variant r_constant_value;
        bool iteration_init = false;
@@ -319,7 +319,7 @@ class UnusedVariableRemover: private TraversingVisitor
 private:
        struct AssignmentInfo
        {
-               Node *node = 0;
+               Node *node = nullptr;
                Assignment::Target target;
                std::vector<Node *> used_by;
                unsigned in_loop = 0;
@@ -335,10 +335,10 @@ private:
 
        typedef std::map<VariableDeclaration *, VariableInfo> BlockVariableMap;
 
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        BlockVariableMap variables;
        std::list<AssignmentInfo> assignments;
-       Assignment *r_assignment = 0;
+       Assignment *r_assignment = nullptr;
        bool assignment_target = false;
        bool r_side_effects = false;
        bool in_struct = false;
index ec794912adfd55c8d42d49b806bc0ce292be0ecc..57abed75af68b50d20b936e4a46c67945a6be11a 100644 (file)
@@ -13,7 +13,7 @@ namespace SL {
 class Formatter: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        std::string formatted;
        unsigned source_index = 0;
        unsigned source_line = 1;
index db60789443bdd59ce10b13ae9550b20fd60f804f..907cb7fe651c48d83672e8987acd161c13349524 100644 (file)
@@ -19,7 +19,7 @@ namespace SL {
 Parser::Parser(ModuleCache *s):
        mod_cache(s),
        preprocessor(tokenizer),
-       module(0)
+       module(nullptr)
 {
        tokenizer.signal_preprocess.connect(sigc::mem_fun(&preprocessor, &Preprocessor::preprocess));
        preprocessor.signal_version.connect(sigc::mem_fun(this, &Parser::set_required_version));
@@ -71,7 +71,7 @@ void Parser::parse_source(const string &name, int index)
                        if(next_global_declaration)
                        {
                                cur_stage->content.body.push_back(next_global_declaration);
-                               next_global_declaration = 0;
+                               next_global_declaration = nullptr;
                        }
                }
 
@@ -332,7 +332,7 @@ RefPtr<Statement> Parser::parse_global_declaration()
                        return parse_variable_declaration();
        }
        else if(token.empty())
-               return 0;
+               return nullptr;
        else
                throw parse_error(tokenizer.get_location(), token, "a global declaration");
 }
@@ -476,12 +476,12 @@ RefPtr<Expression> Parser::parse_expression(const Operator *outer_oper)
 {
        unsigned outer_precedence = (outer_oper ? outer_oper->precedence+(outer_oper->assoc==Operator::RIGHT_TO_LEFT) : 20);
        RefPtr<Expression> left;
-       VariableReference *left_var = 0;
+       VariableReference *left_var = nullptr;
        while(1)
        {
                string token = tokenizer.peek_token();
 
-               const Operator *oper = 0;
+               const Operator *oper = nullptr;
                for(const Operator *i=Operator::operators; (!oper && i->type); ++i)
                        if(token==i->token && (!left || i->type!=Operator::PREFIX) && (left || i->type!=Operator::POSTFIX))
                                oper = i;
@@ -525,7 +525,7 @@ RefPtr<Expression> Parser::parse_expression(const Operator *outer_oper)
                                left = parse_ternary(left, *oper);
                        else
                                throw parse_error(tokenizer.get_location(), token, "an operator");
-                       left_var = 0;
+                       left_var = nullptr;
                }
                else
                {
index 51616378c29c947653496ca71be80640081e55f4..d1dd379d30bea40c3d156eaa238ff76404b34037 100644 (file)
@@ -75,7 +75,7 @@ private:
        RefPtr<Layout> parse_layout();
        template<typename T>
        void parse_block(Block &, bool, RefPtr<T> (Parser::*)());
-       RefPtr<Expression> parse_expression(const Operator * = 0);
+       RefPtr<Expression> parse_expression(const Operator * = nullptr);
        RefPtr<Literal> parse_literal();
        RefPtr<BinaryExpression> parse_binary(const RefPtr<Expression> &, const Operator &);
        RefPtr<TernaryExpression> parse_ternary(const RefPtr<Expression> &, const Operator &);
index 818ccc97c316fd1743a521a6ec6a8f6fbb74bace..c4fba0682f224b5bdd0e00089624b09ec8320e68 100644 (file)
@@ -23,7 +23,7 @@ BasicTypeDeclaration *get_element_type(BasicTypeDeclaration &type)
        if(is_vector_or_matrix(type) || type.kind==BasicTypeDeclaration::ARRAY)
        {
                BasicTypeDeclaration *basic_base = dynamic_cast<BasicTypeDeclaration *>(type.base_type);
-               return (basic_base ? get_element_type(*basic_base) : 0);
+               return (basic_base ? get_element_type(*basic_base) : nullptr);
        }
        else
                return &type;
@@ -71,7 +71,7 @@ T *TypeComparer::multi_visit(T &node)
                Node *s = second;
                first = &node;
                first_tag = tag;
-               second = 0;
+               second = nullptr;
                s->visit(*this);
        }
        else if(!first || tag!=first_tag)
@@ -79,11 +79,11 @@ T *TypeComparer::multi_visit(T &node)
        else
        {
                T *f = static_cast<T *>(first);
-               first = 0;
+               first = nullptr;
                return f;
        }
 
-       return 0;
+       return nullptr;
 }
 
 void TypeComparer::visit(Literal &literal)
index 308d7c8038c5d59c149df472f374226110adecd3..13528c0d290cbcc9320a3748827d9d06b2193095 100644 (file)
@@ -16,8 +16,8 @@ bool can_convert(const BasicTypeDeclaration &, const BasicTypeDeclaration &);
 class TypeComparer: private NodeVisitor
 {
 private:
-       Node *first = 0;
-       Node *second = 0;
+       Node *first = nullptr;
+       Node *second = nullptr;
        unsigned first_tag = 0;
        bool r_result = false;
 
index ffcec7b9fad5e44a08ce6ab33801096f8b255101..e1d2065b7ffaa74f09512d57fe36d76231cd8330 100644 (file)
@@ -69,7 +69,7 @@ TypeDeclaration *TypeResolver::get_or_create_image_type(ImageTypeDeclaration &ty
 
 void TypeResolver::resolve_type(TypeDeclaration *&type, const string &name, bool array, const Layout *layout)
 {
-       TypeDeclaration *resolved = 0;
+       TypeDeclaration *resolved = nullptr;
        auto i = stage->types.find(name);
        if(i!=stage->types.end())
        {
@@ -158,7 +158,7 @@ void TypeResolver::visit(VariableDeclaration &var)
 {
        resolve_type(var.type_declaration, var.type, var.array, var.layout.get());
 
-       var.block_declaration = 0;
+       var.block_declaration = nullptr;
        if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(get_ultimate_base_type(var.type_declaration)))
                if(!strct->block_name.empty())
                {
@@ -206,17 +206,17 @@ void VariableResolver::enter(Block &block)
 
 void VariableResolver::visit(RefPtr<Expression> &expr)
 {
-       r_replacement_expr = 0;
+       r_replacement_expr = nullptr;
        expr->visit(*this);
        if(r_replacement_expr)
        {
                expr = r_replacement_expr;
                /* Don't record assignment target when doing a replacement, because chain
                information won't be correct. */
-               r_assignment_target.declaration = 0;
+               r_assignment_target.declaration = nullptr;
                r_any_resolved = true;
        }
-       r_replacement_expr = 0;
+       r_replacement_expr = nullptr;
 }
 
 void VariableResolver::check_assignment_target(VariableDeclaration *declaration)
@@ -228,7 +228,7 @@ void VariableResolver::check_assignment_target(VariableDeclaration *declaration)
                        /* More than one reference found in assignment target.  Unable to
                        determine what the primary target is. */
                        record_target = false;
-                       r_assignment_target.declaration = 0;
+                       r_assignment_target.declaration = nullptr;
                }
                else
                        r_assignment_target.declaration = declaration;
@@ -240,7 +240,7 @@ void VariableResolver::check_assignment_target(VariableDeclaration *declaration)
 
 void VariableResolver::visit(VariableReference &var)
 {
-       VariableDeclaration *declaration = 0;
+       VariableDeclaration *declaration = nullptr;
 
        /* Look for variable declarations in the block hierarchy first.  Interface
        blocks are always defined in the top level so we can't accidentally skip
@@ -286,7 +286,7 @@ void VariableResolver::visit(MemberAccess &memacc)
 {
        TraversingVisitor::visit(memacc);
 
-       VariableDeclaration *declaration = 0;
+       VariableDeclaration *declaration = nullptr;
        int index = -1;
        if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(memacc.left->type))
        {
@@ -423,8 +423,8 @@ void VariableResolver::visit(VariableDeclaration &var)
        TraversingVisitor::visit(var);
 
        auto i = current_block->variables.find(var.name);
-       VariableDeclaration *existing = 0;
-       VariableDeclaration *block = 0;
+       VariableDeclaration *existing = nullptr;
+       VariableDeclaration *block = nullptr;
        if(i!=current_block->variables.end())
                existing = i->second;
        else if(!current_block->parent)
@@ -714,7 +714,7 @@ void ExpressionResolver::visit(BinaryExpression &binary, bool assign)
        if(assign && (compat==LEFT_CONVERTIBLE || elem_compat==LEFT_CONVERTIBLE))
                return;
 
-       TypeDeclaration *type = 0;
+       TypeDeclaration *type = nullptr;
        char oper2 = binary.oper->token[1];
        if((oper=='<' && oper2!='<') || (oper=='>' && oper2!='>'))
        {
@@ -833,7 +833,7 @@ void ExpressionResolver::visit(BinaryExpression &binary, bool assign)
                converted = convert_to_element(binary.right, *elem_left);
 
        if(!converted)
-               type = 0;
+               type = nullptr;
 
        resolve(binary, type, assign);
 }
@@ -875,7 +875,7 @@ void ExpressionResolver::visit(TernaryExpression &ternary)
        if(!basic_cond || basic_cond->kind!=BasicTypeDeclaration::BOOL)
                return;
 
-       TypeDeclaration *type = 0;
+       TypeDeclaration *type = nullptr;
        if(ternary.true_expr->type==ternary.false_expr->type)
                type = ternary.true_expr->type;
        else
@@ -1236,7 +1236,7 @@ bool FunctionResolver::can_convert_arguments(const FunctionCall &call, const Fun
 
 void FunctionResolver::visit(FunctionCall &call)
 {
-       FunctionDeclaration *declaration = 0;
+       FunctionDeclaration *declaration = nullptr;
        if(stage->types.count(call.name))
                call.constructor = true;
        else
@@ -1268,7 +1268,7 @@ void FunctionResolver::visit(FunctionCall &call)
                                        {
                                                if(declaration)
                                                {
-                                                       declaration = 0;
+                                                       declaration = nullptr;
                                                        break;
                                                }
                                                else
@@ -1326,7 +1326,7 @@ void FunctionResolver::visit(FunctionDeclaration &func)
        }
        else
        {
-               FunctionDeclaration *definition = (stage_decl ? stage_decl->definition : 0);
+               FunctionDeclaration *definition = (stage_decl ? stage_decl->definition : nullptr);
                r_any_resolved |= (definition!=func.definition);
                func.definition = definition;
 
index c014891aff3f11facc490e867b4a028994ec1ca9..43326cfb2ba52cd51549b538f6d20d82ab3c675d 100644 (file)
@@ -28,13 +28,13 @@ private:
 class TypeResolver: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        std::map<TypeDeclaration *, TypeDeclaration *> alias_map;
        std::map<std::pair<TypeDeclaration *, bool>, TypeDeclaration *> array_types;
        std::map<std::pair<ImageTypeDeclaration *, std::string>, ImageTypeDeclaration *> image_types;
        NodeList<Statement>::iterator type_insert_point;
        NodeList<Statement>::iterator block_member_type_ins_pt;
-       VariableDeclaration *iface_block = 0;
+       VariableDeclaration *iface_block = nullptr;
        bool r_any_resolved = false;
 
 public:
@@ -43,7 +43,7 @@ public:
 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 * = 0);
+       void resolve_type(TypeDeclaration *&, const std::string &, bool, const Layout * = nullptr);
        virtual void visit(Block &);
        virtual void visit(BasicTypeDeclaration &);
        virtual void visit(ImageTypeDeclaration &);
@@ -56,7 +56,7 @@ private:
 class VariableResolver: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        RefPtr<Expression> r_replacement_expr;
        bool r_any_resolved = false;
        bool record_target = false;
@@ -96,12 +96,12 @@ private:
 
        struct ArgumentInfo
        {
-               BasicTypeDeclaration *type = 0;
+               BasicTypeDeclaration *type = nullptr;
                unsigned component_count = 0;
        };
 
-       Stage *stage = 0;
-       const FunctionDeclaration *current_function = 0;
+       Stage *stage = nullptr;
+       const FunctionDeclaration *current_function = nullptr;
        std::vector<BasicTypeDeclaration *> basic_types;
        NodeList<Statement>::iterator insert_point;
        bool r_any_resolved = false;
@@ -141,7 +141,7 @@ private:
 class FunctionResolver: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
+       Stage *stage = nullptr;
        std::map<std::string, std::vector<FunctionDeclaration *> > declarations;
        bool r_any_resolved = false;
 
index a9cb302db9558b18cac6f0e3b3077f070138616d..88ab30b94282a17e2de9e028e846c3c2256c206a 100644 (file)
@@ -12,102 +12,102 @@ namespace SL {
 
 const SpirVGenerator::BuiltinFunctionInfo SpirVGenerator::builtin_functions[] =
 {
-       { "radians", "f", "GLSL.std.450", GLSL450_RADIANS, { 1 }, 0, 0 },
-       { "degrees", "f", "GLSL.std.450", GLSL450_DEGREES, { 1 }, 0, 0 },
-       { "sin", "f", "GLSL.std.450", GLSL450_SIN, { 1 }, 0, 0 },
-       { "cos", "f", "GLSL.std.450", GLSL450_COS, { 1 }, 0, 0 },
-       { "tan", "f", "GLSL.std.450", GLSL450_TAN, { 1 }, 0, 0 },
-       { "asin", "f", "GLSL.std.450", GLSL450_ASIN, { 1 }, 0, 0 },
-       { "acos", "f", "GLSL.std.450", GLSL450_ACOS, { 1 }, 0, 0 },
-       { "atan", "f", "GLSL.std.450", GLSL450_ATAN, { 1 }, 0, 0 },
-       { "atan", "ff", "GLSL.std.450", GLSL450_ATAN2, { 1, 2 }, 0, 0 },
-       { "sinh", "f", "GLSL.std.450", GLSL450_SINH, { 1 }, 0, 0 },
-       { "cosh", "f", "GLSL.std.450", GLSL450_COSH, { 1 }, 0, 0 },
-       { "tanh", "f", "GLSL.std.450", GLSL450_TANH, { 1 }, 0, 0 },
-       { "asinh", "f", "GLSL.std.450", GLSL450_ASINH, { 1 }, 0, 0 },
-       { "acosh", "f", "GLSL.std.450", GLSL450_ACOSH, { 1 }, 0, 0 },
-       { "atanh", "f", "GLSL.std.450", GLSL450_ATANH, { 1 }, 0, 0 },
-       { "pow", "ff", "GLSL.std.450", GLSL450_POW, { 1, 2 }, 0, 0 },
-       { "exp", "f", "GLSL.std.450", GLSL450_EXP, { 1 }, 0, 0 },
-       { "log", "f", "GLSL.std.450", GLSL450_LOG, { 1 }, 0, 0 },
-       { "exp2", "f", "GLSL.std.450", GLSL450_EXP2, { 1 }, 0, 0 },
-       { "log2", "f", "GLSL.std.450", GLSL450_LOG2, { 1 }, 0, 0 },
-       { "sqrt", "f", "GLSL.std.450", GLSL450_SQRT, { 1 }, 0, 0 },
-       { "inversesqrt", "f", "GLSL.std.450", GLSL450_INVERSE_SQRT, { 1 }, 0, 0 },
-       { "abs", "f", "GLSL.std.450", GLSL450_F_ABS, { 1 }, 0, 0 },
-       { "abs", "i", "GLSL.std.450", GLSL450_S_ABS, { 1 }, 0, 0 },
-       { "sign", "f", "GLSL.std.450", GLSL450_F_SIGN, { 1 }, 0, 0 },
-       { "sign", "i", "GLSL.std.450", GLSL450_S_SIGN, { 1 }, 0, 0 },
-       { "floor", "f", "GLSL.std.450", GLSL450_FLOOR, { 1 }, 0, 0 },
-       { "trunc", "f", "GLSL.std.450", GLSL450_TRUNC, { 1 }, 0, 0 },
-       { "round", "f", "GLSL.std.450", GLSL450_ROUND, { 1 }, 0, 0 },
-       { "roundEven", "f", "GLSL.std.450", GLSL450_ROUND_EVEN, { 1 }, 0, 0 },
-       { "ceil", "f", "GLSL.std.450", GLSL450_CEIL, { 1 }, 0, 0 },
-       { "fract", "f", "GLSL.std.450", GLSL450_FRACT, { 1 }, 0, 0 },
-       { "mod", "f", "", OP_F_MOD, { 1, 2 }, 0, 0 },
-       { "min", "ff", "GLSL.std.450", GLSL450_F_MIN, { 1, 2 }, 0, 0 },
-       { "min", "ii", "GLSL.std.450", GLSL450_S_MIN, { 1, 2 }, 0, 0 },
-       { "min", "uu", "GLSL.std.450", GLSL450_U_MIN, { 1, 2 }, 0, 0 },
-       { "max", "ff", "GLSL.std.450", GLSL450_F_MAX, { 1, 2 }, 0, 0 },
-       { "max", "ii", "GLSL.std.450", GLSL450_S_MAX, { 1, 2 }, 0, 0 },
-       { "max", "uu", "GLSL.std.450", GLSL450_U_MAX, { 1, 2 }, 0, 0 },
-       { "clamp", "fff", "GLSL.std.450", GLSL450_F_CLAMP, { 1, 2, 3 }, 0, 0 },
-       { "clamp", "iii", "GLSL.std.450", GLSL450_S_CLAMP, { 1, 2, 3 }, 0, 0 },
-       { "clamp", "uuu", "GLSL.std.450", GLSL450_U_CLAMP, { 1, 2, 3 }, 0, 0 },
-       { "mix", "fff", "GLSL.std.450", GLSL450_F_MIX, { 1, 2, 3 }, 0, 0 },
-       { "mix", "ffb", "", OP_SELECT, { 3, 2, 1 }, 0, 0 },
-       { "mix", "iib", "", OP_SELECT, { 3, 2, 1 }, 0, 0 },
-       { "mix", "uub", "", OP_SELECT, { 3, 2, 1 }, 0, 0 },
-       { "step", "ff", "GLSL.std.450", GLSL450_F_STEP, { 1, 2 }, 0, 0 },
-       { "smoothstep", "fff", "GLSL.std.450", GLSL450_F_SMOOTH_STEP, { 1, 2, 3 }, 0, 0 },
-       { "isnan", "f", "", OP_IS_NAN, { 1 }, 0, 0 },
-       { "isinf", "f", "", OP_IS_INF, { 1 }, 0, 0 },
-       { "fma", "fff", "GLSL.std.450", GLSL450_F_FMA, { 1, 2, 3 }, 0, 0 },
-       { "length", "f", "GLSL.std.450", GLSL450_LENGTH, { 1 }, 0, 0 },
-       { "distance", "ff", "GLSL.std.450", GLSL450_DISTANCE, { 1, 2 }, 0, 0 },
-       { "dot", "ff", "", OP_DOT, { 1, 2 }, 0, 0 },
-       { "cross", "ff", "GLSL.std.450", GLSL450_CROSS, { 1, 2 }, 0, 0 },
-       { "normalize", "f", "GLSL.std.450", GLSL450_NORMALIZE, { 1 }, 0, 0 },
-       { "faceforward", "fff", "GLSL.std.450", GLSL450_FACE_FORWARD, { 1, 2, 3 }, 0, 0 },
-       { "reflect", "ff", "GLSL.std.450", GLSL450_REFLECT, { 1, 2 }, 0, 0 },
-       { "refract", "fff", "GLSL.std.450", GLSL450_REFRACT, { 1, 2, 3 }, 0, 0 },
+       { "radians", "f", "GLSL.std.450", GLSL450_RADIANS, { 1 }, 0, nullptr },
+       { "degrees", "f", "GLSL.std.450", GLSL450_DEGREES, { 1 }, 0, nullptr },
+       { "sin", "f", "GLSL.std.450", GLSL450_SIN, { 1 }, 0, nullptr },
+       { "cos", "f", "GLSL.std.450", GLSL450_COS, { 1 }, 0, nullptr },
+       { "tan", "f", "GLSL.std.450", GLSL450_TAN, { 1 }, 0, nullptr },
+       { "asin", "f", "GLSL.std.450", GLSL450_ASIN, { 1 }, 0, nullptr },
+       { "acos", "f", "GLSL.std.450", GLSL450_ACOS, { 1 }, 0, nullptr },
+       { "atan", "f", "GLSL.std.450", GLSL450_ATAN, { 1 }, 0, nullptr },
+       { "atan", "ff", "GLSL.std.450", GLSL450_ATAN2, { 1, 2 }, 0, nullptr },
+       { "sinh", "f", "GLSL.std.450", GLSL450_SINH, { 1 }, 0, nullptr },
+       { "cosh", "f", "GLSL.std.450", GLSL450_COSH, { 1 }, 0, nullptr },
+       { "tanh", "f", "GLSL.std.450", GLSL450_TANH, { 1 }, 0, nullptr },
+       { "asinh", "f", "GLSL.std.450", GLSL450_ASINH, { 1 }, 0, nullptr },
+       { "acosh", "f", "GLSL.std.450", GLSL450_ACOSH, { 1 }, 0, nullptr },
+       { "atanh", "f", "GLSL.std.450", GLSL450_ATANH, { 1 }, 0, nullptr },
+       { "pow", "ff", "GLSL.std.450", GLSL450_POW, { 1, 2 }, 0, nullptr },
+       { "exp", "f", "GLSL.std.450", GLSL450_EXP, { 1 }, 0, nullptr },
+       { "log", "f", "GLSL.std.450", GLSL450_LOG, { 1 }, 0, nullptr },
+       { "exp2", "f", "GLSL.std.450", GLSL450_EXP2, { 1 }, 0, nullptr },
+       { "log2", "f", "GLSL.std.450", GLSL450_LOG2, { 1 }, 0, nullptr },
+       { "sqrt", "f", "GLSL.std.450", GLSL450_SQRT, { 1 }, 0, nullptr },
+       { "inversesqrt", "f", "GLSL.std.450", GLSL450_INVERSE_SQRT, { 1 }, 0, nullptr },
+       { "abs", "f", "GLSL.std.450", GLSL450_F_ABS, { 1 }, 0, nullptr },
+       { "abs", "i", "GLSL.std.450", GLSL450_S_ABS, { 1 }, 0, nullptr },
+       { "sign", "f", "GLSL.std.450", GLSL450_F_SIGN, { 1 }, 0, nullptr },
+       { "sign", "i", "GLSL.std.450", GLSL450_S_SIGN, { 1 }, 0, nullptr },
+       { "floor", "f", "GLSL.std.450", GLSL450_FLOOR, { 1 }, 0, nullptr },
+       { "trunc", "f", "GLSL.std.450", GLSL450_TRUNC, { 1 }, 0, nullptr },
+       { "round", "f", "GLSL.std.450", GLSL450_ROUND, { 1 }, 0, nullptr },
+       { "roundEven", "f", "GLSL.std.450", GLSL450_ROUND_EVEN, { 1 }, 0, nullptr },
+       { "ceil", "f", "GLSL.std.450", GLSL450_CEIL, { 1 }, 0, nullptr },
+       { "fract", "f", "GLSL.std.450", GLSL450_FRACT, { 1 }, 0, nullptr },
+       { "mod", "f", "", OP_F_MOD, { 1, 2 }, 0, nullptr },
+       { "min", "ff", "GLSL.std.450", GLSL450_F_MIN, { 1, 2 }, 0, nullptr },
+       { "min", "ii", "GLSL.std.450", GLSL450_S_MIN, { 1, 2 }, 0, nullptr },
+       { "min", "uu", "GLSL.std.450", GLSL450_U_MIN, { 1, 2 }, 0, nullptr },
+       { "max", "ff", "GLSL.std.450", GLSL450_F_MAX, { 1, 2 }, 0, nullptr },
+       { "max", "ii", "GLSL.std.450", GLSL450_S_MAX, { 1, 2 }, 0, nullptr },
+       { "max", "uu", "GLSL.std.450", GLSL450_U_MAX, { 1, 2 }, 0, nullptr },
+       { "clamp", "fff", "GLSL.std.450", GLSL450_F_CLAMP, { 1, 2, 3 }, 0, nullptr },
+       { "clamp", "iii", "GLSL.std.450", GLSL450_S_CLAMP, { 1, 2, 3 }, 0, nullptr },
+       { "clamp", "uuu", "GLSL.std.450", GLSL450_U_CLAMP, { 1, 2, 3 }, 0, nullptr },
+       { "mix", "fff", "GLSL.std.450", GLSL450_F_MIX, { 1, 2, 3 }, 0, nullptr },
+       { "mix", "ffb", "", OP_SELECT, { 3, 2, 1 }, 0, nullptr },
+       { "mix", "iib", "", OP_SELECT, { 3, 2, 1 }, 0, nullptr },
+       { "mix", "uub", "", OP_SELECT, { 3, 2, 1 }, 0, nullptr },
+       { "step", "ff", "GLSL.std.450", GLSL450_F_STEP, { 1, 2 }, 0, nullptr },
+       { "smoothstep", "fff", "GLSL.std.450", GLSL450_F_SMOOTH_STEP, { 1, 2, 3 }, 0, nullptr },
+       { "isnan", "f", "", OP_IS_NAN, { 1 }, 0, nullptr },
+       { "isinf", "f", "", OP_IS_INF, { 1 }, 0, nullptr },
+       { "fma", "fff", "GLSL.std.450", GLSL450_F_FMA, { 1, 2, 3 }, 0, nullptr },
+       { "length", "f", "GLSL.std.450", GLSL450_LENGTH, { 1 }, 0, nullptr },
+       { "distance", "ff", "GLSL.std.450", GLSL450_DISTANCE, { 1, 2 }, 0, nullptr },
+       { "dot", "ff", "", OP_DOT, { 1, 2 }, 0, nullptr },
+       { "cross", "ff", "GLSL.std.450", GLSL450_CROSS, { 1, 2 }, 0, nullptr },
+       { "normalize", "f", "GLSL.std.450", GLSL450_NORMALIZE, { 1 }, 0, nullptr },
+       { "faceforward", "fff", "GLSL.std.450", GLSL450_FACE_FORWARD, { 1, 2, 3 }, 0, nullptr },
+       { "reflect", "ff", "GLSL.std.450", GLSL450_REFLECT, { 1, 2 }, 0, nullptr },
+       { "refract", "fff", "GLSL.std.450", GLSL450_REFRACT, { 1, 2, 3 }, 0, nullptr },
        { "matrixCompMult", "ff", "", 0, { 0 }, 0, &SpirVGenerator::visit_builtin_matrix_comp_mult },
-       { "outerProduct", "ff", "", OP_OUTER_PRODUCT, { 1, 2 }, 0, 0 },
-       { "transpose", "f", "", OP_TRANSPOSE, { 1 }, 0, 0 },
-       { "determinant", "f", "GLSL.std.450", GLSL450_DETERMINANT, { 1 }, 0, 0 },
-       { "inverse", "f", "GLSL.std.450", GLSL450_MATRIX_INVERSE, { 1 }, 0, 0 },
-       { "lessThan", "ff", "", OP_F_ORD_LESS_THAN, { 1, 2 }, 0, 0 },
-       { "lessThan", "ii", "", OP_S_LESS_THAN, { 1, 2 }, 0, 0 },
-       { "lessThan", "uu", "", OP_U_LESS_THAN, { 1, 2 }, 0, 0 },
-       { "lessThanEqual", "ff", "", OP_F_ORD_LESS_THAN_EQUAL, { 1, 2 }, 0, 0 },
-       { "lessThanEqual", "ii", "", OP_S_LESS_THAN_EQUAL, { 1, 2 }, 0, 0 },
-       { "lessThanEqual", "uu", "", OP_U_LESS_THAN_EQUAL, { 1, 2 }, 0, 0 },
-       { "greaterThan", "ff", "", OP_F_ORD_GREATER_THAN, { 1, 2 }, 0, 0 },
-       { "greaterThan", "ii", "", OP_S_GREATER_THAN, { 1, 2 }, 0, 0 },
-       { "greaterThan", "uu", "", OP_U_GREATER_THAN, { 1, 2 }, 0, 0 },
-       { "greaterThanEqual", "ff", "", OP_F_ORD_GREATER_THAN_EQUAL, { 1, 2 }, 0, 0 },
-       { "greaterThanEqual", "ii", "", OP_S_GREATER_THAN_EQUAL, { 1, 2 }, 0, 0 },
-       { "greaterThanEqual", "uu", "", OP_U_GREATER_THAN_EQUAL, { 1, 2 }, 0, 0 },
-       { "equal", "ff", "", OP_F_ORD_EQUAL, { 1, 2 }, 0, 0 },
-       { "equal", "ii", "", OP_I_EQUAL, { 1, 2 }, 0, 0 },
-       { "equal", "uu", "", OP_I_EQUAL, { 1, 2 }, 0, 0 },
-       { "notEqual", "ff", "", OP_F_ORD_NOT_EQUAL, { 1, 2 }, 0, 0 },
-       { "notEqual", "ii", "", OP_I_NOT_EQUAL, { 1, 2 }, 0, 0 },
-       { "notEqual", "uu", "", OP_I_NOT_EQUAL, { 1, 2 }, 0, 0 },
-       { "any", "b", "", OP_ANY, { 1 }, 0, 0 },
-       { "all", "b", "", OP_ALL, { 1 }, 0, 0 },
-       { "not", "b", "", OP_LOGICAL_NOT, { 1 }, 0, 0 },
-       { "bitfieldExtract", "iii", "", OP_BIT_FIELD_S_EXTRACT, { 1, 2, 3 }, 0, 0 },
-       { "bitfieldExtract", "uii", "", OP_BIT_FIELD_U_EXTRACT, { 1, 2, 3 }, 0, 0 },
-       { "bitfieldInsert", "iiii", "", OP_BIT_FIELD_INSERT, { 1, 2, 3, 4 }, 0, 0 },
-       { "bitfieldInsert", "uuii", "", OP_BIT_FIELD_INSERT, { 1, 2, 3, 4 }, 0, 0 },
-       { "bitfieldReverse", "i", "", OP_BIT_REVERSE, { 1 }, 0, 0 },
-       { "bitfieldReverse", "u", "", OP_BIT_REVERSE, { 1 }, 0, 0 },
-       { "bitCount", "i", "", OP_BIT_COUNT, { 1 }, 0, 0 },
-       { "findLSB", "i", "GLSL.std.450", GLSL450_FIND_I_LSB, { 1 }, 0, 0 },
-       { "findLSB", "u", "GLSL.std.450", GLSL450_FIND_I_LSB, { 1 }, 0, 0 },
-       { "findMSB", "i", "GLSL.std.450", GLSL450_FIND_S_MSB, { 1 }, 0, 0 },
-       { "findMSB", "u", "GLSL.std.450", GLSL450_FIND_U_MSB, { 1 }, 0, 0 },
+       { "outerProduct", "ff", "", OP_OUTER_PRODUCT, { 1, 2 }, 0, nullptr },
+       { "transpose", "f", "", OP_TRANSPOSE, { 1 }, 0, nullptr },
+       { "determinant", "f", "GLSL.std.450", GLSL450_DETERMINANT, { 1 }, 0, nullptr },
+       { "inverse", "f", "GLSL.std.450", GLSL450_MATRIX_INVERSE, { 1 }, 0, nullptr },
+       { "lessThan", "ff", "", OP_F_ORD_LESS_THAN, { 1, 2 }, 0, nullptr },
+       { "lessThan", "ii", "", OP_S_LESS_THAN, { 1, 2 }, 0, nullptr },
+       { "lessThan", "uu", "", OP_U_LESS_THAN, { 1, 2 }, 0, nullptr },
+       { "lessThanEqual", "ff", "", OP_F_ORD_LESS_THAN_EQUAL, { 1, 2 }, 0, nullptr },
+       { "lessThanEqual", "ii", "", OP_S_LESS_THAN_EQUAL, { 1, 2 }, 0, nullptr },
+       { "lessThanEqual", "uu", "", OP_U_LESS_THAN_EQUAL, { 1, 2 }, 0, nullptr },
+       { "greaterThan", "ff", "", OP_F_ORD_GREATER_THAN, { 1, 2 }, 0, nullptr },
+       { "greaterThan", "ii", "", OP_S_GREATER_THAN, { 1, 2 }, 0, nullptr },
+       { "greaterThan", "uu", "", OP_U_GREATER_THAN, { 1, 2 }, 0, nullptr },
+       { "greaterThanEqual", "ff", "", OP_F_ORD_GREATER_THAN_EQUAL, { 1, 2 }, 0, nullptr },
+       { "greaterThanEqual", "ii", "", OP_S_GREATER_THAN_EQUAL, { 1, 2 }, 0, nullptr },
+       { "greaterThanEqual", "uu", "", OP_U_GREATER_THAN_EQUAL, { 1, 2 }, 0, nullptr },
+       { "equal", "ff", "", OP_F_ORD_EQUAL, { 1, 2 }, 0, nullptr },
+       { "equal", "ii", "", OP_I_EQUAL, { 1, 2 }, 0, nullptr },
+       { "equal", "uu", "", OP_I_EQUAL, { 1, 2 }, 0, nullptr },
+       { "notEqual", "ff", "", OP_F_ORD_NOT_EQUAL, { 1, 2 }, 0, nullptr },
+       { "notEqual", "ii", "", OP_I_NOT_EQUAL, { 1, 2 }, 0, nullptr },
+       { "notEqual", "uu", "", OP_I_NOT_EQUAL, { 1, 2 }, 0, nullptr },
+       { "any", "b", "", OP_ANY, { 1 }, 0, nullptr },
+       { "all", "b", "", OP_ALL, { 1 }, 0, nullptr },
+       { "not", "b", "", OP_LOGICAL_NOT, { 1 }, 0, nullptr },
+       { "bitfieldExtract", "iii", "", OP_BIT_FIELD_S_EXTRACT, { 1, 2, 3 }, 0, nullptr },
+       { "bitfieldExtract", "uii", "", OP_BIT_FIELD_U_EXTRACT, { 1, 2, 3 }, 0, nullptr },
+       { "bitfieldInsert", "iiii", "", OP_BIT_FIELD_INSERT, { 1, 2, 3, 4 }, 0, nullptr },
+       { "bitfieldInsert", "uuii", "", OP_BIT_FIELD_INSERT, { 1, 2, 3, 4 }, 0, nullptr },
+       { "bitfieldReverse", "i", "", OP_BIT_REVERSE, { 1 }, 0, nullptr },
+       { "bitfieldReverse", "u", "", OP_BIT_REVERSE, { 1 }, 0, nullptr },
+       { "bitCount", "i", "", OP_BIT_COUNT, { 1 }, 0, nullptr },
+       { "findLSB", "i", "GLSL.std.450", GLSL450_FIND_I_LSB, { 1 }, 0, nullptr },
+       { "findLSB", "u", "GLSL.std.450", GLSL450_FIND_I_LSB, { 1 }, 0, nullptr },
+       { "findMSB", "i", "GLSL.std.450", GLSL450_FIND_S_MSB, { 1 }, 0, nullptr },
+       { "findMSB", "u", "GLSL.std.450", GLSL450_FIND_U_MSB, { 1 }, 0, nullptr },
        { "textureSize", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
        { "textureQueryLod", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
        { "textureQueryLevels", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
@@ -119,21 +119,21 @@ const SpirVGenerator::BuiltinFunctionInfo SpirVGenerator::builtin_functions[] =
        { "imageSamples", "", "", 0, { }, CAP_IMAGE_QUERY, &SpirVGenerator::visit_builtin_texture_query },
        { "imageLoad", "", "", 0, { }, 0, &SpirVGenerator::visit_builtin_texture_fetch },
        { "imageStore", "", "", 0, { }, 0, &SpirVGenerator::visit_builtin_texture_store },
-       { "EmitVertex", "", "", OP_EMIT_VERTEX, { }, 0, 0 },
-       { "EndPrimitive", "", "", OP_END_PRIMITIVE, { }, 0, 0 },
-       { "dFdx", "f", "", OP_DP_DX, { 1 }, 0, 0 },
-       { "dFdy", "f", "", OP_DP_DY, { 1 }, 0, 0 },
-       { "dFdxFine", "f", "", OP_DP_DX_FINE, { 1 }, CAP_DERIVATIVE_CONTROL, 0 },
-       { "dFdyFine", "f", "", OP_DP_DY_FINE, { 1 }, CAP_DERIVATIVE_CONTROL, 0 },
-       { "dFdxCoarse", "f", "", OP_DP_DX_COARSE, { 1 }, CAP_DERIVATIVE_CONTROL, 0 },
-       { "dFdyCoarse", "f", "", OP_DP_DY_COARSE, { 1 }, CAP_DERIVATIVE_CONTROL, 0 },
-       { "fwidth", "f", "", OP_FWIDTH, { 1 }, 0, 0 },
-       { "fwidthFine", "f", "", OP_FWIDTH_FINE, { 1 }, CAP_DERIVATIVE_CONTROL, 0 },
-       { "fwidthCoarse", "f", "", OP_FWIDTH_COARSE, { 1 }, CAP_DERIVATIVE_CONTROL, 0 },
+       { "EmitVertex", "", "", OP_EMIT_VERTEX, { }, 0, nullptr },
+       { "EndPrimitive", "", "", OP_END_PRIMITIVE, { }, 0, nullptr },
+       { "dFdx", "f", "", OP_DP_DX, { 1 }, 0, nullptr },
+       { "dFdy", "f", "", OP_DP_DY, { 1 }, 0, nullptr },
+       { "dFdxFine", "f", "", OP_DP_DX_FINE, { 1 }, CAP_DERIVATIVE_CONTROL, nullptr },
+       { "dFdyFine", "f", "", OP_DP_DY_FINE, { 1 }, CAP_DERIVATIVE_CONTROL, nullptr },
+       { "dFdxCoarse", "f", "", OP_DP_DX_COARSE, { 1 }, CAP_DERIVATIVE_CONTROL, nullptr },
+       { "dFdyCoarse", "f", "", OP_DP_DY_COARSE, { 1 }, CAP_DERIVATIVE_CONTROL, nullptr },
+       { "fwidth", "f", "", OP_FWIDTH, { 1 }, 0, nullptr },
+       { "fwidthFine", "f", "", OP_FWIDTH_FINE, { 1 }, CAP_DERIVATIVE_CONTROL, nullptr },
+       { "fwidthCoarse", "f", "", OP_FWIDTH_COARSE, { 1 }, CAP_DERIVATIVE_CONTROL, nullptr },
        { "interpolateAtCentroid", "", "", 0, { }, CAP_INTERPOLATION_FUNCTION, &SpirVGenerator::visit_builtin_interpolate },
        { "interpolateAtSample", "", "", 0, { }, CAP_INTERPOLATION_FUNCTION, &SpirVGenerator::visit_builtin_interpolate },
        { "interpolateAtOffset", "", "", 0, { }, CAP_INTERPOLATION_FUNCTION, &SpirVGenerator::visit_builtin_interpolate },
-       { "", "", "", 0, { }, 0, 0 }
+       { "", "", "", 0, { }, 0, nullptr }
 };
 
 SpirVGenerator::SpirVGenerator():
@@ -672,7 +672,7 @@ void SpirVGenerator::visit_composite(Expression &base_expr, unsigned index, Type
 {
        if(!composite_access)
        {
-               r_composite_base = 0;
+               r_composite_base = nullptr;
                r_composite_base_id = 0;
                r_composite_chain.clear();
        }
@@ -983,7 +983,7 @@ void SpirVGenerator::visit(BinaryExpression &binary)
                                swap_operands = (basic_right.kind==BasicTypeDeclaration::VECTOR);
                        }
                }
-               else if((basic_left.base_type!=0)!=(basic_right.base_type!=0))
+               else if((basic_left.base_type!=nullptr)!=(basic_right.base_type!=nullptr))
                {
                        /* One operand is scalar and the other is a vector or a matrix.
                        Expand the scalar to a vector of appropriate size. */
@@ -1715,7 +1715,7 @@ void SpirVGenerator::visit(VariableDeclaration &var)
                        throw internal_error("const variable without initializer");
 
                int spec_id = get_layout_value(var.layout.get(), "constant_id");
-               Id *spec_var_id = (spec_id>=0 ? &declared_spec_ids[spec_id] : 0);
+               Id *spec_var_id = (spec_id>=0 ? &declared_spec_ids[spec_id] : nullptr);
                if(spec_id>=0 && *spec_var_id)
                {
                        insert_unique(declared_ids, &var, Declaration(*spec_var_id, type_id));
index e98fd91e7142ec0fecabd8850c76557071c5ea06..af30212ed048787d10b050ba2df05a86073c2902 100644 (file)
@@ -71,8 +71,8 @@ private:
        };
 
        Features features;
-       Stage *stage = 0;
-       FunctionDeclaration *current_function = 0;
+       Stage *stage = nullptr;
+       FunctionDeclaration *current_function = nullptr;
        std::vector<const InterfaceLayout *> interface_layouts;
        SpirVContent content;
        SpirVWriter writer;
@@ -96,7 +96,7 @@ private:
        bool reachable = false;
        bool composite_access = false;
        Id r_composite_base_id = 0;
-       Node *r_composite_base = 0;
+       Node *r_composite_base = nullptr;
        std::vector<unsigned> r_composite_chain;
        Id assignment_source_id = 0;
        Id loop_merge_block_id = 0;
index 30369f2c8fe4fd022434711f13b59732a74538db..c73b725a68b8c3315c9c2ef0b8b355a9a3aca4d6 100644 (file)
@@ -9,7 +9,7 @@ namespace SL {
 
 SpirVWriter::SpirVWriter(SpirVContent &c):
        content(c),
-       op_target(0),
+       op_target(nullptr),
        op_head_pos(0),
        current_block_id(0)
 { }
@@ -82,7 +82,7 @@ void SpirVWriter::end_op(Opcode opcode)
        else
                op_head |= (words<<16);
 
-       op_target = 0;
+       op_target = nullptr;
        op_head_pos = 0;
 }
 
index c37ad0895a86dfd09517b8a7d94d764c3fc4ed8f..f69c70bf2f099c4c7e8d17715bb5389fc4ad964b 100644 (file)
@@ -268,7 +268,7 @@ VariableDeclaration::VariableDeclaration(const VariableDeclaration &other):
 VariableDeclaration::~VariableDeclaration()
 {
        if(linked_declaration && linked_declaration->linked_declaration==this)
-               linked_declaration->linked_declaration = 0;
+               linked_declaration->linked_declaration = nullptr;
 }
 
 void VariableDeclaration::visit(NodeVisitor &visitor)
@@ -286,7 +286,7 @@ FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other):
        overrd(other.overrd),
        body(other.body),
        signature(other.signature),
-       definition(other.definition==&other ? this : 0)
+       definition(other.definition==&other ? this : nullptr)
        // Do not copy return type declaration
 { }
 
@@ -365,7 +365,7 @@ string get_unused_variable_name(const Block &block, const string &base)
 TypeDeclaration *get_ultimate_base_type(TypeDeclaration *type)
 {
        if(!type)
-               return 0;
+               return nullptr;
        while(const BasicTypeDeclaration *basic = dynamic_cast<const BasicTypeDeclaration *>(type))
        {
                if(!basic->base_type)
index 1f2a5182bee1b95b089f7bba8ba152d9ab9f12a0..b3932c6fc8d9c05bfe7d52e60c52161f4ef47f86 100644 (file)
@@ -81,7 +81,7 @@ class NodePtr: public RefPtr<T>
 public:
        NodePtr() = default;
        NodePtr(T *p): RefPtr<T>(p) { }
-       NodePtr(const NodePtr &p): RefPtr<T>(p ? p->clone() : 0) { }
+       NodePtr(const NodePtr &p): RefPtr<T>(p ? p->clone() : nullptr) { }
        NodePtr &operator=(const NodePtr &p) = default;
 
        template<typename U>
@@ -128,7 +128,7 @@ struct Block: Node
        bool use_braces = false;
 
        std::map<std::string, VariableDeclaration *> variables;
-       Block *parent = 0;
+       Block *parent = nullptr;
 
        Block() = default;
        Block(const Block &);
@@ -139,9 +139,9 @@ struct Block: Node
 
 struct Expression: Node
 {
-       const Operator *oper = 0;
+       const Operator *oper = nullptr;
 
-       TypeDeclaration *type = 0;
+       TypeDeclaration *type = nullptr;
        bool lvalue = false;
 
        virtual Expression *clone() const = 0;
@@ -160,7 +160,7 @@ struct VariableReference: Expression
 {
        std::string name;
 
-       VariableDeclaration *declaration = 0;
+       VariableDeclaration *declaration = nullptr;
 
        VariableReference() = default;
        VariableReference(const VariableReference &);
@@ -174,7 +174,7 @@ struct MemberAccess: Expression
        NodePtr<Expression> left;
        std::string member;
 
-       VariableDeclaration *declaration = 0;
+       VariableDeclaration *declaration = nullptr;
        int index = -1;
 
        MemberAccess() = default;
@@ -223,11 +223,11 @@ struct Assignment: BinaryExpression
                        ARRAY = 0xC0
                };
 
-               VariableDeclaration *declaration = 0;
+               VariableDeclaration *declaration = nullptr;
                std::uint8_t chain_len = 0;
                std::uint8_t chain[7] = { };
 
-               Target(VariableDeclaration *d = 0): declaration(d) { }
+               Target(VariableDeclaration *d = nullptr): declaration(d) { }
 
                bool operator<(const Target &) const;
        };
@@ -259,7 +259,7 @@ struct FunctionCall: Expression
        bool constructor = false;
        NodeArray<Expression> arguments;
 
-       FunctionDeclaration *declaration = 0;
+       FunctionDeclaration *declaration = nullptr;
 
        FunctionCall() = default;
        FunctionCall(const FunctionCall &);
@@ -347,7 +347,7 @@ struct BasicTypeDeclaration: TypeDeclaration
        bool extended_alignment = false;
        std::string base;
 
-       TypeDeclaration *base_type = 0;
+       TypeDeclaration *base_type = nullptr;
 
        BasicTypeDeclaration() = default;
        BasicTypeDeclaration(const BasicTypeDeclaration &);
@@ -374,8 +374,8 @@ struct ImageTypeDeclaration: TypeDeclaration
        std::string base;
        std::string format;
 
-       TypeDeclaration *base_type = 0;
-       ImageTypeDeclaration *base_image = 0;
+       TypeDeclaration *base_type = nullptr;
+       ImageTypeDeclaration *base_image = nullptr;
 
        virtual ImageTypeDeclaration *clone() const { return new ImageTypeDeclaration(*this); }
        virtual void visit(NodeVisitor &);
@@ -387,7 +387,7 @@ struct StructDeclaration: TypeDeclaration
        std::string block_name;
        bool extended_alignment = false;
 
-       VariableDeclaration *block_declaration = 0;
+       VariableDeclaration *block_declaration = nullptr;
 
        StructDeclaration();
        StructDeclaration(const StructDeclaration &);
@@ -410,9 +410,9 @@ struct VariableDeclaration: Statement
        NodePtr<Expression> array_size;
        NodePtr<Expression> init_expression;
 
-       TypeDeclaration *type_declaration = 0;
-       StructDeclaration *block_declaration = 0;
-       VariableDeclaration *linked_declaration = 0;
+       TypeDeclaration *type_declaration = nullptr;
+       StructDeclaration *block_declaration = nullptr;
+       VariableDeclaration *linked_declaration = nullptr;
 
        VariableDeclaration() = default;
        VariableDeclaration(const VariableDeclaration &);
@@ -432,8 +432,8 @@ struct FunctionDeclaration: Statement
        Block body;
 
        std::string signature;
-       FunctionDeclaration *definition = 0;
-       TypeDeclaration *return_type_declaration = 0;
+       FunctionDeclaration *definition = nullptr;
+       TypeDeclaration *return_type_declaration = nullptr;
 
        FunctionDeclaration() = default;
        FunctionDeclaration(const FunctionDeclaration &);
@@ -501,7 +501,7 @@ struct Stage
        };
 
        Type type;
-       Stage *previous = 0;
+       Stage *previous = nullptr;
        Block content;
        std::map<std::string, TypeDeclaration *> types;
        std::map<std::string, VariableDeclaration *> interface_blocks;
index 304bcd9ec4ecdd9afd61c754a48bdf238995737c..3ef58181da2c48b8f68a15e904fb22b308791982 100644 (file)
@@ -40,7 +40,7 @@ void DeclarationValidator::apply(Stage &s, const Features &f)
        features = f;
        s.content.visit(*this);
 
-       Node *global_err_node = 0;
+       Node *global_err_node = nullptr;
        auto i = s.functions.find("main()");
        if(i!=s.functions.end())
                global_err_node = i->second;
index c90a9d757887387fc8b189364f7541abc1771221..da1ed1c32231c15ff3361c24ede6bfeb9897969c 100644 (file)
@@ -15,8 +15,8 @@ messages. */
 class Validator: protected TraversingVisitor
 {
 protected:
-       Stage *stage = 0;
-       Node *last_provoker = 0;
+       Stage *stage = nullptr;
+       Node *last_provoker = nullptr;
 
        Validator() = default;
 
@@ -41,9 +41,9 @@ private:
 
        Features features;
        ScopeType scope = GLOBAL;
-       InterfaceLayout *iface_layout = 0;
-       VariableDeclaration *iface_block = 0;
-       VariableDeclaration *variable = 0;
+       InterfaceLayout *iface_layout = nullptr;
+       VariableDeclaration *iface_block = nullptr;
+       VariableDeclaration *variable = nullptr;
        bool have_input_primitive = false;
        bool have_output_primitive = false;
        bool have_output_vertex_count = false;
@@ -122,7 +122,7 @@ private:
                SPEC_CONSTANT
        };
 
-       FunctionDeclaration *current_function = 0;
+       FunctionDeclaration *current_function = nullptr;
        bool in_struct = false;
        ConstantKind constant_expression = NOT_CONSTANT;
 
@@ -186,8 +186,8 @@ class GlobalInterfaceValidator: private Validator
 private:
        struct Uniform
        {
-               Node *node = 0;
-               TypeDeclaration *type = 0;
+               Node *node = nullptr;
+               TypeDeclaration *type = nullptr;
                std::string name;
                int location = -1;
                unsigned loc_count = 1;
index bcd6051a7c4a65b13604a5e75ec63eeed9c8de7b..d3a08d8d60c70439b74162ec2d6c79f0d6f06aec 100644 (file)
@@ -172,7 +172,7 @@ void NodeRemover::visit(StructDeclaration &strct)
                        string key = format("%s %s", strct.block_declaration->interface, strct.block_name);
                        remove_from_map(stage->interface_blocks, key, *strct.block_declaration);
                        remove_from_map(stage->interface_blocks, strct.block_declaration->name, *strct.block_declaration);
-                       strct.block_declaration->block_declaration = 0;
+                       strct.block_declaration->block_declaration = nullptr;
                }
        }
 }
@@ -186,14 +186,14 @@ void NodeRemover::visit(VariableDeclaration &var)
                {
                        remove_from_map(stage->interface_blocks, format("%s %s", var.interface, var.block_declaration->block_name), var);
                        remove_from_map(stage->interface_blocks, var.name, var);
-                       var.block_declaration->block_declaration = 0;
+                       var.block_declaration->block_declaration = nullptr;
                }
                stage->locations.erase(var.name);
                if(var.linked_declaration)
-                       var.linked_declaration->linked_declaration = 0;
+                       var.linked_declaration->linked_declaration = nullptr;
        }
        else if(var.init_expression && to_remove->count(var.init_expression.get()))
-               var.init_expression = 0;
+               var.init_expression = nullptr;
 }
 
 void NodeRemover::visit(FunctionDeclaration &func)
@@ -210,7 +210,7 @@ void NodeRemover::visit(FunctionDeclaration &func)
 void NodeRemover::visit(Iteration &iter)
 {
        if(to_remove->count(iter.init_statement.get()))
-               iter.init_statement = 0;
+               iter.init_statement = nullptr;
        TraversingVisitor::visit(iter);
 }
 
index 0b561b8d1d496032d8e351c1bf6b0f3573f8e3e1..9a5aaff75b55e6ac118317038bcb1c3a46a180e8 100644 (file)
@@ -48,7 +48,7 @@ public:
 class TraversingVisitor: public NodeVisitor
 {
 protected:
-       Block *current_block = 0;
+       Block *current_block = nullptr;
 
        TraversingVisitor() = default;
 
@@ -79,8 +79,8 @@ public:
 class NodeRemover: private TraversingVisitor
 {
 private:
-       Stage *stage = 0;
-       const std::set<Node *> *to_remove = 0;
+       Stage *stage = nullptr;
+       const std::set<Node *> *to_remove = nullptr;
 
 public:
        void apply(Stage &, const std::set<Node *> &);
@@ -105,8 +105,8 @@ on the same hierarchly level as the target node are reordered. */
 class NodeReorderer: private TraversingVisitor
 {
 private:
-       Node *reorder_before = 0;
-       const std::set<Node *> *to_reorder = 0;
+       Node *reorder_before = nullptr;
+       const std::set<Node *> *to_reorder = nullptr;
 
 public:
        void apply(Stage &, Node &, const std::set<Node *> &);
index 3a4b7487ec2fc528fe2cecc54010800a552e3971..412bb7191e126a4c884f924ee1e6036dbf357949 100644 (file)
@@ -28,17 +28,17 @@ BasicMaterial::BasicMaterial()
 void BasicMaterial::fill_program_info(string &module_name, map<string, int> &spec_values) const
 {
        module_name = "phong.glsl";
-       spec_values["use_diffuse_map"] = (diffuse.texture!=0);
+       spec_values["use_diffuse_map"] = (diffuse.texture!=nullptr);
        bool use_specular = (specular.texture || specular.value.r || specular.value.g || specular.value.b);
        spec_values["use_specular"] = use_specular;
-       spec_values["use_specular_map"] = (specular.texture!=0);
-       spec_values["use_shininess_map"] = (use_specular && shininess.texture!=0);
-       spec_values["use_normal_map"] = (normal.texture!=0);
+       spec_values["use_specular_map"] = (specular.texture!=nullptr);
+       spec_values["use_shininess_map"] = (use_specular && shininess.texture!=nullptr);
+       spec_values["use_normal_map"] = (normal.texture!=nullptr);
        bool use_emission = (emission.texture || emission.value.r || emission.value.g || emission.value.b);
        spec_values["use_emission"] = use_emission;
-       spec_values["use_emission_map"] = (emission.texture!=0);
-       spec_values["use_reflectivity"] = (reflectivity.value!=0 || reflectivity.texture!=0);
-       spec_values["use_reflectivity_map"] = (reflectivity.texture!=0);
+       spec_values["use_emission_map"] = (emission.texture!=nullptr);
+       spec_values["use_reflectivity"] = (reflectivity.value!=0 || reflectivity.texture!=nullptr);
+       spec_values["use_reflectivity_map"] = (reflectivity.texture!=nullptr);
 }
 
 const Texture *BasicMaterial::get_texture(Tag tag) const
@@ -56,7 +56,7 @@ const Texture *BasicMaterial::get_texture(Tag tag) const
        else if(tag==texture_tags[5])
                return reflectivity.texture;
        else
-               return 0;
+               return nullptr;
 }
 
 void BasicMaterial::set_diffuse(const Color &color)
index d2d741ccae762d3199237d5b3e6473a9a86c1e03..f9ae80873a6aa180045c5e758ceba150c52dad51 100644 (file)
@@ -40,7 +40,7 @@ protected:
                T value;
                const Texture *texture;
 
-               Property(): value(T()), texture(0) { }
+               Property(): value(T()), texture(nullptr) { }
        };
 
        template<typename C>
@@ -74,7 +74,7 @@ public:
        };
 
 protected:
-       const Sampler *sampler = 0;
+       const Sampler *sampler = nullptr;
        float alpha_cutoff = 0.0f;
        float alpha_feather = 1.0f;
        ProgramData shdata;
index 41da18b5992c87845d0e31236d85d6e7842db745..43da34917e61c4c3e56b16787d2d8ca44d4d4a64 100644 (file)
@@ -70,14 +70,14 @@ const Texture2D &PbrMaterial::get_or_create_fresnel_lookup()
 void PbrMaterial::fill_program_info(string &module_name, map<string, int> &spec_values) const
 {
        module_name = "pbr_material.glsl";
-       spec_values["use_base_color_map"] = (base_color.texture!=0);
-       spec_values["use_normal_map"] = (normal.texture!=0);
-       spec_values["use_metalness_map"] = (metalness.texture!=0);
-       spec_values["use_roughness_map"] = (roughness.texture!=0);
-       spec_values["use_occlusion_map"] = (occlusion.texture!=0);
+       spec_values["use_base_color_map"] = (base_color.texture!=nullptr);
+       spec_values["use_normal_map"] = (normal.texture!=nullptr);
+       spec_values["use_metalness_map"] = (metalness.texture!=nullptr);
+       spec_values["use_roughness_map"] = (roughness.texture!=nullptr);
+       spec_values["use_occlusion_map"] = (occlusion.texture!=nullptr);
        bool use_emission = (emission.texture || emission.value.r || emission.value.g || emission.value.b);
        spec_values["use_emission"] = use_emission;
-       spec_values["use_emission_map"] = (emission.texture!=0);
+       spec_values["use_emission_map"] = (emission.texture!=nullptr);
 }
 
 const Texture *PbrMaterial::get_texture(Tag tag) const
@@ -97,7 +97,7 @@ const Texture *PbrMaterial::get_texture(Tag tag) const
        else if(tag==texture_tags[6])
                return &fresnel_lookup;
        else
-               return 0;
+               return nullptr;
 }
 
 const Sampler *PbrMaterial::get_sampler(Tag tag) const
@@ -186,7 +186,7 @@ void PbrMaterial::Loader::init_actions()
        add_property("roughness", &PbrMaterial::set_roughness, &PbrMaterial::set_roughness_map);
        add_property("occlusion", &PbrMaterial::set_occlusion_map);
        add_property("emission", &PbrMaterial::set_emission, &PbrMaterial::set_emission_map, false);
-       add_property("tint", &PbrMaterial::set_tint, 0, true);
+       add_property("tint", &PbrMaterial::set_tint, nullptr, true);
 }
 
 } // namespace GL
index f0214666cbc3a0ff285e5f53952c23e2656adbc9..ac63585eee8958f41e3d03541acde199517c8953 100644 (file)
@@ -33,7 +33,7 @@ ProgramData::ProgramData(ProgramData &&other):
        debug_name(move(other.debug_name))
 {
        other.blocks.clear();
-       other.buffer = 0;
+       other.buffer = nullptr;
 }
 
 ProgramData::~ProgramData()
@@ -644,7 +644,7 @@ vector<ProgramData::ProgramBlock>::const_iterator ProgramData::prepare_program(c
                                if(shared.dirty==ALL_ONES)
                                        update_block_uniform_indices(shared, b);
                                prog_begin->masks.used |= shared.used;
-                               j->block = (shared.used ? shared.block : 0);
+                               j->block = (shared.used ? shared.block : nullptr);
                                ++j;
                        }
                }
@@ -718,7 +718,7 @@ ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h):
        block_hash(h),
        used(0),
        dirty(0),
-       block(0)
+       block(nullptr)
 {
        indices.type_flag = 0xFD;
 }
index f60f712e1a5bf6e4335b0f7fee79c2d9677719cf..41121e4457976431c7ba20a61afe9b5f95f939eb 100644 (file)
@@ -156,14 +156,14 @@ private:
        unsigned generation = 0;
        mutable std::vector<SharedBlock> blocks;
        mutable std::vector<ProgramBlock> programs;
-       mutable UniformBlock *last_buffer_block = 0;
-       mutable Buffer *buffer = 0;
+       mutable UniformBlock *last_buffer_block = nullptr;
+       mutable Buffer *buffer = nullptr;
        bool streaming = false;
        mutable Mask dirty = 0;
        std::string debug_name;
 
 public:
-       ProgramData(const Program * = 0);
+       ProgramData(const Program * = nullptr);
        ProgramData(ProgramData &&);
        ~ProgramData();
 
index e489dbe7c2540ab5c1bd114fc7ca3138bf8bd5a6..9a7b637b612040b3a088a2de94e50edacc4f2dcd 100644 (file)
@@ -60,7 +60,7 @@ void RenderMethod::set_shader_program(const Program *prog, const ProgramData *da
                shdata->copy_uniforms(*data);
        }
        else
-               shdata = 0;
+               shdata = nullptr;
        maybe_create_material_shader();
 }
 
index b3140dd3f5adead4ed40b351023b68654c352c6d..e0356b8234ee9c70d2fa093f2139263c3a581a68 100644 (file)
@@ -76,14 +76,14 @@ private:
                const Texture *texture;
                const Sampler *sampler;
 
-               TextureSlot(Tag t): tag(t), texture(0), sampler(0) { }
+               TextureSlot(Tag t): tag(t), texture(nullptr), sampler(nullptr) { }
        };
 
-       const Program *shprog = 0;
+       const Program *shprog = nullptr;
        bool shprog_from_material = false;
        RefPtr<ProgramData> shdata;
        std::map<Tag, Tag> uniform_slots;
-       const Material *material = 0;
+       const Material *material = nullptr;
        std::string material_slot;
        std::vector<TextureSlot> textures;
        CullMode face_cull = NO_CULL;
@@ -109,7 +109,7 @@ public:
 
        const Material *get_material() const { return material; }
        const std::string &get_material_slot_name() const { return material_slot; }
-       void set_texture(Tag, const Texture *, const Sampler * = 0);
+       void set_texture(Tag, const Texture *, const Sampler * = nullptr);
        Tag get_texture_tag(const std::string &) const;
        const Texture *get_texture(Tag) const;
        const Sampler *get_sampler(Tag) const;
index a1295bbaea82bf7f5a688195addf6dbce7ae9c09..70af9bbbe8ca6a8a0e2d509c26f1fb918a183847 100644 (file)
@@ -72,7 +72,7 @@ const Texture *SplatMaterial::get_texture(Tag tag) const
        else if(tag==texture_tags[6])
                return &fresnel_lookup;
        else
-               return 0;
+               return nullptr;
 }
 
 const Sampler *SplatMaterial::get_sampler(Tag tag) const
index d957c71c968baebc1f31ecebdfe121eee3ed2bd4..9fc7de4e174292139ecf4198f1dc27370a332433 100644 (file)
@@ -72,7 +72,7 @@ private:
 
        struct MapArray
        {
-               Texture2DArray *texture = 0;
+               Texture2DArray *texture = nullptr;
                PixelFormat format = NO_PIXELFORMAT;
                unsigned width = 0;
                unsigned height = 0;
index 92ccde46b79a3052358f50b62fada8a0bcdc13b8..55914f35313ee44a975738f2afdeda203aab764d 100644 (file)
@@ -30,7 +30,7 @@ const RenderMethod &Technique::get_method(Tag tag) const
 const RenderMethod *Technique::find_method(Tag tag) const
 {
        auto i = methods.find(tag);
-       return (i!=methods.end() ? &i->second : 0);
+       return (i!=methods.end() ? &i->second : nullptr);
 }
 
 bool Technique::replace_texture(const string &slot, const Texture &tex)
index e1979051672481f277b953253589e88925c23716..7c3d26fcc5221443449d6d83df69cb44c35c0a13 100644 (file)
@@ -19,7 +19,7 @@ UnlitMaterial::UnlitMaterial()
 void UnlitMaterial::fill_program_info(string &module_name, map<string, int> &spec_values) const
 {
        module_name = "unlit.glsl";
-       spec_values["use_texture"] = (texture!=0);
+       spec_values["use_texture"] = (texture!=nullptr);
        spec_values["use_vertex_color"] = vertex_color;
 }
 
@@ -28,7 +28,7 @@ const Texture *UnlitMaterial::get_texture(Tag tag) const
        if(tag==texture_tags[0])
                return texture;
        else
-               return 0;
+               return nullptr;
 }
 
 void UnlitMaterial::set_texture(const Texture *tex)
@@ -60,7 +60,7 @@ void UnlitMaterial::Loader::init_actions()
 {
        Material::PropertyLoader<UnlitMaterial>::init_actions();
        add("texture", &Loader::property_texture, &UnlitMaterial::set_texture);
-       add_property("color", &UnlitMaterial::set_color, 0, true);
+       add_property("color", &UnlitMaterial::set_color, nullptr, true);
        add("vertex_color", &UnlitMaterial::vertex_color);
 }
 
index 8640e7c50efbd62bbcfd0783f5a28162aea1f4d7..a89e46ecc1785b857adf5816b7cc4f71b7077af9 100644 (file)
@@ -29,7 +29,7 @@ public:
        };
 
 private:
-       const Texture *texture = 0;
+       const Texture *texture = nullptr;
        Color color;
        bool vertex_color = false;
 
index e3fdf9a784ac2a91a47ef4da9f9d4cf1b75bc328..cd7b333b013613b2802b563eee1a75beb390182c 100644 (file)
@@ -37,8 +37,8 @@ protected:
 private:
        struct Block
        {
-               char *begin = 0;
-               char *end = 0;
+               char *begin = nullptr;
+               char *end = nullptr;
        };
 
        struct Slot
@@ -55,7 +55,7 @@ private:
 
        const Object &object;
        VertexArray instance_data;
-       Buffer *instance_buffer = 0;
+       Buffer *instance_buffer = nullptr;
        VertexSetup vtx_setup;
        int matrix_location = -1;
        unsigned matrix_offset = 0;
index e46274f6362a44fb2dc569269c8e39f5123eeadf..0ae739a38151eed4f8acf93152420065f3694ab7 100644 (file)
@@ -127,7 +127,7 @@ void Object::update_bounding_sphere()
 const Mesh *Object::get_mesh(unsigned i) const
 {
        if(i>=lods.size())
-               return 0;
+               return nullptr;
 
        return lods[i].mesh;
 }
@@ -140,7 +140,7 @@ void Object::set_technique(unsigned i, const Technique *t)
 const Technique *Object::get_technique(unsigned i) const
 {
        if(i>=lods.size())
-               return 0;
+               return nullptr;
 
        return lods[i].technique;
 }
index cb37a60e924eb266624f5762e0a990c0e23c5a2d..9858ec0ad41353ef9aaeed3e90862080ff4bc0f3 100644 (file)
@@ -54,7 +54,7 @@ void OccludedScene::populate_cache() const
                j++->renderable = r;
        for(; j!=occluded_cache.end(); ++j)
        {
-               j->renderable = 0;
+               j->renderable = nullptr;
                j->in_frustum = false;
        }
 
index b14e4f6751ef7216fddfed928d82c444b28cf17b..2a9f18a396421599854029a6fff1f7a9f4a112cd 100644 (file)
@@ -30,8 +30,8 @@ public:
 private:
        struct OccludedRenderable
        {
-               Renderable *renderable = 0;
-               const Geometry::BoundingSphere<float, 3> *bounding_sphere = 0;
+               Renderable *renderable = nullptr;
+               const Geometry::BoundingSphere<float, 3> *bounding_sphere = nullptr;
                bool in_frustum = false;
                bool occluder = false;
        };
index e9a0e064bf906546fbb7f4c98b9b771a5860037e..bf31a43e18b5a60bedf2cdf32f30f80c2ab3c3dc 100644 (file)
@@ -36,12 +36,12 @@ public:
        /** Returns the model matrix of the Renderable.  Null is returned if no such
        matrix exists.  The matrix should be in world space for some effects to work
        correctly. */
-       virtual const Matrix *get_matrix() const { return 0; }
+       virtual const Matrix *get_matrix() const { return nullptr; }
 
        /** Returns a bounding sphere that completely encloses the Renderable.  The
        bounding sphere is expressed in the renderable's coordinates.  Null is
        returned if the bounding sphere cannot be determined. */
-       virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return 0; }
+       virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return nullptr; }
 
        /** Called when starting to render a new frame. */
        virtual void setup_frame(Renderer &) { }
index 362285453c17e1632a9d3b7943132d3918a5bc33..e941d9fd86d540f4225a2b2009f198d69d438749 100644 (file)
@@ -52,7 +52,7 @@ void Renderer::end()
 
        RendererBackend::end();
 
-       current_state = 0;
+       current_state = nullptr;
        state_stack.clear();
        texture_stack.clear();
        shdata_stack.clear();
@@ -191,7 +191,7 @@ void Renderer::set_texture(Tag tag, const Texture *tex, int level, const Sampler
                }
        }
        else
-               samp = 0;
+               samp = nullptr;
 
        set_resource(texture_stack, state.texture_count, tag, { tex, samp, level });
 }
@@ -199,7 +199,7 @@ void Renderer::set_texture(Tag tag, const Texture *tex, int level, const Sampler
 void Renderer::set_storage_texture(Tag tag, const Texture *tex)
 {
        State &state = get_state();
-       set_resource(texture_stack, state.texture_count, tag, { tex, 0, 0 });
+       set_resource(texture_stack, state.texture_count, tag, { tex, nullptr, 0 });
 }
 
 template<typename T>
index e9c15fdc525db90ab885eb625a3fbb1c53867944..1703ddb19d8f37a8d2f4d37cb6a9ba19b2fb7758 100644 (file)
@@ -65,8 +65,8 @@ public:
 private:
        struct SampledTexture
        {
-               const Texture *texture = 0;
-               const Sampler *sampler = 0;
+               const Texture *texture = nullptr;
+               const Sampler *sampler = nullptr;
                int level = -1;
 
                SampledTexture() = default;
@@ -95,21 +95,21 @@ private:
        struct State
        {
                std::uintptr_t pipeline_key = 0;
-               const Camera *camera = 0;
+               const Camera *camera = nullptr;
                Matrix model_matrix;
-               const Framebuffer *framebuffer = 0;
-               const Rect *viewport = 0;
-               const Rect *scissor = 0;
+               const Framebuffer *framebuffer = nullptr;
+               const Rect *viewport = nullptr;
+               const Rect *scissor = nullptr;
                unsigned texture_count = 0;
-               const Program *shprog = 0;
+               const Program *shprog = nullptr;
                unsigned shdata_count = 0;
                unsigned buffer_count = 0;
-               const VertexSetup *vertex_setup = 0;
+               const VertexSetup *vertex_setup = nullptr;
                FaceWinding front_face = NON_MANIFOLD;
                CullMode face_cull = NO_CULL;
-               const DepthTest *depth_test = 0;
-               const StencilTest *stencil_test = 0;
-               const Blend *blend = 0;
+               const DepthTest *depth_test = nullptr;
+               const StencilTest *stencil_test = nullptr;
+               const Blend *blend = nullptr;
                unsigned object_lod_bias = 0;
        };
 
@@ -124,14 +124,14 @@ private:
        unsigned frame_number = 0;
        unsigned char changed = 0;
        std::vector<State> state_stack;
-       State *current_state = 0;
+       State *current_state = nullptr;
        ProgramData standard_shdata;
        std::vector<BoundProgramData> shdata_stack;
        std::vector<BoundResource<const Buffer *>> buffer_stack;
        std::vector<BoundResource<SampledTexture>> texture_stack;
-       const Texture *placeholder_texture = 0;
-       const Sampler *default_sampler = 0;
-       PipelineState *last_pipeline = 0;
+       const Texture *placeholder_texture = nullptr;
+       const Sampler *default_sampler = nullptr;
+       PipelineState *last_pipeline = nullptr;
        Commands commands;
 
        static const Tag world_obj_matrix_tag;
@@ -190,7 +190,7 @@ public:
 
        /** Sets the shader program to use.  As a convenience, uniform values may be
        specified at the same time. */
-       void set_shader_program(const Program *prog, const ProgramData *data = 0);
+       void set_shader_program(const Program *prog, const ProgramData *data = nullptr);
 
        /** Adds uniform values, which will be available for shader programs.  If
        multiple ProgramData objects with the same uniforms are added, the one added
@@ -199,8 +199,8 @@ public:
 
        void set_storage_buffer(Tag, const Buffer *);
 
-       void set_texture(Tag, const Texture *, const Sampler * = 0);
-       void set_texture(Tag, const Texture *, int, const Sampler * = 0);
+       void set_texture(Tag, const Texture *, const Sampler * = nullptr);
+       void set_texture(Tag, const Texture *, int, const Sampler * = nullptr);
        void set_storage_texture(Tag, const Texture *);
 
 private:
index bb694858ef609cca085bd66adcce04a114a46151..0e53e869c563fdcc68c94f1a906f73c18d7b08bb 100644 (file)
@@ -36,7 +36,7 @@ protected:
                static unsigned inline_counter;
 
        public:
-               Loader(Scene &s, Collection &c): Loader(s, c, 0) { }
+               Loader(Scene &s, Collection &c): Loader(s, c, nullptr) { }
                Loader(Scene &s, Collection &c, ContentMap &m) : Loader(s, c, &m) { }
        private:
                Loader(Scene &, Collection &, ContentMap *);
index a98ed50869a57e07d25eeb5fbc67625f4b164d86..6fe2cc0834826fb129c0c9d8c446c47d53f115e7 100644 (file)
@@ -150,9 +150,9 @@ void Sequence::render(Renderer &renderer, Tag tag) const
                        source = target_ms;
                }
 
-               renderer.set_depth_test(0);
-               renderer.set_stencil_test(0);
-               renderer.set_blend(0);
+               renderer.set_depth_test(nullptr);
+               renderer.set_stencil_test(nullptr);
+               renderer.set_blend(nullptr);
 
                for(unsigned i=0; i<postproc.size(); ++i)
                {
@@ -182,7 +182,7 @@ void Sequence::set_debug_name(const string &name)
 
 Sequence::Step::Step(Tag t, Renderable *r):
        tag(t),
-       lighting(0),
+       lighting(nullptr),
        renderable(r)
 { }
 
index c28b4bdd412d5b640e94b2a168f72627d2f2e264..9be14a4335826cf7c721bb3d8f8a8d023874a0cf 100644 (file)
@@ -64,8 +64,8 @@ public:
 private:
        struct OwnedObject
        {
-               void *pointer = 0;
-               void (*delete_func)(void *) = 0;
+               void *pointer = nullptr;
+               void (*delete_func)(void *) = nullptr;
 
                OwnedObject(void *p, void (*d)(void *)): pointer(p), delete_func(d) { }
        };
@@ -75,8 +75,8 @@ private:
        unsigned width = 0;
        unsigned height = 0;
        FrameFormat target_format;
-       RenderTarget *target[2] = { 0, 0 };
-       RenderTarget *target_ms = 0;
+       RenderTarget *target[2] = { nullptr, nullptr };
+       RenderTarget *target_ms = nullptr;
        bool clear_enabled = false;
        std::vector<Color> clear_colors;
        float clear_depth = 1.0f;
index eb2a2e3e186188cdff7d3e11b7eee247c80ed02e..564474be5d32e8e68b9cbc189766a6a6750c5112 100644 (file)
@@ -11,12 +11,12 @@ void Slot::set(Renderable *c)
 
 const Matrix *Slot::get_matrix() const
 {
-       return content ? content->get_matrix() : 0;
+       return content ? content->get_matrix() : nullptr;
 }
 
 const Geometry::BoundingSphere<float, 3> *Slot::get_bounding_sphere() const
 {
-       return content ? content->get_bounding_sphere() : 0;
+       return content ? content->get_bounding_sphere() : nullptr;
 }
 
 void Slot::setup_frame(Renderer &renderer)
index f80330d3ca68405e073f89c31e4ea0edf524a06a..91dca7c1f04d7b8c38abf6d0c11074faeec4da2f 100644 (file)
@@ -14,7 +14,7 @@ needs to be switched without affecting the rest.
 class MSPGL_API Slot: public Renderable
 {
 private:
-       Renderable *content = 0;
+       Renderable *content = nullptr;
 
 public:
        void set(Renderable *);
index 3415ab30cebd1175831b246f0a7ad29589447320..012b96a9dae913fc348e4842e95979eb38e9dfd4 100644 (file)
@@ -49,7 +49,7 @@ void Text::set_technique(const Technique *tech, Tag tex_tag)
        }
        else
        {
-               object.set_technique(0);
+               object.set_technique(nullptr);
                texture_tag = Tag();
                sampler = nullptr;
        }
index d16d97e5b2be0e25e82ff07554f44fc992cf6d1f..812ab71fabd1b17676d0ca839cc84641eb485ca4 100644 (file)
@@ -48,7 +48,7 @@ private:
        float width = 0.0f;
 
 public:
-       Text(const Font &, const Technique * = 0, Tag = Tag());
+       Text(const Font &, const Technique * = nullptr, Tag = Tag());
 
        const Mesh *get_mesh() const { return &mesh; }
 
index cac82d5d309815bb044b9fbc64b2f07b64b0ab5b..b55c5b4c3f754a4b76d2a97a368bd82b892bcc71 100644 (file)
@@ -16,7 +16,7 @@ View::View(View &&other):
        content(other.content),
        internal_renderer(other.internal_renderer)
 {
-       other.internal_renderer = 0;
+       other.internal_renderer = nullptr;
 }
 
 void View::set_camera(Camera *c)
index 48048d32139e75759d71cac2dc7d48c7b1dc4216..1c63f84bfc09be95b2a9199f27f8563f0ff180bf 100644 (file)
@@ -22,9 +22,9 @@ Sequence can be used to specify other tags and add post-processing.
 class MSPGL_API View: public NonCopyable
 {
 protected:
-       Camera *camera = 0;
-       Renderable *content = 0;
-       Renderer *internal_renderer = 0;
+       Camera *camera = nullptr;
+       Renderable *content = nullptr;
+       Renderer *internal_renderer = nullptr;
 
        View() = default;
 public:
index 60d611f8ace7a20386a9232497e2f2f0dfb42e1a..a517ddbe36281aa41bc9774ddac0e69c147f1faa 100644 (file)
@@ -19,8 +19,8 @@ Resource::Resource(Resource &&other):
                manager->move_resource(other, *this);
                manager_data = manager->get_data_for_resource(*this);
        }
-       other.manager = 0;
-       other.manager_data = 0;
+       other.manager = nullptr;
+       other.manager_data = nullptr;
 }
 
 void Resource::set_manager(ResourceManager *m)
@@ -34,7 +34,7 @@ void Resource::set_manager(ResourceManager *m)
                manager_data = manager->get_data_for_resource(*this);
        }
        else
-               manager_data = 0;
+               manager_data = nullptr;
 }
 
 bool Resource::is_loaded() const
index 9ab8c553a243812c9e2b19f7d358dcf4c551159c..465f81dc0ac407e40eb422dcc59e060a639e1d89 100644 (file)
@@ -27,8 +27,8 @@ public:
        };
 
 protected:
-       ResourceManager *manager = 0;
-       void *manager_data = 0;
+       ResourceManager *manager = nullptr;
+       void *manager_data = nullptr;
 
        Resource() = default;
        Resource(Resource &&);
@@ -39,7 +39,7 @@ public:
        ResourceManager *get_manager() const { return manager; }
        void *get_manager_data() const { return manager_data; }
        virtual int get_load_priority() const { return 0; }
-       virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) = 0;
+       virtual AsyncLoader *load(IO::Seekable &, const Resources * = nullptr) = 0;
        virtual bool is_loaded() const;
 
        /** Returns the amount of graphics memory used by this resource.  The
index 36b7091d17c2285406c5ad94d6246b6285518466..af780bf07c89306cfa94589b39f257c7d8adada1 100644 (file)
@@ -31,7 +31,7 @@ ResourceManager::~ResourceManager()
        thread.terminate();
 
        while(!resources.empty())
-               resources.begin()->second.resource->set_manager(0);
+               resources.begin()->second.resource->set_manager(nullptr);
 }
 
 void ResourceManager::set_loading_policy(LoadingPolicy p)
@@ -109,7 +109,7 @@ void ResourceManager::set_resource_location(Resource &r, const ResourceLocation
 const ResourceManager::ResourceLocation *ResourceManager::get_resource_location(const Resource &r) const
 {
        const ManagedResource &managed = get_managed_resource(r);
-       return managed.location.collection ? &managed.location : 0;
+       return managed.location.collection ? &managed.location : nullptr;
 }
 
 void ResourceManager::load_resource(Resource &r)
@@ -256,7 +256,7 @@ void ResourceManager::unload_by_size()
 
        while(total_data_size>size_limit)
        {
-               ManagedResource *best = 0;
+               ManagedResource *best = nullptr;
                uint64_t best_impact = 0;
                for(auto &kvp: resources)
                        if(kvp.second.state==ManagedResource::LOADED && kvp.second.last_used<unload_limit)
@@ -284,7 +284,7 @@ bool ResourceManager::age_order(ManagedResource *mr1, ManagedResource *mr2)
 
 
 ResourceManager::ResourceLocation::ResourceLocation():
-       collection(0)
+       collection(nullptr)
 { }
 
 ResourceManager::ResourceLocation::ResourceLocation(DataFile::Collection &c, const string &n):
@@ -296,8 +296,8 @@ ResourceManager::ResourceLocation::ResourceLocation(DataFile::Collection &c, con
 ResourceManager::ManagedResource::ManagedResource(Resource &r):
        resource(&r),
        load_priority(r.get_load_priority()),
-       io(0),
-       loader(0),
+       io(nullptr),
+       loader(nullptr),
        state(NOT_LOADED),
        last_used(0),
        data_size(0)
@@ -314,7 +314,7 @@ void ResourceManager::ManagedResource::start_loading()
        if(!loader)
        {
                delete io;
-               io = 0;
+               io = nullptr;
                throw logic_error("no loader created");
        }
        state = LOADING;
@@ -332,9 +332,9 @@ bool ResourceManager::ManagedResource::process(bool sync)
 void ResourceManager::ManagedResource::finish_loading(bool successful)
 {
        delete loader;
-       loader = 0;
+       loader = nullptr;
        delete io;
-       io = 0;
+       io = nullptr;
 
        if(successful)
        {
@@ -425,7 +425,7 @@ ResourceManager::ManagedResource *ResourceManager::LoadingThread::front(deque<Ma
 {
        MutexLock lock(queue_mutex);
        if(que.empty())
-               return 0;
+               return nullptr;
 
        return que.front();
 }
index 1a580552f878ff846bbc7b80f42de1ab8ab67747..fae77c9611c09c1a31f05d89640936caa295a904 100644 (file)
@@ -42,20 +42,20 @@ namespace GL {
 void init_shaderlib(DataFile::BuiltinSource &);
 void init_builtin_data(DataFile::BuiltinSource &);
 
-Resources *Resources::global_resources = 0;
+Resources *Resources::global_resources = nullptr;
 
 Resources::Resources(bool set_as_global):
-       resource_manager(0)
+       resource_manager(nullptr)
 {
        add_type<Animation>().suffix(".anim").keyword("animation");
        add_type<Armature>().suffix(".arma").keyword("armature");
        add_type<BasicMaterial>().base<Material>().suffix(".mat")
-               .creator([this](const string &n) -> BasicMaterial * { create_generic<Material>(n); return 0; })
+               .creator([this](const string &n) -> BasicMaterial * { create_generic<Material>(n); return nullptr; })
                .notify(&set_debug_name<Material>);
        add_type<Camera>().keyword("camera")
                .notify(&set_debug_name<Camera>);
        add_type<DirectionalLight>().base<Light>().suffix(".light")
-               .creator([this](const string &n) -> DirectionalLight * { create_generic<Light>(n); return 0; });
+               .creator([this](const string &n) -> DirectionalLight * { create_generic<Light>(n); return nullptr; });
        add_type<Font>().keyword("font");
        add_type<KeyFrame>().suffix(".kframe").keyword("keyframe");
        add_type<Lighting>().suffix(".lightn").keyword("lighting")
@@ -68,14 +68,14 @@ Resources::Resources(bool set_as_global):
                .notify(&set_debug_name<Module>);
        add_type<Object>().base<Renderable>().keyword("object");
        add_type<OccludedScene>().base<Scene>().base<Renderable>().suffix(".scene")
-               .creator([this](const string &n) -> OccludedScene * { create_generic<Scene>(n); return 0; });
+               .creator([this](const string &n) -> OccludedScene * { create_generic<Scene>(n); return nullptr; });
        add_type<OrderedScene>().base<Scene>().base<Renderable>().suffix(".scene")
-               .creator([this](const string &n) -> OrderedScene * { create_generic<Scene>(n); return 0; });
+               .creator([this](const string &n) -> OrderedScene * { create_generic<Scene>(n); return nullptr; });
        add_type<PbrMaterial>().base<Material>().suffix(".mat")
-               .creator([this](const string &n) -> PbrMaterial * { create_generic<Material>(n); return 0; })
+               .creator([this](const string &n) -> PbrMaterial * { create_generic<Material>(n); return nullptr; })
                .notify(&set_debug_name<Material>);
        add_type<PointLight>().base<Light>().suffix(".light")
-               .creator([this](const string &n) -> PointLight * { create_generic<Light>(n); return 0; });
+               .creator([this](const string &n) -> PointLight * { create_generic<Light>(n); return nullptr; });
        add_type<SequenceTemplate>().suffix(".seq").keyword("sequence");
        add_type<Pose>().keyword("pose");
        add_type<Program>().keyword("shader")
@@ -84,32 +84,32 @@ Resources::Resources(bool set_as_global):
        add_type<Sampler>().suffix(".samp").keyword("sampler")
                .notify(&set_debug_name<Sampler>);
        add_type<SimpleScene>().base<Scene>().base<Renderable>().suffix(".scene")
-               .creator([this](const string &n) -> SimpleScene * { create_generic<Scene>(n); return 0; });
+               .creator([this](const string &n) -> SimpleScene * { create_generic<Scene>(n); return nullptr; });
        add_type<SplatMaterial>().base<Material>().suffix(".mat")
-               .creator([this](const string &n) -> SplatMaterial * { create_generic<Material>(n); return 0; })
+               .creator([this](const string &n) -> SplatMaterial * { create_generic<Material>(n); return nullptr; })
                .notify(&set_debug_name<Material>);
        add_type<Technique>().suffix(".tech").keyword("technique")
                .notify(&set_debug_name<Technique>);
        add_type<Texture1D>().base<Texture>().suffix(".tex")
-               .creator([this](const string &n) -> Texture1D * { create_texture(n); return 0; })
+               .creator([this](const string &n) -> Texture1D * { create_texture(n); return nullptr; })
                .notify(&set_debug_name<Texture1D>);
        add_type<Texture2D>().base<Texture>().suffix(".tex").suffix(".png").suffix(".jpg")
-               .creator([this](const string &n) -> Texture2D * { create_texture(n); return 0; })
+               .creator([this](const string &n) -> Texture2D * { create_texture(n); return nullptr; })
                .notify(&set_debug_name<Texture2D>);
        add_type<Texture3D>().base<Texture>().suffix(".tex")
-               .creator([this](const string &n) -> Texture3D * { create_texture(n); return 0; })
+               .creator([this](const string &n) -> Texture3D * { create_texture(n); return nullptr; })
                .notify(&set_debug_name<Texture3D>);
        add_type<TextureCube>().base<Texture>().suffix(".tex")
-               .creator([this](const string &n) -> TextureCube * { create_texture(n); return 0; })
+               .creator([this](const string &n) -> TextureCube * { create_texture(n); return nullptr; })
                .notify(&set_debug_name<TextureCube>);
        add_type<Texture2DArray>().base<Texture>().suffix(".tex")
-               .creator([this](const string &n) -> Texture2DArray * { create_texture(n); return 0; })
+               .creator([this](const string &n) -> Texture2DArray * { create_texture(n); return nullptr; })
                .notify(&set_debug_name<Texture2DArray>);
        add_type<UnlitMaterial>().base<Material>().suffix(".mat")
-               .creator([this](const string &n) -> UnlitMaterial * { create_generic<Material>(n); return 0; })
+               .creator([this](const string &n) -> UnlitMaterial * { create_generic<Material>(n); return nullptr; })
                .notify(&set_debug_name<Material>);
        add_type<ZSortedScene>().base<Scene>().base<Renderable>().suffix(".scene")
-               .creator([this](const string &n) -> ZSortedScene * { create_generic<Scene>(n); return 0; });
+               .creator([this](const string &n) -> ZSortedScene * { create_generic<Scene>(n); return nullptr; });
 
        add_source(get_builtins());
 
@@ -120,7 +120,7 @@ Resources::Resources(bool set_as_global):
 Resources::~Resources()
 {
        if(this==global_resources)
-               global_resources = 0;
+               global_resources = nullptr;
 }
 
 Resources &Resources::get_global()
@@ -161,13 +161,13 @@ T *Resources::create_generic(const string &name)
                ldr.store_object(*this, name);
        }
 
-       return 0;
+       return nullptr;
 }
 
 Mesh *Resources::create_mesh(const string &name)
 {
        if(!resource_manager || name[0]=='_')
-               return 0;
+               return nullptr;
 
        if(RefPtr<IO::Seekable> io = open_raw(name))
        {
@@ -177,7 +177,7 @@ Mesh *Resources::create_mesh(const string &name)
                return mesh.release();
        }
 
-       return 0;
+       return nullptr;
 }
 
 Texture *Resources::create_texture(const string &name)
@@ -216,14 +216,14 @@ Texture *Resources::create_texture(const string &name)
                tex.release();
        }
 
-       return 0;
+       return nullptr;
 }
 
 Module *Resources::create_module(const string &name)
 {
        string ext = FS::extpart(name);
        if(ext!=".glsl" && ext!=".spv")
-               return 0;
+               return nullptr;
 
        if(RefPtr<IO::Seekable> io = open_raw(name))
        {
@@ -254,7 +254,7 @@ Module *Resources::create_module(const string &name)
                }
        }
 
-       return 0;
+       return nullptr;
 }
 
 Program *Resources::create_program(const string &name)
@@ -270,7 +270,7 @@ Program *Resources::create_program(const string &name)
                return shprog.release();
        }
 
-       return 0;
+       return nullptr;
 }
 
 template<typename T>
index 7d562397b9e0819305e625948dbd36d77c3e2dc2..f4bb924d1964b00e8140c310d5d2139b72839172 100644 (file)
@@ -135,10 +135,10 @@ Viewer::Viewer(int argc, char **argv):
        gl_device(window),
        mouse(window),
        view(window),
-       sequence(0),
-       renderable(0),
-       anim_object(0),
-       anim_player(0),
+       sequence(nullptr),
+       renderable(nullptr),
+       anim_object(nullptr),
+       anim_player(nullptr),
        distance(10),
        dragging(0)
 {
@@ -156,12 +156,12 @@ Viewer::Viewer(int argc, char **argv):
                }
        }
 
-       GL::Object *object = 0;
+       GL::Object *object = nullptr;
 
        string ext = FS::extpart(opts.renderable_name);
        if(ext==".mesh")
        {
-               GL::Mesh *mesh = 0;
+               GL::Mesh *mesh = nullptr;
                if(FS::exists(opts.renderable_name))
                {
                        mesh = new GL::Mesh;
@@ -173,7 +173,7 @@ Viewer::Viewer(int argc, char **argv):
 
                object = new GL::Object;
                GL::Technique *tech = new GL::Technique;
-               tech->add_method(0);
+               tech->add_method(GL::Tag());
                object->set_mesh(mesh);
                object->set_technique(tech);
                renderable = object;
@@ -235,7 +235,7 @@ Viewer::Viewer(int argc, char **argv):
                sequence = new GL::Sequence();
                sequence->set_debug_name("Sequence");
                sequence->set_clear_enabled(true);
-               GL::Sequence::Step &step = sequence->add_step(0, *renderable);
+               GL::Sequence::Step &step = sequence->add_step(GL::Tag(), *renderable);
                step.set_lighting(&lighting);
                step.set_depth_test(GL::LEQUAL);
        }