From 3a1b9cbe2441ae670a97541dc8ccb0a2860c8302 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 18 Sep 2021 02:31:16 +0300 Subject: [PATCH] Use standard fixed-size integer types --- source/builders/primitivebuilder.cpp | 2 +- source/builders/vertexarraybuilder.cpp | 14 +++++++------- source/core/batch.cpp | 24 ++++++++++++------------ source/core/batch.h | 2 +- source/core/framebuffer.cpp | 4 ++-- source/core/frameformat.cpp | 6 +++--- source/core/frameformat.h | 16 ++++++++-------- source/core/mesh.cpp | 4 ++-- source/core/mesh.h | 2 +- source/core/module.cpp | 8 ++++---- source/core/module.h | 10 +++++----- source/core/program.cpp | 2 +- source/core/texture.h | 2 +- source/core/texture1d.cpp | 2 +- source/core/texture1d.h | 2 +- source/core/texture2d.cpp | 2 +- source/core/texture2d.h | 2 +- source/core/texture2dmultisample.cpp | 2 +- source/core/texture2dmultisample.h | 2 +- source/core/texture3d.cpp | 2 +- source/core/texture3d.h | 2 +- source/core/texturecube.cpp | 2 +- source/core/texturecube.h | 2 +- source/core/vertexformat.cpp | 8 ++++---- source/core/vertexformat.h | 20 ++++++++++---------- source/core/vertexsetup.cpp | 10 +++++----- source/glsl/compiler.cpp | 2 +- source/glsl/compiler.h | 2 +- source/glsl/resolve.cpp | 2 +- source/glsl/spirv.h | 2 +- source/glsl/spirvwriter.h | 4 ++-- source/glsl/syntax.h | 10 +++++----- source/render/programdata.cpp | 8 ++++---- source/render/programdata.h | 10 +++++----- source/render/rendertarget.cpp | 4 ++-- source/resources/resource.h | 4 ++-- source/resources/resourcemanager.cpp | 10 +++++----- source/resources/resourcemanager.h | 16 ++++++++-------- tools/glslcompiler.cpp | 2 +- 39 files changed, 115 insertions(+), 115 deletions(-) diff --git a/source/builders/primitivebuilder.cpp b/source/builders/primitivebuilder.cpp index 1a10af4b..ca16fcde 100644 --- a/source/builders/primitivebuilder.cpp +++ b/source/builders/primitivebuilder.cpp @@ -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(ptr, value, !integer, cc); + store_attribute(ptr, value, !integer, cc); else if(type==BYTE) - store_attribute(ptr, value, !integer, cc); + store_attribute(ptr, value, !integer, cc); else if(type==UNSIGNED_SHORT) - store_attribute(ptr, value, !integer, cc); + store_attribute(ptr, value, !integer, cc); else if(type==SHORT) - store_attribute(ptr, value, !integer, cc); + store_attribute(ptr, value, !integer, cc); else if(type==UNSIGNED_INT) - store_attribute(ptr, value, !integer, cc); + store_attribute(ptr, value, !integer, cc); else if(type==INT) - store_attribute(ptr, value, !integer, cc); + store_attribute(ptr, value, !integer, cc); else if(type==FLOAT) store_attribute(ptr, value, false, cc); } diff --git a/source/core/batch.cpp b/source/core/batch.cpp index d99bb95e..b882cf1b 100644 --- a/source/core/batch.cpp +++ b/source/core/batch.cpp @@ -10,7 +10,7 @@ using namespace std; namespace { template -void append(vector &data, T i) +void append(vector &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 -void expand(vector &data) +void expand(vector &data) { unsigned count = data.size()/sizeof(T); data.resize(count*sizeof(U)); @@ -35,7 +35,7 @@ void expand(vector &data) } template -void shrink(vector &data) +void shrink(vector &data) { unsigned count = data.size()/sizeof(T); for(unsigned i=0; i(data); + expand(data); else if(index_type==UNSIGNED_INT && t==UNSIGNED_SHORT) - shrink(data); + shrink(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(data, 0xFFFFFFFF); + ::append(data, 0xFFFFFFFF); else - ::append(data, 0xFFFF); + ::append(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(data, i); + ::append(data, i); else - ::append(data, i); + ::append(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)]; } diff --git a/source/core/batch.h b/source/core/batch.h index f551a5e9..51cc573b 100644 --- a/source/core/batch.h +++ b/source/core/batch.h @@ -36,7 +36,7 @@ private: GLenum gl_prim_type; DataType index_type; GLenum gl_index_type; - std::vector data; + std::vector data; unsigned max_index; public: diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index 0ce00bec..e9d8863c 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -131,7 +131,7 @@ void Framebuffer::update() const vector 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(*j)); if(dirty&(1<(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(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)) diff --git a/source/core/frameformat.h b/source/core/frameformat.h index c67586a9..35d982ba 100644 --- a/source/core/frameformat.h +++ b/source/core/frameformat.h @@ -1,7 +1,7 @@ #ifndef MSP_GL_FRAMEFORMAT_H_ #define MSP_GL_FRAMEFORMAT_H_ -#include +#include #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); diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index f6a06021..371b38b4 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -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) diff --git a/source/core/mesh.h b/source/core/mesh.h index 0111bb77..0cebaa69 100644 --- a/source/core/mesh.h +++ b/source/core/mesh.h @@ -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 &); diff --git a/source/core/module.cpp b/source/core/module.cpp index 601aae99..ed5f0282 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -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(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 &code) +void SpirVModule::Reflection::reflect_code(const vector &code) { for(CodeIterator op=code.begin()+5; op!=code.end(); ) { diff --git a/source/core/module.h b/source/core/module.h index 2b632fab..5ea0149d 100644 --- a/source/core/module.h +++ b/source/core/module.h @@ -156,7 +156,7 @@ private: struct Reflection { - typedef std::vector::const_iterator CodeIterator; + typedef std::vector::const_iterator CodeIterator; std::map names; std::map constants; @@ -165,11 +165,11 @@ private: std::map structs; std::map 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 &); + void reflect_code(const std::vector &); 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 code; + std::vector code; std::vector entry_points; std::vector structs; std::vector variables; @@ -212,7 +212,7 @@ private: void reflect(); public: - const std::vector &get_code() const { return code; } + const std::vector &get_code() const { return code; } const std::vector &get_entry_points() const { return entry_points; } const std::vector &get_variables() const { return variables; } const std::vector &get_spec_constants() const { return spec_constants; } diff --git a/source/core/program.cpp b/source/core/program.cpp index 468a40f5..473d8a0b 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -227,7 +227,7 @@ void Program::add_spirv_stages(const SpirVModule &mod, const map &s used_stage_ids[n_stages++] = stage_id; } - const vector &code = mod.get_code(); + const vector &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) diff --git a/source/core/texture.h b/source/core/texture.h index 04a81085..555d19ff 100644 --- a/source/core/texture.h +++ b/source/core/texture.h @@ -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 &); diff --git a/source/core/texture1d.cpp b/source/core/texture1d.cpp index 03e02159..df8dd06c 100644 --- a/source/core/texture1d.cpp +++ b/source/core/texture1d.cpp @@ -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; } diff --git a/source/core/texture1d.h b/source/core/texture1d.h index b14ff917..225cb0de 100644 --- a/source/core/texture1d.h +++ b/source/core/texture1d.h @@ -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() { } }; diff --git a/source/core/texture2d.cpp b/source/core/texture2d.cpp index 0fc300e0..857ef17a 100644 --- a/source/core/texture2d.cpp +++ b/source/core/texture2d.cpp @@ -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; } diff --git a/source/core/texture2d.h b/source/core/texture2d.h index 877555c0..442c544e 100644 --- a/source/core/texture2d.h +++ b/source/core/texture2d.h @@ -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(); }; diff --git a/source/core/texture2dmultisample.cpp b/source/core/texture2dmultisample.cpp index 4fdb7c1d..85fa1950 100644 --- a/source/core/texture2dmultisample.cpp +++ b/source/core/texture2dmultisample.cpp @@ -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; } diff --git a/source/core/texture2dmultisample.h b/source/core/texture2dmultisample.h index 1abacfaa..94323eca 100644 --- a/source/core/texture2dmultisample.h +++ b/source/core/texture2dmultisample.h @@ -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() { } }; diff --git a/source/core/texture3d.cpp b/source/core/texture3d.cpp index a7dae703..285abeb9 100644 --- a/source/core/texture3d.cpp +++ b/source/core/texture3d.cpp @@ -183,7 +183,7 @@ LinAl::Vector Texture3D::get_level_size(unsigned level) const return LinAl::Vector(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; } diff --git a/source/core/texture3d.h b/source/core/texture3d.h index df52bf66..19444c77 100644 --- a/source/core/texture3d.h +++ b/source/core/texture3d.h @@ -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() { } }; diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index 6eaa3a44..c56094c9 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -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; } diff --git a/source/core/texturecube.h b/source/core/texturecube.h index ae305153..15b59817 100644 --- a/source/core/texturecube.h +++ b/source/core/texturecube.h @@ -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() { } }; diff --git a/source/core/vertexformat.cpp b/source/core/vertexformat.cpp index 3d15705a..9bfca5d2 100644 --- a/source/core/vertexformat.cpp +++ b/source/core/vertexformat.cpp @@ -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(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(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) { diff --git a/source/core/vertexformat.h b/source/core/vertexformat.h index 68c3e4c9..85d525f9 100644 --- a/source/core/vertexformat.h +++ b/source/core/vertexformat.h @@ -1,7 +1,7 @@ #ifndef MSP_GL_VERTEXFORMAT_H_ #define MSP_GL_VERTEXFORMAT_H_ -#include +#include #include #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((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 &); diff --git a/source/core/vertexsetup.cpp b/source/core/vertexsetup.cpp index 7a24da73..75d3ad8b 100644 --- a/source/core/vertexsetup.cpp +++ b/source/core/vertexsetup.cpp @@ -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); diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 4f2080ab..8d96cc42 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -157,7 +157,7 @@ string Compiler::get_stage_glsl(Stage::Type stage_type) const throw key_error(Stage::get_stage_name(stage_type)); } -vector Compiler::get_combined_spirv() const +vector Compiler::get_combined_spirv() const { if(!compiled) throw invalid_operation("Compiler::get_combined_spirv"); diff --git a/source/glsl/compiler.h b/source/glsl/compiler.h index 3b540a8c..f9e0e3fe 100644 --- a/source/glsl/compiler.h +++ b/source/glsl/compiler.h @@ -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 get_combined_spirv() const; + std::vector 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 diff --git a/source/glsl/resolve.cpp b/source/glsl/resolve.cpp index c12a0f48..96ca4921 100644 --- a/source/glsl/resolve.cpp +++ b/source/glsl/resolve.cpp @@ -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 &); }; diff --git a/source/glsl/spirvwriter.h b/source/glsl/spirvwriter.h index fb5ec644..95db13c1 100644 --- a/source/glsl/spirvwriter.h +++ b/source/glsl/spirvwriter.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include "spirvconstants.h" namespace Msp { @@ -12,7 +12,7 @@ namespace SL { struct SpirVContent { - typedef UInt32 Word; + typedef std::uint32_t Word; std::vector code; std::vector capabilities; diff --git a/source/glsl/syntax.h b/source/glsl/syntax.h index 4d30ee04..7fa116b7 100644 --- a/source/glsl/syntax.h +++ b/source/glsl/syntax.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #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 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); diff --git a/source/render/programdata.cpp b/source/render/programdata.cpp index 915444d8..1ef013dd 100644 --- a/source/render/programdata.cpp +++ b/source/render/programdata.cpp @@ -521,12 +521,12 @@ vector::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; itype)) @@ -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); } diff --git a/source/render/programdata.h b/source/render/programdata.h index 93eb3be8..1bcd3aab 100644 --- a/source/render/programdata.h +++ b/source/render/programdata.h @@ -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 diff --git a/source/render/rendertarget.cpp b/source/render/rendertarget.cpp index b144580c..302b983f 100644 --- a/source/render/rendertarget.cpp +++ b/source/render/rendertarget.cpp @@ -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(*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(*j)); diff --git a/source/resources/resource.h b/source/resources/resource.h index 571d1ea5..4efc0821 100644 --- a/source/resources/resource.h +++ b/source/resources/resource.h @@ -1,7 +1,7 @@ #ifndef MSP_GL_RESOURCE_H_ #define MSP_GL_RESOURCE_H_ -#include +#include #include 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; }; diff --git a/source/resources/resourcemanager.cpp b/source/resources/resourcemanager.cpp index 91acb3d0..5358183f 100644 --- a/source/resources/resourcemanager.cpp +++ b/source/resources/resourcemanager.cpp @@ -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_usedbest_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; } diff --git a/source/resources/resourcemanager.h b/source/resources/resourcemanager.h index 38437a72..2b9aef58 100644 --- a/source/resources/resourcemanager.h +++ b/source/resources/resourcemanager.h @@ -2,7 +2,7 @@ #define MSP_GL_RESOURCEMANAGER_H_ #include -#include +#include #include #include #include @@ -62,7 +62,7 @@ private: Resource::AsyncLoader *loader; State state; unsigned last_used; - UInt64 data_size; + std::uint64_t data_size; std::vector observers; ManagedResource(Resource &); @@ -88,7 +88,7 @@ private: unsigned size; std::list 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 resources; std::deque 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 *); diff --git a/tools/glslcompiler.cpp b/tools/glslcompiler.cpp index 4fe6bc8b..458a56ce 100644 --- a/tools/glslcompiler.cpp +++ b/tools/glslcompiler.cpp @@ -149,7 +149,7 @@ int GlslCompiler::main() if(compile_mode==GL::SL::Compiler::SPIRV) { - vector code = compiler.get_combined_spirv(); + vector code = compiler.get_combined_spirv(); out->write(reinterpret_cast(&code.front()), code.size()*4); } else if(combined) -- 2.45.2