diff --git a/examples/12-lod/lod.cpp b/examples/12-lod/lod.cpp index 4ce9cca3f..510565d0e 100644 --- a/examples/12-lod/lod.cpp +++ b/examples/12-lod/lod.cpp @@ -146,7 +146,7 @@ class ExampleLod : public entry::AppI imguiEndFrame(); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index 9ca6c7269..5149e79e3 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -661,7 +661,7 @@ struct HalfEdges m_offsets = (uint32_t*)malloc(numRows * sizeof(uint32_t) ); HalfEdge* he = m_data; - for (uint32_t ii = 0; ii < numRows; ++ii) + for (uint16_t ii = 0; ii < numRows; ++ii) { m_offsets[ii] = uint32_t(he - m_data); @@ -753,7 +753,7 @@ uint16_t weldVertices(WeldedVertex* _output, const bgfx::VertexDecl& _decl, cons const uint32_t hashMask = hashSize-1; const float epsilonSq = _epsilon*_epsilon; - uint32_t numVertices = 0; + uint16_t numVertices = 0; const uint32_t size = sizeof(uint16_t)*(hashSize + _num); uint16_t* hashTable = (uint16_t*)alloca(size); @@ -761,7 +761,7 @@ uint16_t weldVertices(WeldedVertex* _output, const bgfx::VertexDecl& _decl, cons uint16_t* next = hashTable + hashSize; - for (uint32_t ii = 0; ii < _num; ++ii) + for (uint16_t ii = 0; ii < _num; ++ii) { float pos[4]; vertexUnpack(pos, bgfx::Attrib::Position, _decl, _data, ii); @@ -988,7 +988,7 @@ namespace bgfx struct Mesh { - void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) { Group group; const bgfx::Memory* mem; @@ -1137,7 +1137,7 @@ struct Model m_texture.idx = bgfx::invalidHandle; } - void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) { m_mesh.load(_vertices, _numVertices, _decl, _indices, _numIndices); } @@ -1562,7 +1562,7 @@ void shadowVolumeCreate(ShadowVolume& _shadowVolume for (uint16_t jj = 0; jj < 2; ++jj) { - int16_t kk = res[jj] + res[jj+2]; + int32_t kk = res[jj] + res[jj+2]; if (kk != 0) { float* v0 = (float*)&vertices[edges[ii+jj].m_i0*_stride]; @@ -1574,7 +1574,7 @@ void shadowVolumeCreate(ShadowVolume& _shadowVolume kk = _textureAsStencil ? 1 : kk; uint16_t winding = uint16_t(kk > 0); - for (uint8_t ll = 0, end = abs(kk); ll < end; ++ll) + for (int32_t ll = 0, end = abs(kk); ll < end; ++ll) { indicesSide[sideI++] = indexSide; indicesSide[sideI++] = indexSide + 2 - winding; @@ -1611,7 +1611,7 @@ void shadowVolumeCreate(ShadowVolume& _shadowVolume kk = _textureAsStencil ? 1 : kk; uint16_t winding = uint16_t(kk > 0); - for (uint8_t jj = 0, end = abs(kk); jj < end; ++jj) + for (int32_t jj = 0, end = abs(kk); jj < end; ++jj) { indicesSide[sideI++] = indexSide; indicesSide[sideI++] = indexSide + 2 - winding; @@ -1878,8 +1878,8 @@ int _main_(int _argc, char** _argv) bgfx::TextureHandle fbtextures[] = { - bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT), - bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY), + bgfx::createTexture2D(uint16_t(viewState.m_width), uint16_t(viewState.m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_RT), + bgfx::createTexture2D(uint16_t(viewState.m_width), uint16_t(viewState.m_height), false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY), }; s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); @@ -2072,8 +2072,8 @@ int _main_(int _argc, char** _argv) bgfx::destroyFrameBuffer(s_stencilFb); - fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT); - fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY); + fbtextures[0] = bgfx::createTexture2D(uint16_t(viewState.m_width), uint16_t(viewState.m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT); + fbtextures[1] = bgfx::createTexture2D(uint16_t(viewState.m_width), uint16_t(viewState.m_height), false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY); s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); } @@ -2116,8 +2116,8 @@ int _main_(int _argc, char** _argv) | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , mouseState.m_mz - , viewState.m_width - , viewState.m_height + , uint16_t(viewState.m_width) + , uint16_t(viewState.m_height) ); imguiBeginScrollArea("Settings", viewState.m_width - 256 - 10, 10, 256, 700, &scrollAreaRight); @@ -2792,7 +2792,7 @@ int _main_(int _argc, char** _argv) } // Setup view rect and transform for all used views. - setViewRectMask(s_viewMask, 0, 0, viewState.m_width, viewState.m_height); + setViewRectMask(s_viewMask, 0, 0, uint16_t(viewState.m_width), uint16_t(viewState.m_height) ); setViewTransformMask(s_viewMask, viewState.m_view, viewState.m_proj); s_viewMask = 0; diff --git a/examples/17-drawstress/drawstress.cpp b/examples/17-drawstress/drawstress.cpp index d3546f650..18a7a8fee 100644 --- a/examples/17-drawstress/drawstress.cpp +++ b/examples/17-drawstress/drawstress.cpp @@ -205,8 +205,8 @@ class ExampleDrawStress : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginScrollArea("Settings", m_width - m_width / 4 - 10, 10, m_width / 4, m_height / 2, &m_scrollArea); @@ -249,7 +249,7 @@ class ExampleDrawStress : public entry::AppI bgfx::setViewTransform(0, view, proj); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. diff --git a/examples/19-oit/oit.cpp b/examples/19-oit/oit.cpp index 59fefbf4b..90c5db05c 100644 --- a/examples/19-oit/oit.cpp +++ b/examples/19-oit/oit.cpp @@ -264,8 +264,8 @@ class ExampleOIT : public entry::AppI bgfx::destroyFrameBuffer(m_fbh); } - m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT); - m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT); + m_fbtextures[0] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT); + m_fbtextures[1] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT); m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true); } @@ -275,8 +275,8 @@ class ExampleOIT : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginScrollArea("Settings", m_width - m_width / 4 - 10, 10, m_width / 4, m_height / 3, &m_scrollArea); @@ -306,8 +306,8 @@ class ExampleOIT : public entry::AppI imguiEndFrame(); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); - bgfx::setViewRect(1, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) ); int64_t now = bx::getHPCounter(); static int64_t last = now; diff --git a/examples/20-nanovg/nanovg.cpp b/examples/20-nanovg/nanovg.cpp index 42d2fdbe8..e6f89ce7c 100644 --- a/examples/20-nanovg/nanovg.cpp +++ b/examples/20-nanovg/nanovg.cpp @@ -73,7 +73,7 @@ static char* cpToUTF8(int cp, char* str) case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; - case 1: str[0] = cp; + case 1: str[0] = char(cp); } return str; } @@ -1262,7 +1262,7 @@ class ExampleNanoVG : public entry::AppI float time = (float)( (now-m_timeOffset)/freq); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. diff --git a/examples/21-deferred/deferred.cpp b/examples/21-deferred/deferred.cpp index fb3f91ac4..de37b19f8 100644 --- a/examples/21-deferred/deferred.cpp +++ b/examples/21-deferred/deferred.cpp @@ -401,7 +401,7 @@ class ExampleDeferred : public entry::AppI bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " MRT not supported by GPU. "); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. @@ -432,9 +432,9 @@ class ExampleDeferred : public entry::AppI | BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP ; - m_gbufferTex[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); - m_gbufferTex[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); - m_gbufferTex[2] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D24, samplerFlags); + m_gbufferTex[0] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); + m_gbufferTex[1] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); + m_gbufferTex[2] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::D24, samplerFlags); m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true); if (bgfx::isValid(m_lightBuffer) ) @@ -442,7 +442,7 @@ class ExampleDeferred : public entry::AppI bgfx::destroyFrameBuffer(m_lightBuffer); } - m_lightBuffer = bgfx::createFrameBuffer(m_width, m_height, bgfx::TextureFormat::BGRA8, samplerFlags); + m_lightBuffer = bgfx::createFrameBuffer(uint16_t(m_width), uint16_t(m_height), bgfx::TextureFormat::BGRA8, samplerFlags); } imguiBeginFrame(m_mouseState.m_mx @@ -451,8 +451,8 @@ class ExampleDeferred : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginScrollArea("Settings", m_width - m_width / 5 - 10, 10, m_width / 5, m_height / 3, &m_scrollArea); @@ -490,11 +490,11 @@ class ExampleDeferred : public entry::AppI float vp[16]; float invMvp[16]; { - bgfx::setViewRect(RENDER_PASS_GEOMETRY_ID, 0, 0, m_width, m_height); - bgfx::setViewRect(RENDER_PASS_LIGHT_ID, 0, 0, m_width, m_height); - bgfx::setViewRect(RENDER_PASS_COMBINE_ID, 0, 0, m_width, m_height); - bgfx::setViewRect(RENDER_PASS_DEBUG_LIGHTS_ID, 0, 0, m_width, m_height); - bgfx::setViewRect(RENDER_PASS_DEBUG_GBUFFER_ID, 0, 0, m_width, m_height); + bgfx::setViewRect(RENDER_PASS_GEOMETRY_ID, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + bgfx::setViewRect(RENDER_PASS_LIGHT_ID, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + bgfx::setViewRect(RENDER_PASS_COMBINE_ID, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + bgfx::setViewRect(RENDER_PASS_DEBUG_LIGHTS_ID, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + bgfx::setViewRect(RENDER_PASS_DEBUG_GBUFFER_ID, 0, 0, uint16_t(m_width), uint16_t(m_height) ); bgfx::setViewFrameBuffer(RENDER_PASS_LIGHT_ID, m_lightBuffer); @@ -685,7 +685,7 @@ class ExampleDeferred : public entry::AppI bgfx::setUniform(u_lightRgbInnerR, lightRgbInnerR); bgfx::setUniform(u_mtx, invMvp); const uint16_t scissorHeight = uint16_t(y1-y0); - bgfx::setScissor(uint16_t(x0), m_height-scissorHeight-uint16_t(y0), uint16_t(x1-x0), scissorHeight); + bgfx::setScissor(uint16_t(x0), uint16_t(m_height-scissorHeight-y0), uint16_t(x1-x0), uint16_t(scissorHeight) ); bgfx::setTexture(0, s_normal, bgfx::getTexture(m_gbuffer, 1) ); bgfx::setTexture(1, s_depth, bgfx::getTexture(m_gbuffer, 2) ); bgfx::setState(0 diff --git a/examples/22-windows/windows.cpp b/examples/22-windows/windows.cpp index 6bede26b6..1b900d7d0 100644 --- a/examples/22-windows/windows.cpp +++ b/examples/22-windows/windows.cpp @@ -187,7 +187,7 @@ public: if (NULL != win.m_nwh) { - m_fbh[viewId] = bgfx::createFrameBuffer(win.m_nwh, win.m_width, win.m_height); + m_fbh[viewId] = bgfx::createFrameBuffer(win.m_nwh, uint16_t(win.m_width), uint16_t(win.m_height) ); } else { @@ -207,13 +207,13 @@ public: bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); bgfx::setViewTransform(0, view, proj); - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. bgfx::touch(0); // Set view and projection matrix for view 0. - for (uint32_t ii = 1; ii < MAX_WINDOWS; ++ii) + for (uint8_t ii = 1; ii < MAX_WINDOWS; ++ii) { bgfx::setViewTransform(ii, view, proj); bgfx::setViewFrameBuffer(ii, m_fbh[ii]); @@ -221,12 +221,12 @@ public: if (!bgfx::isValid(m_fbh[ii]) ) { // Set view to default viewport. - bgfx::setViewRect(ii, 0, 0, m_width, m_height); + bgfx::setViewRect(ii, 0, 0, uint16_t(m_width), uint16_t(m_height) ); bgfx::setViewClear(ii, BGFX_CLEAR_NONE); } else { - bgfx::setViewRect(ii, 0, 0, m_windows[ii].m_width, m_windows[ii].m_height); + bgfx::setViewRect(ii, 0, 0, uint16_t(m_windows[ii].m_width), uint16_t(m_windows[ii].m_height) ); bgfx::setViewClear(ii , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH , 0x303030ff diff --git a/examples/23-vectordisplay/main.cpp b/examples/23-vectordisplay/main.cpp index f1dcd00d9..9a89d16ab 100644 --- a/examples/23-vectordisplay/main.cpp +++ b/examples/23-vectordisplay/main.cpp @@ -47,7 +47,7 @@ int _main_(int _argc, char** _argv) bool originBottomLeft = bgfx::RendererType::OpenGL == renderer || bgfx::RendererType::OpenGLES == renderer; VectorDisplay vd(originBottomLeft, texelHalf); - vd.setup(width, height); + vd.setup(uint16_t(width), uint16_t(height) ); // Enable debug text. bgfx::setDebug(debug); @@ -71,7 +71,7 @@ int _main_(int _argc, char** _argv) { oldWidth = width; oldHeight = height; - vd.resize(width, height); + vd.resize(uint16_t(width), uint16_t(height) ); } float view[16]; @@ -82,7 +82,7 @@ int _main_(int _argc, char** _argv) bgfx::setViewTransform(0, view, proj); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) ); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. diff --git a/examples/23-vectordisplay/vectordisplay.cpp b/examples/23-vectordisplay/vectordisplay.cpp index 79985a2ac..f5b5828f2 100644 --- a/examples/23-vectordisplay/vectordisplay.cpp +++ b/examples/23-vectordisplay/vectordisplay.cpp @@ -56,7 +56,7 @@ VectorDisplay::VectorDisplay(bool _originBottomLeft, float _texelHalf) { } -void VectorDisplay::setup(uint16_t _width, uint16_t _height, int _view) +void VectorDisplay::setup(uint16_t _width, uint16_t _height, uint8_t _view) { PosColorUvVertex::init(); @@ -190,7 +190,7 @@ void VectorDisplay::endFrame() } } - int viewCounter = m_view + 1; + uint8_t viewCounter = m_view + 1; bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); diff --git a/examples/23-vectordisplay/vectordisplay.h b/examples/23-vectordisplay/vectordisplay.h index b11400eb9..3ac7a4b55 100644 --- a/examples/23-vectordisplay/vectordisplay.h +++ b/examples/23-vectordisplay/vectordisplay.h @@ -40,7 +40,7 @@ public: { } - void setup(uint16_t _width, uint16_t _height, int _view = 2); + void setup(uint16_t _width, uint16_t _height, uint8_t _view = 2); void resize(uint16_t _width, uint16_t _height); void teardown(); @@ -167,14 +167,17 @@ protected: bgfx::FrameBufferHandle m_glow0FrameBuffer; // framebuffer for glow pass 0 bgfx::FrameBufferHandle m_glow1FrameBuffer; // framebuffer for glow pass 1 - int m_view; + uint8_t m_view; uint16_t m_screenWidth, m_screenHeight; uint16_t m_glowWidth, m_glowHeight; int m_numberDecaySteps; float m_decayValue; - uint8_t m_drawColorR, m_drawColorG, m_drawColorB, m_drawColorA; + uint8_t m_drawColorR; + uint8_t m_drawColorG; + uint8_t m_drawColorB; + uint8_t m_drawColorA; stl::vector m_points; stl::vector m_pendingPoints; diff --git a/examples/24-nbody/nbody.cpp b/examples/24-nbody/nbody.cpp index 51e4d2cc5..0350ab5bb 100644 --- a/examples/24-nbody/nbody.cpp +++ b/examples/24-nbody/nbody.cpp @@ -212,7 +212,7 @@ int _main_(int _argc, char** _argv) } // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) ); // Use debug font to print information about this example. bgfx::dbgTextClear(); @@ -225,8 +225,8 @@ int _main_(int _argc, char** _argv) | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , mouseState.m_mz - , width - , height + , uint16_t(width) + , uint16_t(height) ); imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea); imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100); @@ -285,7 +285,7 @@ int _main_(int _argc, char** _argv) } else { - bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1); + bgfx::dispatch(0, updateInstancesProgram, uint16_t(u_paramsData.dispatchSize), 1, 1); } bx::xchg(currPositionBuffer0, currPositionBuffer1); @@ -320,7 +320,7 @@ int _main_(int _argc, char** _argv) bgfx::setViewTransform(0, view, proj); // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) ); } // Set vertex and index buffer. @@ -382,7 +382,7 @@ int _main_(int _argc, char** _argv) int64_t now = bx::getHPCounter(); float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) ); - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height)); bgfx::dbgTextClear(); bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody"); diff --git a/examples/25-c99/helloworld.c b/examples/25-c99/helloworld.c index 6b0a029fe..6fb38ae0d 100644 --- a/examples/25-c99/helloworld.c +++ b/examples/25-c99/helloworld.c @@ -43,7 +43,7 @@ int _main_(int _argc, char** _argv) while (!entry_process_events(&width, &height, &debug, &reset) ) { // Set view 0 default viewport. - bgfx_set_view_rect(0, 0, 0, width, height); + bgfx_set_view_rect(0, 0, 0, (uint16_t)width, (uint16_t)height); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. @@ -51,13 +51,14 @@ int _main_(int _argc, char** _argv) // Use debug font to print information about this example. bgfx_dbg_text_clear(0, false); - bgfx_dbg_text_image(uint16_max(width/2/8, 20)-20 - , uint16_max(height/2/16, 6)-6 - , 40 - , 12 - , s_logo - , 160 - ); + bgfx_dbg_text_image( + uint16_max( (uint16_t)width /2/8, 20)-20 + , uint16_max( (uint16_t)height/2/16, 6)-6 + , 40 + , 12 + , s_logo + , 160 + ); bgfx_dbg_text_printf(0, 1, 0x4f, "bgfx/examples/25-c99"); bgfx_dbg_text_printf(0, 2, 0x6f, "Description: Initialization and debug text with C99 API."); diff --git a/examples/26-occlusion/occlusion.cpp b/examples/26-occlusion/occlusion.cpp index bf97d6653..634aaa6cc 100644 --- a/examples/26-occlusion/occlusion.cpp +++ b/examples/26-occlusion/occlusion.cpp @@ -193,17 +193,17 @@ class ExampleOcclusion : public entry::AppI bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f, bgfx::getCaps()->homogeneousDepth); bgfx::setViewTransform(0, view, proj); - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) ); bgfx::setViewTransform(1, view, proj); - bgfx::setViewRect(1, 0, 0, width, height); + bgfx::setViewRect(1, 0, 0, uint16_t(width), uint16_t(height) ); float at[3] = { 0.0f, 0.0f, 0.0f }; float eye[3] = { 17.5f, 10.0f, -17.5f }; bx::mtxLookAt(view, eye, at); bgfx::setViewTransform(2, view, proj); - bgfx::setViewRect(2, 10, height - height/4 - 10, width/4, height/4); + bgfx::setViewRect(2, 10, uint16_t(height - height/4 - 10), uint16_t(width/4), uint16_t(height/4) ); } bgfx::touch(0); @@ -251,7 +251,7 @@ class ExampleOcclusion : public entry::AppI } } - for (uint32_t xx = 0; xx < CUBES_DIM; ++xx) + for (uint16_t xx = 0; xx < CUBES_DIM; ++xx) { bgfx::dbgTextImage(5 + xx*2, 5, 1, CUBES_DIM, img + xx*2, CUBES_DIM*2); } diff --git a/examples/27-terrain/terrain.cpp b/examples/27-terrain/terrain.cpp index 72c443a5c..3bcd8491d 100644 --- a/examples/27-terrain/terrain.cpp +++ b/examples/27-terrain/terrain.cpp @@ -12,7 +12,7 @@ #include #include -static uint32_t s_terrainSize = 256; +static const uint16_t s_terrainSize = 256; struct PosTexCoord0Vertex { @@ -198,10 +198,10 @@ class ExampleTerrain : public entry::AppI } m_terrain.m_indexCount = 0; - for (uint32_t y = 0; y < (s_terrainSize - 1); y++) + for (uint16_t y = 0; y < (s_terrainSize - 1); y++) { - uint32_t y_offset = (y * s_terrainSize); - for (uint32_t x = 0; x < (s_terrainSize - 1); x++) + uint16_t y_offset = (y * s_terrainSize); + for (uint16_t x = 0; x < (s_terrainSize - 1); x++) { m_terrain.m_indices[m_terrain.m_indexCount + 0] = y_offset + x + 1; m_terrain.m_indices[m_terrain.m_indexCount + 1] = y_offset + x + s_terrainSize; @@ -398,8 +398,8 @@ class ExampleTerrain : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginScrollArea("Settings", m_width - m_width / 5 - 10, 10, m_width / 5, m_height / 3, &m_scrollArea); @@ -455,7 +455,7 @@ class ExampleTerrain : public entry::AppI } // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); cameraGetViewMtx(m_viewMtx); bx::mtxProj(m_projMtx, 60.0f, float(m_width) / float(m_height), 0.1f, 2000.0f, bgfx::getCaps()->homogeneousDepth); diff --git a/examples/28-wireframe/wireframe.cpp b/examples/28-wireframe/wireframe.cpp index 03d01db0c..332a4f1e6 100644 --- a/examples/28-wireframe/wireframe.cpp +++ b/examples/28-wireframe/wireframe.cpp @@ -394,8 +394,8 @@ class ExampleWireframe : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginScrollArea("Settings" diff --git a/examples/29-debugdraw/debugdraw.cpp b/examples/29-debugdraw/debugdraw.cpp index 7b8c22071..f3b0cf5c0 100644 --- a/examples/29-debugdraw/debugdraw.cpp +++ b/examples/29-debugdraw/debugdraw.cpp @@ -121,7 +121,7 @@ class DebugDrawApp : public entry::AppI bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); bgfx::setViewTransform(0, view, proj); - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); } float zero[3] = {}; diff --git a/examples/30-picking/picking.cpp b/examples/30-picking/picking.cpp index 4419f3202..563e44bf6 100644 --- a/examples/30-picking/picking.cpp +++ b/examples/30-picking/picking.cpp @@ -363,8 +363,8 @@ class ExamplePicking : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginArea("Picking Render Target:", 10, 100, 300, 400); diff --git a/examples/31-rsm/reflectiveshadowmap.cpp b/examples/31-rsm/reflectiveshadowmap.cpp index 40117ffed..00134c7c4 100644 --- a/examples/31-rsm/reflectiveshadowmap.cpp +++ b/examples/31-rsm/reflectiveshadowmap.cpp @@ -579,8 +579,8 @@ public: // Set up transform matrix for fullscreen quad float orthoProj[16]; bx::mtxOrtho(orthoProj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); - bgfx::setViewTransform(RENDER_PASS_COMBINE, NULL, orthoProj); - bgfx::setViewRect(RENDER_PASS_COMBINE, 0, 0, m_width, m_height); + bgfx::setViewTransform(RENDER_PASS_COMBINE, NULL, orthoProj); + bgfx::setViewRect(RENDER_PASS_COMBINE, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // Bind vertex buffer and draw quad screenSpaceQuad( (float)m_width, (float)m_height, m_texelHalf, m_caps->originBottomLeft); bgfx::submit(RENDER_PASS_COMBINE, m_combineProgram); @@ -592,8 +592,8 @@ public: | (m_mouseState.m_buttons[entry::MouseButton::Right] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); imguiBeginArea("RSM:", 10, 100, 300, 400); diff --git a/examples/32-particles/particles.cpp b/examples/32-particles/particles.cpp index a1f6f7fe0..ca38efa60 100644 --- a/examples/32-particles/particles.cpp +++ b/examples/32-particles/particles.cpp @@ -305,7 +305,7 @@ class Particles : public entry::AppI if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) { // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); bgfx::touch(0); @@ -346,7 +346,7 @@ class Particles : public entry::AppI bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); bgfx::setViewTransform(0, view, proj); - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); } imguiBeginFrame( @@ -356,8 +356,8 @@ class Particles : public entry::AppI | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz - , m_width - , m_height + , uint16_t(m_width) + , uint16_t(m_height) ); ImGui::Begin("Properties" diff --git a/scripts/genie.lua b/scripts/genie.lua index 416075b9e..9230a56fb 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -141,6 +141,10 @@ function exampleProject(_name) path.join(BGFX_DIR, "examples", _name, "**.bin.h"), } + flags { + "FatalWarnings", + } + links { "example-common", "bgfx",