mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Fixed variable narrowing warnings.
This commit is contained in:
parent
ad6b0d87af
commit
c85c12b5cd
8 changed files with 118 additions and 115 deletions
|
@ -456,7 +456,7 @@ struct Imgui
|
|||
}
|
||||
}
|
||||
|
||||
return bgfx::createTexture2D(_width, _height, 0, bgfx::TextureFormat::BGRA8, 0, mem);
|
||||
return bgfx::createTexture2D(uint16_t(_width), uint16_t(_height), 0, bgfx::TextureFormat::BGRA8, 0, mem);
|
||||
}
|
||||
|
||||
ImguiFontHandle create(const void* _data, uint32_t _size, float _fontSize)
|
||||
|
@ -910,7 +910,7 @@ struct Imgui
|
|||
Area& area = getCurrentArea();
|
||||
|
||||
const uint16_t parentBottom = parentArea.m_scissorY + parentArea.m_scissorHeight;
|
||||
const uint16_t childBottom = parentArea.m_widgetY + _height;
|
||||
const uint16_t childBottom = parentArea.m_widgetY + _height;
|
||||
const uint16_t bottom = IMGUI_MIN(childBottom, parentBottom);
|
||||
|
||||
const uint16_t top = IMGUI_MAX(parentArea.m_widgetY, parentArea.m_scissorY);
|
||||
|
|
49
src/bgfx.cpp
49
src/bgfx.cpp
|
@ -485,12 +485,12 @@ namespace bgfx
|
|||
memcpy(vertex, vert, sizeof(vert) );
|
||||
vertex += 4;
|
||||
|
||||
indices[0] = startVertex+0;
|
||||
indices[1] = startVertex+1;
|
||||
indices[2] = startVertex+2;
|
||||
indices[3] = startVertex+2;
|
||||
indices[4] = startVertex+3;
|
||||
indices[5] = startVertex+0;
|
||||
indices[0] = uint16_t(startVertex+0);
|
||||
indices[1] = uint16_t(startVertex+1);
|
||||
indices[2] = uint16_t(startVertex+2);
|
||||
indices[3] = uint16_t(startVertex+2);
|
||||
indices[4] = uint16_t(startVertex+3);
|
||||
indices[5] = uint16_t(startVertex+0);
|
||||
|
||||
startVertex += 4;
|
||||
indices += 6;
|
||||
|
@ -973,7 +973,7 @@ namespace bgfx
|
|||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii)
|
||||
{
|
||||
m_viewRemap[ii] = ii;
|
||||
m_viewRemap[ii] = uint8_t(ii);
|
||||
}
|
||||
|
||||
memset(m_fb, 0xff, sizeof(m_fb) );
|
||||
|
@ -1211,7 +1211,10 @@ namespace bgfx
|
|||
freeAllHandles(m_submit);
|
||||
|
||||
m_submit->resetFreeHandles();
|
||||
m_submit->m_textVideoMem->resize(m_render->m_textVideoMem->m_small, m_resolution.m_width, m_resolution.m_height);
|
||||
m_submit->m_textVideoMem->resize(m_render->m_textVideoMem->m_small
|
||||
, m_resolution.m_width
|
||||
, m_resolution.m_height
|
||||
);
|
||||
}
|
||||
|
||||
bool Context::renderFrame()
|
||||
|
@ -2380,15 +2383,15 @@ again:
|
|||
{
|
||||
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
|
||||
const uint8_t bpp = blockInfo.bitsPerPixel;
|
||||
const uint32_t blockWidth = blockInfo.blockWidth;
|
||||
const uint32_t blockHeight = blockInfo.blockHeight;
|
||||
const uint32_t minBlockX = blockInfo.minBlockX;
|
||||
const uint32_t minBlockY = blockInfo.minBlockY;
|
||||
const uint16_t blockWidth = blockInfo.blockWidth;
|
||||
const uint16_t blockHeight = blockInfo.blockHeight;
|
||||
const uint16_t minBlockX = blockInfo.minBlockX;
|
||||
const uint16_t minBlockY = blockInfo.minBlockY;
|
||||
|
||||
_width = bx::uint32_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
|
||||
_height = bx::uint32_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
|
||||
_depth = bx::uint32_max(1, _depth);
|
||||
_numMips = bx::uint32_max(1, _numMips);
|
||||
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
|
||||
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
|
||||
_depth = bx::uint16_max(1, _depth);
|
||||
_numMips = uint8_t(bx::uint16_max(1, _numMips) );
|
||||
|
||||
uint32_t width = _width;
|
||||
uint32_t height = _height;
|
||||
|
@ -2430,7 +2433,7 @@ again:
|
|||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
|
||||
_numMips = bx::uint32_max(1, _numMips);
|
||||
_numMips = uint8_t(bx::uint32_max(1, _numMips) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
|
||||
&& NULL != _mem)
|
||||
|
@ -2471,7 +2474,7 @@ again:
|
|||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(0 != (g_caps.supported & BGFX_CAPS_TEXTURE_3D), "Texture3D is not supported! Use bgfx::getCaps to check backend renderer capabilities.");
|
||||
|
||||
_numMips = bx::uint32_max(1, _numMips);
|
||||
_numMips = uint8_t(bx::uint32_max(1, _numMips) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
|
||||
&& NULL != _mem)
|
||||
|
@ -2511,7 +2514,7 @@ again:
|
|||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
|
||||
_numMips = bx::uint32_max(1, _numMips);
|
||||
_numMips = uint8_t(bx::uint32_max(1, _numMips) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
|
||||
&& NULL != _mem)
|
||||
|
@ -2651,10 +2654,10 @@ again:
|
|||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
|
||||
const uint8_t rr = _rgba>>24;
|
||||
const uint8_t gg = _rgba>>16;
|
||||
const uint8_t bb = _rgba>> 8;
|
||||
const uint8_t aa = _rgba>> 0;
|
||||
const uint8_t rr = uint8_t(_rgba>>24);
|
||||
const uint8_t gg = uint8_t(_rgba>>16);
|
||||
const uint8_t bb = uint8_t(_rgba>> 8);
|
||||
const uint8_t aa = uint8_t(_rgba>> 0);
|
||||
|
||||
float rgba[4] =
|
||||
{
|
||||
|
|
18
src/bgfx_p.h
18
src/bgfx_p.h
|
@ -379,7 +379,7 @@ namespace bgfx
|
|||
BX_FREE(g_allocator, m_mem);
|
||||
}
|
||||
|
||||
void resize(bool _small = false, uint16_t _width = BGFX_DEFAULT_WIDTH, uint16_t _height = BGFX_DEFAULT_HEIGHT)
|
||||
void resize(bool _small = false, uint32_t _width = BGFX_DEFAULT_WIDTH, uint32_t _height = BGFX_DEFAULT_HEIGHT)
|
||||
{
|
||||
uint32_t width = bx::uint32_max(1, _width/8);
|
||||
uint32_t height = bx::uint32_max(1, _height/(_small ? 8 : 16) );
|
||||
|
@ -389,8 +389,8 @@ namespace bgfx
|
|||
|| m_height != height
|
||||
|| m_small != _small)
|
||||
{
|
||||
m_small = _small;
|
||||
m_width = (uint16_t)width;
|
||||
m_small = _small;
|
||||
m_width = (uint16_t)width;
|
||||
m_height = (uint16_t)height;
|
||||
|
||||
uint32_t size = m_size;
|
||||
|
@ -1418,7 +1418,7 @@ namespace bgfx
|
|||
{
|
||||
m_draw.m_instanceDataOffset = _idb->offset;
|
||||
m_draw.m_instanceDataStride = _idb->stride;
|
||||
m_draw.m_numInstances = bx::uint32_min(_idb->num, _num);
|
||||
m_draw.m_numInstances = uint16_t(bx::uint32_min(_idb->num, _num) );
|
||||
m_draw.m_instanceDataBuffer = _idb->handle;
|
||||
BX_FREE(g_allocator, const_cast<InstanceDataBuffer*>(_idb) );
|
||||
}
|
||||
|
@ -1427,7 +1427,7 @@ namespace bgfx
|
|||
{
|
||||
m_draw.m_instanceDataOffset = _startVertex * _stride;
|
||||
m_draw.m_instanceDataStride = _stride;
|
||||
m_draw.m_numInstances = _num;
|
||||
m_draw.m_numInstances = uint16_t(_num);
|
||||
m_draw.m_instanceDataBuffer = _handle;
|
||||
}
|
||||
|
||||
|
@ -3068,10 +3068,10 @@ namespace bgfx
|
|||
{
|
||||
Clear& clear = m_clear[_id];
|
||||
clear.m_flags = _flags;
|
||||
clear.m_index[0] = _rgba>>24;
|
||||
clear.m_index[1] = _rgba>>16;
|
||||
clear.m_index[2] = _rgba>> 8;
|
||||
clear.m_index[3] = _rgba>> 0;
|
||||
clear.m_index[0] = uint8_t(_rgba>>24);
|
||||
clear.m_index[1] = uint8_t(_rgba>>16);
|
||||
clear.m_index[2] = uint8_t(_rgba>> 8);
|
||||
clear.m_index[3] = uint8_t(_rgba>> 0);
|
||||
clear.m_depth = _depth;
|
||||
clear.m_stencil = _stencil;
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to)
|
||||
uint8_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to)
|
||||
{
|
||||
using namespace bx;
|
||||
uint32_t tmp0 = uint32_sll(1, _to);
|
||||
|
@ -449,7 +449,7 @@ namespace bgfx
|
|||
uint32_t tmp7 = uint32_add(tmp5, tmp6);
|
||||
uint32_t result = uint32_srl(tmp7, _from);
|
||||
|
||||
return result;
|
||||
return uint8_t(result);
|
||||
}
|
||||
|
||||
void decodeBlockDxt(uint8_t _dst[16*4], const uint8_t _src[8])
|
||||
|
@ -986,7 +986,7 @@ namespace bgfx
|
|||
{ 0, 8, 0, 8 },
|
||||
};
|
||||
|
||||
uint32_t morton2d(uint16_t _x, uint16_t _y)
|
||||
uint32_t morton2d(uint32_t _x, uint32_t _y)
|
||||
{
|
||||
using namespace bx;
|
||||
const uint32_t tmpx = uint32_part1by1(_x);
|
||||
|
@ -1099,9 +1099,9 @@ namespace bgfx
|
|||
const uint8_t wa = weight[0];
|
||||
const uint8_t wb = weight[1];
|
||||
|
||||
_dst[(yy*4 + xx)*4+0] = (ab * wa + bb * wb) >> 7;
|
||||
_dst[(yy*4 + xx)*4+1] = (ag * wa + bg * wb) >> 7;
|
||||
_dst[(yy*4 + xx)*4+2] = (ar * wa + br * wb) >> 7;
|
||||
_dst[(yy*4 + xx)*4+0] = uint8_t( (ab * wa + bb * wb) >> 7);
|
||||
_dst[(yy*4 + xx)*4+1] = uint8_t( (ag * wa + bg * wb) >> 7);
|
||||
_dst[(yy*4 + xx)*4+2] = uint8_t( (ar * wa + br * wb) >> 7);
|
||||
_dst[(yy*4 + xx)*4+3] = 255;
|
||||
|
||||
mod >>= 2;
|
||||
|
@ -1209,10 +1209,10 @@ namespace bgfx
|
|||
const uint8_t wc = weight[2];
|
||||
const uint8_t wd = weight[3];
|
||||
|
||||
_dst[(yy*4 + xx)*4+0] = (ab * wa + bb * wb) >> 7;
|
||||
_dst[(yy*4 + xx)*4+1] = (ag * wa + bg * wb) >> 7;
|
||||
_dst[(yy*4 + xx)*4+2] = (ar * wa + br * wb) >> 7;
|
||||
_dst[(yy*4 + xx)*4+3] = (aa * wc + ba * wd) >> 7;
|
||||
_dst[(yy*4 + xx)*4+0] = uint8_t( (ab * wa + bb * wb) >> 7);
|
||||
_dst[(yy*4 + xx)*4+1] = uint8_t( (ag * wa + bg * wb) >> 7);
|
||||
_dst[(yy*4 + xx)*4+2] = uint8_t( (ar * wa + br * wb) >> 7);
|
||||
_dst[(yy*4 + xx)*4+3] = uint8_t( (aa * wc + ba * wd) >> 7);
|
||||
|
||||
mod >>= 2;
|
||||
factorTable += 4;
|
||||
|
@ -1542,13 +1542,13 @@ namespace bgfx
|
|||
_imageContainer.m_data = NULL;
|
||||
_imageContainer.m_size = 0;
|
||||
_imageContainer.m_offset = (uint32_t)bx::seek(_reader);
|
||||
_imageContainer.m_width = width;
|
||||
_imageContainer.m_width = width;
|
||||
_imageContainer.m_height = height;
|
||||
_imageContainer.m_depth = depth;
|
||||
_imageContainer.m_format = format;
|
||||
_imageContainer.m_numMips = (caps[0] & DDSCAPS_MIPMAP) ? mips : 1;
|
||||
_imageContainer.m_depth = depth;
|
||||
_imageContainer.m_format = uint8_t(format);
|
||||
_imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1);
|
||||
_imageContainer.m_hasAlpha = hasAlpha;
|
||||
_imageContainer.m_cubeMap = cubeMap;
|
||||
_imageContainer.m_cubeMap = cubeMap;
|
||||
_imageContainer.m_ktx = false;
|
||||
|
||||
return TextureFormat::Unknown != format;
|
||||
|
@ -1719,13 +1719,13 @@ namespace bgfx
|
|||
_imageContainer.m_data = NULL;
|
||||
_imageContainer.m_size = 0;
|
||||
_imageContainer.m_offset = (uint32_t)offset;
|
||||
_imageContainer.m_width = width;
|
||||
_imageContainer.m_width = width;
|
||||
_imageContainer.m_height = height;
|
||||
_imageContainer.m_depth = depth;
|
||||
_imageContainer.m_format = format;
|
||||
_imageContainer.m_numMips = numMips;
|
||||
_imageContainer.m_depth = depth;
|
||||
_imageContainer.m_format = uint8_t(format);
|
||||
_imageContainer.m_numMips = uint8_t(numMips);
|
||||
_imageContainer.m_hasAlpha = hasAlpha;
|
||||
_imageContainer.m_cubeMap = numFaces > 1;
|
||||
_imageContainer.m_cubeMap = numFaces > 1;
|
||||
_imageContainer.m_ktx = true;
|
||||
|
||||
return TextureFormat::Unknown != format;
|
||||
|
@ -1865,13 +1865,13 @@ namespace bgfx
|
|||
_imageContainer.m_data = NULL;
|
||||
_imageContainer.m_size = 0;
|
||||
_imageContainer.m_offset = (uint32_t)offset;
|
||||
_imageContainer.m_width = width;
|
||||
_imageContainer.m_width = width;
|
||||
_imageContainer.m_height = height;
|
||||
_imageContainer.m_depth = depth;
|
||||
_imageContainer.m_format = format;
|
||||
_imageContainer.m_numMips = numMips;
|
||||
_imageContainer.m_depth = depth;
|
||||
_imageContainer.m_format = uint8_t(format);
|
||||
_imageContainer.m_numMips = uint8_t(numMips);
|
||||
_imageContainer.m_hasAlpha = hasAlpha;
|
||||
_imageContainer.m_cubeMap = numFaces > 1;
|
||||
_imageContainer.m_cubeMap = numFaces > 1;
|
||||
_imageContainer.m_ktx = false;
|
||||
|
||||
return TextureFormat::Unknown != format;
|
||||
|
@ -2175,13 +2175,13 @@ namespace bgfx
|
|||
if (side == _side
|
||||
&& lod == _lod)
|
||||
{
|
||||
_mip.m_width = width;
|
||||
_mip.m_height = height;
|
||||
_mip.m_width = width;
|
||||
_mip.m_height = height;
|
||||
_mip.m_blockSize = blockSize;
|
||||
_mip.m_size = size;
|
||||
_mip.m_data = (const uint8_t*)_data + offset;
|
||||
_mip.m_bpp = bpp;
|
||||
_mip.m_format = type;
|
||||
_mip.m_bpp = bpp;
|
||||
_mip.m_format = uint8_t(type);
|
||||
_mip.m_hasAlpha = hasAlpha;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace bgfx { namespace d3d11
|
|||
* 0x01 // MIP_LINEAR
|
||||
*/
|
||||
|
||||
static const uint32_t s_textureFilter[3][3] =
|
||||
static const uint8_t s_textureFilter[3][3] =
|
||||
{
|
||||
{
|
||||
0x10, // min linear
|
||||
|
@ -752,7 +752,7 @@ namespace bgfx { namespace d3d11
|
|||
| (m_ovr.isInitialized() ? BGFX_CAPS_HMD : 0)
|
||||
);
|
||||
g_caps.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.maxFBAttachments = bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
|
||||
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
|
||||
{
|
||||
|
@ -1390,7 +1390,7 @@ namespace bgfx { namespace d3d11
|
|||
}
|
||||
}
|
||||
|
||||
void setShaderUniform(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
|
||||
{
|
||||
|
@ -1404,12 +1404,12 @@ namespace bgfx { namespace d3d11
|
|||
}
|
||||
}
|
||||
|
||||
void setShaderUniform4f(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform4f(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
setShaderUniform(_flags, _regIndex, _val, _numRegs);
|
||||
}
|
||||
|
||||
void setShaderUniform4x4f(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform4x4f(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
setShaderUniform(_flags, _regIndex, _val, _numRegs);
|
||||
}
|
||||
|
@ -1513,7 +1513,7 @@ namespace bgfx { namespace d3d11
|
|||
}
|
||||
}
|
||||
|
||||
void setInputLayout(const VertexDecl& _vertexDecl, const ProgramD3D11& _program, uint8_t _numInstanceData)
|
||||
void setInputLayout(const VertexDecl& _vertexDecl, const ProgramD3D11& _program, uint16_t _numInstanceData)
|
||||
{
|
||||
uint64_t layoutHash = (uint64_t(_vertexDecl.m_hash)<<32) | _program.m_vsh->m_hash;
|
||||
layoutHash ^= _numInstanceData;
|
||||
|
@ -1643,7 +1643,7 @@ namespace bgfx { namespace d3d11
|
|||
drt->DestBlendAlpha = s_blendFactor[dstA][1];
|
||||
drt->BlendOpAlpha = s_blendEquation[equA];
|
||||
|
||||
uint32_t writeMask = (_state&BGFX_STATE_ALPHA_WRITE) ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0;
|
||||
uint8_t writeMask = (_state&BGFX_STATE_ALPHA_WRITE) ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0;
|
||||
writeMask |= (_state&BGFX_STATE_RGB_WRITE) ? D3D11_COLOR_WRITE_ENABLE_RED|D3D11_COLOR_WRITE_ENABLE_GREEN|D3D11_COLOR_WRITE_ENABLE_BLUE : 0;
|
||||
|
||||
drt->RenderTargetWriteMask = writeMask;
|
||||
|
@ -2068,11 +2068,11 @@ namespace bgfx { namespace d3d11
|
|||
case UniformType::_uniform: \
|
||||
case UniformType::_uniform|BGFX_UNIFORM_FRAGMENTBIT: \
|
||||
{ \
|
||||
setShaderUniform(type, loc, data, num); \
|
||||
setShaderUniform(uint8_t(type), loc, data, num); \
|
||||
} \
|
||||
break;
|
||||
|
||||
switch ( (int32_t)type)
|
||||
switch ( (uint32_t)type)
|
||||
{
|
||||
case UniformType::Uniform3x3fv:
|
||||
case UniformType::Uniform3x3fv|BGFX_UNIFORM_FRAGMENTBIT: \
|
||||
|
@ -2093,7 +2093,7 @@ namespace bgfx { namespace d3d11
|
|||
mtx.un.val[ 9] = value[7];
|
||||
mtx.un.val[10] = value[8];
|
||||
mtx.un.val[11] = 0.0f;
|
||||
setShaderUniform(type, loc, &mtx.un.val[0], 3);
|
||||
setShaderUniform(uint8_t(type), loc, &mtx.un.val[0], 3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2564,7 +2564,7 @@ namespace bgfx { namespace d3d11
|
|||
kind = "predefined";
|
||||
m_predefined[m_numPredefined].m_loc = regIndex;
|
||||
m_predefined[m_numPredefined].m_count = regCount;
|
||||
m_predefined[m_numPredefined].m_type = predefined|fragmentBit;
|
||||
m_predefined[m_numPredefined].m_type = uint8_t(predefined|fragmentBit);
|
||||
m_numPredefined++;
|
||||
}
|
||||
else
|
||||
|
@ -2668,7 +2668,7 @@ namespace bgfx { namespace d3d11
|
|||
if (imageParse(imageContainer, _mem->data, _mem->size) )
|
||||
{
|
||||
uint8_t numMips = imageContainer.m_numMips;
|
||||
const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
|
||||
const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) );
|
||||
numMips -= startLod;
|
||||
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
|
||||
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
|
||||
|
@ -2728,7 +2728,7 @@ namespace bgfx { namespace d3d11
|
|||
uint32_t height = textureHeight;
|
||||
uint32_t depth = imageContainer.m_depth;
|
||||
|
||||
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
|
||||
for (uint8_t lod = 0, num = numMips; lod < num; ++lod)
|
||||
{
|
||||
width = bx::uint32_max(1, width);
|
||||
height = bx::uint32_max(1, height);
|
||||
|
@ -3589,7 +3589,7 @@ namespace bgfx { namespace d3d11
|
|||
|
||||
{
|
||||
uint32_t changes = 0;
|
||||
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
|
||||
for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
|
||||
{
|
||||
const Binding& sampler = draw.m_bind[stage];
|
||||
Binding& current = currentState.m_bind[stage];
|
||||
|
|
|
@ -359,7 +359,7 @@ namespace bgfx { namespace d3d9
|
|||
m_adapter = D3DADAPTER_DEFAULT;
|
||||
m_deviceType = D3DDEVTYPE_HAL;
|
||||
|
||||
uint8_t numGPUs = bx::uint32_min(BX_COUNTOF(g_caps.gpu), m_d3d9->GetAdapterCount() );
|
||||
uint8_t numGPUs = uint8_t(bx::uint32_min(BX_COUNTOF(g_caps.gpu), m_d3d9->GetAdapterCount() ) );
|
||||
for (uint32_t ii = 0; ii < numGPUs; ++ii)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 desc;
|
||||
|
@ -470,10 +470,10 @@ namespace bgfx { namespace d3d9
|
|||
| BGFX_CAPS_FRAGMENT_DEPTH
|
||||
| BGFX_CAPS_SWAP_CHAIN
|
||||
);
|
||||
g_caps.maxTextureSize = bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight);
|
||||
g_caps.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) );
|
||||
|
||||
m_caps.NumSimultaneousRTs = bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
|
||||
g_caps.maxFBAttachments = (uint8_t)m_caps.NumSimultaneousRTs;
|
||||
m_caps.NumSimultaneousRTs = uint8_t(bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
g_caps.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs);
|
||||
|
||||
m_caps.MaxAnisotropy = bx::uint32_min(m_caps.MaxAnisotropy, 1);
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ namespace bgfx { namespace d3d9
|
|||
m_rtMsaa = _msaa;
|
||||
}
|
||||
|
||||
void setShaderUniform(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
|
||||
{
|
||||
|
@ -1099,12 +1099,12 @@ namespace bgfx { namespace d3d9
|
|||
}
|
||||
}
|
||||
|
||||
void setShaderUniform4f(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform4f(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
setShaderUniform(_flags, _regIndex, _val, _numRegs);
|
||||
}
|
||||
|
||||
void setShaderUniform4x4f(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform4x4f(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
setShaderUniform(_flags, _regIndex, _val, _numRegs);
|
||||
}
|
||||
|
@ -1885,7 +1885,7 @@ namespace bgfx { namespace d3d9
|
|||
};
|
||||
BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1);
|
||||
|
||||
static const D3DDECLTYPE s_attribType[][4][2] =
|
||||
static const uint8_t s_attribType[][4][2] =
|
||||
{
|
||||
{
|
||||
{ D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N },
|
||||
|
@ -1939,17 +1939,17 @@ namespace bgfx { namespace d3d9
|
|||
return elem;
|
||||
}
|
||||
|
||||
static IDirect3DVertexDeclaration9* createVertexDeclaration(const VertexDecl& _decl, uint8_t _numInstanceData)
|
||||
static IDirect3DVertexDeclaration9* createVertexDeclaration(const VertexDecl& _decl, uint16_t _numInstanceData)
|
||||
{
|
||||
D3DVERTEXELEMENT9 vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
|
||||
D3DVERTEXELEMENT9* elem = fillVertexDecl(vertexElements, _decl);
|
||||
|
||||
const D3DVERTEXELEMENT9 inst = { 1, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 };
|
||||
|
||||
for (uint32_t ii = 0; ii < _numInstanceData; ++ii)
|
||||
for (uint8_t ii = 0; ii < _numInstanceData; ++ii)
|
||||
{
|
||||
memcpy(elem, &inst, sizeof(D3DVERTEXELEMENT9) );
|
||||
elem->UsageIndex = 8-_numInstanceData+ii;
|
||||
elem->UsageIndex = uint8_t(8-_numInstanceData+ii);
|
||||
elem->Offset = ii*16;
|
||||
++elem;
|
||||
}
|
||||
|
@ -2029,9 +2029,9 @@ namespace bgfx { namespace d3d9
|
|||
if (PredefinedUniform::Count != predefined)
|
||||
{
|
||||
kind = "predefined";
|
||||
m_predefined[m_numPredefined].m_loc = regIndex;
|
||||
m_predefined[m_numPredefined].m_loc = regIndex;
|
||||
m_predefined[m_numPredefined].m_count = regCount;
|
||||
m_predefined[m_numPredefined].m_type = predefined|fragmentBit;
|
||||
m_predefined[m_numPredefined].m_type = uint8_t(predefined|fragmentBit);
|
||||
m_numPredefined++;
|
||||
}
|
||||
else
|
||||
|
@ -2365,7 +2365,7 @@ namespace bgfx { namespace d3d9
|
|||
if (imageParse(imageContainer, _mem->data, _mem->size) )
|
||||
{
|
||||
uint8_t numMips = imageContainer.m_numMips;
|
||||
const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
|
||||
const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) );
|
||||
numMips -= startLod;
|
||||
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
|
||||
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
|
||||
|
@ -2428,7 +2428,7 @@ namespace bgfx { namespace d3d9
|
|||
uint32_t mipWidth = imageContainer.m_width;
|
||||
uint32_t mipHeight = imageContainer.m_height;
|
||||
|
||||
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
|
||||
for (uint8_t lod = 0, num = numMips; lod < num; ++lod)
|
||||
{
|
||||
width = bx::uint32_max(1, width);
|
||||
height = bx::uint32_max(1, height);
|
||||
|
@ -3015,7 +3015,7 @@ namespace bgfx { namespace d3d9
|
|||
{
|
||||
uint32_t fstencil = unpackStencil(0, newStencil);
|
||||
uint32_t bstencil = unpackStencil(1, newStencil);
|
||||
uint32_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != fstencil;
|
||||
uint8_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != fstencil;
|
||||
DX_CHECK(device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, 0 != frontAndBack) );
|
||||
|
||||
uint32_t fchanged = unpackStencil(0, changedStencil);
|
||||
|
@ -3035,7 +3035,7 @@ namespace bgfx { namespace d3d9
|
|||
// DX_CHECK(device->SetRenderState(D3DRS_STENCILWRITEMASK, wmask) );
|
||||
// }
|
||||
|
||||
for (uint32_t ii = 0, num = frontAndBack+1; ii < num; ++ii)
|
||||
for (uint8_t ii = 0, num = frontAndBack+1; ii < num; ++ii)
|
||||
{
|
||||
uint32_t stencil = unpackStencil(ii, newStencil);
|
||||
uint32_t changed = unpackStencil(ii, changedStencil);
|
||||
|
@ -3221,7 +3221,7 @@ namespace bgfx { namespace d3d9
|
|||
}
|
||||
|
||||
{
|
||||
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
|
||||
for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
|
||||
{
|
||||
const Binding& sampler = draw.m_bind[stage];
|
||||
Binding& current = currentState.m_bind[stage];
|
||||
|
|
|
@ -1355,14 +1355,14 @@ namespace bgfx { namespace gl
|
|||
: 0
|
||||
;
|
||||
|
||||
g_caps.maxTextureSize = glGet(GL_MAX_TEXTURE_SIZE);
|
||||
g_caps.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|
||||
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|
||||
|| s_extension[Extension::EXT_draw_buffers ].m_supported
|
||||
|| s_extension[Extension::WEBGL_draw_buffers].m_supported)
|
||||
{
|
||||
g_caps.maxFBAttachments = bx::uint32_min(glGet(GL_MAX_COLOR_ATTACHMENTS), BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_COLOR_ATTACHMENTS), BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
}
|
||||
|
||||
m_vaoSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|
||||
|
@ -1918,7 +1918,7 @@ namespace bgfx { namespace gl
|
|||
}
|
||||
}
|
||||
|
||||
void setShaderUniform4f(uint8_t /*_flags*/, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform4f(uint8_t /*_flags*/, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
GL_CHECK(glUniform4fv(_regIndex
|
||||
, _numRegs
|
||||
|
@ -1926,7 +1926,7 @@ namespace bgfx { namespace gl
|
|||
) );
|
||||
}
|
||||
|
||||
void setShaderUniform4x4f(uint8_t /*_flags*/, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
|
||||
void setShaderUniform4x4f(uint8_t /*_flags*/, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
GL_CHECK(glUniformMatrix4fv(_regIndex
|
||||
, _numRegs
|
||||
|
@ -1935,7 +1935,7 @@ namespace bgfx { namespace gl
|
|||
) );
|
||||
}
|
||||
|
||||
uint32_t setFrameBuffer(FrameBufferHandle _fbh, uint32_t _height, uint8_t _discard = BGFX_CLEAR_NONE, bool _msaa = true)
|
||||
uint32_t setFrameBuffer(FrameBufferHandle _fbh, uint32_t _height, uint16_t _discard = BGFX_CLEAR_NONE, bool _msaa = true)
|
||||
{
|
||||
if (isValid(m_fbh)
|
||||
&& m_fbh.idx != _fbh.idx
|
||||
|
@ -2635,7 +2635,7 @@ namespace bgfx { namespace gl
|
|||
bool m_rtMsaa;
|
||||
|
||||
FrameBufferHandle m_fbh;
|
||||
uint32_t m_fbDiscard;
|
||||
uint16_t m_fbDiscard;
|
||||
|
||||
Resolution m_resolution;
|
||||
void* m_capture;
|
||||
|
@ -3062,9 +3062,9 @@ namespace bgfx { namespace gl
|
|||
PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name);
|
||||
if (PredefinedUniform::Count != predefined)
|
||||
{
|
||||
m_predefined[m_numPredefined].m_loc = loc;
|
||||
m_predefined[m_numPredefined].m_type = predefined;
|
||||
m_predefined[m_numPredefined].m_count = num;
|
||||
m_predefined[m_numPredefined].m_loc = loc;
|
||||
m_predefined[m_numPredefined].m_count = uint16_t(num);
|
||||
m_predefined[m_numPredefined].m_type = uint8_t(predefined);
|
||||
m_numPredefined++;
|
||||
}
|
||||
else
|
||||
|
@ -3078,7 +3078,7 @@ namespace bgfx { namespace gl
|
|||
}
|
||||
|
||||
UniformType::Enum type = convertGlType(gltype);
|
||||
m_constantBuffer->writeUniformHandle(type, 0, info->m_handle, num);
|
||||
m_constantBuffer->writeUniformHandle(type, 0, info->m_handle, uint16_t(num) );
|
||||
m_constantBuffer->write(loc);
|
||||
BX_TRACE("store %s %d", name, info->m_handle);
|
||||
}
|
||||
|
@ -3141,7 +3141,7 @@ namespace bgfx { namespace gl
|
|||
|
||||
memset(m_attributes, 0xff, sizeof(m_attributes) );
|
||||
uint32_t used = 0;
|
||||
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
|
||||
for (uint8_t ii = 0; ii < Attrib::Count; ++ii)
|
||||
{
|
||||
GLint loc = glGetAttribLocation(m_id, s_attribName[ii]);
|
||||
if (-1 != loc)
|
||||
|
@ -3378,8 +3378,8 @@ namespace bgfx { namespace gl
|
|||
if (imageParse(imageContainer, _mem->data, _mem->size) )
|
||||
{
|
||||
uint8_t numMips = imageContainer.m_numMips;
|
||||
const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
|
||||
numMips -= uint8_t(startLod);
|
||||
const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) );
|
||||
numMips -= startLod;
|
||||
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
|
||||
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
|
||||
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
|
||||
|
@ -3456,7 +3456,7 @@ namespace bgfx { namespace gl
|
|||
uint32_t height = textureHeight;
|
||||
uint32_t depth = imageContainer.m_depth;
|
||||
|
||||
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
|
||||
for (uint8_t lod = 0, num = numMips; lod < num; ++lod)
|
||||
{
|
||||
width = bx::uint32_max(blockWidth, width);
|
||||
height = bx::uint32_max(blockHeight, height);
|
||||
|
@ -4284,7 +4284,7 @@ namespace bgfx { namespace gl
|
|||
}
|
||||
}
|
||||
|
||||
m_num = colorIdx;
|
||||
m_num = uint8_t(colorIdx);
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
|
||||
{
|
||||
|
@ -4395,7 +4395,7 @@ namespace bgfx { namespace gl
|
|||
}
|
||||
}
|
||||
|
||||
void FrameBufferGL::discard(uint8_t _flags)
|
||||
void FrameBufferGL::discard(uint16_t _flags)
|
||||
{
|
||||
GLenum buffers[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS+2];
|
||||
uint32_t idx = 0;
|
||||
|
@ -4518,7 +4518,7 @@ namespace bgfx { namespace gl
|
|||
bool viewHasScissor = false;
|
||||
Rect viewScissorRect;
|
||||
viewScissorRect.clear();
|
||||
uint8_t discardFlags = BGFX_CLEAR_NONE;
|
||||
uint16_t discardFlags = BGFX_CLEAR_NONE;
|
||||
|
||||
const bool blendIndependentSupported = s_extension[Extension::ARB_draw_buffers_blend].m_supported;
|
||||
const bool computeSupported = (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && s_extension[Extension::ARB_compute_shader].m_supported)
|
||||
|
@ -4803,7 +4803,7 @@ namespace bgfx { namespace gl
|
|||
GL_CHECK(glEnable(GL_STENCIL_TEST) );
|
||||
|
||||
uint32_t bstencil = unpackStencil(1, newStencil);
|
||||
uint32_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != unpackStencil(0, newStencil);
|
||||
uint8_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != unpackStencil(0, newStencil);
|
||||
|
||||
// uint32_t bchanged = unpackStencil(1, changedStencil);
|
||||
// if (BGFX_STENCIL_FUNC_RMASK_MASK & bchanged)
|
||||
|
@ -4812,7 +4812,7 @@ namespace bgfx { namespace gl
|
|||
// GL_CHECK(glStencilMask(wmask) );
|
||||
// }
|
||||
|
||||
for (uint32_t ii = 0, num = frontAndBack+1; ii < num; ++ii)
|
||||
for (uint8_t ii = 0, num = frontAndBack+1; ii < num; ++ii)
|
||||
{
|
||||
uint32_t stencil = unpackStencil(ii, newStencil);
|
||||
uint32_t changed = unpackStencil(ii, changedStencil);
|
||||
|
|
|
@ -928,7 +928,7 @@ namespace bgfx { namespace gl
|
|||
void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat);
|
||||
uint16_t destroy();
|
||||
void resolve();
|
||||
void discard(uint8_t _flags);
|
||||
void discard(uint16_t _flags);
|
||||
|
||||
SwapChainGL* m_swapChain;
|
||||
GLuint m_fbo[2];
|
||||
|
|
Loading…
Reference in a new issue