diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index dad95d88..ce8b5aac 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -675,7 +675,7 @@ struct HalfEdges m_offsets[ii] = uint32_t(he - m_data); std::vector<uint16_t>& row = edges[ii]; - for (uint32_t jj = 0, end = (uint32_t)row.size(); jj < end; ++jj) + for (uint32_t jj = 0, size = (uint32_t)row.size(); jj < size; ++jj) { he->m_secondIndex = row[jj]; he->m_marked = false; diff --git a/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/examples/15-shadowmaps-simple/shadowmaps_simple.cpp index 3e4e7940..9f7124c3 100644 --- a/examples/15-shadowmaps-simple/shadowmaps_simple.cpp +++ b/examples/15-shadowmaps-simple/shadowmaps_simple.cpp @@ -186,8 +186,8 @@ int _main_(int /*_argc*/, char** /*_argv*/) float view[16]; float proj[16]; - const float eye[3] = { 0.0f, 30.0f, -60.0f }; - const float at[3] = { 0.0f, 5.0f, 0.0f }; + float eye[3] = { 0.0f, 30.0f, -60.0f }; + float at[3] = { 0.0f, 5.0f, 0.0f }; bx::mtxLookAt(view, eye, at); const float aspect = float(int32_t(width) ) / float(int32_t(height) ); @@ -261,13 +261,14 @@ int _main_(int /*_argc*/, char** /*_argv*/) float lightView[16]; float lightProj[16]; - const float eye[3] = - { - -lightPos[0], - -lightPos[1], - -lightPos[2], - }; - const float at[3] = { 0.0f, 0.0f, 0.0f }; + eye[0] = -lightPos[0]; + eye[0] = -lightPos[1]; + eye[0] = -lightPos[2]; + + at[0] = 0.0f; + at[1] = 0.0f; + at[2] = 0.0f; + bx::mtxLookAt(lightView, eye, at); const float area = 30.0f; diff --git a/examples/16-shadowmaps/shadowmaps.cpp b/examples/16-shadowmaps/shadowmaps.cpp index 09dc689a..6754ccd2 100644 --- a/examples/16-shadowmaps/shadowmaps.cpp +++ b/examples/16-shadowmaps/shadowmaps.cpp @@ -2452,10 +2452,10 @@ int _main_(int /*_argc*/, char** /*_argv*/) } // Determine on-screen rectangle size where depth buffer will be drawn. - const uint16_t depthRectHeight = uint16_t(float(viewState.m_height) / 2.5f); - const uint16_t depthRectWidth = depthRectHeight; - const uint16_t depthRectX = 0; - const uint16_t depthRectY = viewState.m_height - depthRectHeight; + uint16_t depthRectHeight = uint16_t(float(viewState.m_height) / 2.5f); + uint16_t depthRectWidth = depthRectHeight; + uint16_t depthRectX = 0; + uint16_t depthRectY = viewState.m_height - depthRectHeight; // Setup views and render targets. bgfx::setViewRect(0, 0, 0, viewState.m_width, viewState.m_height); @@ -2583,10 +2583,10 @@ int _main_(int /*_argc*/, char** /*_argv*/) * RENDERVIEW_DRAWDEPTH_3_ID - Draw depth buffer for fourth split. */ - const uint16_t depthRectHeight = viewState.m_height / 3; - const uint16_t depthRectWidth = depthRectHeight; - const uint16_t depthRectX = 0; - const uint16_t depthRectY = viewState.m_height - depthRectHeight; + depthRectHeight = viewState.m_height / 3; + depthRectWidth = depthRectHeight; + depthRectX = 0; + depthRectY = viewState.m_height - depthRectHeight; bgfx::setViewRect(RENDERVIEW_SHADOWMAP_1_ID, 0, 0, currentShadowMapSize, currentShadowMapSize); bgfx::setViewRect(RENDERVIEW_SHADOWMAP_2_ID, 0, 0, currentShadowMapSize, currentShadowMapSize); @@ -2795,10 +2795,10 @@ int _main_(int /*_argc*/, char** /*_argv*/) ); // Trees. - for (uint8_t ii = 0; ii < numTrees; ++ii) + for (uint8_t jj = 0; jj < numTrees; ++jj) { treeMesh.submit(viewId - , mtxTrees[ii] + , mtxTrees[jj] , *currentSmSettings->m_progPack , s_renderStates[renderStateIndex] ); @@ -2851,7 +2851,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float mtxShadow[16]; const float ymul = (s_flipV) ? 0.5f : -0.5f; - const float zadd = (DepthImpl::Linear == settings.m_depthImpl) ? 0.0f : 0.5f; + float zadd = (DepthImpl::Linear == settings.m_depthImpl) ? 0.0f : 0.5f; const float mtxBias[16] = { @@ -2870,7 +2870,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) else if (LightType::PointLight == settings.m_lightType) { const float s = (s_flipV) ? 1.0f : -1.0f; //sign - const float zadd = (DepthImpl::Linear == settings.m_depthImpl) ? 0.0f : 0.5f; + zadd = (DepthImpl::Linear == settings.m_depthImpl) ? 0.0f : 0.5f; const float mtxCropBias[2][TetrahedronFaces::Count][16] = { diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index 001232d5..4eb25a51 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -29,11 +29,12 @@ namespace entry #if ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR bx::ReallocatorI* getDefaultAllocator() { -BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC(); +BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4459); // warning C4459: declaration of 's_allocator' hides global declaration +BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow"); static bx::CrtAllocator s_allocator; return &s_allocator; -BX_PRAGMA_DIAGNOSTIC_POP_MSVC(); +BX_PRAGMA_DIAGNOSTIC_POP(); } #endif // ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR diff --git a/src/bgfx_p.h b/src/bgfx_p.h index d894d1b6..9ae0887b 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -1768,9 +1768,9 @@ namespace bgfx if (0 < m_free.size() ) { - Free free = m_free.front(); + Free freeBlock = m_free.front(); m_free.pop_front(); - return free.m_ptr; + return freeBlock.m_ptr; } return 0;