mirror of https://github.com/bkaradzic/bgfx
Fixed MSVC L4 warnings.
This commit is contained in:
parent
537c70965d
commit
071912b2d2
|
@ -47,7 +47,7 @@ class ExampleHelloWorld : public entry::AppI
|
|||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
|
||||
{
|
||||
// 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.
|
||||
|
@ -55,8 +55,8 @@ class ExampleHelloWorld : public entry::AppI
|
|||
|
||||
// Use debug font to print information about this example.
|
||||
bgfx::dbgTextClear();
|
||||
bgfx::dbgTextImage(bx::uint16_max(m_width /2/8, 20)-20
|
||||
, bx::uint16_max(m_height/2/16, 6)-6
|
||||
bgfx::dbgTextImage(bx::uint16_max(uint16_t(m_width /2/8 ), 20)-20
|
||||
, bx::uint16_max(uint16_t(m_height/2/16), 6)-6
|
||||
, 40
|
||||
, 12
|
||||
, s_logo
|
||||
|
|
|
@ -161,7 +161,7 @@ class ExampleCubes : 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
|
||||
|
|
|
@ -549,7 +549,7 @@ class ExampleMetaballs : public entry::AppI
|
|||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
|
||||
{
|
||||
// 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.
|
||||
|
@ -595,7 +595,7 @@ class ExampleMetaballs : 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) );
|
||||
}
|
||||
|
||||
// Stats.
|
||||
|
|
|
@ -37,7 +37,7 @@ inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, flo
|
|||
bx::mtxProj(_result, _fovy, _aspect, _near, _far, s_oglNdc);
|
||||
}
|
||||
|
||||
void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _x, float _y, float _width, float _height)
|
||||
void renderScreenSpaceQuad(uint8_t _view, bgfx::ProgramHandle _program, float _x, float _y, float _width, float _height)
|
||||
{
|
||||
bgfx::TransientVertexBuffer tvb;
|
||||
bgfx::TransientIndexBuffer tib;
|
||||
|
@ -161,10 +161,10 @@ class ExampleRaymarch : public entry::AppI
|
|||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
|
||||
{
|
||||
// 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) );
|
||||
|
||||
// Set view 1 default viewport.
|
||||
bgfx::setViewRect(1, 0, 0, m_width, m_height);
|
||||
bgfx::setViewRect(1, 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 viewZ 0.
|
||||
|
|
|
@ -61,7 +61,7 @@ class ExampleMesh : public entry::AppI
|
|||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
|
||||
{
|
||||
// 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.
|
||||
|
@ -109,7 +109,7 @@ class ExampleMesh : 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) );
|
||||
}
|
||||
|
||||
float mtx[16];
|
||||
|
|
|
@ -118,7 +118,7 @@ class ExampleInstancing : public entry::AppI
|
|||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
|
||||
{
|
||||
// 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.
|
||||
|
@ -178,7 +178,7 @@ class ExampleInstancing : 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) );
|
||||
}
|
||||
|
||||
const uint16_t instanceStride = 80;
|
||||
|
|
|
@ -195,7 +195,7 @@ class ExampleBump : public entry::AppI
|
|||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
|
||||
{
|
||||
// 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.
|
||||
|
@ -243,7 +243,7 @@ class ExampleBump : 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) );
|
||||
}
|
||||
|
||||
float lightPosRadius[4][4];
|
||||
|
|
|
@ -250,7 +250,7 @@ int _main_(int _argc, char** _argv)
|
|||
float ortho[16];
|
||||
bx::mtxOrtho(ortho, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
|
||||
bgfx::setViewTransform(0, view, ortho);
|
||||
bgfx::setViewRect(0, 0, 0, width, height);
|
||||
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
|
||||
}
|
||||
|
||||
// Submit the debug text.
|
||||
|
|
|
@ -771,14 +771,14 @@ static RenderState s_renderStates[RenderState::Count] =
|
|||
|
||||
struct ViewState
|
||||
{
|
||||
ViewState(uint32_t _width = 1280, uint32_t _height = 720)
|
||||
ViewState(uint16_t _width = 1280, uint16_t _height = 720)
|
||||
: m_width(_width)
|
||||
, m_height(_height)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t m_width;
|
||||
uint32_t m_height;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
|
||||
float m_view[16];
|
||||
float m_proj[16];
|
||||
|
@ -1971,8 +1971,13 @@ int _main_(int _argc, char** _argv)
|
|||
float timeAccumulatorScene = 0.0f;
|
||||
|
||||
entry::MouseState mouseState;
|
||||
while (!entry::processEvents(viewState.m_width, viewState.m_height, debug, reset, &mouseState) )
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
|
||||
{
|
||||
viewState.m_width = uint16_t(width);
|
||||
viewState.m_height = uint16_t(height);
|
||||
|
||||
// Imgui.
|
||||
imguiBeginFrame(mouseState.m_mx
|
||||
, mouseState.m_my
|
||||
|
@ -2451,7 +2456,7 @@ int _main_(int _argc, char** _argv)
|
|||
|
||||
// Reset render targets.
|
||||
const bgfx::FrameBufferHandle invalidRt = BGFX_INVALID_HANDLE;
|
||||
for (uint32_t ii = 0; ii < RENDERVIEW_DRAWDEPTH_3_ID+1; ++ii)
|
||||
for (uint8_t ii = 0; ii < RENDERVIEW_DRAWDEPTH_3_ID+1; ++ii)
|
||||
{
|
||||
bgfx::setViewFrameBuffer(ii, invalidRt);
|
||||
}
|
||||
|
@ -2767,7 +2772,7 @@ int _main_(int _argc, char** _argv)
|
|||
uint8_t renderStateIndex = RenderState::ShadowMap_PackDepth;
|
||||
if(LightType::PointLight == settings.m_lightType && settings.m_stencilPack)
|
||||
{
|
||||
renderStateIndex = (ii < 2) ? RenderState::ShadowMap_PackDepthHoriz : RenderState::ShadowMap_PackDepthVert;
|
||||
renderStateIndex = uint8_t( (ii < 2) ? RenderState::ShadowMap_PackDepthHoriz : RenderState::ShadowMap_PackDepthVert);
|
||||
}
|
||||
|
||||
// Floor.
|
||||
|
|
|
@ -81,7 +81,7 @@ RectanglePacker::RectanglePacker(uint32_t _width, uint32_t _height)
|
|||
{
|
||||
// We want a one pixel border around the whole atlas to avoid any artefact when
|
||||
// sampling texture
|
||||
m_skyline.push_back(Node(1, 1, _width - 2) );
|
||||
m_skyline.push_back(Node(1, 1, uint16_t(_width - 2) ) );
|
||||
}
|
||||
|
||||
void RectanglePacker::init(uint32_t _width, uint32_t _height)
|
||||
|
@ -95,32 +95,29 @@ void RectanglePacker::init(uint32_t _width, uint32_t _height)
|
|||
m_skyline.clear();
|
||||
// We want a one pixel border around the whole atlas to avoid any artifact when
|
||||
// sampling texture
|
||||
m_skyline.push_back(Node(1, 1, _width - 2) );
|
||||
m_skyline.push_back(Node(1, 1, uint16_t(_width - 2) ) );
|
||||
}
|
||||
|
||||
bool RectanglePacker::addRectangle(uint16_t _width, uint16_t _height, uint16_t& _outX, uint16_t& _outY)
|
||||
{
|
||||
int yy, best_height, best_index;
|
||||
int best_height, best_index;
|
||||
int32_t best_width;
|
||||
Node* node;
|
||||
Node* prev;
|
||||
_outX = 0;
|
||||
_outY = 0;
|
||||
|
||||
uint32_t ii;
|
||||
|
||||
best_height = INT_MAX;
|
||||
best_index = -1;
|
||||
best_width = INT_MAX;
|
||||
for (ii = 0; ii < m_skyline.size(); ++ii)
|
||||
for (uint16_t ii = 0, num = uint16_t(m_skyline.size() ); ii < num; ++ii)
|
||||
{
|
||||
yy = fit(ii, _width, _height);
|
||||
uint16_t yy = (uint16_t)fit(ii, _width, _height);
|
||||
if (yy >= 0)
|
||||
{
|
||||
node = &m_skyline[ii];
|
||||
if ( ( (yy + _height) < best_height)
|
||||
|| ( ( (yy + _height) == best_height)
|
||||
&& (node->width < best_width) ) )
|
||||
|| ( ( (yy + _height) == best_height) && (node->width < best_width) ) )
|
||||
{
|
||||
best_height = yy + _height;
|
||||
best_index = ii;
|
||||
|
@ -139,13 +136,13 @@ bool RectanglePacker::addRectangle(uint16_t _width, uint16_t _height, uint16_t&
|
|||
Node newNode(_outX, _outY + _height, _width);
|
||||
m_skyline.insert(m_skyline.begin() + best_index, newNode);
|
||||
|
||||
for (ii = best_index + 1; ii < m_skyline.size(); ++ii)
|
||||
for (uint16_t ii = uint16_t(best_index + 1), num = uint16_t(m_skyline.size() ); ii < num; ++ii)
|
||||
{
|
||||
node = &m_skyline[ii];
|
||||
prev = &m_skyline[ii - 1];
|
||||
if (node->x < (prev->x + prev->width) )
|
||||
{
|
||||
int shrink = prev->x + prev->width - node->x;
|
||||
uint16_t shrink = uint16_t(prev->x + prev->width - node->x);
|
||||
node->x += shrink;
|
||||
node->width -= shrink;
|
||||
if (node->width <= 0)
|
||||
|
@ -187,7 +184,7 @@ void RectanglePacker::clear()
|
|||
|
||||
// We want a one pixel border around the whole atlas to avoid any artefact when
|
||||
// sampling texture
|
||||
m_skyline.push_back(Node(1, 1, m_width - 2) );
|
||||
m_skyline.push_back(Node(1, 1, uint16_t(m_width - 2) ) );
|
||||
}
|
||||
|
||||
int32_t RectanglePacker::fit(uint32_t _skylineNodeIndex, uint16_t _width, uint16_t _height)
|
||||
|
|
|
@ -188,7 +188,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
const bool isNumber = (Key::Key0 <= _key && _key <= Key::Key9);
|
||||
if (isNumber)
|
||||
{
|
||||
return '0' + (_key - Key::Key0);
|
||||
return '0' + char(_key - Key::Key0);
|
||||
}
|
||||
|
||||
const bool isChar = (Key::KeyA <= _key && _key <= Key::KeyZ);
|
||||
|
@ -197,7 +197,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
enum { ShiftMask = Modifier::LeftShift|Modifier::RightShift };
|
||||
|
||||
const bool shift = !!(_modifiers&ShiftMask);
|
||||
return (shift ? 'A' : 'a') + (_key - Key::KeyA);
|
||||
return (shift ? 'A' : 'a') + char(_key - Key::KeyA);
|
||||
}
|
||||
|
||||
switch (_key)
|
||||
|
@ -538,7 +538,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
{
|
||||
_reset = s_reset;
|
||||
bgfx::reset(_width, _height, _reset);
|
||||
inputSetMouseResolution(_width, _height);
|
||||
inputSetMouseResolution(uint16_t(_width), uint16_t(_height) );
|
||||
}
|
||||
|
||||
_debug = s_debug;
|
||||
|
@ -692,7 +692,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
|
||||
if (handle.idx == 0)
|
||||
{
|
||||
inputSetMouseResolution(win.m_width, win.m_height);
|
||||
inputSetMouseResolution(uint16_t(win.m_width), uint16_t(win.m_height) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
{
|
||||
_reset = s_reset;
|
||||
bgfx::reset(s_window[0].m_width, s_window[0].m_height, _reset);
|
||||
inputSetMouseResolution(s_window[0].m_width, s_window[0].m_height);
|
||||
inputSetMouseResolution(uint16_t(s_window[0].m_width), uint16_t(s_window[0].m_height) );
|
||||
}
|
||||
|
||||
_debug = s_debug;
|
||||
|
|
|
@ -823,7 +823,7 @@ namespace entry
|
|||
WindowHandle findHandle(HWND _hwnd)
|
||||
{
|
||||
bx::LwMutexScope scope(m_lock);
|
||||
for (uint32_t ii = 0, num = m_windowAlloc.getNumHandles(); ii < num; ++ii)
|
||||
for (uint16_t ii = 0, num = m_windowAlloc.getNumHandles(); ii < num; ++ii)
|
||||
{
|
||||
uint16_t idx = m_windowAlloc.getHandleAt(ii);
|
||||
if (_hwnd == m_hwnd[idx])
|
||||
|
|
Loading…
Reference in New Issue