本文整理汇总了C++中DE_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ DE_ASSERT函数的具体用法?C++ DE_ASSERT怎么用?C++ DE_ASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DE_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rnd
UniqueRandomIterator<T>::UniqueRandomIterator (deUint32 numItems, deUint32 numValues, int seed)
{
de::Random rnd(seed);
DE_ASSERT(numItems <= numValues);
if (numItems == numValues)
{
// Fast way to populate the index sequence
m_indices = std::vector<deUint32>(numItems);
for (deUint32 itemNdx = 0; itemNdx < numItems; itemNdx++)
m_indices[itemNdx] = itemNdx;
}
else
{
std::set<deUint32> uniqueIndices;
// Populate set with "numItems" unique values between 0 and numValues - 1
while (uniqueIndices.size() < numItems)
uniqueIndices.insert(rnd.getUint32() % numValues);
// Copy set into index sequence
m_indices = std::vector<deUint32>(uniqueIndices.begin(), uniqueIndices.end());
}
// Scramble the indices
rnd.shuffle(m_indices.begin(), m_indices.end());
reset();
}
示例2: DE_ASSERT
void ContainerFormatParser::getData (deUint8* dst, int numBytes, int offset)
{
DE_ASSERT(de::inBounds(offset, 0, m_elementLen) && numBytes > 0 && de::inRange(numBytes+offset, 0, m_elementLen));
for (int ndx = 0; ndx < numBytes; ndx++)
dst[ndx] = m_buf.peekBack(offset+ndx);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_deqp,代码行数:7,代码来源:xeContainerFormatParser.cpp
示例3: DE_ASSERT
void RingBuffer<T>::resize (int newSize)
{
DE_ASSERT(newSize >= m_numElements);
T* buf = new T[newSize];
try
{
// Copy old elements.
for (int ndx = 0; ndx < m_numElements; ndx++)
buf[ndx] = m_buffer[(m_back + ndx) % m_size];
// Reset pointers.
m_front = m_numElements;
m_back = 0;
m_size = newSize;
DE_SWAP(T*, buf, m_buffer);
delete[] buf;
}
catch (...)
{
delete[] buf;
throw;
}
}
示例4: switch
std::ostream& operator<< (std::ostream& str, const TypeAccessFormat& format)
{
const VarType* curType = &format.type;
for (TypeComponentVector::const_iterator iter = format.path.begin(); iter != format.path.end(); iter++)
{
switch (iter->type)
{
case VarTypeComponent::ARRAY_ELEMENT:
curType = &curType->getElementType(); // Update current type.
// Fall-through.
case VarTypeComponent::MATRIX_COLUMN:
case VarTypeComponent::VECTOR_COMPONENT:
str << "[" << iter->index << "]";
break;
case VarTypeComponent::STRUCT_MEMBER:
{
const StructMember& member = curType->getStructPtr()->getMember(iter->index);
str << "." << member.getName();
curType = &member.getType();
break;
}
default:
DE_ASSERT(false);
}
}
return str;
}
示例5: wrap
int wrap (Sampler::WrapMode mode, int c, int size)
{
switch (mode)
{
// \note CL and GL modes are handled identically here, as verification process accounts for
// accuracy differences caused by different methods (wrapping vs. denormalizing first).
case tcu::Sampler::CLAMP_TO_BORDER:
return deClamp32(c, -1, size);
case tcu::Sampler::CLAMP_TO_EDGE:
return deClamp32(c, 0, size-1);
case tcu::Sampler::REPEAT_GL:
case tcu::Sampler::REPEAT_CL:
return imod(c, size);
case tcu::Sampler::MIRRORED_REPEAT_GL:
case tcu::Sampler::MIRRORED_REPEAT_CL:
return (size - 1) - mirror(imod(c, 2*size) - size);
default:
DE_ASSERT(DE_FALSE);
return 0;
}
}
示例6: handle_dlm_load_cfm
static void handle_dlm_load_cfm(hic_dlm_load_cfm_t *cfm)
{
hic_message_context_t msg_ref;
hic_dlm_load_req_t *req;
DE_ASSERT(dlm_state.ops);
if(cfm->remaining_size == 0)
{
/* done */
WiFiEngine_AllowPowerSave(dlm_state.ps_ctrl);
return;
}
create_dlm_req_and_update_state(
&msg_ref,
&req,
cfm->address,
cfm->remaining_size);
DE_TRACE_INT4(TR_INITIALIZE, "DLM_REQ a:%x s:%u rs:%u c:%x\n",
req->address,
req->page.size,
req->remaining_size,
req->checksum);
send_and_free(&msg_ref,req);
}
示例7: qpTestLog_writeKeyValuePair
static deBool qpTestLog_writeKeyValuePair (qpTestLog* log, const char* elementName, const char* name, const char* description, const char* unit, qpKeyValueTag tag, const char* text)
{
const char* tagString = QP_LOOKUP_STRING(s_qpTagMap, tag);
qpXmlAttribute attribs[8];
int numAttribs = 0;
DE_ASSERT(log && elementName && text);
deMutex_lock(log->lock);
/* Fill in attributes. */
if (name) attribs[numAttribs++] = qpSetStringAttrib("Name", name);
if (description) attribs[numAttribs++] = qpSetStringAttrib("Description", description);
if (tagString) attribs[numAttribs++] = qpSetStringAttrib("Tag", tagString);
if (unit) attribs[numAttribs++] = qpSetStringAttrib("Unit", unit);
if (!qpXmlWriter_startElement(log->writer, elementName, numAttribs, attribs) ||
!qpXmlWriter_writeString(log->writer, text) ||
!qpXmlWriter_endElement(log->writer, elementName))
{
qpPrintf("qpTestLog_writeKeyValuePair(): Writing XML failed\n");
deMutex_unlock(log->lock);
return DE_FALSE;
}
deMutex_unlock(log->lock);
return DE_TRUE;
}
示例8: DE_ASSERT
/** Reads read buffer's depth data (assuming it's of 32-bit FP resolution)
* and verifies its correctness.
*
* @param texture_size Texture size
* @param n_layer Index of the layer to verify.
*
* @return true if the retrieved data was found correct, false otherwise.
**/
bool TextureCubeMapArrayColorDepthAttachmentsTest::verifyDepth32FData(const _texture_size& texture_size,
glw::GLuint n_layer)
{
/* Allocate buffer for the data we will retrieve from the implementation */
glw::GLfloat expected_value = (glw::GLfloat)n_layer / 256.0f;
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
bool result = false;
const glw::GLuint result_data_size = texture_size.m_size * texture_size.m_size;
glw::GLfloat* result_data = new glw::GLfloat[result_data_size];
DE_ASSERT(result_data != NULL);
/* Read the data */
gl.readPixels(0, /* x */
0, /* y */
texture_size.m_size, texture_size.m_size, m_depth_format, m_depth_type, result_data);
GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels() call failed");
/* Verify image, expected value is layer index */
result = verifyImage<glw::GLfloat, 1>(texture_size.m_size, texture_size.m_size, &expected_value, result_data);
/* Release the buffer */
if (result_data != NULL)
{
delete[] result_data;
result_data = NULL;
}
return result;
}
示例9: Message
explicit Message (MessageType type_)
: type(type_)
{
DE_ASSERT(type_ == MESSAGE_RESUME ||
type_ == MESSAGE_PAUSE ||
type_ == MESSAGE_FINISH);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_deqp,代码行数:7,代码来源:tcuAndroidRenderActivity.hpp
示例10: mapGLBlendFunc
rr::BlendFunc mapGLBlendFunc (deUint32 func)
{
switch (func)
{
case GL_ZERO: return rr::BLENDFUNC_ZERO;
case GL_ONE: return rr::BLENDFUNC_ONE;
case GL_SRC_COLOR: return rr::BLENDFUNC_SRC_COLOR;
case GL_ONE_MINUS_SRC_COLOR: return rr::BLENDFUNC_ONE_MINUS_SRC_COLOR;
case GL_DST_COLOR: return rr::BLENDFUNC_DST_COLOR;
case GL_ONE_MINUS_DST_COLOR: return rr::BLENDFUNC_ONE_MINUS_DST_COLOR;
case GL_SRC_ALPHA: return rr::BLENDFUNC_SRC_ALPHA;
case GL_ONE_MINUS_SRC_ALPHA: return rr::BLENDFUNC_ONE_MINUS_SRC_ALPHA;
case GL_DST_ALPHA: return rr::BLENDFUNC_DST_ALPHA;
case GL_ONE_MINUS_DST_ALPHA: return rr::BLENDFUNC_ONE_MINUS_DST_ALPHA;
case GL_CONSTANT_COLOR: return rr::BLENDFUNC_CONSTANT_COLOR;
case GL_ONE_MINUS_CONSTANT_COLOR: return rr::BLENDFUNC_ONE_MINUS_CONSTANT_COLOR;
case GL_CONSTANT_ALPHA: return rr::BLENDFUNC_CONSTANT_ALPHA;
case GL_ONE_MINUS_CONSTANT_ALPHA: return rr::BLENDFUNC_ONE_MINUS_CONSTANT_ALPHA;
case GL_SRC_ALPHA_SATURATE: return rr::BLENDFUNC_SRC_ALPHA_SATURATE;
case GL_SRC1_COLOR: return rr::BLENDFUNC_SRC1_COLOR;
case GL_ONE_MINUS_SRC1_COLOR: return rr::BLENDFUNC_ONE_MINUS_SRC1_COLOR;
case GL_SRC1_ALPHA: return rr::BLENDFUNC_SRC1_ALPHA;
case GL_ONE_MINUS_SRC1_ALPHA: return rr::BLENDFUNC_ONE_MINUS_SRC1_ALPHA;
default:
DE_ASSERT(false);
return rr::BLENDFUNC_LAST;
}
}
示例11: core_dump_append
int core_dump_append(void *ctx, void *data, size_t len)
{
struct dump_s *s = (struct dump_s*)ctx;
if(s==NULL)
{
return -1;
}
if( s->cache )
{
/* Coredump cache must be larger then each packet */
DE_ASSERT(len < DE_COREDUMP_CACHE_SIZE);
if(s->cache_off + len >= DE_COREDUMP_CACHE_SIZE)
{
s->written += de_fwrite(s->file, s->cache, s->cache_off);
s->cache_off = 0;
}
DE_MEMCPY(s->cache + s->cache_off, data, len);
s->cache_off += len;
} else {
s->written += de_fwrite(s->file, (char*)data, len);
}
DE_TRACE_INT2(TR_NOISE, "wrote %d file at %d\n", len, s->written);
return len;
}
示例12: stripLeadingPath
static void stripLeadingPath (char* fileName, const char* pathPrefix)
{
int pathLen = strlen(pathPrefix);
int fileNameLen = strlen(fileName);
DE_ASSERT(beginsWithPath(fileName, pathPrefix));
/* Strip trailing / */
while (pathLen > 0 && pathPrefix[pathLen-1] == '/')
pathLen -= 1;
DE_ASSERT(pathLen > 0);
DE_ASSERT(fileName[pathLen] == '/');
memmove(&fileName[0], &fileName[0]+pathLen+1, fileNameLen-pathLen);
}
示例13: deProcess_cleanupHandles
void deProcess_cleanupHandles (deProcess* process)
{
DE_ASSERT(!deProcess_isRunning(process));
if (process->standardErr)
deFile_destroy(process->standardErr);
if (process->standardOut)
deFile_destroy(process->standardOut);
if (process->standardIn)
deFile_destroy(process->standardIn);
if (process->procInfo.hProcess)
CloseHandle(process->procInfo.hProcess);
if (process->procInfo.hThread)
CloseHandle(process->procInfo.hThread);
process->standardErr = DE_NULL;
process->standardOut = DE_NULL;
process->standardIn = DE_NULL;
process->procInfo.hProcess = DE_NULL;
process->procInfo.hThread = DE_NULL;
}
示例14: DE_ASSERT
/*--------------------------------------------------------------------*//*!
* \brief Start thread.
*
* Starts thread that will execute the virtual run() method.
*
* The function will fail if the thread is currently running or has finished
* but no join() has been called.
*//*--------------------------------------------------------------------*/
void Thread::start (void)
{
DE_ASSERT(!m_thread);
m_thread = deThread_create(threadFunc, this, &m_attribs);
if (!m_thread)
throw std::bad_alloc();
}
示例15: switch
IterateResult NumLayersTest::build (FboBuilder& builder)
{
TextureLayered* texCfg = DE_NULL;
const GLenum target = GL_COLOR_ATTACHMENT0;
switch (m_params.textureKind)
{
case GL_TEXTURE_3D:
texCfg = &builder.makeConfig<Texture3D>();
break;
case GL_TEXTURE_2D_ARRAY:
texCfg = &builder.makeConfig<Texture2DArray>();
break;
default:
DE_ASSERT(!"Impossible case");
}
texCfg->internalFormat = getDefaultFormat(target, GL_TEXTURE);
texCfg->width = 64;
texCfg->height = 64;
texCfg->numLayers = m_params.numLayers;
const GLuint tex = builder.glCreateTexture(*texCfg);
TextureLayerAttachment* att = &builder.makeConfig<TextureLayerAttachment>();
att->layer = m_params.attachmentLayer;
att->imageName = tex;
builder.glAttach(target, att);
return STOP;
}