Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gli/core/duplicate.inl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ namespace detail
texture_cube::size_type BaseLevel, texture_cube::size_type MaxLevel
)
{
GLI_UNUSED(MaxFace);
GLI_ASSERT(BaseLevel >= 0 && BaseLevel < Texture.levels() && BaseLevel <= MaxLevel && MaxLevel < Texture.levels());
GLI_ASSERT(BaseFace <= MaxFace);
GLI_ASSERT(BaseFace < Texture.faces());
Expand All @@ -242,6 +243,7 @@ namespace detail
texture_cube_array::size_type BaseLevel, texture_cube_array::size_type MaxLevel
)
{
GLI_UNUSED(MaxFace);
GLI_ASSERT(BaseLevel <= MaxLevel);
GLI_ASSERT(BaseLevel < Texture.levels());
GLI_ASSERT(MaxLevel < Texture.levels());
Expand Down
4 changes: 2 additions & 2 deletions gli/core/format.inl
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ namespace detail
GLI_ASSERT(Format != FORMAT_UNDEFINED);

return Table[Format - FORMAT_FIRST];
};
}

inline std::uint32_t bits_per_pixel(format Format)
{
Expand Down Expand Up @@ -375,7 +375,7 @@ namespace detail

inline bool is_packed(format Format)
{
gli::uint16 flags = detail::get_format_info(Format).Flags;
gli::uint32 flags = detail::get_format_info(Format).Flags;

return (flags & detail::CAP_PACKED8_BIT) != 0 || (flags & detail::CAP_PACKED16_BIT) != 0 || (flags & detail::CAP_PACKED32_BIT) != 0;
}
Expand Down
14 changes: 7 additions & 7 deletions gli/core/gl.inl
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@ namespace detail
{
GLI_ASSERT(Format >= FORMAT_FIRST && Format <= FORMAT_LAST);

gl::format_desc const& FormatDesc = this->FormatDesc[Format - FORMAT_FIRST];
gl::format_desc const& FormatDesc_ = this->FormatDesc[Format - FORMAT_FIRST];

gl::format FormatGL;
FormatGL.Internal = FormatDesc.Internal;
FormatGL.External = FormatDesc.External;
FormatGL.Type = FormatDesc.Type;
FormatGL.Swizzles = this->compute_swizzle(FormatDesc, Swizzles);
FormatGL.Internal = FormatDesc_.Internal;
FormatGL.External = FormatDesc_.External;
FormatGL.Type = FormatDesc_.Type;
FormatGL.Swizzles = this->compute_swizzle(FormatDesc_, Swizzles);
return FormatGL;
}

Expand All @@ -354,12 +354,12 @@ namespace detail
return gli::FORMAT_UNDEFINED;
}

inline gl::swizzles gl::compute_swizzle(format_desc const& FormatDesc, gli::swizzles const& Swizzles) const
inline gl::swizzles gl::compute_swizzle(format_desc const& FormatDesc_, gli::swizzles const& Swizzles) const
{
if (!this->has_swizzle(this->Profile))
return swizzles(gl::SWIZZLE_RED, gl::SWIZZLE_GREEN, gl::SWIZZLE_BLUE, gl::SWIZZLE_ALPHA);

bool const IsExternalBGRA = ((FormatDesc.Properties & detail::FORMAT_PROPERTY_BGRA_FORMAT_BIT) && !has_swizzle(this->Profile)) || (FormatDesc.Properties & detail::FORMAT_PROPERTY_BGRA_TYPE_BIT);
bool const IsExternalBGRA = ((FormatDesc_.Properties & detail::FORMAT_PROPERTY_BGRA_FORMAT_BIT) && !has_swizzle(this->Profile)) || (FormatDesc_.Properties & detail::FORMAT_PROPERTY_BGRA_TYPE_BIT);

return detail::translate(IsExternalBGRA ? gli::swizzles(Swizzles.b, Swizzles.g, Swizzles.r, Swizzles.a) : Swizzles);
}
Expand Down
8 changes: 6 additions & 2 deletions gli/core/image.inl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace detail
extent1d const& TexelCoord
)
{
GLI_UNUSED(Extent);
GLI_ASSERT(glm::all(glm::lessThan(TexelCoord, Extent)));

return static_cast<size_t>(TexelCoord.x);
Expand Down Expand Up @@ -43,6 +44,7 @@ namespace detail
extent1d const& TexelCoord
)
{
GLI_UNUSED(Extent);
GLI_ASSERT(TexelCoord.x < Extent.x);

return TexelCoord.x;
Expand All @@ -54,6 +56,7 @@ namespace detail
extent2d const& TexelCoord
)
{
GLI_UNUSED(Extent);
GLI_ASSERT(TexelCoord.x < Extent.x && TexelCoord.x >= 0 && TexelCoord.x < std::numeric_limits<extent2d::value_type>::max());
GLI_ASSERT(TexelCoord.y < Extent.y && TexelCoord.y >= 0 && TexelCoord.y < std::numeric_limits<extent2d::value_type>::max());

Expand All @@ -68,6 +71,7 @@ namespace detail
extent3d const& TexelCoord
)
{
GLI_UNUSED(Extent);
GLI_ASSERT(TexelCoord.x < Extent.x);
GLI_ASSERT(TexelCoord.y < Extent.y);
GLI_ASSERT(TexelCoord.z < Extent.z);
Expand Down Expand Up @@ -213,9 +217,9 @@ namespace detail
*(this->data<genType>() + TexelIndex) = Texel;
}

inline image::data_type* image::compute_data(size_type BaseLayer, size_type BaseFace, size_type BaseLevel)
inline image::data_type* image::compute_data(size_type BaseLayer, size_type BaseFace, size_type BaseLevel_)
{
size_type const BaseOffset = this->Storage->base_offset(BaseLayer, BaseFace, BaseLevel);
size_type const BaseOffset = this->Storage->base_offset(BaseLayer, BaseFace, BaseLevel_);

return this->Storage->data() + BaseOffset;
}
Expand Down
2 changes: 2 additions & 0 deletions gli/core/load_dds.inl
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ namespace detail

inline texture load_dds(char const * Data, std::size_t Size)
{
GLI_UNUSED(Size);
GLI_ASSERT(Data && (Size >= sizeof(detail::FOURCC_DDS)));

if(strncmp(Data, detail::FOURCC_DDS, 4) != 0)
Expand Down Expand Up @@ -293,6 +294,7 @@ namespace detail
std::max<texture::size_type>(Header10.ArraySize, 1), FaceCount, MipMapCount);

std::size_t const SourceSize = Offset + Texture.size();
GLI_UNUSED(SourceSize);
GLI_ASSERT(SourceSize == Size);

std::memcpy(Texture.data(), Data + Offset, Texture.size());
Expand Down
1 change: 1 addition & 0 deletions gli/core/load_kmg.inl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace detail

inline texture load_kmg100(char const * Data, std::size_t Size)
{
GLI_UNUSED(Size);
detail::kmgHeader10 const & Header(*reinterpret_cast<detail::kmgHeader10 const *>(Data));

size_t Offset = sizeof(detail::kmgHeader10);
Expand Down
4 changes: 3 additions & 1 deletion gli/core/load_ktx.inl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ namespace detail
return TARGET_2D;
}

inline texture load_ktx10(char const* Data, std::size_t Size)
inline texture load_ktx10(char const* Data, std::size_t Size )
{
(void)Size; // parameter unused

detail::ktx_header10 const & Header(*reinterpret_cast<detail::ktx_header10 const*>(Data));

size_t Offset = sizeof(detail::ktx_header10);
Expand Down
2 changes: 1 addition & 1 deletion gli/core/save_dds.inl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace detail
if(Texture.faces() > 1)
{
GLI_ASSERT(Texture.faces() == 6);
Header.CubemapFlags |= detail::DDSCAPS2_CUBEMAP_ALLFACES | detail::DDSCAPS2_CUBEMAP;
Header.CubemapFlags |= (glm::uint32)detail::DDSCAPS2_CUBEMAP_ALLFACES | detail::DDSCAPS2_CUBEMAP;
}

// Texture3D
Expand Down
25 changes: 13 additions & 12 deletions gli/core/storage_linear.inl
Original file line number Diff line number Diff line change
Expand Up @@ -107,44 +107,45 @@ namespace gli
return BaseOffset;
}

inline storage_linear::size_type storage_linear::image_offset(extent1d const& Coord, extent1d const& Extent) const
inline storage_linear::size_type storage_linear::image_offset(extent1d const& Coord, extent1d const& Extent_) const
{
GLI_ASSERT(glm::all(glm::lessThan(Coord, Extent)));
GLI_UNUSED(Extent_);
GLI_ASSERT(glm::all(glm::lessThan(Coord, Extent_)));
return static_cast<size_t>(Coord.x);
}

inline storage_linear::size_type storage_linear::image_offset(extent2d const& Coord, extent2d const& Extent) const
inline storage_linear::size_type storage_linear::image_offset(extent2d const& Coord, extent2d const& Extent_) const
{
GLI_ASSERT(glm::all(glm::lessThan(Coord, Extent)));
return static_cast<size_t>(Coord.x + Coord.y * Extent.x);
GLI_ASSERT(glm::all(glm::lessThan(Coord, Extent_)));
return static_cast<size_t>(Coord.x + Coord.y * Extent_.x);
}

inline storage_linear::size_type storage_linear::image_offset(extent3d const& Coord, extent3d const& Extent) const
inline storage_linear::size_type storage_linear::image_offset(extent3d const& Coord, extent3d const& Extent_) const
{
GLI_ASSERT(glm::all(glm::lessThan(Coord, Extent)));
return static_cast<storage_linear::size_type>(Coord.x + Coord.y * Extent.x + Coord.z * Extent.x * Extent.y);
GLI_ASSERT(glm::all(glm::lessThan(Coord, Extent_)));
return static_cast<storage_linear::size_type>(Coord.x + Coord.y * Extent_.x + Coord.z * Extent_.x * Extent_.y);
}

inline void storage_linear::copy(
storage_linear const& StorageSrc,
size_t LayerSrc, size_t FaceSrc, size_t LevelSrc, extent_type const& BlockIndexSrc,
size_t LayerDst, size_t FaceDst, size_t LevelDst, extent_type const& BlockIndexDst,
extent_type const& BlockCount)
extent_type const& BlockCount_)
{
storage_linear::size_type const BaseOffsetSrc = StorageSrc.base_offset(LayerSrc, FaceSrc, LevelSrc);
storage_linear::size_type const BaseOffsetDst = this->base_offset(LayerDst, FaceDst, LevelDst);
storage_linear::data_type const* const ImageSrc = StorageSrc.data() + BaseOffsetSrc;
storage_linear::data_type* const ImageDst = this->data() + BaseOffsetDst;

for(size_t BlockIndexZ = 0, BlockCountZ = BlockCount.z; BlockIndexZ < BlockCountZ; ++BlockIndexZ)
for(size_t BlockIndexY = 0, BlockCountY = BlockCount.y; BlockIndexY < BlockCountY; ++BlockIndexY)
for(size_t BlockIndexZ = 0, BlockCountZ = BlockCount_.z; BlockIndexZ < BlockCountZ; ++BlockIndexZ)
for(size_t BlockIndexY = 0, BlockCountY = BlockCount_.y; BlockIndexY < BlockCountY; ++BlockIndexY)
{
extent_type const BlockIndex(0, BlockIndexY, BlockIndexZ);
gli::size_t const OffsetSrc = StorageSrc.image_offset(BlockIndexSrc + BlockIndex, StorageSrc.extent(LevelSrc)) * StorageSrc.block_size();
gli::size_t const OffsetDst = this->image_offset(BlockIndexDst + BlockIndex, this->extent(LevelDst)) * this->block_size();
storage_linear::data_type const* const DataSrc = ImageSrc + OffsetSrc;
storage_linear::data_type* DataDst = ImageDst + OffsetDst;
memcpy(DataDst, DataSrc, this->block_size() * BlockCount.x);
memcpy(DataDst, DataSrc, this->block_size() * BlockCount_.x);
}
}

Expand Down
1 change: 1 addition & 0 deletions gli/core/view.inl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ namespace gli
texture_cube::size_type BaseLevel, texture_cube::size_type MaxLevel
)
{
GLI_UNUSED(BaseFace);
GLI_ASSERT(!Texture.empty());
GLI_ASSERT(BaseLevel >= 0 && BaseLevel < Texture.levels() && MaxLevel >= 0 && MaxLevel < Texture.levels() && BaseLevel <= MaxLevel);
GLI_ASSERT(BaseFace >= 0 && BaseFace < Texture.faces() && MaxFace >= 0 && MaxFace < Texture.faces() && BaseFace <= MaxFace);
Expand Down
4 changes: 2 additions & 2 deletions gli/gl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ namespace gli
unsigned int Properties;
};

bool has_swizzle(profile Profile) const
bool has_swizzle(profile Profile_) const
{
return Profile == PROFILE_ES30 || Profile == PROFILE_GL33;
return Profile_ == PROFILE_ES30 || Profile_ == PROFILE_GL33;
}

gl::swizzles compute_swizzle(format_desc const& FormatDesc, gli::swizzles const& Swizzle) const;
Expand Down
2 changes: 2 additions & 0 deletions gli/type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# define GLI_ASSERT(test) assert((test))
#endif

#define GLI_UNUSED(x) (void)(x)

namespace gli
{
using namespace glm;
Expand Down