Renamed constants to new style.

This commit is contained in:
Branimir Karadžić 2017-06-09 21:57:08 -07:00
parent 3fbcddb4ef
commit 07d799f72e
26 changed files with 154 additions and 154 deletions

View File

@ -210,13 +210,13 @@ public:
// Create programs.
m_program = loadProgram("vs_update", "fs_update");
m_programCmp = loadProgram("vs_update", "fs_update_cmp");
m_program3d.idx = bgfx::invalidHandle;
m_program3d.idx = bgfx::kInvalidHandle;
if (m_texture3DSupported)
{
m_program3d = loadProgram("vs_update", "fs_update_3d");
}
m_programCompute.idx = bgfx::invalidHandle;
m_programCompute.idx = bgfx::kInvalidHandle;
if (m_computeSupported)
{
m_programCompute = bgfx::createProgram( loadShader( "cs_update" ), true );
@ -231,7 +231,7 @@ public:
for(uint32_t ii = 0; ii<BX_COUNTOF( m_textureCube ); ++ii)
{
m_textureCube[ii].idx = bgfx::invalidHandle;
m_textureCube[ii].idx = bgfx::kInvalidHandle;
}
m_textureCube[0] = bgfx::createTextureCube(

View File

@ -204,7 +204,7 @@ class ExampleHDR : public entry::AppI
}
else
{
m_rb.idx = bgfx::invalidHandle;
m_rb.idx = bgfx::kInvalidHandle;
}
// Imgui.

View File

@ -606,8 +606,8 @@ struct Group
void reset()
{
m_vbh.idx = bgfx::invalidHandle;
m_ibh.idx = bgfx::invalidHandle;
m_vbh.idx = bgfx::kInvalidHandle;
m_ibh.idx = bgfx::kInvalidHandle;
m_prims.clear();
}
@ -741,7 +741,7 @@ struct Mesh
const Group& group = *it;
bgfx::destroyVertexBuffer(group.m_vbh);
if (bgfx::invalidHandle != group.m_ibh.idx)
if (bgfx::kInvalidHandle != group.m_ibh.idx)
{
bgfx::destroyIndexBuffer(group.m_ibh);
}
@ -770,7 +770,7 @@ struct Mesh
bgfx::setVertexBuffer(0, group.m_vbh);
// Set texture
if (bgfx::invalidHandle != _texture.idx)
if (bgfx::kInvalidHandle != _texture.idx)
{
bgfx::setTexture(0, s_texColor, _texture);
}

View File

@ -778,8 +778,8 @@ struct Group
void reset()
{
m_vbh.idx = bgfx::invalidHandle;
m_ibh.idx = bgfx::invalidHandle;
m_vbh.idx = bgfx::kInvalidHandle;
m_ibh.idx = bgfx::kInvalidHandle;
m_numVertices = 0;
m_vertices = NULL;
m_numIndices = 0;
@ -921,7 +921,7 @@ struct Group
void unload()
{
bgfx::destroyVertexBuffer(m_vbh);
if (bgfx::invalidHandle != m_ibh.idx)
if (bgfx::kInvalidHandle != m_ibh.idx)
{
bgfx::destroyIndexBuffer(m_ibh);
}
@ -1108,8 +1108,8 @@ struct Model
{
Model()
{
m_program.idx = bgfx::invalidHandle;
m_texture.idx = bgfx::invalidHandle;
m_program.idx = bgfx::kInvalidHandle;
m_texture.idx = bgfx::kInvalidHandle;
}
void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices)
@ -1144,7 +1144,7 @@ struct Model
bgfx::setVertexBuffer(0, group.m_vbh);
// Set textures
if (bgfx::invalidHandle != m_texture.idx)
if (bgfx::kInvalidHandle != m_texture.idx)
{
bgfx::setTexture(0, s_texColor, m_texture);
}
@ -1154,7 +1154,7 @@ struct Model
::setRenderState(_renderState);
// Submit
BX_CHECK(bgfx::invalidHandle != m_program, "Error, program is not set.");
BX_CHECK(bgfx::kInvalidHandle != m_program, "Error, program is not set.");
::submit(_viewId, m_program);
}
}

View File

@ -816,8 +816,8 @@ struct Group
void reset()
{
m_vbh.idx = bgfx::invalidHandle;
m_ibh.idx = bgfx::invalidHandle;
m_vbh.idx = bgfx::kInvalidHandle;
m_ibh.idx = bgfx::kInvalidHandle;
m_prims.clear();
}
@ -950,7 +950,7 @@ struct Mesh
const Group& group = *it;
bgfx::destroyVertexBuffer(group.m_vbh);
if (bgfx::invalidHandle != group.m_ibh.idx)
if (bgfx::kInvalidHandle != group.m_ibh.idx)
{
bgfx::destroyIndexBuffer(group.m_ibh);
}
@ -979,7 +979,7 @@ struct Mesh
bgfx::setVertexBuffer(0, group.m_vbh);
// Set textures.
if (bgfx::invalidHandle != _texture.idx)
if (bgfx::kInvalidHandle != _texture.idx)
{
bgfx::setTexture(0, s_texColor, _texture);
}

View File

@ -206,9 +206,9 @@ class ExampleOIT : public entry::AppI
m_wbPass = loadProgram("vs_oit", "fs_oit_wb" );
m_wbBlit = loadProgram("vs_oit_blit", "fs_oit_wb_blit" );
m_fbtextures[0].idx = bgfx::invalidHandle;
m_fbtextures[1].idx = bgfx::invalidHandle;
m_fbh.idx = bgfx::invalidHandle;
m_fbtextures[0].idx = bgfx::kInvalidHandle;
m_fbtextures[1].idx = bgfx::kInvalidHandle;
m_fbh.idx = bgfx::kInvalidHandle;
m_mode = 1;
m_scrollArea = 0;

View File

@ -273,11 +273,11 @@ class ExampleDeferred : public entry::AppI
// Load normal texture.
m_textureNormal = loadTexture("textures/fieldstone-n.dds");
m_gbufferTex[0].idx = bgfx::invalidHandle;
m_gbufferTex[1].idx = bgfx::invalidHandle;
m_gbufferTex[2].idx = bgfx::invalidHandle;
m_gbuffer.idx = bgfx::invalidHandle;
m_lightBuffer.idx = bgfx::invalidHandle;
m_gbufferTex[0].idx = bgfx::kInvalidHandle;
m_gbufferTex[1].idx = bgfx::kInvalidHandle;
m_gbufferTex[2].idx = bgfx::kInvalidHandle;
m_gbuffer.idx = bgfx::kInvalidHandle;
m_lightBuffer.idx = bgfx::kInvalidHandle;
// Imgui.
imguiCreate();

View File

@ -178,7 +178,7 @@ public:
if (bgfx::isValid(m_fbh[viewId]) )
{
bgfx::destroyFrameBuffer(m_fbh[viewId]);
m_fbh[viewId].idx = bgfx::invalidHandle;
m_fbh[viewId].idx = bgfx::kInvalidHandle;
}
win.m_nwh = state.m_nwh;
@ -319,7 +319,7 @@ public:
if (bgfx::isValid(m_fbh[ii]) )
{
bgfx::destroyFrameBuffer(m_fbh[ii]);
m_fbh[ii].idx = bgfx::invalidHandle;
m_fbh[ii].idx = bgfx::kInvalidHandle;
// Flush destruction of swap chain before destroying window!
bgfx::frame();

View File

@ -93,11 +93,11 @@ class ExampleTerrain : public entry::AppI
m_timeOffset = bx::getHPCounter();
m_vbh.idx = bgfx::invalidHandle;
m_ibh.idx = bgfx::invalidHandle;
m_dvbh.idx = bgfx::invalidHandle;
m_dibh.idx = bgfx::invalidHandle;
m_heightTexture.idx = bgfx::invalidHandle;
m_vbh.idx = bgfx::kInvalidHandle;
m_ibh.idx = bgfx::kInvalidHandle;
m_dvbh.idx = bgfx::kInvalidHandle;
m_dibh.idx = bgfx::kInvalidHandle;
m_heightTexture.idx = bgfx::kInvalidHandle;
s_heightTexture = bgfx::createUniform("s_heightTexture", bgfx::UniformType::Int1);
m_oldWidth = 0;

View File

@ -373,8 +373,8 @@ struct Group
void reset()
{
m_vbh.idx = bgfx::invalidHandle;
m_ibh.idx = bgfx::invalidHandle;
m_vbh.idx = bgfx::kInvalidHandle;
m_ibh.idx = bgfx::kInvalidHandle;
m_prims.clear();
}

View File

@ -335,7 +335,7 @@ struct SpriteT
SpriteHandle create(uint16_t _width, uint16_t _height)
{
SpriteHandle handle = { bx::HandleAlloc::invalid };
SpriteHandle handle = { bx::kInvalidHandle };
if (m_handleAlloc.getNumHandles() < m_handleAlloc.getMaxHandles() )
{

View File

@ -446,7 +446,7 @@ struct FontManager::CachedFont
CachedFont()
: trueTypeFont(NULL)
{
masterFontHandle.idx = bx::HandleAlloc::invalid;
masterFontHandle.idx = bx::kInvalidHandle;
}
FontInfo fontInfo;
@ -510,7 +510,7 @@ FontManager::~FontManager()
TrueTypeHandle FontManager::createTtf(const uint8_t* _buffer, uint32_t _size)
{
uint16_t id = m_filesHandles.alloc();
BX_CHECK(id != bx::HandleAlloc::invalid, "Invalid handle used");
BX_CHECK(id != bx::kInvalidHandle, "Invalid handle used");
m_cachedFiles[id].buffer = new uint8_t[_size];
m_cachedFiles[id].bufferSize = _size;
bx::memCopy(m_cachedFiles[id].buffer, _buffer, _size);
@ -536,12 +536,12 @@ FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_
if (!ttf->init(m_cachedFiles[_ttfHandle.idx].buffer, m_cachedFiles[_ttfHandle.idx].bufferSize, _typefaceIndex, _pixelSize) )
{
delete ttf;
FontHandle invalid = { bx::HandleAlloc::invalid };
FontHandle invalid = { bx::kInvalidHandle };
return invalid;
}
uint16_t fontIdx = m_fontHandles.alloc();
BX_CHECK(fontIdx != bx::HandleAlloc::invalid, "Invalid handle used");
BX_CHECK(fontIdx != bx::kInvalidHandle, "Invalid handle used");
CachedFont& font = m_cachedFonts[fontIdx];
font.trueTypeFont = ttf;
@ -549,7 +549,7 @@ FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_
font.fontInfo.fontType = int16_t(_fontType);
font.fontInfo.pixelSize = uint16_t(_pixelSize);
font.cachedGlyphs.clear();
font.masterFontHandle.idx = bx::HandleAlloc::invalid;
font.masterFontHandle.idx = bx::kInvalidHandle;
FontHandle handle = { fontIdx };
return handle;
@ -572,7 +572,7 @@ FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle,
newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
uint16_t fontIdx = m_fontHandles.alloc();
BX_CHECK(fontIdx != bx::HandleAlloc::invalid, "Invalid handle used");
BX_CHECK(fontIdx != bx::kInvalidHandle, "Invalid handle used");
CachedFont& font = m_cachedFonts[fontIdx];
font.cachedGlyphs.clear();

View File

@ -628,8 +628,8 @@ TextBufferHandle TextBufferManager::createTextBuffer(uint32_t _type, BufferType:
bc.textBuffer = new TextBuffer(m_fontManager);
bc.fontType = _type;
bc.bufferType = _bufferType;
bc.indexBufferHandleIdx = bgfx::invalidHandle;
bc.vertexBufferHandleIdx = bgfx::invalidHandle;
bc.indexBufferHandleIdx = bgfx::kInvalidHandle;
bc.vertexBufferHandleIdx = bgfx::kInvalidHandle;
TextBufferHandle ret = {textIdx};
return ret;
@ -644,7 +644,7 @@ void TextBufferManager::destroyTextBuffer(TextBufferHandle _handle)
delete bc.textBuffer;
bc.textBuffer = NULL;
if (bc.vertexBufferHandleIdx == bgfx::invalidHandle)
if (bc.vertexBufferHandleIdx == bgfx::kInvalidHandle)
{
return;
}
@ -730,7 +730,7 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, uint8_t _id,
bgfx::IndexBufferHandle ibh;
bgfx::VertexBufferHandle vbh;
if (bgfx::invalidHandle == bc.vertexBufferHandleIdx)
if (bgfx::kInvalidHandle == bc.vertexBufferHandleIdx)
{
ibh = bgfx::createIndexBuffer(
bgfx::copy(bc.textBuffer->getIndexBuffer(), indexSize)
@ -760,7 +760,7 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, uint8_t _id,
bgfx::DynamicIndexBufferHandle ibh;
bgfx::DynamicVertexBufferHandle vbh;
if (bgfx::invalidHandle == bc.vertexBufferHandleIdx )
if (bgfx::kInvalidHandle == bc.vertexBufferHandleIdx )
{
ibh = bgfx::createDynamicIndexBuffer(
bgfx::copy(bc.textBuffer->getIndexBuffer(), indexSize)

View File

@ -413,17 +413,17 @@ struct Imgui
m_invTextureWidth = 1.0f/m_textureWidth;
m_invTextureHeight = 1.0f/m_textureHeight;
u_imageLodEnabled.idx = bgfx::invalidHandle;
u_imageSwizzle.idx = bgfx::invalidHandle;
s_texColor.idx = bgfx::invalidHandle;
m_missingTexture.idx = bgfx::invalidHandle;
u_imageLodEnabled.idx = bgfx::kInvalidHandle;
u_imageSwizzle.idx = bgfx::kInvalidHandle;
s_texColor.idx = bgfx::kInvalidHandle;
m_missingTexture.idx = bgfx::kInvalidHandle;
m_colorProgram.idx = bgfx::invalidHandle;
m_textureProgram.idx = bgfx::invalidHandle;
m_cubeMapProgram.idx = bgfx::invalidHandle;
m_latlongProgram.idx = bgfx::invalidHandle;
m_imageProgram.idx = bgfx::invalidHandle;
m_imageSwizzProgram.idx = bgfx::invalidHandle;
m_colorProgram.idx = bgfx::kInvalidHandle;
m_textureProgram.idx = bgfx::kInvalidHandle;
m_cubeMapProgram.idx = bgfx::kInvalidHandle;
m_latlongProgram.idx = bgfx::kInvalidHandle;
m_imageProgram.idx = bgfx::kInvalidHandle;
m_imageSwizzProgram.idx = bgfx::kInvalidHandle;
}
ImguiFontHandle createFont(const void* _data, float _fontSize)
@ -443,7 +443,7 @@ struct Imgui
);
m_fonts[handle.idx].m_size = _fontSize;
#else
const ImguiFontHandle handle = { bgfx::invalidHandle };
const ImguiFontHandle handle = { bgfx::kInvalidHandle };
#endif // !USE_NANOVG_FONT
return handle;
}
@ -569,7 +569,7 @@ struct Imgui
const ImguiFontHandle handle = createFont(s_robotoRegularTtf, _fontSize);
m_currentFontIdx = handle.idx;
#else
const ImguiFontHandle handle = { bgfx::invalidHandle };
const ImguiFontHandle handle = { bgfx::kInvalidHandle };
#endif // !USE_NANOVG_FONT
return handle;
}

View File

@ -185,7 +185,7 @@ namespace
for (i = 0; i < gl->ntextures; i++)
{
if (gl->textures[i].id.idx == bgfx::invalidHandle)
if (gl->textures[i].id.idx == bgfx::kInvalidHandle)
{
tex = &gl->textures[i];
break;
@ -240,7 +240,7 @@ namespace
bgfx::destroyTexture(gl->textures[ii].id);
}
bx::memSet(&gl->textures[ii], 0, sizeof(gl->textures[ii]) );
gl->textures[ii].id.idx = bgfx::invalidHandle;
gl->textures[ii].id.idx = bgfx::kInvalidHandle;
return 1;
}
}
@ -280,7 +280,7 @@ namespace
}
else
{
gl->u_halfTexel.idx = bgfx::invalidHandle;
gl->u_halfTexel.idx = bgfx::kInvalidHandle;
}
s_nvgDecl

View File

@ -195,7 +195,7 @@ namespace ps
EmitterSpriteHandle create(uint16_t _width, uint16_t _height)
{
EmitterSpriteHandle handle = { bx::HandleAlloc::invalid };
EmitterSpriteHandle handle = { bx::kInvalidHandle };
if (m_handleAlloc.getNumHandles() < m_handleAlloc.getMaxHandles() )
{

View File

@ -15,9 +15,9 @@
///
#define BGFX_HANDLE(_name) \
struct _name { uint16_t idx; }; \
inline bool isValid(_name _handle) { return bgfx::invalidHandle != _handle.idx; }
inline bool isValid(_name _handle) { return bgfx::kInvalidHandle != _handle.idx; }
#define BGFX_INVALID_HANDLE { bgfx::invalidHandle }
#define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
namespace bx { struct AllocatorI; }
@ -342,7 +342,7 @@ namespace bgfx
};
};
static const uint16_t invalidHandle = UINT16_MAX;
static const uint16_t kInvalidHandle = UINT16_MAX;
BGFX_HANDLE(DynamicIndexBufferHandle);
BGFX_HANDLE(DynamicVertexBufferHandle);

View File

@ -781,7 +781,7 @@ namespace bgfx
if (isValid(m_program[ii]) )
{
destroyProgram(m_program[ii]);
m_program[ii].idx = invalidHandle;
m_program[ii].idx = kInvalidHandle;
}
}
@ -870,7 +870,7 @@ namespace bgfx
m_uniformEnd = m_uniformBuffer->getPos();
m_key.m_program = invalidHandle == _program.idx
m_key.m_program = kInvalidHandle == _program.idx
? 0
: _program.idx
;

View File

@ -24,7 +24,7 @@
#include <inttypes.h>
// Check handle, cannot be bgfx::invalidHandle and must be valid.
// Check handle, cannot be bgfx::kInvalidHandle and must be valid.
#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \
BX_CHECK(isValid(_handle) \
&& _handleAlloc.isValid(_handle.idx) \
@ -34,7 +34,7 @@
, _handleAlloc.getMaxHandles() \
)
// Check handle, it's ok to be bgfx::invalidHandle or must be valid.
// Check handle, it's ok to be bgfx::kInvalidHandle or must be valid.
#define BGFX_CHECK_HANDLE_INVALID_OK(_desc, _handleAlloc, _handle) \
BX_CHECK(!isValid(_handle) \
|| _handleAlloc.isValid(_handle.idx) \
@ -558,7 +558,7 @@ namespace bgfx
{
for (uint32_t ii = 0; ii < BX_COUNTOF(m_program); ++ii)
{
m_program[ii].idx = invalidHandle;
m_program[ii].idx = kInvalidHandle;
}
}
@ -1158,7 +1158,7 @@ namespace bgfx
const UniformRegInfo* find(const char* _name) const
{
uint16_t handle = m_uniforms.find(bx::hashMurmur2A(_name) );
if (UniformHashMap::invalid != handle)
if (kInvalidHandle != handle)
{
return &m_info[handle];
}
@ -1228,8 +1228,8 @@ namespace bgfx
void clear()
{
m_startVertex = 0;
m_handle.idx = invalidHandle;
m_decl.idx = invalidHandle;
m_handle.idx = kInvalidHandle;
m_decl.idx = kInvalidHandle;
}
uint32_t m_startVertex;
@ -1244,7 +1244,7 @@ namespace bgfx
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
{
Binding& bind = m_bind[ii];
bind.m_idx = invalidHandle;
bind.m_idx = kInvalidHandle;
bind.m_type = 0;
bind.m_un.m_draw.m_textureFlags = 0;
}
@ -1276,10 +1276,10 @@ namespace bgfx
m_scissor = UINT16_MAX;
m_streamMask = 0;
m_stream[0].clear();
m_indexBuffer.idx = invalidHandle;
m_instanceDataBuffer.idx = invalidHandle;
m_indirectBuffer.idx = invalidHandle;
m_occlusionQuery.idx = invalidHandle;
m_indexBuffer.idx = kInvalidHandle;
m_instanceDataBuffer.idx = kInvalidHandle;
m_indirectBuffer.idx = kInvalidHandle;
m_occlusionQuery.idx = kInvalidHandle;
}
bool setStreamBit(uint8_t _stream, VertexBufferHandle _handle)
@ -1330,7 +1330,7 @@ namespace bgfx
m_num = 0;
m_submitFlags = BGFX_SUBMIT_EYE_FIRST;
m_indirectBuffer.idx = invalidHandle;
m_indirectBuffer.idx = kInvalidHandle;
m_startIndirect = 0;
m_numIndirect = UINT16_MAX;
}
@ -1424,7 +1424,7 @@ namespace bgfx
{
SortKey term;
term.reset();
term.m_program = invalidHandle;
term.m_program = kInvalidHandle;
m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS] = term.encodeDraw();
m_sortValues[BGFX_CONFIG_MAX_DRAW_CALLS] = BGFX_CONFIG_MAX_DRAW_CALLS;
bx::memSet(m_occlusion, 0xff, sizeof(m_occlusion) );
@ -1592,7 +1592,7 @@ namespace bgfx
Stream& stream = m_draw.m_stream[_stream];
stream.m_startVertex = _startVertex;
stream.m_handle = _handle;
stream.m_decl.idx = invalidHandle;
stream.m_decl.idx = kInvalidHandle;
m_numVertices[_stream] = _numVertices;
}
}
@ -1993,7 +1993,7 @@ namespace bgfx
void add(VertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash)
{
BX_CHECK(m_vertexBufferRef[_handle.idx].idx == invalidHandle, "");
BX_CHECK(m_vertexBufferRef[_handle.idx].idx == kInvalidHandle, "");
m_vertexBufferRef[_handle.idx] = _declHandle;
m_vertexDeclRef[_declHandle.idx]++;
m_vertexDeclMap.insert(_hash, _declHandle.idx);
@ -2001,7 +2001,7 @@ namespace bgfx
void add(DynamicVertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash)
{
BX_CHECK(m_dynamicVertexBufferRef[_handle.idx].idx == invalidHandle, "");
BX_CHECK(m_dynamicVertexBufferRef[_handle.idx].idx == kInvalidHandle, "");
m_dynamicVertexBufferRef[_handle.idx] = _declHandle;
m_vertexDeclRef[_declHandle.idx]++;
m_vertexDeclMap.insert(_hash, _declHandle.idx);
@ -2028,7 +2028,7 @@ namespace bgfx
{
VertexDeclHandle declHandle = m_vertexBufferRef[_handle.idx];
declHandle = release(declHandle);
m_vertexBufferRef[_handle.idx].idx = invalidHandle;
m_vertexBufferRef[_handle.idx].idx = kInvalidHandle;
return declHandle;
}
@ -2037,7 +2037,7 @@ namespace bgfx
{
VertexDeclHandle declHandle = m_dynamicVertexBufferRef[_handle.idx];
declHandle = release(declHandle);
m_dynamicVertexBufferRef[_handle.idx].idx = invalidHandle;
m_dynamicVertexBufferRef[_handle.idx].idx = kInvalidHandle;
return declHandle;
}
@ -2054,7 +2054,7 @@ namespace bgfx
class NonLocalAllocator
{
public:
static const uint64_t invalidBlock = UINT64_MAX;
static const uint64_t kInvalidBlock = UINT64_MAX;
NonLocalAllocator()
{
@ -2114,7 +2114,7 @@ namespace bgfx
}
// there is no block large enough.
return invalidBlock;
return kInvalidBlock;
}
void free(uint64_t _block)
@ -2458,7 +2458,7 @@ namespace bgfx
uint64_t allocDynamicIndexBuffer(uint32_t _size, uint16_t _flags)
{
uint64_t ptr = m_dynIndexBufferAllocator.alloc(_size);
if (ptr == NonLocalAllocator::invalidBlock)
if (ptr == NonLocalAllocator::kInvalidBlock)
{
IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() };
BX_WARN(isValid(indexBufferHandle), "Failed to allocate index buffer handle.");
@ -2506,7 +2506,7 @@ namespace bgfx
else
{
ptr = allocDynamicIndexBuffer(size, _flags);
if (ptr == NonLocalAllocator::invalidBlock)
if (ptr == NonLocalAllocator::kInvalidBlock)
{
return handle;
}
@ -2618,14 +2618,14 @@ namespace bgfx
uint64_t allocDynamicVertexBuffer(uint32_t _size, uint16_t _flags)
{
uint64_t ptr = m_dynVertexBufferAllocator.alloc(_size);
if (ptr == NonLocalAllocator::invalidBlock)
if (ptr == NonLocalAllocator::kInvalidBlock)
{
VertexBufferHandle vertexBufferHandle = { m_vertexBufferHandle.alloc() };
BX_WARN(isValid(vertexBufferHandle), "Failed to allocate dynamic vertex buffer handle.");
if (!isValid(vertexBufferHandle) )
{
return NonLocalAllocator::invalidBlock;
return NonLocalAllocator::kInvalidBlock;
}
uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size);
@ -2666,7 +2666,7 @@ namespace bgfx
else
{
ptr = allocDynamicVertexBuffer(size, _flags);
if (ptr == NonLocalAllocator::invalidBlock)
if (ptr == NonLocalAllocator::kInvalidBlock)
{
return handle;
}
@ -3146,7 +3146,7 @@ namespace bgfx
}
uint16_t idx = m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx);
if (ProgramHashMap::invalid != idx)
if (kInvalidHandle != idx)
{
ProgramHandle handle = { idx };
ProgramRef& pr = m_programRef[handle.idx];
@ -3205,7 +3205,7 @@ namespace bgfx
}
uint16_t idx = m_programHashMap.find(_vsh.idx);
if (ProgramHashMap::invalid != idx)
if (kInvalidHandle != idx)
{
ProgramHandle handle = { idx };
ProgramRef& pr = m_programRef[handle.idx];
@ -3581,7 +3581,7 @@ namespace bgfx
_num = bx::uint16_max(1, _num);
uint16_t idx = m_uniformHashMap.find(bx::hashMurmur2A(_name) );
if (UniformHashMap::invalid != idx)
if (kInvalidHandle != idx)
{
UniformHandle handle = { idx };
UniformRef& uniform = m_uniformRef[handle.idx];

View File

@ -707,7 +707,7 @@ namespace bgfx { namespace d3d11
, m_rtMsaa(false)
, m_timerQuerySupport(false)
{
m_fbh.idx = invalidHandle;
m_fbh.idx = kInvalidHandle;
bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) );
bx::memSet(&m_scd, 0, sizeof(m_scd) );
bx::memSet(&m_windows, 0xff, sizeof(m_windows) );
@ -744,7 +744,7 @@ namespace bgfx { namespace d3d11
m_renderdocdll = loadRenderDoc();
}
m_fbh.idx = invalidHandle;
m_fbh.idx = kInvalidHandle;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
@ -5368,7 +5368,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
Query& query = m_query[(m_control.m_read + ii) % size];
if (query.m_handle.idx == _handle.idx)
{
query.m_handle.idx = bgfx::invalidHandle;
query.m_handle.idx = bgfx::kInvalidHandle;
}
}
}
@ -5510,7 +5510,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bool scissorEnabled = false;
setDebugWireframe(wireframe);
uint16_t programIdx = invalidHandle;
uint16_t programIdx = kInvalidHandle;
SortKey key;
uint16_t view = UINT16_MAX;
FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS };
@ -5577,7 +5577,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
view = key.m_view;
programIdx = invalidHandle;
programIdx = kInvalidHandle;
if (_render->m_fb[view].idx != fbh.idx)
{
@ -5721,7 +5721,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
constantsChanged = true;
}
if (invalidHandle != programIdx)
if (kInvalidHandle != programIdx)
{
ProgramD3D11& program = m_program[programIdx];
@ -5750,7 +5750,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
{
const Binding& bind = renderBind.m_bind[ii];
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
switch (bind.m_type)
{
@ -5837,7 +5837,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
programIdx = invalidHandle;
programIdx = kInvalidHandle;
m_currentProgram = NULL;
invalidateCompute();
@ -5982,7 +5982,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
programIdx = key.m_program;
if (invalidHandle == programIdx)
if (kInvalidHandle == programIdx)
{
m_currentProgram = NULL;
@ -6015,7 +6015,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
constantsChanged = true;
}
if (invalidHandle != programIdx)
if (kInvalidHandle != programIdx)
{
ProgramD3D11& program = m_program[programIdx];
@ -6054,7 +6054,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|| current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags
|| programChanged)
{
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
switch (bind.m_type)
{
@ -6173,7 +6173,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
currentState.m_indexBuffer = draw.m_indexBuffer;
uint16_t handle = draw.m_indexBuffer.idx;
if (invalidHandle != handle)
if (kInvalidHandle != handle)
{
const IndexBufferD3D11& ib = m_indexBuffers[handle];
deviceCtx->IASetIndexBuffer(ib.m_ptr

View File

@ -544,7 +544,7 @@ namespace bgfx { namespace d3d12
m_renderdocdll = loadRenderDoc();
setGraphicsDebuggerPresent(NULL != m_renderdocdll);
m_fbh.idx = invalidHandle;
m_fbh.idx = kInvalidHandle;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
@ -4507,7 +4507,7 @@ data.NumQualityLevels = 0;
m_width = 0;
m_height = 0;
m_depth.idx = bgfx::invalidHandle;
m_depth.idx = bgfx::kInvalidHandle;
m_num = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
@ -4567,7 +4567,7 @@ data.NumQualityLevels = 0;
{
m_numTh = 0;
m_depth.idx = bgfx::invalidHandle;
m_depth.idx = bgfx::kInvalidHandle;
uint16_t denseIdx = m_denseIdx;
m_denseIdx = UINT16_MAX;
@ -4806,7 +4806,7 @@ data.NumQualityLevels = 0;
OcclusionQueryHandle& handle = m_handle[(m_control.m_read + ii) % size];
if (handle.idx == _handle.idx)
{
handle.idx = bgfx::invalidHandle;
handle.idx = bgfx::kInvalidHandle;
}
}
}
@ -4942,8 +4942,8 @@ data.NumQualityLevels = 0;
// bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
// setDebugWireframe(wireframe);
uint16_t currentSamplerStateIdx = invalidHandle;
uint16_t currentProgramIdx = invalidHandle;
uint16_t currentSamplerStateIdx = kInvalidHandle;
uint16_t currentProgramIdx = kInvalidHandle;
uint32_t currentBindHash = 0;
bool hasPredefined = false;
bool commandListChanged = false;
@ -5027,8 +5027,8 @@ data.NumQualityLevels = 0;
view = key.m_view;
currentPso = NULL;
currentSamplerStateIdx = invalidHandle;
currentProgramIdx = invalidHandle;
currentSamplerStateIdx = kInvalidHandle;
currentProgramIdx = kInvalidHandle;
hasPredefined = false;
fbh = _render->m_fb[view];
@ -5108,7 +5108,7 @@ data.NumQualityLevels = 0;
for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
{
const Binding& bind = renderBind.m_bind[ii];
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
switch (bind.m_type)
{
@ -5285,8 +5285,8 @@ data.NumQualityLevels = 0;
currentPso = NULL;
currentBindHash = 0;
currentSamplerStateIdx = invalidHandle;
currentProgramIdx = invalidHandle;
currentSamplerStateIdx = kInvalidHandle;
currentProgramIdx = kInvalidHandle;
currentState.clear();
currentState.m_scissor = !draw.m_scissor;
changedFlags = BGFX_STATE_MASK;
@ -5351,7 +5351,7 @@ data.NumQualityLevels = 0;
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
{
const Binding& bind = renderBind.m_bind[stage];
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
switch (bind.m_type)
{

View File

@ -306,7 +306,7 @@ namespace bgfx { namespace d3d12
, m_num(0)
, m_numTh(0)
{
m_depth.idx = bgfx::invalidHandle;
m_depth.idx = bgfx::kInvalidHandle;
}
void create(uint8_t _num, const Attachment* _attachment);

View File

@ -414,7 +414,7 @@ namespace bgfx { namespace d3d9
ErrorState::Enum errorState = ErrorState::Default;
m_fbh.idx = invalidHandle;
m_fbh.idx = kInvalidHandle;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
@ -3631,7 +3631,7 @@ namespace bgfx { namespace d3d9
Query& query = m_query[(m_control.m_read + ii) % size];
if (query.m_handle.idx == _handle.idx)
{
query.m_handle.idx = bgfx::invalidHandle;
query.m_handle.idx = bgfx::kInvalidHandle;
}
}
}
@ -3732,7 +3732,7 @@ namespace bgfx { namespace d3d9
ViewState viewState(_render, false);
DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, _render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) );
uint16_t programIdx = invalidHandle;
uint16_t programIdx = kInvalidHandle;
SortKey key;
uint16_t view = UINT16_MAX;
FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS };
@ -3816,7 +3816,7 @@ namespace bgfx { namespace d3d9
BGFX_PROFILER_BEGIN_DYNAMIC(s_viewName[key.m_view]);
view = key.m_view;
programIdx = invalidHandle;
programIdx = kInvalidHandle;
if (_render->m_fb[view].idx != fbh.idx)
{
@ -4087,7 +4087,7 @@ namespace bgfx { namespace d3d9
{
programIdx = key.m_program;
if (invalidHandle == programIdx)
if (kInvalidHandle == programIdx)
{
device->SetVertexShader(NULL);
device->SetPixelShader(NULL);
@ -4103,7 +4103,7 @@ namespace bgfx { namespace d3d9
constantsChanged = true;
}
if (invalidHandle != programIdx)
if (kInvalidHandle != programIdx)
{
ProgramD3D9& program = m_program[programIdx];
@ -4135,7 +4135,7 @@ namespace bgfx { namespace d3d9
|| current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags
|| programChanged)
{
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
m_textures[bind.m_idx].commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette);
}
@ -4232,7 +4232,7 @@ namespace bgfx { namespace d3d9
currentState.m_indexBuffer = draw.m_indexBuffer;
uint16_t handle = draw.m_indexBuffer.idx;
if (invalidHandle != handle)
if (kInvalidHandle != handle)
{
const IndexBufferD3D9& ib = m_indexBuffers[handle];
DX_CHECK(device->SetIndices(ib.m_ptr) );

View File

@ -1473,7 +1473,7 @@ namespace bgfx { namespace gl
{
m_renderdocdll = loadRenderDoc();
m_fbh.idx = invalidHandle;
m_fbh.idx = kInvalidHandle;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
@ -6250,7 +6250,7 @@ namespace bgfx { namespace gl
Query& query = m_query[(m_control.m_read + ii) % size];
if (query.m_handle.idx == _handle.idx)
{
query.m_handle.idx = bgfx::invalidHandle;
query.m_handle.idx = bgfx::kInvalidHandle;
}
}
}
@ -6363,7 +6363,7 @@ namespace bgfx { namespace gl
static ViewState viewState;
viewState.reset(_render, hmdEnabled);
uint16_t programIdx = invalidHandle;
uint16_t programIdx = kInvalidHandle;
SortKey key;
uint16_t view = UINT16_MAX;
FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS };
@ -6451,7 +6451,7 @@ namespace bgfx { namespace gl
}
view = key.m_view;
programIdx = invalidHandle;
programIdx = kInvalidHandle;
if (_render->m_fb[view].idx != fbh.idx)
{
@ -6574,7 +6574,7 @@ namespace bgfx { namespace gl
for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
{
const Binding& bind = renderBind.m_bind[ii];
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
switch (bind.m_type)
{
@ -6650,7 +6650,7 @@ namespace bgfx { namespace gl
{
if (isValid(currentState.m_indirectBuffer) )
{
currentState.m_indirectBuffer.idx = invalidHandle;
currentState.m_indirectBuffer.idx = kInvalidHandle;
GL_CHECK(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0) );
}
@ -7035,10 +7035,10 @@ namespace bgfx { namespace gl
if (key.m_program != programIdx)
{
programIdx = key.m_program;
GLuint id = invalidHandle == programIdx ? 0 : m_program[programIdx].m_id;
GLuint id = kInvalidHandle == programIdx ? 0 : m_program[programIdx].m_id;
// Skip rendering if program index is valid, but program is invalid.
programIdx = 0 == id ? invalidHandle : programIdx;
programIdx = 0 == id ? kInvalidHandle : programIdx;
GL_CHECK(glUseProgram(id) );
programChanged =
@ -7046,7 +7046,7 @@ namespace bgfx { namespace gl
bindAttribs = true;
}
if (invalidHandle != programIdx)
if (kInvalidHandle != programIdx)
{
ProgramGL& program = m_program[programIdx];
@ -7068,7 +7068,7 @@ namespace bgfx { namespace gl
|| current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags
|| programChanged)
{
if (invalidHandle != bind.m_idx)
if (kInvalidHandle != bind.m_idx)
{
switch (bind.m_type)
{
@ -7242,9 +7242,9 @@ namespace bgfx { namespace gl
currentState.m_streamMask = 0;
for (size_t ii = 0; ii < BGFX_CONFIG_MAX_VERTEX_STREAMS; ++ii)
{
currentState.m_stream[ii].m_handle.idx = invalidHandle;
currentState.m_stream[ii].m_handle.idx = kInvalidHandle;
}
currentState.m_indexBuffer.idx = invalidHandle;
currentState.m_indexBuffer.idx = kInvalidHandle;
bindAttribs = true;
currentVao = 0;
}
@ -7296,7 +7296,7 @@ namespace bgfx { namespace gl
currentState.m_indexBuffer = draw.m_indexBuffer;
uint16_t handle = draw.m_indexBuffer.idx;
if (invalidHandle != handle)
if (kInvalidHandle != handle)
{
IndexBufferGL& ib = m_indexBuffers[handle];
GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) );
@ -7435,7 +7435,7 @@ namespace bgfx { namespace gl
{
if (isValid(currentState.m_indirectBuffer) )
{
currentState.m_indirectBuffer.idx = invalidHandle;
currentState.m_indirectBuffer.idx = kInvalidHandle;
GL_CHECK(glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0) );
}

View File

@ -818,7 +818,7 @@ namespace bgfx { namespace mtl
, m_pixelFormatHash(0)
, m_num(0)
{
m_depthHandle.idx = invalidHandle;
m_depthHandle.idx = kInvalidHandle;
}
void create(uint8_t _num, const Attachment* _attachment);

View File

@ -725,7 +725,7 @@ VK_IMPORT_DEVICE
ErrorState::Enum errorState = ErrorState::Default;
m_fbh.idx = invalidHandle;
m_fbh.idx = kInvalidHandle;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_resolution, 0, sizeof(m_resolution) );
@ -3667,8 +3667,8 @@ VK_DESTROY
// bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
// setDebugWireframe(wireframe);
uint16_t currentSamplerStateIdx = invalidHandle;
uint16_t currentProgramIdx = invalidHandle;
uint16_t currentSamplerStateIdx = kInvalidHandle;
uint16_t currentProgramIdx = kInvalidHandle;
uint32_t currentBindHash = 0;
bool hasPredefined = false;
bool commandListChanged = false;
@ -3787,9 +3787,9 @@ finishAll();
view = key.m_view;
currentPipeline = VK_NULL_HANDLE;
currentSamplerStateIdx = invalidHandle;
currentSamplerStateIdx = kInvalidHandle;
BX_UNUSED(currentSamplerStateIdx);
currentProgramIdx = invalidHandle;
currentProgramIdx = kInvalidHandle;
hasPredefined = false;
fbh = _render->m_fb[view];
@ -3878,7 +3878,7 @@ BX_UNUSED(currentSamplerStateIdx);
// for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
// {
// const Binding& bind = renderBind.m_bind[ii];
// if (invalidHandle != bind.m_idx)
// if (kInvalidHandle != bind.m_idx)
// {
// switch (bind.m_type)
// {
@ -4055,8 +4055,8 @@ BX_UNUSED(currentSamplerStateIdx);
currentPipeline = VK_NULL_HANDLE;
currentBindHash = 0;
currentSamplerStateIdx = invalidHandle;
currentProgramIdx = invalidHandle;
currentSamplerStateIdx = kInvalidHandle;
currentProgramIdx = kInvalidHandle;
currentState.clear();
currentState.m_scissor = !draw.m_scissor;
changedFlags = BGFX_STATE_MASK;
@ -4117,7 +4117,7 @@ BX_UNUSED(currentSamplerStateIdx);
// for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
// {
// const Binding& bind = renderBind.m_bind[stage];
// if (invalidHandle != bind.m_idx)
// if (kInvalidHandle != bind.m_idx)
// {
// TextureD3D12& texture = m_textures[bind.m_idx];
// texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ);