本文整理匯總了C++中AssertISV函數的典型用法代碼示例。如果您正苦於以下問題:C++ AssertISV函數的具體用法?C++ AssertISV怎麽用?C++ AssertISV使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AssertISV函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AssertISV
void GFXPCD3D9WindowTarget::initPresentationParams()
{
// Get some video mode related info.
GFXVideoMode vm = mWindow->getVideoMode();
// Do some validation...
if(vm.fullScreen == true && mImplicit == false)
{
AssertISV(false,
"GFXPCD3D9WindowTarget::initPresentationParams - Cannot go fullscreen with secondary window!");
}
HWND hwnd = (HWND)mWindow->getSystemWindow( PlatformWindow::WindowSystem_Windows );
AssertISV(hwnd, "GFXPCD3D9WindowTarget::initPresentationParams() - no HWND");
// At some point, this will become GFXPCD3D9WindowTarget like trunk has,
// so this cast isn't as bad as it looks. ;) BTR
GFXPCD3D9Device* pcdevice = dynamic_cast<GFXPCD3D9Device*>(mDevice);
mPresentationParams = pcdevice->setupPresentParams(vm, hwnd);
if (mImplicit)
{
pcdevice->mMultisampleType = mPresentationParams.MultiSampleType;
pcdevice->mMultisampleLevel = mPresentationParams.MultiSampleQuality;
}
}
示例2: fillInputBuffer
static boolean fillInputBuffer(j_decompress_ptr cinfo)
// Read data into our input buffer. Client calls this
// when it needs more data from the file.
{
StreamedJPEGReader* src = (StreamedJPEGReader*) cinfo->client_data;
AssertISV(src, "StreamedJPEGReader::fillInputBuffer - 'this' is missing!");
U32 bytesRead = src->mFile->read((char*)src->mBuffer, 8192);
if (bytesRead <= 0)
{
// Is the file completely empty?
AssertISV(!src->mStartOfFile, "StreamedJPEGReader::fillInputBuffer - Empty source stream!");
// Insert a fake EOI marker.
src->mBuffer[0] = (JOCTET) 0xFF;
src->mBuffer[1] = (JOCTET) JPEG_EOI;
bytesRead = 2;
}
// Expose buffer state to clients.
src->mSource.next_input_byte = src->mBuffer;
src->mSource.bytes_in_buffer = bytesRead;
src->mStartOfFile = false;
return true;
}
示例3: AssertISV
void AtlasOldMesher::optimize()
{
AssertISV(false, "This is probably broken right now - BJG");
#if 0
// Shove everything through nvTriStrip
SetCacheSize(24);
// first, stripify our geometry...
PrimitiveGroup *pg;
U16 pgCount;
GenerateStrips(mIndices.address(), mIndices.size(), &pg, &pgCount, AtlasOldActivationHeightfield::smDoChecks);
// We're lazy.
AssertISV(pgCount == 1,
"AtlasOldMesher::optimize - Got unexpectedly complex geometry from NVTriStrip! (a)");
AssertISV(pg->type == PT_STRIP,
"AtlasOldMesher::optimize - Got unexpectedly complex geometry from NVTriStrip! (b)");
// Remap indices! BJGTODO - how am I supposed to interpet the results?
/* PrimitiveGroup *pgRemapped;
RemapIndices(pg, pgCount, mVerts.size(), &pgRemapped); */
// Ok, let's suck this stuff back in.
mIndices.clear();
mIndices.reserve(pg->numIndices);
for(S32 i=0; i<pg->numIndices; i++)
mIndices[i] = pg->indices[i];
// And clean up the memory from the stripper.
delete[] pg;
#endif
}
示例4: AssertISV
bool ResourceManager::remove( ResourceBase::Header* header )
{
const Path &path = header->getPath();
#ifdef TORQUE_DEBUG_RES_MANAGER
Con::printf( "ResourceManager::remove : [%s]", path.getFullPath().c_str() );
#endif
ResourceHeaderMap::Iterator iter = mResourceHeaderMap.find( path.getFullPath() );
if ( iter != mResourceHeaderMap.end() && iter->value == header )
{
AssertISV( header && (header->getRefCount() == 0), "ResourceManager error: trying to remove resource which is still in use." );
mResourceHeaderMap.erase( iter );
}
else
{
iter = mPrevResourceHeaderMap.find( path.getFullPath() );
if ( iter == mPrevResourceHeaderMap.end() || iter->value != header )
{
Con::errorf( "ResourceManager::remove : Trying to remove non-existent resource [%s]", path.getFullPath().c_str() );
return false;
}
AssertISV( header && (header->getRefCount() == 0), "ResourceManager error: trying to remove resource which is still in use." );
mPrevResourceHeaderMap.erase( iter );
}
FS::RemoveChangeNotification( path, this, &ResourceManager::notifiedFileChanged );
return true;
}
示例5: AssertISV
void GFXPCD3D9WindowTarget::initPresentationParams()
{
// Get some video mode related info.
GFXVideoMode vm = mWindow->getVideoMode();
// Do some validation...
if(vm.fullScreen == true && mImplicit == false)
{
AssertISV(false,
"GFXPCD3D9WindowTarget::initPresentationParams - Cannot go fullscreen with secondary window!");
}
Win32Window *win = dynamic_cast<Win32Window*>(mWindow);
AssertISV(win, "GFXPCD3D9WindowTarget::initPresentationParams() - got a non Win32Window window passed in! Did DX go crossplatform?");
HWND hwnd = win->getHWND();
// At some point, this will become GFXPCD3D9WindowTarget like trunk has,
// so this cast isn't as bad as it looks. ;) BTR
GFXPCD3D9Device* pcdevice = dynamic_cast<GFXPCD3D9Device*>(mDevice);
mPresentationParams = pcdevice->setupPresentParams(vm, hwnd);
if (mImplicit)
{
pcdevice->mMultisampleType = mPresentationParams.MultiSampleType;
pcdevice->mMultisampleLevel = mPresentationParams.MultiSampleQuality;
}
}
示例6: AssertISV
bool AtlasChunk::readFromStream(AtlasChunk *ac, Stream *s)
{
// First, read the size and allocate a buffer.
// Let's do a sentinel check.
U32 sent1;
s->read(&sent1);
AssertISV(sent1 == MakeFourCC('A', 'T', 'S', 'P'), "AtlasChunk::readFromStream - (sent1) invalid chunk master sentinel!");
s->read(&ac->mChunkSize);
// And now validate the chunk-type-sentinel.
U32 sent2;
s->read(&sent2);
AssertISV(sent2 == ac->getHeadSentinel(), "AtlasChunk::readFromStream - (sent2) invalid chunk head sentinel!");
// Get the chunk's data. If it's already in memory, just reuse it.
// Otherwise read it from the stream.
bool isMemStream = false;
U8 *data;
U32 dataSize = ac->mChunkSize;
if( dynamic_cast< MemStream* >( s ) )
{
MemStream* memStream = ( MemStream* ) s;
U32 currentPos = memStream->getPosition();
isMemStream = true;
data = &( ( U8* ) memStream->getBuffer() )[ currentPos ];
memStream->setPosition( currentPos + dataSize );
}
else
{
data = new U8[ dataSize ];
// Read next chunksize bytes into the buffer for later processing.
s->read( dataSize, data);
}
// Check end sentinel.
U32 sent3;
s->read(&sent3);
AssertISV(sent3 == ac->getTailSentinel(), "AtlasChunk::readFromStream - (sent3) invalid chunk tail sentinel!");
// And tell the chunk to read from that buffer...
MemStream dataStream( dataSize, data );
ac->read(&dataStream);
// Clean up memory.
if( !isMemStream )
delete[] data;
// All done!
return true;
}
示例7: initSource
static void initSource(j_decompress_ptr cinfo)
{
StreamedJPEGReader* src = (StreamedJPEGReader*) cinfo->client_data;
AssertISV(src, "StreamedJPEGReader::initSource - 'this' is missing!");
src->mStartOfFile = true;
}
示例8: AssertFatal
bool GFXD3D11OcclusionQuery::begin()
{
if(GFXDevice::getDisableOcclusionQuery())
return true;
if (mQuery == NULL)
{
D3D11_QUERY_DESC queryDesc;
queryDesc.Query = D3D11_QUERY_OCCLUSION;
queryDesc.MiscFlags = 0;
HRESULT hRes = D3D11DEVICE->CreateQuery(&queryDesc, &mQuery);
if(FAILED(hRes))
{
AssertFatal(false, "GFXD3D11OcclusionQuery::begin - Hardware does not support D3D11 Occlusion-Queries, this should be caught before this type is created");
}
AssertISV(hRes != E_OUTOFMEMORY, "GFXD3D11OcclusionQuery::begin - Out of memory");
}
// Add a begin marker to the command buffer queue.
D3D11DEVICECONTEXT->Begin(mQuery);
#ifdef TORQUE_GATHER_METRICS
mBeginFrame = GuiTSCtrl::getFrameCount();
#endif
return true;
}
示例9: switch
U32 DDSFile::getSurfacePitch( U32 mipLevel ) const
{
if(mFlags.test(CompressedData))
{
U32 sizeMultiple = 0;
switch(mFormat)
{
case GFXFormatDXT1:
sizeMultiple = 8;
break;
case GFXFormatDXT2:
case GFXFormatDXT3:
case GFXFormatDXT4:
case GFXFormatDXT5:
sizeMultiple = 16;
break;
default:
AssertISV(false, "DDSFile::getPitch - invalid compressed texture format, we only support DXT1-5 right now.");
break;
}
// Maybe need to be DWORD aligned?
U32 align = getMax(U32(1), getWidth(mipLevel)/4) * sizeMultiple;
align += 3; align >>=2; align <<=2;
return align;
}
示例10: PROFILE_SCOPE
bool GFXGLShader::initShader( const Torque::Path &file,
bool isVertex,
const Vector<GFXShaderMacro> ¯os )
{
PROFILE_SCOPE(GFXGLShader_CompileShader);
GLuint activeShader = glCreateShader(isVertex ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER);
if(isVertex)
mVertexShader = activeShader;
else
mPixelShader = activeShader;
glAttachShader(mProgram, activeShader);
// Ok it's not in the shader gen manager, so ask Torque for it
FileStream stream;
if ( !stream.open( file, Torque::FS::File::Read ) )
{
AssertISV(false, avar("GFXGLShader::initShader - failed to open shader '%s'.", file.getFullPath().c_str()));
if ( smLogErrors )
Con::errorf( "GFXGLShader::initShader - Failed to open shader file '%s'.",
file.getFullPath().c_str() );
return false;
}
if ( !_loadShaderFromStream( activeShader, file, &stream, macros ) )
return false;
GLint compile;
glGetShaderiv(activeShader, GL_COMPILE_STATUS, &compile);
// Dump the info log to the console
U32 logLength = 0;
glGetShaderiv(activeShader, GL_INFO_LOG_LENGTH, (GLint*)&logLength);
GLint compileStatus = GL_TRUE;
if ( logLength )
{
FrameAllocatorMarker fam;
char* log = (char*)fam.alloc(logLength);
glGetShaderInfoLog(activeShader, logLength, NULL, log);
// Always print errors
glGetShaderiv( activeShader, GL_COMPILE_STATUS, &compileStatus );
if ( compileStatus == GL_FALSE )
{
if ( smLogErrors )
{
Con::errorf( "GFXGLShader::initShader - Error compiling shader!" );
Con::errorf( "Program %s: %s", file.getFullPath().c_str(), log );
}
}
else if ( smLogWarnings )
Con::warnf( "Program %s: %s", file.getFullPath().c_str(), log );
}
return compileStatus != GL_FALSE;
}
示例11: if
void ConsoleConstructor::setup()
{
for(ConsoleConstructor *walk = first; walk; walk = walk->next)
{
#ifdef TORQUE_DEBUG
walk->validate();
#endif
if( walk->sc )
Con::addCommand( walk->className, walk->funcName, walk->sc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->ic )
Con::addCommand( walk->className, walk->funcName, walk->ic, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->fc )
Con::addCommand( walk->className, walk->funcName, walk->fc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->vc )
Con::addCommand( walk->className, walk->funcName, walk->vc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->bc )
Con::addCommand( walk->className, walk->funcName, walk->bc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header );
else if( walk->group )
Con::markCommandGroup( walk->className, walk->funcName, walk->usage );
else if( walk->callback )
Con::noteScriptCallback( walk->className, walk->funcName, walk->usage, walk->header );
else if( walk->ns )
{
Namespace* ns = Namespace::find( StringTable->insert( walk->className ) );
if( ns )
ns->mUsage = walk->usage;
}
else
{
AssertISV( false, "Found a ConsoleConstructor with an indeterminate type!" );
}
}
}
示例12: String
HRESULT _gfxD3DXInclude::Open(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName,
LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes,
LPSTR pFullPath, DWORD cbFullPath)
{
// First try making the path relative to the parent.
Torque::Path path = Torque::Path::Join( mLastPath.last(), '/', pFileName );
path = Torque::Path::CompressPath( path );
if ( !Torque::FS::ReadFile( path, (void *&)*ppData, *pBytes, true ) )
{
// Ok... now try using the path as is.
path = String( pFileName );
path = Torque::Path::CompressPath( path );
if ( !Torque::FS::ReadFile( path, (void *&)*ppData, *pBytes, true ) )
{
AssertISV(false, avar( "Failed to open include '%s'.", pFileName));
return E_FAIL;
}
}
// If the data was of zero size then we cannot recurse
// into this file and DX won't call Close() below.
//
// So in this case don't push on the path.
if ( *pBytes > 0 )
mLastPath.push_back( path.getRootAndPath() );
return S_OK;
}
示例13: AssertFatal
bool GFXD3D9OcclusionQuery::begin()
{
if ( GFXDevice::getDisableOcclusionQuery() )
return true;
if ( mQuery == NULL )
{
#ifdef TORQUE_OS_XENON
HRESULT hRes = static_cast<GFXD3D9Device*>( mDevice )->getDevice()->CreateQueryTiled( D3DQUERYTYPE_OCCLUSION, 2, &mQuery );
#else
HRESULT hRes = static_cast<GFXD3D9Device*>( mDevice )->getDevice()->CreateQuery( D3DQUERYTYPE_OCCLUSION, &mQuery );
#endif
AssertFatal( hRes != D3DERR_NOTAVAILABLE, "GFXD3D9OcclusionQuery::begin - Hardware does not support D3D9 Occlusion-Queries, this should be caught before this type is created" );
AssertISV( hRes != E_OUTOFMEMORY, "GFXD3D9OcclusionQuery::begin - Out of memory" );
}
// Add a begin marker to the command buffer queue.
mQuery->Issue( D3DISSUE_BEGIN );
#ifdef TORQUE_GATHER_METRICS
mBeginFrame = GuiTSCtrl::getFrameCount();
#endif
return true;
}
示例14: mngFatalErrorFn
static mng_bool mngFatalErrorFn(mng_handle mng, mng_int32 code, mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq, mng_int32 extra1, mng_int32 extra2, mng_pchar text)
{
mng_cleanup(&mng);
AssertISV(false, avar("Error reading MNG file:\n %s", (const char*)text));
return MNG_FALSE;
}
示例15: AssertISV
void GFXD3D9CardProfiler::init()
{
mD3DDevice = dynamic_cast<GFXD3D9Device *>(GFX)->getDevice();
AssertISV( mD3DDevice, "GFXD3D9CardProfiler::init() - No D3D9 Device found!");
// Grab the caps so we can get our adapter ordinal and look up our name.
D3DCAPS9 caps;
D3D9Assert(mD3DDevice->GetDeviceCaps(&caps), "GFXD3D9CardProfiler::init - failed to get device caps!");
#ifdef TORQUE_OS_XENON
mCardDescription = "Xbox360 GPU";
mChipSet = "ATI";
mVersionString = String::ToString(_XDK_VER);
mVideoMemory = 512 * 1024 * 1024;
#else
WMIVideoInfo wmiVidInfo;
if( wmiVidInfo.profileAdapters() )
{
const PlatformVideoInfo::PVIAdapter &adapter = wmiVidInfo.getAdapterInformation( caps.AdapterOrdinal );
mCardDescription = adapter.description;
mChipSet = adapter.chipSet;
mVersionString = adapter.driverVersion;
mVideoMemory = adapter.vram;
}
#endif
Parent::init();
}