From 62d36ebe8a5826d13dd9a8bd9106856c9da2de08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 5 Jan 2016 10:55:00 -0800 Subject: [PATCH] Fixed compile warnings. --- src/image.cpp | 2 +- src/renderer_d3d9.cpp | 4 ++-- src/renderer_gl.cpp | 6 +++--- src/renderer_gl.h | 2 +- src/renderer_mtl.mm | 10 ++++++++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/image.cpp b/src/image.cpp index b03cdadcd..399eba0d0 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -2544,7 +2544,7 @@ namespace bgfx default: { - void* temp = BX_ALLOC(_allocator, imageGetSize(_format, _pitch/4, _height) ); + void* temp = BX_ALLOC(_allocator, imageGetSize(_format, uint16_t(_pitch/4), uint16_t(_height) ) ); imageDecodeToRgba8(temp, _src, _width, _height, _pitch, _format); imageRgba8ToRgba32f(_dst, _width, _height, _pitch, temp); BX_FREE(_allocator, temp); diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 3b7a15a87..38e4a7de8 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -2798,8 +2798,8 @@ namespace bgfx { namespace d3d9 m_height = textureHeight; m_depth = imageContainer.m_depth; m_numMips = numMips; - m_requestedFormat = imageContainer.m_format; - m_textureFormat = imageContainer.m_format; + m_requestedFormat = + m_textureFormat = uint8_t(imageContainer.m_format); const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat]; uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 0e7413ce2..d7ff1a431 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -3909,7 +3909,7 @@ namespace bgfx { namespace gl } } - bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags) + bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags) { m_target = _target; m_numMips = _numMips; @@ -3918,8 +3918,8 @@ namespace bgfx { namespace gl m_height = _height; m_depth = _depth; m_currentSamplerHash = UINT32_MAX; - m_requestedFormat = _format; - m_textureFormat = _format; + m_requestedFormat = + m_textureFormat = uint8_t(_format); const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE ); diff --git a/src/renderer_gl.h b/src/renderer_gl.h index 34804d6b2..715bf6ae9 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -1103,7 +1103,7 @@ namespace bgfx { namespace gl { } - bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags); + bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags); void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); void destroy(); void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index bb52c45b8..0cbacfd34 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -666,7 +666,7 @@ namespace bgfx { namespace mtl tc.m_sides = 0; tc.m_depth = 0; tc.m_numMips = 1; - tc.m_format = texture.m_requestedFormat; + tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; tc.m_mem = NULL; bx::write(&writer, tc); @@ -2040,7 +2040,13 @@ namespace bgfx { namespace mtl if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat); + imageDecodeToBgra8(temp + , data + , _rect.m_width + , _rect.m_height + , srcpitch + , TextureFormat::Enum(m_requestedFormat) + ); data = temp; }