当前位置: 首页>>代码示例>>C++>>正文


C++ MFDebug_Assert函数代码示例

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


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

示例1: MFFileSystem_UnregisterFileSystem

void MFFileSystem_UnregisterFileSystem(MFFileSystemHandle filesystemHandle)
{
	MFDebug_Assert((uint32)filesystemHandle < gDefaults.filesys.maxFileSystems, "Invalid filesystem");

	GET_MODULE_DATA(MFFileSystemState);

	MFFileSystem *pFS = pModuleData->ppFileSystemList[filesystemHandle];
	MFDebug_Assert(pFS, "Filesystem not mounted");

	if(pFS->callbacks.UnregisterFS)
		pFS->callbacks.UnregisterFS();

	if(pFS->thread)
	{
		// terminate job thread
		MFJob *pJob = NewJob(pFS);
		PostJob(pFS, pJob);
		while(pJob->status != MFJS_Finished)
		{
			// yield
		}

		MFThread_DestroySemaphore(pFS->semaphore);
		pFS->jobs.Deinit();
		MFHeap_Free(pFS->ppJobQueue);
	}

	pModuleData->gFileSystems.Destroy(pFS);
	pModuleData->ppFileSystemList[filesystemHandle] = NULL;
}
开发者ID:TurkeyMan,项目名称:fuji,代码行数:30,代码来源:MFFileSystem.cpp

示例2: MFVertex_UnlockIndexBuffer

MF_API void MFVertex_UnlockIndexBuffer(MFIndexBuffer *pIndexBuffer)
{
	MFDebug_Assert(pIndexBuffer, "NULL index buffer");
	MFDebug_Assert(pIndexBuffer->bLocked, "Index buffer not locked!");

	ID3D11Buffer *pIB = (ID3D11Buffer*)pIndexBuffer->pPlatformData;
	if(pIB)
		pIB->Release();

	D3D11_BUFFER_DESC bd;
	MFZeroMemory(&bd, sizeof(bd));
	bd.Usage = D3D11_USAGE_IMMUTABLE;
	bd.ByteWidth = sizeof(WORD) * pIndexBuffer->numIndices;
	bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
	
	D3D11_SUBRESOURCE_DATA initData;
	MFZeroMemory(&initData, sizeof(initData));
	initData.pSysMem = pIndexBuffer->pLocked;

	HRESULT hr = g_pd3dDevice->CreateBuffer(&bd, &initData, &pIB);
	MFDebug_Assert(SUCCEEDED(hr), "Couldn't create index buffer!");
	if (FAILED(hr))
		return;

	pIndexBuffer->pPlatformData = pIB;

	MFHeap_Free(pIndexBuffer->pLocked);

	pIndexBuffer->pLocked = NULL;
	pIndexBuffer->bLocked = false;
}
开发者ID:FujiGameJam,项目名称:fuji,代码行数:31,代码来源:MFVertex_D3D11.cpp

示例3: DebugMenu_AddMenuTo

MF_API void DebugMenu_AddMenuTo(const char *name, Menu *pParent, DebugCallback callback, void *userData)
{
	MFDebug_Assert(pParent, "Invalid parent menu.");
	MFDebug_Assert(pParent->type == MenuType_Menu, MFStr("Cant add menu '%s', Parent is not of Menu type.", name));
	MFDebug_Assert(MFString_Length(name) < 64, "Max of 64 characters in Menu Name.");
	MFDebug_Assert(pParent->numChildren < MENU_MAX_CHILDREN, MFStr("Maximum number of items in menu: '%s'", pParent->name));

//	Menu *pMenu = Heap_New(Menu);
	Menu *pMenu = new Menu;

	MFString_Copy(pMenu->name, name);
	pMenu->type = MenuType_Menu;

	pMenu->pParent = pParent;
	pMenu->menuDepth = pParent->menuDepth+1;

	pMenu->numChildren = 0;
	pMenu->selection = 0;

	pMenu->pCallback = callback;
	pMenu->pUserData = userData;

	pParent->pChildren[pParent->numChildren] = pMenu;
	++pParent->numChildren;
}
开发者ID:TurkeyMan,项目名称:fuji,代码行数:25,代码来源:DebugMenu.cpp

示例4: MFTexture_CreatePlatformSpecific

// interface functions
void MFTexture_CreatePlatformSpecific(MFTexture *pTexture, bool generateMipChain)
{
	MFCALLSTACK;

	HRESULT hr;
	MFTextureTemplateData *pTemplate = pTexture->pTemplateData;

	// create texture
	D3DFORMAT platformFormat = (D3DFORMAT)MFTexture_GetPlatformFormatID(pTemplate->imageFormat, MFDD_D3D9);
	hr = D3DXCreateTexture(pd3dDevice, pTemplate->pSurfaces[0].width, pTemplate->pSurfaces[0].height, generateMipChain ? 0 : 1, 0, platformFormat, D3DPOOL_MANAGED, (IDirect3DTexture9**)&pTexture->pInternalData);

	MFDebug_Assert(hr != D3DERR_NOTAVAILABLE, MFStr("LoadTexture failed: D3DERR_NOTAVAILABLE, 0x%08X", hr));
	MFDebug_Assert(hr != D3DERR_OUTOFVIDEOMEMORY, MFStr("LoadTexture failed: D3DERR_OUTOFVIDEOMEMORY, 0x%08X", hr));
	MFDebug_Assert(hr != D3DERR_INVALIDCALL, MFStr("LoadTexture failed: D3DERR_INVALIDCALL, 0x%08X", hr));
	MFDebug_Assert(hr != D3DXERR_INVALIDDATA, MFStr("LoadTexture failed: D3DXERR_INVALIDDATA, 0x%08X", hr));

	MFDebug_Assert(hr == D3D_OK, MFStr("Failed to create texture '%s'.", pTexture->name));

	IDirect3DTexture9 *pTex = (IDirect3DTexture9*)pTexture->pInternalData;

	// copy image data
	D3DLOCKED_RECT rect;
	pTex->LockRect(0, &rect, NULL, 0);
	MFCopyMemory(rect.pBits, pTemplate->pSurfaces[0].pImageData, pTemplate->pSurfaces[0].bufferLength);
	pTex->UnlockRect(0);

	// filter mip levels
	if(generateMipChain)
		D3DXFilterTexture(pTex, NULL, 0, D3DX_DEFAULT);
}
开发者ID:jacob-carlborg,项目名称:fuji,代码行数:31,代码来源:MFTexture_D3D9.cpp

示例5: MFCheckForOpenGLError

bool MFCheckForOpenGLError(bool bBreakOnError)
{
	GLenum err = glGetError();
	if(err != GL_NO_ERROR)
	{
#if !defined(MF_OPENGL_ES)
		const GLubyte *errorString = gluErrorString(err);
		if(bBreakOnError)
		{
			MFDebug_Assert(err == GL_NO_ERROR, MFStr("OpenGL Error %04X: %s", err, errorString));
		}
		else
		{
			MFDebug_Warn(1, MFStr("OpenGL Error %04X: %s", err, errorString));
		}
#else
		if(bBreakOnError)
		{
			MFDebug_Assert(err == GL_NO_ERROR, MFStr("OpenGL Error: %04X", err));
		}
		else
		{
			MFDebug_Warn(1, MFStr("OpenGL Error: %04X", err));
		}
#endif
		return true;
	}
	return false;
}
开发者ID:TurkeyMan,项目名称:fuji,代码行数:29,代码来源:MFRenderer_OpenGL.cpp

示例6: MFBegin

//---------------------------------------------------------------------------------------------------------------------
MF_API void MFBegin(uint32 vertexCount)
{
	MFDebug_Assert(phase == 1, "not in order 1");

	MFDebug_Assert(vertexCount > 0, "Invalid primitive count.");

	currentPrim.numVertices = vertexCount;
	if(gImmitateQuads)
		currentPrim.numVertices *= 3;

	// create an appropriate vertex buffer
	pVB = MFVertex_CreateVertexBuffer(pDecl, currentPrim.numVertices, MFVBType_Scratch);

	currentPrim.pMeshState = MFStateBlock_CreateTemporary(gLargeStateblock ? 256 : 64);
	MFStateBlock_SetRenderState(currentPrim.pMeshState, MFSCRS_VertexDeclaration, pDecl);
	MFStateBlock_SetRenderState(currentPrim.pMeshState, MFSCRS_VertexBuffer0, pVB);

	MFVertex_LockVertexBuffer(pVB, (void**)&pLocked);

	currentVert = 0;

	current.u = current.v = 0.0f;
	current.colour = 0xFFFFFFFF;
	current.normal.x = current.normal.z = 0.0f;
	current.normal.y = 1.0f;

	phase = 2;
}
开发者ID:TurkeyMan,项目名称:fuji,代码行数:29,代码来源:MFPrimitive_D3D11.cpp

示例7: MFVertex_LockVertexBuffer

MF_API void MFVertex_LockVertexBuffer(MFVertexBuffer *pVertexBuffer, void **ppVertices)
{
	MFDebug_Assert(pVertexBuffer, "Null vertex buffer");
	MFDebug_Assert(!pVertexBuffer->bLocked, "Vertex buffer already locked!");

	if(pVertexBuffer->bufferType == MFVBType_Dynamic)
	{
		ID3D11Buffer *pVB = (ID3D11Buffer*)pVertexBuffer->pPlatformData;

		D3D11_MAPPED_SUBRESOURCE subresource;
		D3D11_MAP map = (pVertexBuffer->bufferType == MFVBType_Dynamic) ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE;
		HRESULT hr = g_pImmediateContext->Map(pVB, 0, map, D3D11_MAP_FLAG_DO_NOT_WAIT, &subresource);

		if(hr == DXGI_ERROR_WAS_STILL_DRAWING)
		{
			MFDebug_Message("waiting on vertex buffer lock");
			hr = g_pImmediateContext->Map(pVB, 0, map, 0, &subresource);
		}

		MFDebug_Assert(SUCCEEDED(hr), "Failed to map vertex buffer");

		pVertexBuffer->pLocked = subresource.pData;
	}
	else
	{
		pVertexBuffer->pLocked = MFHeap_Alloc(pVertexBuffer->numVerts*pVertexBuffer->pVertexDeclatation->pElementData[0].stride, MFHeap_GetHeap(MFHT_ActiveTemporary));
	}

	if(ppVertices)
		*ppVertices = pVertexBuffer->pLocked;

	pVertexBuffer->bLocked = true;
}
开发者ID:FujiGameJam,项目名称:fuji,代码行数:33,代码来源:MFVertex_D3D11.cpp

示例8: MFDebug_Assert

void MFPoolHeap::Init(int num, size_t size, void *pMem, size_t memsize)
{
	MFDebug_Assert(num > 0 && size >= 4 && (size & 3) == 0, "Bad args");

	itemSize = size;
	numItems = num;
	pNext = NULL;
#if !defined(MF_RETAIL)
	peakNumUsed = 0;
#endif

	// Get the memory for the heap
	if(pMem)
	{
		MFDebug_Assert(memsize > num*size, "Not enought memory");

		pStorage = pMem;
		bOwnStorage = false;
	}
	else
	{
		pStorage = MFHeap_Alloc(num*size);
		bOwnStorage = true;
	}

	DeleteAll();
}
开发者ID:RemedyGameJam,项目名称:fuji,代码行数:27,代码来源:MFPoolHeap.cpp

示例9: MFCollision_RayMeshTest

bool MFCollision_RayMeshTest(const MFVector& rayPos, const MFVector& rayDir, MFCollisionItem *pMesh, MFRayIntersectionResult *pResult)
{
	MFDebug_Assert(pMesh->pTemplate->type == MFCT_Mesh, "Item is not a collision mesh");

	MFDebug_Assert(false, "No dice..");

	return false;
}
开发者ID:RemedyGameJam,项目名称:fuji,代码行数:8,代码来源:MFCollision.cpp

示例10: MFCollision_SphereMeshTest

bool MFCollision_SphereMeshTest(const MFVector &spherePos, float radius, MFCollisionItem *pMesh, MFCollisionResult *pResult)
{
	MFDebug_Assert(pMesh->pTemplate->type == MFCT_Mesh, "Item is not a collision mesh");

	MFDebug_Assert(false, "No dice..");

	return false;
}
开发者ID:RemedyGameJam,项目名称:fuji,代码行数:8,代码来源:MFCollision.cpp

示例11: MFFileNative_Open

int MFFileNative_Open(MFFile *pFile, MFOpenData *pOpenData)
{
	MFCALLSTACK;

	MFDebug_Assert(pOpenData->cbSize == sizeof(MFOpenDataNative), "Incorrect size for MFOpenDataNative structure. Invalid pOpenData.");
	MFOpenDataNative *pNative = (MFOpenDataNative*)pOpenData;

	int flags = 0;

	if(pOpenData->openFlags & MFOF_Read)
	{
		if(pNative->openFlags & MFOF_Write)
		{
			flags = O_RDWR | O_CREAT;
		}
		else
		{
			flags = O_RDONLY;
		}
	}
	else if(pOpenData->openFlags & MFOF_Write)
	{
		flags = O_WRONLY | O_CREAT;
	}
	else
	{
		MFDebug_Assert(0, "Neither MFOF_Read nor MFOF_Write specified.");
	}

	int file = open(pNative->pFilename, flags);
	if(file == -1)
	{
//		MFDebug_Warn(3, MFStr("Failed to open file '%s'.", pNative->pFilename));
		pFile->pFilesysData = 0;
		return -1;
	}

	pFile->pFilesysData = (void*)(size_t)file;
	pFile->createFlags = pOpenData->openFlags;
	pFile->offset = 0;

	struct stat fileStats;
	if(fstat(file, &fileStats) == -1)
	{
		close(file);
		pFile->pFilesysData = 0;
		return -1;
	}

	pFile->length = fileStats.st_size;

#if defined(_DEBUG)
	MFString_Copy(pFile->fileIdentifier, pNative->pFilename);
#endif

	return 0;
}
开发者ID:FujiGameJam,项目名称:fuji,代码行数:57,代码来源:MFFileSystemNative_Linux.cpp

示例12: MFFileNative_Open

int MFFileNative_Open(MFFile *pFile, MFOpenData *pOpenData)
{
	MFCALLSTACK;

#if defined(_USE_CRT_FOR_NULL_DRIVERS)
	MFDebug_Assert(pOpenData->cbSize == sizeof(MFOpenDataNative), "Incorrect size for MFOpenDataNative structure. Invalid pOpenData.");
	MFOpenDataNative *pNative = (MFOpenDataNative*)pOpenData;

	int flags = 0;
	const char *pAccess = "";

	if(pOpenData->openFlags & MFOF_Read)
	{
		if(pNative->openFlags & MFOF_Write)
		{
			pAccess = "w+b";
		}
		else
		{
			pAccess = "rb";
		}
	}
	else if(pOpenData->openFlags & MFOF_Write)
	{
		pAccess = "wb";
	}
	else
	{
		MFDebug_Assert(0, "Neither MFOF_Read nor MFOF_Write specified.");
	}

	FILE *pF = fopen(pNative->pFilename, pAccess);
	if(pF == NULL)
	{
//		MFDebug_Warn(3, MFStr("Failed to open file '%s'.", pNative->pFilename));
		pFile->pFilesysData = 0;
		return -1;
	}

	pFile->pFilesysData = (void*)pF;
	pFile->createFlags = pOpenData->openFlags;
	pFile->offset = 0;

	fseek(pF, 0, SEEK_END);
	pFile->length = ftell(pF);
	fseek(pF, 0, SEEK_SET);

#if defined(_DEBUG)
	MFString_Copy(pFile->fileIdentifier, pNative->pFilename);
#endif

	return 0;
#else
	return -1;
#endif
}
开发者ID:FujiGameJam,项目名称:fuji,代码行数:56,代码来源:MFFileSystemNative_NaCl.cpp

示例13: MFEnd

//---------------------------------------------------------------------------------------------------------------------
MF_API void MFEnd()
{
	MFDebug_Assert(phase == 2, "not in order 2");

	MFVertex_UnlockVertexBuffer(pVB);

	MFDebug_Assert(currentVert == currentPrim.numVertices, "Incorrect number of vertices.");

	MFRenderer_AddMesh(&currentPrim, pMaterial, pEntity, NULL, MFView_GetViewState());

	phase = 0;
}
开发者ID:TurkeyMan,项目名称:fuji,代码行数:13,代码来源:MFPrimitive_D3D11.cpp

示例14: MFVertex_LockIndexBuffer

MF_API void MFVertex_LockIndexBuffer(MFIndexBuffer *pIndexBuffer, uint16 **ppIndices)
{
	MFDebug_Assert(pIndexBuffer, "NULL index buffer");
	MFDebug_Assert(!pIndexBuffer->bLocked, "Index buffer already locked!");

	pIndexBuffer->pLocked = MFHeap_Alloc(sizeof(uint16)*pIndexBuffer->numIndices, MFHeap_GetHeap(MFHT_ActiveTemporary));

	if(ppIndices)
		*ppIndices = (uint16*)pIndexBuffer->pLocked;

	pIndexBuffer->bLocked = true;
}
开发者ID:FujiGameJam,项目名称:fuji,代码行数:12,代码来源:MFVertex_D3D11.cpp

示例15: MFVertex_LockIndexBuffer

MF_API void MFVertex_LockIndexBuffer(MFIndexBuffer *pIndexBuffer, uint16 **ppIndices)
{
	MFDebug_Assert(!pIndexBuffer->bLocked, "Index buffer already locked!");

	IDirect3DIndexBuffer9 *pIB = (IDirect3DIndexBuffer9*)pIndexBuffer->pPlatformData;
	HRESULT hr = pIB->Lock(0, sizeof(uint16)*pIndexBuffer->numIndices, &pIndexBuffer->pLocked, 0);
	MFDebug_Assert(SUCCEEDED(hr), "Failed to lock index buffer");

	if(ppIndices)
		*ppIndices = (uint16*)pIndexBuffer->pLocked;

	pIndexBuffer->bLocked = true;
}
开发者ID:TurkeyMan,项目名称:fuji,代码行数:13,代码来源:MFVertex_D3D9.cpp


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