]> git.tdb.fi Git - libs/gl.git/commitdiff
Use standard fixed-size integer types
authorMikko Rasa <tdb@tdb.fi>
Fri, 17 Sep 2021 23:31:16 +0000 (02:31 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 18 Sep 2021 00:23:25 +0000 (03:23 +0300)
39 files changed:
source/builders/primitivebuilder.cpp
source/builders/vertexarraybuilder.cpp
source/core/batch.cpp
source/core/batch.h
source/core/framebuffer.cpp
source/core/frameformat.cpp
source/core/frameformat.h
source/core/mesh.cpp
source/core/mesh.h
source/core/module.cpp
source/core/module.h
source/core/program.cpp
source/core/texture.h
source/core/texture1d.cpp
source/core/texture1d.h
source/core/texture2d.cpp
source/core/texture2d.h
source/core/texture2dmultisample.cpp
source/core/texture2dmultisample.h
source/core/texture3d.cpp
source/core/texture3d.h
source/core/texturecube.cpp
source/core/texturecube.h
source/core/vertexformat.cpp
source/core/vertexformat.h
source/core/vertexsetup.cpp
source/glsl/compiler.cpp
source/glsl/compiler.h
source/glsl/resolve.cpp
source/glsl/spirv.h
source/glsl/spirvwriter.h
source/glsl/syntax.h
source/render/programdata.cpp
source/render/programdata.h
source/render/rendertarget.cpp
source/resources/resource.h
source/resources/resourcemanager.cpp
source/resources/resourcemanager.h
tools/glslcompiler.cpp

index 1a10af4beaa3794e8aa457a9b028b6ec83fd9bb1..ca16fcde68f9f804026d27c05ec25dd412d77572 100644 (file)
@@ -60,7 +60,7 @@ PrimitiveType PrimitiveBuilder::get_type() const
 void PrimitiveBuilder::vertex_(const Vector4 &v)
 {
        const VertexFormat &format = array.get_format();
-       for(const UInt16 *a=format.begin(); a!=format.end(); ++a)
+       for(const uint16_t *a=format.begin(); a!=format.end(); ++a)
        {
                unsigned sem = get_attribute_semantic(*a);
                if(sem<attr.size())
index 6ede4d2ab60f8a417087f0d784ac0b00642c2114..011a6c0515c59788e1db5675ee65c1f37c2ca9d2 100644 (file)
@@ -14,7 +14,7 @@ void VertexArrayBuilder::vertex_(const Vector4 &vtx)
 {
        char *ptr = array.append();
        const VertexFormat &format = array.get_format();
-       for(const UInt16 *a=format.begin(); a!=format.end(); ++a)
+       for(const uint16_t *a=format.begin(); a!=format.end(); ++a)
        {
                unsigned sem = get_attribute_semantic(*a);
                bool integer = is_integer_attribute(*a);
@@ -25,17 +25,17 @@ void VertexArrayBuilder::vertex_(const Vector4 &vtx)
                {
                        const Vector4 &value = (sem==0 ? vtx : attr[sem]);
                        if(type==UNSIGNED_BYTE)
-                               store_attribute<UInt8>(ptr, value, !integer, cc);
+                               store_attribute<uint8_t>(ptr, value, !integer, cc);
                        else if(type==BYTE)
-                               store_attribute<Int8>(ptr, value, !integer, cc);
+                               store_attribute<int8_t>(ptr, value, !integer, cc);
                        else if(type==UNSIGNED_SHORT)
-                               store_attribute<UInt16>(ptr, value, !integer, cc);
+                               store_attribute<uint16_t>(ptr, value, !integer, cc);
                        else if(type==SHORT)
-                               store_attribute<Int16>(ptr, value, !integer, cc);
+                               store_attribute<int16_t>(ptr, value, !integer, cc);
                        else if(type==UNSIGNED_INT)
-                               store_attribute<UInt32>(ptr, value, !integer, cc);
+                               store_attribute<uint32_t>(ptr, value, !integer, cc);
                        else if(type==INT)
-                               store_attribute<Int32>(ptr, value, !integer, cc);
+                               store_attribute<int32_t>(ptr, value, !integer, cc);
                        else if(type==FLOAT)
                                store_attribute<float>(ptr, value, false, cc);
                }
index d99bb95e24e53a2878143c949f5113fdfca980a5..b882cf1be18f6f5e0b2ede67e831a8eed0ae1cee 100644 (file)
@@ -10,7 +10,7 @@ using namespace std;
 namespace {
 
 template<typename T>
-void append(vector<Msp::UInt8> &data, T i)
+void append(vector<uint8_t> &data, T i)
 {
        data.insert(data.end(), sizeof(T), 0);
        *(T *)(&data[data.size()-sizeof(T)]) = i;
@@ -26,7 +26,7 @@ U convert(T n)
 }
 
 template<typename T, typename U>
-void expand(vector<Msp::UInt8> &data)
+void expand(vector<uint8_t> &data)
 {
        unsigned count = data.size()/sizeof(T);
        data.resize(count*sizeof(U));
@@ -35,7 +35,7 @@ void expand(vector<Msp::UInt8> &data)
 }
 
 template<typename T, typename U>
-void shrink(vector<Msp::UInt8> &data)
+void shrink(vector<uint8_t> &data)
 {
        unsigned count = data.size()/sizeof(T);
        for(unsigned i=0; i<count; ++i)
@@ -70,9 +70,9 @@ void Batch::set_index_type(DataType t)
                throw invalid_operation("Batch::set_data_type");
 
        if(index_type==UNSIGNED_SHORT && t==UNSIGNED_INT)
-               expand<UInt16, UInt32>(data);
+               expand<uint16_t, uint32_t>(data);
        else if(index_type==UNSIGNED_INT && t==UNSIGNED_SHORT)
-               shrink<UInt32, UInt16>(data);
+               shrink<uint32_t, uint16_t>(data);
 
        index_type = t;
        gl_index_type = get_gl_type(t);
@@ -132,9 +132,9 @@ Batch &Batch::append(const Batch &other)
        else if(MSP_primitive_restart)
        {
                if(index_type==UNSIGNED_INT)
-                       ::append<UInt32>(data, 0xFFFFFFFF);
+                       ::append<uint32_t>(data, 0xFFFFFFFF);
                else
-                       ::append<UInt16>(data, 0xFFFF);
+                       ::append<uint16_t>(data, 0xFFFF);
        }
        else if(prim_type==TRIANGLE_STRIP)
        {
@@ -165,22 +165,22 @@ void Batch::append_index(unsigned i)
                set_index_type(UNSIGNED_INT);
 
        if(index_type==UNSIGNED_INT)
-               ::append<UInt32>(data, i);
+               ::append<uint32_t>(data, i);
        else
-               ::append<UInt16>(data, i);
+               ::append<uint16_t>(data, i);
 }
 
 unsigned Batch::get_index_size() const
 {
-       return (index_type==UNSIGNED_INT ? sizeof(UInt32) : sizeof(UInt16));
+       return (index_type==UNSIGNED_INT ? sizeof(uint32_t) : sizeof(uint16_t));
 }
 
 unsigned Batch::get_index(unsigned i) const
 {
        if(index_type==UNSIGNED_INT)
-               return *(UInt32 *)&data[i*sizeof(UInt32)];
+               return *(uint32_t *)&data[i*sizeof(uint32_t)];
        else
-               return *(UInt16 *)&data[i*sizeof(UInt16)];
+               return *(uint16_t *)&data[i*sizeof(uint16_t)];
 }
 
 
index f551a5e9fb0952049018d3984beb29835f8fcaf1..51cc573b18be326ac7b3ae4c26b75cf146e77aa6 100644 (file)
@@ -36,7 +36,7 @@ private:
        GLenum gl_prim_type;
        DataType index_type;
        GLenum gl_index_type;
-       std::vector<UInt8> data;
+       std::vector<std::uint8_t> data;
        unsigned max_index;
 
 public:
index 0ce00becd23d5503ca5f26fec5f13eab065f9f17..e9d8863ca16e4e0379a11e9777def136cb596d2e 100644 (file)
@@ -131,7 +131,7 @@ void Framebuffer::update() const
        vector<GLenum> color_bufs;
        color_bufs.reserve(format.size());
        unsigned i = 0;
-       for(const UInt16 *j=format.begin(); j!=format.end(); ++j, ++i)
+       for(const uint16_t *j=format.begin(); j!=format.end(); ++j, ++i)
        {
                GLenum gl_attach_point = get_gl_attachment(static_cast<FrameAttachment>(*j));
                if(dirty&(1<<i))
@@ -254,7 +254,7 @@ void Framebuffer::set_attachment(FrameAttachment attch, Texture &tex, unsigned l
                throw incompatible_data("Framebuffer::attach");
 
        unsigned i = 0;
-       for(const UInt16 *j=format.begin(); j!=format.end(); ++j, ++i)
+       for(const uint16_t *j=format.begin(); j!=format.end(); ++j, ++i)
                if(*j==attch)
                {
                        attachments[i].set(tex, level, layer);
index f023aba799a59d19cde92ae5e09f7f4fdb9f603d..3a415766696cdf065cbe4670682a32a47f76bd85 100644 (file)
@@ -36,7 +36,7 @@ FrameFormat FrameFormat::operator,(PixelFormat pf) const
                throw invalid_operation("FrameFormat::operator,");
 
        FrameFormat r = *this;
-       UInt16 &fa = r.attachments[r.count-1];
+       uint16_t &fa = r.attachments[r.count-1];
        fa = make_typed_attachment(static_cast<FrameAttachment>(fa), pf);
 
        return r;
@@ -48,7 +48,7 @@ FrameFormat FrameFormat::operator,(unsigned index) const
                throw invalid_operation("FrameFormat::operator,");
 
        FrameFormat r = *this;
-       UInt16 &fa = r.attachments[r.count-1];
+       uint16_t &fa = r.attachments[r.count-1];
        fa = make_indexed_attachment(static_cast<FrameAttachment>(fa), index);
 
        return r;
@@ -104,7 +104,7 @@ FrameAttachment make_indexed_attachment(FrameAttachment fa, unsigned i)
                throw invalid_argument("make_indexed_attachment");
 }
 
-PixelFormat get_attachment_pixelformat(UInt16 fa)
+PixelFormat get_attachment_pixelformat(uint16_t fa)
 {
        PixelComponents comp;
        if(get_attach_point(fa)==get_attach_point(DEPTH_ATTACHMENT))
index c67586a9dd435353c5511f67967e23bd57d4ec6a..35d982ba8839f1489b75efab9489560a7aa2d6e3 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_GL_FRAMEFORMAT_H_
 #define MSP_GL_FRAMEFORMAT_H_
 
-#include <msp/core/inttypes.h>
+#include <cstdint>
 #include "pixelformat.h"
 
 namespace Msp {
@@ -36,9 +36,9 @@ class FrameFormat
 private:
        enum { MAX_ATTACHMENTS = 7 };
 
-       UInt8 count;
-       UInt8 samples;
-       UInt16 attachments[MAX_ATTACHMENTS];
+       std::uint8_t count;
+       std::uint8_t samples;
+       std::uint16_t attachments[MAX_ATTACHMENTS];
 
 public:
        FrameFormat();
@@ -53,8 +53,8 @@ public:
 
        unsigned size() const { return count; }
        bool empty() const { return !count; }
-       const UInt16 *begin() const { return attachments; }
-       const UInt16 *end() const { return attachments+count; }
+       const std::uint16_t *begin() const { return attachments; }
+       const std::uint16_t *end() const { return attachments+count; }
        int index(FrameAttachment) const;
 };
 
@@ -71,10 +71,10 @@ FrameAttachment make_indexed_attachment(FrameAttachment, unsigned);
 inline FrameAttachment operator,(FrameAttachment fa, unsigned i)
 { return make_indexed_attachment(fa, i); }
 
-inline unsigned get_attach_point(UInt16 fa)
+inline unsigned get_attach_point(std::uint16_t fa)
 { return fa>>10; }
 
-PixelFormat get_attachment_pixelformat(UInt16);
+PixelFormat get_attachment_pixelformat(std::uint16_t);
 
 GLenum get_gl_attachment(FrameAttachment);
 
index f6a060215692a01f73ba2f849f83cfdc6c82f9b2..371b38b4894a96935cbd2c75326e790e38e45ce6 100644 (file)
@@ -226,9 +226,9 @@ Resource::AsyncLoader *Mesh::load(IO::Seekable &io, const Resources *)
        return new AsyncLoader(*this, io);
 }
 
-UInt64 Mesh::get_data_size() const
+uint64_t Mesh::get_data_size() const
 {
-       UInt64 size = 0;
+       uint64_t size = 0;
        if(vbuf)
                size += vbuf->get_size();
        if(ibuf)
index 0111bb7798908348cfb09080631c29d7c3e1f6cc..0cebaa69c28ce92917d796afe4e034e5434c4611 100644 (file)
@@ -107,7 +107,7 @@ private:
 public:
        virtual int get_load_priority() const { return 1; }
        virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload();
 
        void set_debug_name(const std::string &);
index 601aae99c8952e355016562d4589e333cfbd2798..ed5f02823f0bf34671a7ee4a31e7dad4035f0dc9 100644 (file)
@@ -117,7 +117,7 @@ void SpirVModule::remap_pointers_from(const SpirVModule &other)
 
 void SpirVModule::load_code(IO::Base &io)
 {
-       UInt32 buffer[1024];
+       uint32_t buffer[1024];
        while(1)
        {
                unsigned len = io.read(reinterpret_cast<char *>(buffer), sizeof(buffer));
@@ -145,7 +145,7 @@ void SpirVModule::reflect()
 
        if(code[0]==SPIRV_MAGIC_REVERSED)
        {
-               for(UInt32 &c: code)
+               for(uint32_t &c: code)
                        c = ((c&0xFF)<<24) || ((c&0xFF00)<<8) | ((c>>8)&0xFF00) | ((c>>24)&0xFF);
        }
        else if(code[0]!=SPIRV_MAGIC)
@@ -291,7 +291,7 @@ SpirVModule::TypeInfo::TypeInfo():
 { }
 
 
-UInt32 SpirVModule::Reflection::get_opcode(UInt32 op)
+uint32_t SpirVModule::Reflection::get_opcode(uint32_t op)
 {
        return op&0xFFFF;
 }
@@ -323,7 +323,7 @@ string SpirVModule::Reflection::read_string(CodeIterator &op, const CodeIterator
        throw invalid_module("Unterminated SPIR-V string literal");
 }
 
-void SpirVModule::Reflection::reflect_code(const vector<UInt32> &code)
+void SpirVModule::Reflection::reflect_code(const vector<uint32_t> &code)
 {
        for(CodeIterator op=code.begin()+5; op!=code.end(); )
        {
index 2b632fab485e27fde131d83251ad6ff8519caa07..5ea0149d2074e498e11e58ec97cfdd072b1ab642 100644 (file)
@@ -156,7 +156,7 @@ private:
 
        struct Reflection
        {
-               typedef std::vector<UInt32>::const_iterator CodeIterator;
+               typedef std::vector<std::uint32_t>::const_iterator CodeIterator;
 
                std::map<unsigned, std::string> names;
                std::map<unsigned, Constant> constants;
@@ -165,11 +165,11 @@ private:
                std::map<unsigned, Structure> structs;
                std::map<unsigned, Variable> variables;
 
-               static UInt32 get_opcode(UInt32);
+               static std::uint32_t get_opcode(std::uint32_t);
                static CodeIterator get_op_end(const CodeIterator &);
                static std::string read_string(CodeIterator &, const CodeIterator &);
 
-               void reflect_code(const std::vector<UInt32> &);
+               void reflect_code(const std::vector<std::uint32_t> &);
                void reflect_name(CodeIterator);
                void reflect_member_name(CodeIterator);
                void reflect_entry_point(CodeIterator);
@@ -190,7 +190,7 @@ private:
                void reflect_member_decorate(CodeIterator);
        };
 
-       std::vector<UInt32> code;
+       std::vector<std::uint32_t> code;
        std::vector<EntryPoint> entry_points;
        std::vector<Structure> structs;
        std::vector<Variable> variables;
@@ -212,7 +212,7 @@ private:
        void reflect();
 
 public:
-       const std::vector<UInt32> &get_code() const { return code; }
+       const std::vector<std::uint32_t> &get_code() const { return code; }
        const std::vector<EntryPoint> &get_entry_points() const { return entry_points; }
        const std::vector<Variable> &get_variables() const { return variables; }
        const std::vector<Constant> &get_spec_constants() const { return spec_constants; }
index 468a40f5c8ba06025fe0729d4fc14bb8a536d227..473d8a0b0d2c79e8a147e4b278e02ffbf303cb73 100644 (file)
@@ -227,7 +227,7 @@ void Program::add_spirv_stages(const SpirVModule &mod, const map<string, int> &s
                used_stage_ids[n_stages++] = stage_id;
        }
 
-       const vector<UInt32> &code = mod.get_code();
+       const vector<uint32_t> &code = mod.get_code();
        glShaderBinary(n_stages, used_stage_ids, GL_SHADER_BINARY_FORMAT_SPIR_V, &code[0], code.size()*4);
 
        if(!spec_values.empty() && !transient)
index 04a810856a5dedab8b16ecbbd453f6817fddd1d7..555d19ffee902f3d3457b9a831a1625b4819b03d 100644 (file)
@@ -103,7 +103,7 @@ public:
        GLenum get_target() const { return target; }
        unsigned get_id() const { return id; }
 
-       virtual UInt64 get_data_size() const { return 0; }
+       virtual std::uint64_t get_data_size() const { return 0; }
 
        void set_debug_name(const std::string &);
 
index 03e02159a5b8dd49e6847366cd37c8e4d56d8e19..df8dd06c75c705e06b31547b0501ea4a86e1c1fb 100644 (file)
@@ -146,7 +146,7 @@ unsigned Texture1D::get_level_size(unsigned level) const
        return width>>level;
 }
 
-UInt64 Texture1D::get_data_size() const
+uint64_t Texture1D::get_data_size() const
 {
        return id ? width*get_pixel_size(storage_fmt) : 0;
 }
index b14ff917666f88cb02fc7fbbcd5c55a8330b0075..225cb0de2ec9f32e3f90fb2a74d818b546426090 100644 (file)
@@ -50,7 +50,7 @@ private:
 
 public:
        virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload() { }
 };
 
index 0fc300e0a09e7b4659aefe3bb842228797f6f3b1..857ef17a69b7c501706c235e888e78ccc8f83856 100644 (file)
@@ -193,7 +193,7 @@ Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
        return ldr;
 }
 
-UInt64 Texture2D::get_data_size() const
+uint64_t Texture2D::get_data_size() const
 {
        return id ? width*height*get_pixel_size(format) : 0;
 }
index 877555c0f5ba43d4cdefb5a78af34225cc2e4756..442c544e3c9a52749d5f21c16da70a2a90041875 100644 (file)
@@ -91,7 +91,7 @@ private:
 
 public:
        virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload();
 };
 
index 4fdb7c1d9ed17bc721942644f58592fdb49bc47c..85fa19504ed65638d76204242d2dea102020c8b3 100644 (file)
@@ -60,7 +60,7 @@ void Texture2DMultisample::image(const Graphics::Image &, unsigned)
        throw invalid_operation("Texture2DMultisample::image");
 }
 
-UInt64 Texture2DMultisample::get_data_size() const
+uint64_t Texture2DMultisample::get_data_size() const
 {
        return id ? width*height*get_pixel_size(format)*samples : 0;
 }
index 1abacfaa6018bd3aafa9c49e9d0968fba7346f6d..94323ecae553c52403b11138d3dad50d2875971a 100644 (file)
@@ -25,7 +25,7 @@ public:
        unsigned get_samples() const { return samples; }
 
        virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload() { }
 };
 
index a7dae70350dab74416eb399b22dbcac63481e21d..285abeb957665b3cad558f2caf62d2d29b04166e 100644 (file)
@@ -183,7 +183,7 @@ LinAl::Vector<unsigned, 3> Texture3D::get_level_size(unsigned level) const
        return LinAl::Vector<unsigned, 3>(w, h, d);
 }
 
-UInt64 Texture3D::get_data_size() const
+uint64_t Texture3D::get_data_size() const
 {
        return id ? width*height*depth*get_pixel_size(storage_fmt) : 0;
 }
index df52bf66ee8daeb1e1a879440c63ed52ab799833..19444c770ecb235496ce0c06a3087d21c9a552e1 100644 (file)
@@ -87,7 +87,7 @@ protected:
 
 public:
        virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload() { }
 };
 
index 6eaa3a4470445d3221afeba689a86f508fb76bc0..c56094c9cb0bd36e837db1df0c1c115fc38ad876 100644 (file)
@@ -270,7 +270,7 @@ Vector3 TextureCube::get_texel_direction(TextureCubeFace face, unsigned u, unsig
        return fv+s*sv+t*tv;
 }
 
-UInt64 TextureCube::get_data_size() const
+uint64_t TextureCube::get_data_size() const
 {
        return id ? size*size*6*get_pixel_size(storage_fmt) : 0;
 }
index ae305153fec6860a8f37e3128f037214f07d5e25..15b598174ae3b233b52846e380603f8093e0a3de 100644 (file)
@@ -126,7 +126,7 @@ public:
        Vector3 get_texel_direction(TextureCubeFace, unsigned, unsigned);
 
        virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
-       virtual UInt64 get_data_size() const;
+       virtual std::uint64_t get_data_size() const;
        virtual void unload() { }
 };
 
index 3d15705a01765c18abe9244dbd8ae0f39261f357..9bfca5d295ad9688303d575434999700a368240e 100644 (file)
@@ -38,7 +38,7 @@ VertexFormat VertexFormat::operator,(DataType t) const
                throw invalid_operation("VertexFormat::operator,");
 
        VertexFormat r = *this;
-       UInt16 &a = r.attributes[r.count-1];
+       uint16_t &a = r.attributes[r.count-1];
        a = make_typed_attribute(static_cast<VertexAttribute>(a), t);
 
        return r;
@@ -50,7 +50,7 @@ VertexFormat VertexFormat::operator,(unsigned i) const
                throw invalid_operation("VertexFormat::operator,");
 
        VertexFormat r = *this;
-       UInt16 &a = r.attributes[r.count-1];
+       uint16_t &a = r.attributes[r.count-1];
        a = make_indexed_attribute(static_cast<VertexAttribute>(a), i);
 
        return r;
@@ -66,7 +66,7 @@ bool VertexFormat::operator==(const VertexFormat &other) const
 unsigned VertexFormat::stride() const
 {
        unsigned s = 0;
-       for(const UInt16 *i=begin(); i!=end(); ++i)
+       for(const uint16_t *i=begin(); i!=end(); ++i)
                s += get_attribute_size(*i);
        return s;
 }
@@ -75,7 +75,7 @@ int VertexFormat::offset(VertexAttribute attr) const
 {
        unsigned sem = get_attribute_semantic(attr);
        unsigned offs = 0;
-       for(const UInt16 *i=begin(); i!=end(); ++i)
+       for(const uint16_t *i=begin(); i!=end(); ++i)
        {
                if(get_attribute_semantic(*i)==sem)
                {
index 68c3e4c9a38828f42cba32729dae126ee3f75187..85d525f9571e90d276cff19e9928c9bfb9d1cc3e 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_GL_VERTEXFORMAT_H_
 #define MSP_GL_VERTEXFORMAT_H_
 
-#include <msp/core/inttypes.h>
+#include <cstdint>
 #include <msp/strings/lexicalcast.h>
 #include "datatype.h"
 
@@ -75,8 +75,8 @@ class VertexFormat
 private:
        enum { MAX_ATTRIBUTES = 15 };
 
-       UInt8 count;
-       UInt16 attributes[MAX_ATTRIBUTES];
+       std::uint8_t count;
+       std::uint16_t attributes[MAX_ATTRIBUTES];
 
 public:
        VertexFormat();
@@ -89,8 +89,8 @@ public:
        bool operator!=(const VertexFormat &other) const { return !(*this==other); }
 
        bool empty() const { return !count; }
-       const UInt16 *begin() const { return attributes; }
-       const UInt16 *end() const { return attributes+count; }
+       const std::uint16_t *begin() const { return attributes; }
+       const std::uint16_t *end() const { return attributes+count; }
        unsigned stride() const;
        int offset(VertexAttribute) const;
 };
@@ -108,19 +108,19 @@ VertexAttribute make_indexed_attribute(VertexAttribute, unsigned);
 inline VertexAttribute operator,(VertexAttribute a, unsigned i)
 { return make_indexed_attribute(a, i); }
 
-inline unsigned get_attribute_semantic(UInt16 a)
+inline unsigned get_attribute_semantic(std::uint16_t a)
 { return a>>10; }
 
-inline DataType get_attribute_source_type(UInt16 a)
+inline DataType get_attribute_source_type(std::uint16_t a)
 { return static_cast<DataType>((a&0x70)>>4 | (a&0x180)<<1); }
 
-inline unsigned get_attribute_component_count(UInt16 a)
+inline unsigned get_attribute_component_count(std::uint16_t a)
 { return a&7; }
 
-inline unsigned get_attribute_size(UInt16 a)
+inline unsigned get_attribute_size(std::uint16_t a)
 { return get_attribute_component_count(a)*get_type_size(get_attribute_source_type(a)); }
 
-inline bool is_integer_attribute(UInt16 a)
+inline bool is_integer_attribute(std::uint16_t a)
 { return a&8; }
 
 void operator>>(const LexicalConverter &, VertexAttribute &);
index 7a24da7350b5f332a1e2aaaaa5c80a29fc7646e8..75d3ad8bc11017966d249adbe4762e2b235cab0f 100644 (file)
@@ -107,7 +107,7 @@ bool VertexSetup::verify_format(const VertexFormat &fmt)
 
        unsigned max_attribs = Limits::get_global().max_vertex_attributes;
 
-       for(const UInt16 *a=fmt.begin(); a!=fmt.end(); ++a)
+       for(const uint16_t *a=fmt.begin(); a!=fmt.end(); ++a)
                if(get_attribute_semantic(*a)>=max_attribs)
                        return false;
 
@@ -117,7 +117,7 @@ bool VertexSetup::verify_format(const VertexFormat &fmt)
 void VertexSetup::require_format(const VertexFormat &fmt)
 {
        bool has_int = false;
-       for(const UInt16 *a=fmt.begin(); a!=fmt.end(); ++a)
+       for(const uint16_t *a=fmt.begin(); a!=fmt.end(); ++a)
                has_int = has_int | is_integer_attribute(*a);
 
        if(has_int)
@@ -162,7 +162,7 @@ void VertexSetup::update_vertex_array(const VertexArray &array, unsigned binding
        }
 
        unsigned offset = 0;
-       for(const UInt16 *a=fmt.begin(); a!=fmt.end(); ++a)
+       for(const uint16_t *a=fmt.begin(); a!=fmt.end(); ++a)
        {
                unsigned sem = get_attribute_semantic(*a);
                bool integer = is_integer_attribute(*a);
@@ -207,13 +207,13 @@ void VertexSetup::unload()
                glBindVertexArray(id);
                glBindBuffer(GL_ARRAY_BUFFER, 0);
 
-               for(const UInt16 *a=vertex_format.begin(); a!=vertex_format.end(); ++a)
+               for(const uint16_t *a=vertex_format.begin(); a!=vertex_format.end(); ++a)
                {
                        unsigned sem = get_attribute_semantic(*a);
                        glDisableVertexAttribArray(sem);
                        glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, 0);
                }
-               for(const UInt16 *a=inst_format.begin(); a!=inst_format.end(); ++a)
+               for(const uint16_t *a=inst_format.begin(); a!=inst_format.end(); ++a)
                {
                        unsigned sem = get_attribute_semantic(*a);
                        glDisableVertexAttribArray(sem);
index 4f2080ab9c59afb8c8b6018aed6cac2d60c40d09..8d96cc4270b5b1566f75e37f26e1e35fa04c0352 100644 (file)
@@ -157,7 +157,7 @@ string Compiler::get_stage_glsl(Stage::Type stage_type) const
        throw key_error(Stage::get_stage_name(stage_type));
 }
 
-vector<UInt32> Compiler::get_combined_spirv() const
+vector<uint32_t> Compiler::get_combined_spirv() const
 {
        if(!compiled)
                throw invalid_operation("Compiler::get_combined_spirv");
index 3b540a8c9d20b8828b9aaa25c033a0b3bf97b043..f9e0e3fe2aa554f623b1d9c85f8f284e5808f58f 100644 (file)
@@ -91,7 +91,7 @@ public:
 
        /** Returns a combined SPIR-V binary for all shader stages.  The result is
        suitable for use with OpenGL or Vulkan. */
-       std::vector<UInt32> get_combined_spirv() const;
+       std::vector<std::uint32_t> get_combined_spirv() const;
 
        /** Returns a map of vertex attribute locations.  If the target GLSL version
        supports interface layouts, the map is empty (locations are included in the
index c12a0f48cd389997a95da283b0bd583b6867729f..96ca492123962a464e77b4de57f9427f6196bdd0 100644 (file)
@@ -311,7 +311,7 @@ void VariableResolver::visit(MemberAccess &memacc)
                        static const char component_names[] = { 'x', 'r', 's', 'y', 'g', 't', 'z', 'b', 'p', 'w', 'a', 'q' };
 
                        bool ok = true;
-                       UInt8 components[4] = { };
+                       uint8_t components[4] = { };
                        for(unsigned i=0; (ok && i<memacc.member.size()); ++i)
                                ok = ((components[i] = (std::find(component_names, component_names+12, memacc.member[i])-component_names)/3) < 4);
 
index d680ee3c8a76e01d8e244aadc1307fbccd457aa9..669342f36a5bb3297bb76ac8a9e8e74913d210bb 100644 (file)
@@ -30,7 +30,7 @@ private:
                char arg_types[5];
                char extension[13];
                Word opcode;
-               UInt8 arg_order[4];
+               std::uint8_t arg_order[4];
                Word capability;
                void (SpirVGenerator::*handler)(FunctionCall &, const std::vector<Id> &);
        };
index fb5ec644d6ee68ee45f3460217f05135d20e5381..95db13c173ec11c819fe4ec5453546c67d82527d 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <string>
 #include <vector>
-#include <msp/core/inttypes.h>
+#include <cstdint>
 #include "spirvconstants.h"
 
 namespace Msp {
@@ -12,7 +12,7 @@ namespace SL {
 
 struct SpirVContent
 {
-       typedef UInt32 Word;
+       typedef std::uint32_t Word;
 
        std::vector<Word> code;
        std::vector<Word> capabilities;
index 4d30ee04c24684557eade28e639f70b4fdee6295..7fa116b717dd388e5a2acba6001dc34c74226bab 100644 (file)
@@ -6,7 +6,7 @@
 #include <set>
 #include <string>
 #include <vector>
-#include <msp/core/inttypes.h>
+#include <cstdint>
 #include <msp/core/refptr.h>
 #include <msp/core/variant.h>
 #include "features.h"
@@ -40,7 +40,7 @@ struct Operator
 
        char token[4];
        char token2[2];
-       UInt8 precedence;
+       std::uint8_t precedence;
        Type type;
        Associativity assoc;
 
@@ -201,7 +201,7 @@ struct Swizzle: Expression
        NodePtr<Expression> left;
        std::string component_group;
        unsigned count;
-       UInt8 components[4];
+       std::uint8_t components[4];
 
        Swizzle();
 
@@ -238,8 +238,8 @@ struct Assignment: BinaryExpression
                };
 
                Statement *declaration;
-               Msp::UInt8 chain_len;
-               Msp::UInt8 chain[7];
+               std::uint8_t chain_len;
+               std::uint8_t chain[7];
 
                Target(Statement * = 0);
 
index 915444d8595e379e8edd250f61c1cc9df73018b8..1ef013ddac86e5a6be72643fe711764f01428d30 100644 (file)
@@ -521,12 +521,12 @@ vector<ProgramData::ProgramBlock>::iterator ProgramData::get_program(const Progr
 
 void ProgramData::update_block_uniform_indices(SharedBlock &block, const Program::UniformBlockInfo &info) const
 {
-       UInt8 *indices = block.indices.values;
+       uint8_t *indices = block.indices.values;
        if(info.uniforms.size()>16)
        {
                if(block.indices.type_flag==0xFD)
                {
-                       block.indices.dynamic.values = new UInt8[info.uniforms.size()];
+                       block.indices.dynamic.values = new uint8_t[info.uniforms.size()];
                        block.indices.type_flag = 0xFE;
                }
                indices = block.indices.dynamic.values;
@@ -588,7 +588,7 @@ void ProgramData::update_block_uniform_indices(SharedBlock &block, const Program
 
 void ProgramData::update_block(SharedBlock &block, const Program::UniformBlockInfo &info) const
 {
-       const UInt8 *indices = block.get_uniform_indices();
+       const uint8_t *indices = block.get_uniform_indices();
        for(unsigned i=0; i<info.uniforms.size(); ++i)
        {
                if(is_image(info.uniforms[i]->type))
@@ -734,7 +734,7 @@ ProgramData::SharedBlock::SharedBlock(Program::LayoutHash h):
        indices.type_flag = 0xFD;
 }
 
-const UInt8 *ProgramData::SharedBlock::get_uniform_indices() const
+const uint8_t *ProgramData::SharedBlock::get_uniform_indices() const
 {
        return (indices.type_flag==0xFE ? indices.dynamic.values : indices.values);
 }
index 93eb3be89e1dc66e7ad85061d75752a4fe080a9a..1bcd3aab42c6ea2158f5beb0fbdcaab8f200720e 100644 (file)
@@ -118,18 +118,18 @@ private:
                UniformBlock *block;
                union
                {
-                       UInt8 type_flag;
-                       UInt8 values[16];
+                       std::uint8_t type_flag;
+                       std::uint8_t values[16];
                        struct
                        {
-                               UInt8 type_flag;
-                               UInt8 *values;
+                               std::uint8_t type_flag;
+                               std::uint8_t *values;
                        } dynamic;
                } indices;
 
                SharedBlock(Program::LayoutHash);
 
-               const UInt8 *get_uniform_indices() const;
+               const std::uint8_t *get_uniform_indices() const;
        };
 
        struct ProgramBlock
index b144580ca50a5aa04c35b35e266c958e63d69ae1..302b983f478ecd34a1d67ebc92fd3ecec33f7d43 100644 (file)
@@ -17,7 +17,7 @@ RenderTarget::RenderTarget(unsigned w, unsigned h, const FrameFormat &f):
 {
        textures.reserve(f.size());
        unsigned samples = f.get_samples();
-       for(const UInt16 *i=f.begin(); i!=f.end(); ++i)
+       for(const uint16_t *i=f.begin(); i!=f.end(); ++i)
        {
                FrameAttachment fa = static_cast<FrameAttachment>(*i);
                PixelFormat pf = get_attachment_pixelformat(*i);
@@ -70,7 +70,7 @@ void RenderTarget::set_debug_name(const string &name)
        fbo.set_debug_name(name+" [FBO]");
        const FrameFormat &fmt = fbo.get_format();
        unsigned i = 0;
-       for(const UInt16 *j=fmt.begin(); j!=fmt.end(); ++i, ++j)
+       for(const uint16_t *j=fmt.begin(); j!=fmt.end(); ++i, ++j)
        {
                unsigned attach_pt = get_attach_point(static_cast<FrameAttachment>(*j));
 
index 571d1ea56c54e61ab10c43ef0f10cce766f19bb3..4efc082116eefcde6a1b3035b4ee354eea97f3a6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_GL_RESOURCE_H_
 #define MSP_GL_RESOURCE_H_
 
-#include <msp/core/inttypes.h>
+#include <cstdint>
 #include <msp/io/seekable.h>
 
 namespace Msp {
@@ -41,7 +41,7 @@ public:
 
        /** Returns the amount of graphics memory used by this resource.  The
        returned value must not change while the resource is loaded. */
-       virtual UInt64 get_data_size() const = 0;
+       virtual std::uint64_t get_data_size() const = 0;
 
        virtual void unload() = 0;
 };
index 91acb3d0baf623e89fea7777cd022006ec847401..5358183f24bc5a39d156b6f9bcab1c87136bac31 100644 (file)
@@ -50,7 +50,7 @@ void ResourceManager::set_async_loads(bool a)
        async_loads = a;
 }
 
-void ResourceManager::set_size_limit(UInt64 s)
+void ResourceManager::set_size_limit(uint64_t s)
 {
        size_limit = s;
 }
@@ -251,11 +251,11 @@ void ResourceManager::unload_by_size()
        while(total_data_size>size_limit)
        {
                ManagedResource *best = 0;
-               UInt64 best_impact = 0;
+               uint64_t best_impact = 0;
                for(auto &kvp: resources)
                        if(kvp.second.state==ManagedResource::LOADED && kvp.second.last_used<unload_limit)
                        {
-                               UInt64 impact = kvp.second.data_size*(frame-kvp.second.last_used);
+                               uint64_t impact = kvp.second.data_size*(frame-kvp.second.last_used);
                                if(!best || impact>best_impact)
                                {
                                        best = &kvp.second;
@@ -530,10 +530,10 @@ bool ResourceManager::LoadingThread::sync()
        return any_finished;
 }
 
-UInt64 ResourceManager::LoadingThread::get_and_reset_loaded_data_size()
+uint64_t ResourceManager::LoadingThread::get_and_reset_loaded_data_size()
 {
        MutexLock lock(data_size_mutex);
-       UInt64 result = loaded_data_size;
+       uint64_t result = loaded_data_size;
        loaded_data_size = 0;
        return result;
 }
index 38437a727fd9a7d94cc24b048123bb62f0a0e35d..2b9aef58f6414af9073988898e08e04483861e6a 100644 (file)
@@ -2,7 +2,7 @@
 #define MSP_GL_RESOURCEMANAGER_H_
 
 #include <deque>
-#include <msp/core/inttypes.h>
+#include <cstdint>
 #include <msp/core/mutex.h>
 #include <msp/core/semaphore.h>
 #include <msp/core/thread.h>
@@ -62,7 +62,7 @@ private:
                Resource::AsyncLoader *loader;
                State state;
                unsigned last_used;
-               UInt64 data_size;
+               std::uint64_t data_size;
                std::vector<ResourceObserver *> observers;
 
                ManagedResource(Resource &);
@@ -88,7 +88,7 @@ private:
                unsigned size;
                std::list<resource_load_error> error_queue;
                Mutex data_size_mutex;
-               UInt64 loaded_data_size;
+               std::uint64_t loaded_data_size;
                volatile bool done;
 
        public:
@@ -107,7 +107,7 @@ private:
        public:
                bool sync();
                bool needs_work() const { return size<capacity; }
-               UInt64 get_and_reset_loaded_data_size();
+               std::uint64_t get_and_reset_loaded_data_size();
 
                void terminate();
        };
@@ -117,8 +117,8 @@ private:
        mutable Mutex map_mutex;
        std::map<const Resource *, ManagedResource> resources;
        std::deque<ManagedResource *> queue;
-       UInt64 total_data_size;
-       UInt64 size_limit;
+       std::uint64_t total_data_size;
+       std::uint64_t size_limit;
        unsigned frame;
        unsigned min_retain_frames;
        unsigned max_retain_frames;
@@ -131,7 +131,7 @@ public:
 
        void set_loading_policy(LoadingPolicy);
        void set_async_loads(bool);
-       void set_size_limit(UInt64);
+       void set_size_limit(std::uint64_t);
        void set_min_retain_frames(unsigned);
        void set_max_retain_frames(unsigned);
 
@@ -158,7 +158,7 @@ private:
        void unload_by_age();
        void unload_by_size();
 public:
-       UInt64 get_total_data_size() const { return total_data_size; }
+       std::uint64_t get_total_data_size() const { return total_data_size; }
 
 private:
        static bool age_order(ManagedResource *, ManagedResource *);
index 4fe6bc8bd636d75e00cb3f76bd1ee0d6a9fc277e..458a56cee87caec21ef54dc42c5d0a5603a42583 100644 (file)
@@ -149,7 +149,7 @@ int GlslCompiler::main()
 
        if(compile_mode==GL::SL::Compiler::SPIRV)
        {
-               vector<UInt32> code = compiler.get_combined_spirv();
+               vector<uint32_t> code = compiler.get_combined_spirv();
                out->write(reinterpret_cast<char *>(&code.front()), code.size()*4);
        }
        else if(combined)