From 24ad492a98dc99abfbf7523b50bbdb13274c097e Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 17 Sep 2018 09:18:57 -0400 Subject: Hotfix/fixing warnings (#636) * * Remove dispose from IRInst * Use MemoryArena instead of MemoryPool * Make all IRInst not require Dtor - by having ref counted array store ptrs that need freeing * Increase block size - typically compilation is 2Mb of IR space(!) * Fix issues around StringRepresentation::equal because null has special meaning. * Don't bother to construct as String to compare StringRepresentation, just used UnownedStringSlice. * Added fromLiteral support to UnownedStringSlice and use instead of strlen version. * Use more conventional way to test StringRepresentation against a String. * Fix gcc/clang template problem with cast. * Fix warnings. --- tools/gfx/model.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tools/gfx/model.cpp') diff --git a/tools/gfx/model.cpp b/tools/gfx/model.cpp index 0173ce950..62e6ec1fd 100644 --- a/tools/gfx/model.cpp +++ b/tools/gfx/model.cpp @@ -141,7 +141,7 @@ RefPtr loadTextureImage( int prevExtentX = extentX; int prevExtentY = extentY; stbi_uc* prevData = data; - ptrdiff_t prevStride = stride; + int prevStride = int(stride); for(;;) { @@ -155,7 +155,7 @@ RefPtr loadTextureImage( if(!newExtentY) newExtentY = 1; stbi_uc* newData = (stbi_uc*) malloc(newExtentX * newExtentY * channelCount * sizeof(stbi_uc)); - ptrdiff_t newStride = newExtentX * channelCount * sizeof(stbi_uc); + int newStride = int(newExtentX * channelCount * sizeof(stbi_uc)); stbir_resize_uint8_srgb( prevData, prevExtentX, prevExtentY, prevStride, @@ -303,8 +303,8 @@ Result ModelLoader::load( size_t objFaceCounter = 0; for(auto objFaceVertexCount : objShape.mesh.num_face_vertices) { - size_t flatFaceIndex = flatFaceCounter++; - size_t objFaceIndex = objFaceCounter++; + const size_t flatFaceIndex = flatFaceCounter++; + const size_t objFaceIndex = objFaceCounter++; size_t smoothingGroup = objShape.mesh.smoothing_group_ids[objFaceIndex]; if(!smoothingGroup) { @@ -330,7 +330,7 @@ Result ModelLoader::load( smoothedVertexNormals.insert(std::make_pair(smoothVertexID, normalID)); - objIndex.normal_index = normalID; + objIndex.normal_index = int(normalID); } } } @@ -348,9 +348,9 @@ Result ModelLoader::load( size_t objFaceCounter = 0; for(auto objFaceVertexCount : objShape.mesh.num_face_vertices) { - size_t flatFaceIndex = flatFaceCounter++; - size_t objFaceIndex = objFaceCounter++; - unsigned int smoothingGroup = objShape.mesh.smoothing_group_ids[objFaceIndex]; + const size_t flatFaceIndex = flatFaceCounter++; + const size_t objFaceIndex = objFaceCounter++; + size_t smoothingGroup = objShape.mesh.smoothing_group_ids[objFaceIndex]; if(!smoothingGroup) { smoothingGroup = ~flatFaceIndex; @@ -506,7 +506,7 @@ Result ModelLoader::load( objVertexAttributes.texcoords[2 * objIndex.texcoord_index + 1]); } - flatIndex = flatVertices.size(); + flatIndex = uint32_t(flatVertices.size()); mapObjIndexToFlatIndex.insert(std::make_pair(objIndexKey, flatIndex)); flatVertices.push_back(flatVertex); } @@ -528,7 +528,7 @@ Result ModelLoader::load( modelData.vertexCount = (int)flatVertices.size(); modelData.indexCount = (int)flatIndices.size(); - modelData.meshCount = meshes.size(); + modelData.meshCount = int(meshes.size()); modelData.meshes = meshes.data(); BufferResource::Desc vertexBufferDesc; -- cgit v1.2.3