• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BX_CHECK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BX_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ BX_CHECK函数的具体用法?C++ BX_CHECK怎么用?C++ BX_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BX_CHECK函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: m_usedLayers

Atlas::Atlas(uint16_t _textureSize, uint16_t _maxRegionsCount)
	: m_usedLayers(0)
	, m_usedFaces(0)
	, m_textureSize(_textureSize)
	, m_regionCount(0)
	, m_maxRegionCount(_maxRegionsCount)
{
	BX_CHECK(_textureSize >= 64 && _textureSize <= 4096, "Invalid _textureSize %d.", _textureSize);
	BX_CHECK(_maxRegionsCount >= 64 && _maxRegionsCount <= 32000, "Invalid _maxRegionsCount %d.", _maxRegionsCount);

	init();

	m_layers = new PackedLayer[24];
	for (int ii = 0; ii < 24; ++ii)
	{
		m_layers[ii].packer.init(_textureSize, _textureSize);
	}

	m_regions = new AtlasRegion[_maxRegionsCount];
	m_textureBuffer = new uint8_t[ _textureSize * _textureSize * 6 * 4 ];
	memset(m_textureBuffer, 0, _textureSize * _textureSize * 6 * 4);

	m_textureHandle = bgfx::createTextureCube(6
		, _textureSize
		, 1
		, bgfx::TextureFormat::BGRA8
		);
}
开发者ID:cdoty,项目名称:bgfx,代码行数:28,代码来源:cube_atlas.cpp


示例2: BX_CHECK

	bool Semaphore::wait(int32_t _msecs)
	{
#		if BX_PLATFORM_NACL || BX_PLATFORM_OSX
		BX_CHECK(-1 == _msecs, "NaCl and OSX don't support sem_timedwait at this moment."); BX_UNUSED(_msecs);
		return 0 == sem_wait(&m_handle);
#		else
		if (0 > _msecs)
		{
			int32_t result;
			do
			{
				result = sem_wait(&m_handle);
			} // keep waiting when interrupted by a signal handler...
			while (-1 == result && EINTR == errno);
			BX_CHECK(0 == result, "sem_wait failed. errno %d", errno);
			return 0 == result;
		}

		timespec ts;
		clock_gettime(CLOCK_REALTIME, &ts);
		ts.tv_sec += _msecs/1000;
		ts.tv_nsec += (_msecs%1000)*1000;
		return 0 == sem_timedwait(&m_handle, &ts);
#		endif // BX_PLATFORM_
	}
开发者ID:Robbbert,项目名称:store1,代码行数:25,代码来源:sem.cpp


示例3: BX_CHECK

FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle, uint32_t _pixelSize)
{
	BX_CHECK(bgfx::isValid(_baseFontHandle), "Invalid handle used");
	CachedFont& baseFont = m_cachedFonts[_baseFontHandle.idx];
	FontInfo& fontInfo = baseFont.fontInfo;

	FontInfo newFontInfo = fontInfo;
	newFontInfo.pixelSize = _pixelSize;
	newFontInfo.scale = (float)_pixelSize / (float) fontInfo.pixelSize;
	newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
	newFontInfo.descender = (newFontInfo.descender * newFontInfo.scale);
	newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
	newFontInfo.maxAdvanceWidth = (newFontInfo.maxAdvanceWidth * newFontInfo.scale);
	newFontInfo.underlineThickness = (newFontInfo.underlineThickness * newFontInfo.scale);
	newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);

	uint16_t fontIdx = m_fontHandles.alloc();
	BX_CHECK(fontIdx != bx::HandleAlloc::invalid, "Invalid handle used");

	CachedFont& font = m_cachedFonts[fontIdx];
	font.cachedGlyphs.clear();
	font.fontInfo = newFontInfo;
	font.trueTypeFont = NULL;
	font.masterFontHandle = _baseFontHandle;

	FontHandle handle = { fontIdx };
	return handle;
}
开发者ID:0-wiz-0,项目名称:bgfx,代码行数:28,代码来源:font_manager.cpp


示例4: pthread_mutex_lock

	bool Semaphore::wait(int32_t _msecs)
	{
		int result = pthread_mutex_lock(&m_mutex);
		BX_CHECK(0 == result, "pthread_mutex_lock %d", result);

#		if BX_PLATFORM_NACL || BX_PLATFORM_OSX
		BX_UNUSED(_msecs);
		BX_CHECK(-1 == _msecs, "NaCl and OSX don't support pthread_cond_timedwait at this moment.");
		while (0 == result
		&&	 0 >= m_count)
		{
			result = pthread_cond_wait(&m_cond, &m_mutex);
		}
#		elif BX_PLATFORM_IOS
		if (-1 == _msecs)
		{
			while (0 == result
			&&     0 >= m_count)
			{
				result = pthread_cond_wait(&m_cond, &m_mutex);
			}
		}
		else
		{
			timespec ts;
			ts.tv_sec = _msecs/1000;
			ts.tv_nsec = (_msecs%1000)*1000;

			while (0 == result
			&&     0 >= m_count)
			{
				result = pthread_cond_timedwait_relative_np(&m_cond, &m_mutex, &ts);
			}
		}
#		else
		timespec ts;
		clock_gettime(CLOCK_REALTIME, &ts);
		ts.tv_sec += _msecs/1000;
		ts.tv_nsec += (_msecs%1000)*1000;

		while (0 == result
		&&     0 >= m_count)
		{
			result = pthread_cond_timedwait(&m_cond, &m_mutex, &ts);
		}
#		endif // BX_PLATFORM_NACL || BX_PLATFORM_OSX
		bool ok = 0 == result;

		if (ok)
		{
			--m_count;
		}

		result = pthread_mutex_unlock(&m_mutex);
		BX_CHECK(0 == result, "pthread_mutex_unlock %d", result);

		BX_UNUSED(result);

		return ok;
	}
开发者ID:Robbbert,项目名称:store1,代码行数:60,代码来源:sem.cpp


示例5: pthread_cond_destroy

	Semaphore::~Semaphore()
	{
		int result;
		result = pthread_cond_destroy(&m_cond);
		BX_CHECK(0 == result, "pthread_cond_destroy %d", result);

		result = pthread_mutex_destroy(&m_mutex);
		BX_CHECK(0 == result, "pthread_mutex_destroy %d", result);

		BX_UNUSED(result);
	}
开发者ID:Robbbert,项目名称:store1,代码行数:11,代码来源:sem.cpp


示例6: m_count

	Semaphore::Semaphore()
		: m_count(0)
	{
		int result;
		result = pthread_mutex_init(&m_mutex, NULL);
		BX_CHECK(0 == result, "pthread_mutex_init %d", result);

		result = pthread_cond_init(&m_cond, NULL);
		BX_CHECK(0 == result, "pthread_cond_init %d", result);

		BX_UNUSED(result);
	}
开发者ID:Robbbert,项目名称:store1,代码行数:12,代码来源:sem.cpp


示例7: BX_CHECK

void RectanglePacker::init(uint32_t _width, uint32_t _height)
{
	BX_CHECK(_width > 2, "_width must be > 2");
	BX_CHECK(_height > 2, "_height must be > 2");
	m_width = _width;
	m_height = _height;
	m_usedSpace = 0;

	m_skyline.clear();
	// We want a one pixel border around the whole atlas to avoid any artifact when
	// sampling texture
	m_skyline.push_back(Node(1, 1, _width - 2) );
}
开发者ID:cdoty,项目名称:bgfx,代码行数:13,代码来源:cube_atlas.cpp


示例8: BX_CHECK

void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
{
	const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);

	if (font.lineGap > m_lineGap)
	{
		m_lineGap = font.lineGap;
	}

	if ( (font.ascender - font.descender) > m_lineHeight)
	{
		m_height -= m_lineHeight;
		m_lineHeight = font.ascender - font.descender;
		m_height += m_lineHeight;
	}

	CodePoint codepoint = 0;
	uint32_t state = 0;

	for (; *_string; ++_string)
	{
		if (!utf8_decode(&state, (uint32_t*)&codepoint, *_string) )
		{
			const GlyphInfo* glyph = m_fontManager->getGlyphInfo(_fontHandle, codepoint);
			if (NULL != glyph)
			{
				if (codepoint == L'\n')
				{
					m_height += m_lineGap + font.ascender - font.descender;					
					m_lineGap = font.lineGap;
					m_lineHeight = font.ascender - font.descender;					
					m_x = 0;
					break;
				}

				m_x += glyph->advance_x;
				if(m_x > m_width)
				{
					m_width = m_x;
				}
			}
			else
			{
				BX_CHECK(false, "Glyph not found");
			}
		}
	}

	BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
}
开发者ID:Akaito,项目名称:bgfx,代码行数:50,代码来源:text_metrics.cpp


示例9: add

	void add(const char* _name, ConsoleFn _fn, void* _userData)
	{
		uint32_t cmd = bx::hashMurmur2A(_name, (uint32_t)strlen(_name) );
		BX_CHECK(m_lookup.end() == m_lookup.find(cmd), "Command \"%s\" already exist.", _name);
		Func fn = { _fn, _userData };
		m_lookup.insert(stl::make_pair(cmd, fn) );
	}
开发者ID:Akaito,项目名称:bgfx,代码行数:7,代码来源:cmd.cpp


示例10: pumpkinLoadShader

bgfx::ShaderHandle pumpkinLoadShader(bx::FileReaderI* _reader, const char* _name)
{
	char filePath[512];

	std::string shaderPath = "shaders/";//SHADER_FILE_PATH;

	switch (bgfx::getRendererType() )
	{
	case bgfx::RendererType::Noop:
	case bgfx::RendererType::Direct3D9:  shaderPath += "dx9/";   break;
	case bgfx::RendererType::Direct3D11:
	case bgfx::RendererType::Direct3D12: shaderPath += "dx11/";  break;
	case bgfx::RendererType::Gnm:        shaderPath += "pssl/";  break;
	case bgfx::RendererType::Metal:      shaderPath += "metal/"; break;
	case bgfx::RendererType::OpenGL:     shaderPath += "glsl/";  break;
	case bgfx::RendererType::OpenGLES:   shaderPath += "essl/";  break;
	case bgfx::RendererType::Vulkan:     shaderPath += "spirv/"; break;

	case bgfx::RendererType::Count:
		BX_CHECK(false, "You should not be here!");
		break;
	}

	strcpy(filePath, shaderPath.c_str());
	strcat(filePath, _name);
	strcat(filePath, ".bin");

	return bgfx::createShader(loadMem(_reader, filePath) );
}
开发者ID:xesf,项目名称:fitd-residualvm,代码行数:29,代码来源:Shader.cpp


示例11: reallocStub

	void* reallocStub(void* _ptr, size_t _size)
	{
		void* ptr = ::realloc(_ptr, _size);
		BX_CHECK(NULL != ptr, "Out of memory!");
		//	BX_TRACE("alloc %d, %p", _size, ptr);
		return ptr;
	}
开发者ID:carbongames,项目名称:bgfx,代码行数:7,代码来源:bgfx.cpp


示例12: while

void TextLineMetrics::getVisibleText(const char* _string, float _top, float _bottom, const char*& _begin, const char*& _end)
{
	CodePoint codepoint = 0;
	uint32_t state = 0;
	// y is bottom of a text line
	float y = m_lineHeight;
	while (*_string && (y < _top) )
	{
		for (; *_string; ++_string)
		{	
			if(utf8_decode(&state, (uint32_t*)&codepoint, *_string) == UTF8_ACCEPT)
			{
				if(codepoint == L'\n')
				{
					y += m_lineHeight;
					++_string;
					break;
				}
			}
		}
	}

	BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
	_begin = _string;

	// y is now top of a text line
	y -= m_lineHeight;
	while ( (*_string) && (y < _bottom) )
	{
		for (; *_string; ++_string)
		{	
			if(utf8_decode(&state, (uint32_t*)&codepoint, *_string) == UTF8_ACCEPT)
			{
				if(codepoint == L'\n')
				{
					y += m_lineHeight;
					++_string;
					break;
				}
			}
		}
	}

	BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
	_end = _string;
}
开发者ID:CallmeNezha,项目名称:bgfx,代码行数:46,代码来源:text_metrics.cpp


示例13: getName

	const char* getName(SpvBuiltin::Enum _enum)
	{
		BX_CHECK(_enum <= SpvBuiltin::Count, "Unknown builtin id %d.", _enum);
		return _enum <= SpvBuiltin::Count
			?  s_spvBuiltin[_enum]
			: "?SpvBuiltin?"
			;
	}
开发者ID:IceOrchid,项目名称:bgfx,代码行数:8,代码来源:shader_spirv.cpp


示例14: getAabb

		void getAabb(EmitterHandle _handle, Aabb& _outAabb)
		{
			BX_CHECK(m_emitterAlloc.isValid(_handle.idx)
				, "getAabb handle %d is not valid."
				, _handle.idx
				);
			_outAabb = m_emitter[_handle.idx].m_aabb;
		}
开发者ID:dumganhar,项目名称:bgfx,代码行数:8,代码来源:particle_system.cpp


示例15: BX_CHECK

	VRImplOVR::~VRImplOVR()
	{
		if (NULL != g_platformData.session)
		{
			return;
		}

		BX_CHECK(NULL == m_session, "OVR not shutdown properly.");
	}
开发者ID:lealzhan,项目名称:bgfx,代码行数:9,代码来源:hmd_ovr.cpp


示例16: CreateSemaphoreExW

	Semaphore::Semaphore()
	{
#if BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT
		m_handle = CreateSemaphoreExW(NULL, 0, LONG_MAX, NULL, 0, SEMAPHORE_ALL_ACCESS);
#else
		m_handle = CreateSemaphoreA(NULL, 0, LONG_MAX, NULL);
#endif
		BX_CHECK(NULL != m_handle, "Failed to create Semaphore!");
	}
开发者ID:Robbbert,项目名称:store1,代码行数:9,代码来源:sem.cpp


示例17: sem_post

	void Semaphore::post(uint32_t _count)
	{
		int32_t result;
		for (uint32_t ii = 0; ii < _count; ++ii)
		{
			result = sem_post(&m_handle);
			BX_CHECK(0 == result, "sem_post failed. errno %d", errno);
		}
		BX_UNUSED(result);
	}
开发者ID:Robbbert,项目名称:store1,代码行数:10,代码来源:sem.cpp


示例18: BX_UNUSED

	void GlContext::create(uint32_t _width, uint32_t _height)
	{
		BX_UNUSED(_width, _height);

		s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
		BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");

		bgfx_GlContext_create((GlCtx*)this, g_bgfxNSWindow, _width, _height);
		import();
	}
开发者ID:gmacd,项目名称:go-bgfx,代码行数:10,代码来源:glcontext_nsgl.cpp


示例19: destroyEmitter

		void destroyEmitter(EmitterHandle _handle)
		{
			BX_CHECK(m_emitterAlloc.isValid(_handle.idx)
				, "destroyEmitter handle %d is not valid."
				, _handle.idx
				);

			m_emitter[_handle.idx].destroy();
			m_emitterAlloc->free(_handle.idx);
		}
开发者ID:dumganhar,项目名称:bgfx,代码行数:10,代码来源:particle_system.cpp



注:本文中的BX_CHECK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BX_DEBUG函数代码示例发布时间:2022-05-30
下一篇:
C++ BVAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap