Removed using namespace bx.

This commit is contained in:
bkaradzic 2013-08-03 22:15:13 -07:00
parent 44231e9c7f
commit e9504c9a26
7 changed files with 150 additions and 150 deletions

View file

@ -573,7 +573,7 @@ namespace bgfx
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num
|| (0 == m_state.m_numVertices && 0 == m_state.m_numIndices) )
{
m_numDropped += uint32_cntbits(_viewMask);
m_numDropped += bx::uint32_cntbits(_viewMask);
return;
}
@ -582,7 +582,7 @@ namespace bgfx
{
m_key.m_depth = _depth;
for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t id = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
id += ntz;
@ -1059,10 +1059,10 @@ namespace bgfx
void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format)
{
_width = uint32_max(1, _width);
_height = uint32_max(1, _height);
_depth = uint32_max(1, _depth);
_numMips = uint32_max(1, _numMips);
_width = bx::uint32_max(1, _width);
_height = bx::uint32_max(1, _height);
_depth = bx::uint32_max(1, _depth);
_numMips = bx::uint32_max(1, _numMips);
uint32_t width = _width;
uint32_t height = _height;
@ -1073,9 +1073,9 @@ namespace bgfx
for (uint32_t lod = 0; lod < _numMips; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
size += _width*_height*depth*bpp/8;
@ -1274,7 +1274,7 @@ namespace bgfx
{
BGFX_CHECK_MAIN_THREAD();
BX_WARN(0 != _width && 0 != _height, "Render target resolution width or height cannot be 0 (width %d, height %d).", _width, _height);
return s_ctx.createRenderTarget(uint16_max(1, _width), uint16_max(1, _height), _flags, _textureFlags);
return s_ctx.createRenderTarget(bx::uint16_max(1, _width), bx::uint16_max(1, _height), _flags, _textureFlags);
}
void destroyRenderTarget(RenderTargetHandle _handle)
@ -1437,7 +1437,7 @@ namespace bgfx
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(NULL != _tib, "_tib can't be NULL");
uint32_t numIndices = uint32_min(_numIndices, _tib->size/2);
uint32_t numIndices = bx::uint32_min(_numIndices, _tib->size/2);
s_ctx.m_submit->setIndexBuffer(_tib, numIndices);
}

View file

@ -54,7 +54,6 @@ namespace bgfx
} \
} while(0)
#define BX_NAMESPACE 1
#include <bx/bx.h>
#include <bx/debug.h>
#include <bx/blockalloc.h>
@ -184,14 +183,14 @@ namespace bgfx
void intersect(const Rect& _a, const Rect& _b)
{
const uint16_t sx = uint16_max(_a.m_x, _b.m_x);
const uint16_t sy = uint16_max(_a.m_y, _b.m_y);
const uint16_t ex = uint16_min(_a.m_x + _a.m_width, _b.m_x + _b.m_width );
const uint16_t ey = uint16_min(_a.m_y + _a.m_height, _b.m_y + _b.m_height);
const uint16_t sx = bx::uint16_max(_a.m_x, _b.m_x);
const uint16_t sy = bx::uint16_max(_a.m_y, _b.m_y);
const uint16_t ex = bx::uint16_min(_a.m_x + _a.m_width, _b.m_x + _b.m_width );
const uint16_t ey = bx::uint16_min(_a.m_y + _a.m_height, _b.m_y + _b.m_height);
m_x = sx;
m_y = sy;
m_width = (uint16_t)uint32_satsub(ex, sx);
m_height = (uint16_t)uint32_satsub(ey, sy);
m_width = (uint16_t)bx::uint32_satsub(ex, sx);
m_height = (uint16_t)bx::uint32_satsub(ey, sy);
}
uint16_t m_x;
@ -243,11 +242,11 @@ namespace bgfx
inline uint32_t strideAlign(uint32_t _offset, uint32_t _stride)
{
const uint32_t mod = uint32_mod(_offset, _stride);
const uint32_t add = uint32_sub(_stride, mod);
const uint32_t mask = uint32_cmpeq(mod, 0);
const uint32_t tmp = uint32_selb(mask, 0, add);
const uint32_t result = uint32_add(_offset, tmp);
const uint32_t mod = bx::uint32_mod(_offset, _stride);
const uint32_t add = bx::uint32_sub(_stride, mod);
const uint32_t mask = bx::uint32_cmpeq(mod, 0);
const uint32_t tmp = bx::uint32_selb(mask, 0, add);
const uint32_t result = bx::uint32_add(_offset, tmp);
return result;
}
@ -303,8 +302,8 @@ namespace bgfx
void resize(bool _small = false, uint16_t _width = BGFX_DEFAULT_WIDTH, uint16_t _height = BGFX_DEFAULT_HEIGHT)
{
uint32_t width = uint32_max(1, _width/8);
uint32_t height = uint32_max(1, _height/(_small ? 8 : 16) );
uint32_t width = bx::uint32_max(1, _width/8);
uint32_t height = bx::uint32_max(1, _height/(_small ? 8 : 16) );
if (NULL == m_mem
|| m_width != width
@ -649,7 +648,7 @@ namespace bgfx
{
BX_CHECK(m_num+_num < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache overflow. %d (max: %d)", m_num+_num, BGFX_CONFIG_MAX_MATRIX_CACHE);
uint32_t num = uint32_min(BGFX_CONFIG_MAX_MATRIX_CACHE-m_num, _num);
uint32_t num = bx::uint32_min(BGFX_CONFIG_MAX_MATRIX_CACHE-m_num, _num);
uint32_t first = m_num;
memcpy(&m_cache[m_num], _mtx, sizeof(Matrix4)*num);
m_num += num;
@ -723,7 +722,7 @@ namespace bgfx
public:
static ConstantBuffer* create(uint32_t _size)
{
uint32_t size = BX_ALIGN_16(uint32_max(_size, sizeof(ConstantBuffer) ) );
uint32_t size = BX_ALIGN_16(bx::uint32_max(_size, sizeof(ConstantBuffer) ) );
void* data = g_realloc(NULL, size);
return ::new(data) ConstantBuffer(_size);
}
@ -1103,7 +1102,7 @@ namespace bgfx
void setVertexBuffer(const DynamicVertexBuffer& _dvb, uint32_t _numVertices)
{
m_state.m_startVertex = _dvb.m_startVertex;
m_state.m_numVertices = uint32_min(_dvb.m_numVertices, _numVertices);
m_state.m_numVertices = bx::uint32_min(_dvb.m_numVertices, _numVertices);
m_state.m_vertexBuffer = _dvb.m_handle;
m_state.m_vertexDecl = _dvb.m_decl;
}
@ -1111,7 +1110,7 @@ namespace bgfx
void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _numVertices)
{
m_state.m_startVertex = _tvb->startVertex;
m_state.m_numVertices = uint32_min(_tvb->size/_tvb->stride, _numVertices);
m_state.m_numVertices = bx::uint32_min(_tvb->size/_tvb->stride, _numVertices);
m_state.m_vertexBuffer = _tvb->handle;
m_state.m_vertexDecl = _tvb->decl;
}
@ -1120,7 +1119,7 @@ namespace bgfx
{
m_state.m_instanceDataOffset = _idb->offset;
m_state.m_instanceDataStride = _idb->stride;
m_state.m_numInstances = uint16_min( (uint16_t)_idb->num, _num);
m_state.m_numInstances = bx::uint16_min( (uint16_t)_idb->num, _num);
m_state.m_instanceDataBuffer = _idb->handle;
g_free(const_cast<InstanceDataBuffer*>(_idb) );
}
@ -1180,7 +1179,7 @@ namespace bgfx
{
uint32_t offset = m_iboffset;
uint32_t iboffset = offset + _num*sizeof(uint16_t);
iboffset = uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
iboffset = bx::uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
uint32_t num = (iboffset-offset)/sizeof(uint16_t);
return num == _num;
}
@ -1189,7 +1188,7 @@ namespace bgfx
{
uint32_t offset = m_iboffset;
m_iboffset = offset + _num*sizeof(uint16_t);
m_iboffset = uint32_min(m_iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
m_iboffset = bx::uint32_min(m_iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
_num = (m_iboffset-offset)/sizeof(uint16_t);
return offset;
}
@ -1198,7 +1197,7 @@ namespace bgfx
{
uint32_t offset = strideAlign(m_vboffset, _stride);
uint32_t vboffset = offset + _num * _stride;
vboffset = uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
vboffset = bx::uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
uint32_t num = (vboffset-offset)/_stride;
return num == _num;
}
@ -1207,7 +1206,7 @@ namespace bgfx
{
uint32_t offset = strideAlign(m_vboffset, _stride);
m_vboffset = offset + _num * _stride;
m_vboffset = uint32_min(m_vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
m_vboffset = bx::uint32_min(m_vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
_num = (m_vboffset-offset)/_stride;
return offset;
}
@ -1360,7 +1359,7 @@ namespace bgfx
memset(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) );
}
void shutdown(HandleAlloc& _handleAlloc)
void shutdown(bx::HandleAlloc& _handleAlloc)
{
for (VertexDeclMap::iterator it = m_vertexDeclMap.begin(), itEnd = m_vertexDeclMap.end(); it != itEnd; ++it)
{
@ -1588,8 +1587,8 @@ namespace bgfx
void reset(uint32_t _width, uint32_t _height, uint32_t _flags)
{
BX_WARN(0 != _width && 0 != _height, "Frame buffer resolution width or height cannot be 0 (width %d, height %d).", _width, _height);
m_resolution.m_width = uint32_max(1, _width);
m_resolution.m_height = uint32_max(1, _height);
m_resolution.m_width = bx::uint32_max(1, _width);
m_resolution.m_height = bx::uint32_max(1, _height);
m_resolution.m_flags = _flags;
memset(m_rt, 0xff, sizeof(m_rt) );
@ -2261,7 +2260,7 @@ namespace bgfx
{
Uniform& uniform = m_uniform[_handle.idx];
BX_CHECK(uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num);
m_submit->writeConstant(uniform.m_type, _handle, _value, uint16_min(uniform.m_num, _num) );
m_submit->writeConstant(uniform.m_type, _handle, _value, bx::uint16_min(uniform.m_num, _num) );
}
void setViewName(uint8_t _id, const char* _name)
@ -2278,13 +2277,13 @@ namespace bgfx
Rect& rect = m_rect[_id];
rect.m_x = _x;
rect.m_y = _y;
rect.m_width = uint16_max(_width, 1);
rect.m_height = uint16_max(_height, 1);
rect.m_width = bx::uint16_max(_width, 1);
rect.m_height = bx::uint16_max(_height, 1);
}
void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
view += ntz;
@ -2304,7 +2303,7 @@ namespace bgfx
void setViewScissorMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
view += ntz;
@ -2324,7 +2323,7 @@ namespace bgfx
void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
{
for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
view += ntz;
@ -2341,7 +2340,7 @@ namespace bgfx
void setViewSeqMask(uint32_t _viewMask, bool _enabled)
{
uint16_t mask = _enabled ? 0xffff : 0x0;
for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
view += ntz;
@ -2357,7 +2356,7 @@ namespace bgfx
void setViewRenderTargetMask(uint32_t _viewMask, RenderTargetHandle _handle)
{
for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
view += ntz;
@ -2398,7 +2397,7 @@ namespace bgfx
void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj, uint8_t _other)
{
for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) )
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
{
viewMask >>= ntz;
view += ntz;
@ -3098,8 +3097,8 @@ namespace bgfx
m_submit->m_waitRender = bx::getHPCounter() - start;
}
Semaphore m_renderSem;
Semaphore m_gameSem;
bx::Semaphore m_renderSem;
bx::Semaphore m_gameSem;
#else
void gameSemPost()
{
@ -3118,7 +3117,7 @@ namespace bgfx
}
#endif // BGFX_CONFIG_MULTITHREADED
Thread m_thread;
bx::Thread m_thread;
Frame m_frame[2];
Frame* m_render;
Frame* m_submit;
@ -3135,19 +3134,19 @@ namespace bgfx
DynamicVertexBufferHandle m_freeDynamicVertexBufferHandle[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS];
NonLocalAllocator m_dynamicIndexBufferAllocator;
HandleAlloc m_dynamicIndexBufferHandle;
bx::HandleAlloc m_dynamicIndexBufferHandle;
NonLocalAllocator m_dynamicVertexBufferAllocator;
HandleAlloc m_dynamicVertexBufferHandle;
bx::HandleAlloc m_dynamicVertexBufferHandle;
HandleAlloc m_indexBufferHandle;
HandleAlloc m_vertexDeclHandle;
HandleAlloc m_vertexBufferHandle;
HandleAlloc m_vertexShaderHandle;
HandleAlloc m_fragmentShaderHandle;
HandleAlloc m_programHandle;
HandleAlloc m_textureHandle;
HandleAlloc m_renderTargetHandle;
HandleAlloc m_uniformHandle;
bx::HandleAlloc m_indexBufferHandle;
bx::HandleAlloc m_vertexDeclHandle;
bx::HandleAlloc m_vertexBufferHandle;
bx::HandleAlloc m_vertexShaderHandle;
bx::HandleAlloc m_fragmentShaderHandle;
bx::HandleAlloc m_programHandle;
bx::HandleAlloc m_textureHandle;
bx::HandleAlloc m_renderTargetHandle;
bx::HandleAlloc m_uniformHandle;
struct VertexShaderRef
{

View file

@ -75,6 +75,7 @@ bool isDds(const Memory* _mem)
uint32_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to)
{
using namespace bx;
uint32_t tmp0 = uint32_sll(1, _to);
uint32_t tmp1 = uint32_sll(1, _from);
uint32_t tmp2 = uint32_dec(tmp0);
@ -575,15 +576,15 @@ bool getRawImageData(const Dds& _dds, uint8_t _side, uint8_t _lod, const Memory*
for (uint8_t lod = 0, num = _dds.m_numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
uint32_t size = width*height*depth*blockSize;
if (TextureFormat::Unknown > type)
{
width = uint32_max(1, (width + 3)>>2);
height = uint32_max(1, (height + 3)>>2);
width = bx::uint32_max(1, (width + 3)>>2);
height = bx::uint32_max(1, (height + 3)>>2);
size = width*height*depth*blockSize;
width <<= 2;

View file

@ -851,7 +851,7 @@ namespace bgfx
uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT;
_stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK);
HashMurmur2A murmur;
bx::HashMurmur2A murmur;
murmur.begin();
murmur.add(_state);
murmur.add(_stencil);
@ -1617,7 +1617,7 @@ namespace bgfx
}
else
{
m_hash = hashMurmur2A(code, shaderSize);
m_hash = bx::hashMurmur2A(code, shaderSize);
m_code = alloc(shaderSize);
memcpy(m_code->data, code, shaderSize);
@ -1665,15 +1665,15 @@ namespace bgfx
for (uint8_t side = 0, numSides = dds.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = dds.m_width;
uint32_t width = dds.m_width;
uint32_t height = dds.m_height;
uint32_t depth = dds.m_depth;
uint32_t depth = dds.m_depth;
for (uint32_t lod = 0, num = m_numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
Mip mip;
if (getRawImageData(dds, side, lod, _mem, mip) )
@ -1696,9 +1696,9 @@ namespace bgfx
++kk;
}
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
}
@ -1859,15 +1859,15 @@ namespace bgfx
for (uint8_t side = 0, numSides = tc.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = tc.m_width;
uint32_t width = tc.m_width;
uint32_t height = tc.m_height;
uint32_t depth = tc.m_depth;
uint32_t depth = tc.m_depth;
for (uint32_t lod = 0, num = tc.m_numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
srd[lod].pSysMem = data;
srd[lod].SysMemPitch = width*bpp/8;
@ -1875,9 +1875,9 @@ namespace bgfx
data += width*height*bpp/8;
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
@ -2154,7 +2154,7 @@ namespace bgfx
void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem)
{
s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data);
s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
}
void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle _handle)
@ -2170,7 +2170,7 @@ namespace bgfx
void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem)
{
s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data);
s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
}
void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle _handle)
@ -2548,20 +2548,20 @@ namespace bgfx
case PredefinedUniform::View:
{
s_renderCtx.setShaderConstant(flags, predefined.m_loc, m_render->m_view[view].val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, m_render->m_view[view].val, bx::uint32_min(4, predefined.m_count) );
}
break;
case PredefinedUniform::ViewProj:
{
s_renderCtx.setShaderConstant(flags, predefined.m_loc, viewProj[view].val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, viewProj[view].val, bx::uint32_min(4, predefined.m_count) );
}
break;
case PredefinedUniform::Model:
{
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
s_renderCtx.setShaderConstant(flags, predefined.m_loc, model.val, uint32_min(state.m_num*4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, model.val, bx::uint32_min(state.m_num*4, predefined.m_count) );
}
break;
@ -2570,7 +2570,7 @@ namespace bgfx
Matrix4 modelView;
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
mtxMul(modelView.val, model.val, m_render->m_view[view].val);
s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelView.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelView.val, bx::uint32_min(4, predefined.m_count) );
}
break;
@ -2579,7 +2579,7 @@ namespace bgfx
Matrix4 modelViewProj;
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
mtxMul(modelViewProj.val, model.val, viewProj[view].val);
s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelViewProj.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelViewProj.val, bx::uint32_min(4, predefined.m_count) );
}
break;
@ -2602,7 +2602,7 @@ namespace bgfx
Matrix4 modelViewProj;
mtxMul(modelViewProj.val, model.val, viewProjBias.val);
s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelViewProj.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelViewProj.val, bx::uint32_min(4, predefined.m_count) );
}
break;
@ -2620,7 +2620,7 @@ namespace bgfx
Matrix4 viewProjBias;
mtxMul(viewProjBias.val, viewProj[other].val, s_bias);
s_renderCtx.setShaderConstant(flags, predefined.m_loc, viewProjBias.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstant(flags, predefined.m_loc, viewProjBias.val, bx::uint32_min(4, predefined.m_count) );
}
break;

View file

@ -548,7 +548,7 @@ namespace bgfx
if (SUCCEEDED(hr) )
{
s_msaa[ii].m_type = msaa;
s_msaa[ii].m_quality = uint32_imax(0, quality-1);
s_msaa[ii].m_quality = bx::uint32_imax(0, quality-1);
last = ii;
}
else
@ -1537,15 +1537,15 @@ namespace bgfx
{
for (uint8_t side = 0, numSides = dds.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = dds.m_width;
uint32_t width = dds.m_width;
uint32_t height = dds.m_height;
uint32_t depth = dds.m_depth;
uint32_t depth = dds.m_depth;
for (uint32_t lod = 0, num = dds.m_numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
Mip mip;
if (getRawImageData(dds, side, lod, _mem, mip) )
@ -1580,9 +1580,9 @@ namespace bgfx
unlock(side, lod);
}
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
}
@ -1598,15 +1598,15 @@ namespace bgfx
for (uint8_t side = 0, numSides = dds.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = dds.m_width;
uint32_t width = dds.m_width;
uint32_t height = dds.m_height;
uint32_t depth = dds.m_depth;
uint32_t depth = dds.m_depth;
for (uint32_t lod = 0, num = dds.m_numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
Mip mip;
if (getRawImageData(dds, 0, lod, _mem, mip) )
@ -1622,9 +1622,9 @@ namespace bgfx
unlock(side, lod);
}
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
}
@ -1662,15 +1662,15 @@ namespace bgfx
for (uint8_t side = 0, numSides = tc.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = tc.m_width;
uint32_t width = tc.m_width;
uint32_t height = tc.m_height;
uint32_t depth = tc.m_depth;
uint32_t depth = tc.m_depth;
for (uint32_t lod = 0, num = tc.m_numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
uint32_t pitch;
uint32_t slicePitch;
@ -1680,9 +1680,9 @@ namespace bgfx
data += len;
unlock(side, lod);
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
@ -2084,7 +2084,7 @@ namespace bgfx
void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem)
{
s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data);
s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
}
void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle _handle)
@ -2100,7 +2100,7 @@ namespace bgfx
void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem)
{
s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data);
s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
}
void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle _handle)
@ -2612,20 +2612,20 @@ namespace bgfx
case PredefinedUniform::View:
{
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, m_render->m_view[view].val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, m_render->m_view[view].val, bx::uint32_min(4, predefined.m_count) );
}
break;
case PredefinedUniform::ViewProj:
{
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, viewProj[view].val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, viewProj[view].val, bx::uint32_min(4, predefined.m_count) );
}
break;
case PredefinedUniform::Model:
{
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, model.val, uint32_min(state.m_num*4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, model.val, bx::uint32_min(state.m_num*4, predefined.m_count) );
}
break;
@ -2634,7 +2634,7 @@ namespace bgfx
Matrix4 modelView;
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
mtxMul(modelView.val, model.val, m_render->m_view[view].val);
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, modelView.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, modelView.val, bx::uint32_min(4, predefined.m_count) );
}
break;
@ -2643,7 +2643,7 @@ namespace bgfx
Matrix4 modelViewProj;
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
mtxMul(modelViewProj.val, model.val, viewProj[view].val);
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, modelViewProj.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, modelViewProj.val, bx::uint32_min(4, predefined.m_count) );
}
break;
@ -2666,7 +2666,7 @@ namespace bgfx
Matrix4 modelViewProj;
mtxMul(modelViewProj.val, model.val, viewProjBias.val);
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, modelViewProj.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, modelViewProj.val, bx::uint32_min(4, predefined.m_count) );
}
break;
@ -2684,7 +2684,7 @@ namespace bgfx
Matrix4 viewProjBias;
mtxMul(viewProjBias.val, viewProj[other].val, s_bias);
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, viewProjBias.val, uint32_min(4, predefined.m_count) );
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, viewProjBias.val, bx::uint32_min(4, predefined.m_count) );
}
break;

View file

@ -429,11 +429,11 @@ namespace bgfx
const char* space = strchr(pos, ' ');
if (NULL != space)
{
len = uint32_min(sizeof(name), (uint32_t)(space - pos) );
len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) );
}
else
{
len = uint32_min(sizeof(name), (uint32_t)strlen(pos) );
len = bx::uint32_min(sizeof(name), (uint32_t)strlen(pos) );
}
strncpy(name, pos, len);
@ -521,7 +521,7 @@ namespace bgfx
m_resolution = _resolution;
uint32_t msaa = 1<<( (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT);
msaa = uint32_min(m_maxMsaa, msaa == 0 ? 0 : 1<<msaa);
msaa = bx::uint32_min(m_maxMsaa, msaa == 0 ? 0 : 1<<msaa);
bool vsync = !!(m_resolution.m_flags&BGFX_RESET_VSYNC);
setRenderContextSize(_resolution.m_width, _resolution.m_height, msaa, vsync);
updateCapture();
@ -1109,7 +1109,7 @@ namespace bgfx
GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max0) );
GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max1) );
GLint maxLength = uint32_max(max0, max1);
GLint maxLength = bx::uint32_max(max0, max1);
char* name = (char*)g_realloc(NULL, maxLength + 1);
BX_TRACE("Program %d", m_id);
@ -1461,9 +1461,9 @@ namespace bgfx
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
Mip mip;
if (getRawImageData(dds, side, lod, _mem, mip) )
@ -1502,15 +1502,15 @@ namespace bgfx
for (uint8_t side = 0, numSides = dds.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = dds.m_width;
uint32_t width = dds.m_width;
uint32_t height = dds.m_height;
uint32_t depth = dds.m_depth;
uint32_t depth = dds.m_depth;
for (uint32_t ii = 0, num = numMips; ii < num; ++ii)
{
width = uint32_max(1, width);
height = uint32_max(1, height);
depth = uint32_max(1, depth);
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
depth = bx::uint32_max(1, depth);
Mip mip;
if (getRawImageData(dds, side, ii, _mem, mip) )
@ -1527,9 +1527,9 @@ namespace bgfx
);
}
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
}
@ -1592,15 +1592,15 @@ namespace bgfx
for (uint8_t side = 0, numSides = tc.m_cubeMap ? 6 : 1; side < numSides; ++side)
{
uint32_t width = tc.m_width;
uint32_t width = tc.m_width;
uint32_t height = tc.m_height;
uint32_t depth = tc.m_depth;
uint32_t depth = tc.m_depth;
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
{
width = uint32_max(width, min);
height = uint32_max(height, min);
depth = uint32_max(1, depth);
width = bx::uint32_max(width, min);
height = bx::uint32_max(height, min);
depth = bx::uint32_max(1, depth);
uint32_t size = width*height*bpp/8;
if (m_compressed)
@ -1642,9 +1642,9 @@ namespace bgfx
data += size;
}
width >>= 1;
width >>= 1;
height >>= 1;
depth >>= 1;
depth >>= 1;
}
}
@ -1917,7 +1917,7 @@ namespace bgfx
m_width = _width;
m_height = _height;
uint32_t msaa = (_flags&BGFX_RENDER_TARGET_MSAA_MASK)>>BGFX_RENDER_TARGET_MSAA_SHIFT;
m_msaa = uint32_min(s_renderCtx.m_maxMsaa, msaa == 0 ? 0 : 1<<msaa);
m_msaa = bx::uint32_min(s_renderCtx.m_maxMsaa, msaa == 0 ? 0 : 1<<msaa);
uint32_t colorFormat = (_flags&BGFX_RENDER_TARGET_COLOR_MASK)>>BGFX_RENDER_TARGET_COLOR_SHIFT;
uint32_t depthFormat = (_flags&BGFX_RENDER_TARGET_DEPTH_MASK)>>BGFX_RENDER_TARGET_DEPTH_SHIFT;
@ -2426,11 +2426,11 @@ namespace bgfx
const char* space = strchr(pos, ' ');
if (NULL != space)
{
len = uint32_min(sizeof(name), (uint32_t)(space - pos) );
len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) );
}
else
{
len = uint32_min(sizeof(name), (uint32_t)strlen(pos) );
len = bx::uint32_min(sizeof(name), (uint32_t)strlen(pos) );
}
strncpy(name, pos, len);
@ -2640,7 +2640,7 @@ namespace bgfx
void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem)
{
s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data);
s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
}
void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle _handle)
@ -2656,7 +2656,7 @@ namespace bgfx
void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem)
{
s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data);
s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
}
void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle _handle)
@ -3017,7 +3017,7 @@ namespace bgfx
#if BGFX_CONFIG_RENDERER_OPENGL
if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
{
float pointSize = (float)(uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) );
float pointSize = (float)(bx::uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) );
GL_CHECK(glPointSize(pointSize) );
}
@ -3158,7 +3158,7 @@ namespace bgfx
{
const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix];
GL_CHECK(glUniformMatrix4fv(predefined.m_loc
, uint32_min(predefined.m_count, state.m_num)
, bx::uint32_min(predefined.m_count, state.m_num)
, GL_FALSE
, model.val
) );

View file

@ -547,7 +547,7 @@ namespace bgfx
m_type = _type;
bx::MemoryReader reader(_mem->data, _mem->size);
m_hash = hashMurmur2A(_mem->data, _mem->size);
m_hash = bx::hashMurmur2A(_mem->data, _mem->size);
uint32_t magic;
bx::read(&reader, magic);