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


C++ VOGL_ASSERT函数代码示例

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


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

示例1: VOGL_ASSERT

    char *strcpy_safe(char *pDst, uint32_t dst_len, const char *pSrc)
    {
        VOGL_ASSERT(pDst && pSrc && dst_len);
        if (!dst_len)
            return pDst;

        char *pCur_dst = pDst;
        char c;

        do
        {
            if (dst_len == 1)
            {
                *pCur_dst++ = '\0';
                break;
            }

            c = *pSrc++;
            *pCur_dst++ = c;

            dst_len--;

        } while (c);

        VOGL_ASSERT((pCur_dst - pDst) <= (int)dst_len);

        return pDst;
    }
开发者ID:Cyberbanan,项目名称:vogl,代码行数:28,代码来源:vogl_strutils.cpp

示例2: VOGL_ASSERT

    bool task_pool::init(uint num_threads)
    {
        VOGL_ASSERT(num_threads <= cMaxThreads);
        num_threads = math::minimum<uint>(num_threads, cMaxThreads);

        deinit();

        bool succeeded = true;

        m_num_threads = 0;
        while (m_num_threads < num_threads)
        {
            m_threads[m_num_threads] = (HANDLE)_beginthreadex(NULL, 32768, thread_func, this, 0, NULL);
            VOGL_ASSERT(m_threads[m_num_threads] != 0);

            if (!m_threads[m_num_threads])
            {
                succeeded = false;
                break;
            }

            m_num_threads++;
        }

        if (!succeeded)
        {
            deinit();
            return false;
        }

        return true;
    }
开发者ID:CSRedRat,项目名称:vogl,代码行数:32,代码来源:vogl_threading_win32.cpp

示例3: VOGL_ASSERT

void QTextureViewer::setTexture(const vogl::ktx_texture* pTexture, uint baseMipLevel, uint maxMipLevel)
{
    m_mipmappedTexture.clear();
    bool bStatus = m_mipmappedTexture.read_ktx(*pTexture);
    VOGL_ASSERT(bStatus);
    if (bStatus)
    {
        bStatus = m_mipmappedTexture.convert(vogl::PIXEL_FMT_A8R8G8B8, false, vogl::dxt_image::pack_params());

        m_mipmappedTexture.unflip(true, true);

        VOGL_ASSERT(bStatus);
    }

    if (!bStatus)
    {
        return;
    }

    delete_pixmaps();
    m_draw_enabled = true;
    m_pKtxTexture = pTexture;
    m_baseMipLevel = baseMipLevel;
    m_maxMipLevel = maxMipLevel;
}
开发者ID:CSRedRat,项目名称:vogl,代码行数:25,代码来源:vogleditor_qtextureviewer.cpp

示例4: free_contrib_lists

    bool threaded_resampler::resample(const params &p)
    {
        free_contrib_lists();

        m_pParams = &p;

        VOGL_ASSERT(m_pParams->m_src_width && m_pParams->m_src_height);
        VOGL_ASSERT(m_pParams->m_dst_width && m_pParams->m_dst_height);

        switch (p.m_fmt)
        {
            case cPF_Y_F32:
                m_bytes_per_pixel = 4;
                break;
            case cPF_RGBX_F32:
            case cPF_RGBA_F32:
                m_bytes_per_pixel = 16;
                break;
            default:
                VOGL_ASSERT(false);
                return false;
        }

        int filter_index = find_resample_filter(p.m_Pfilter_name);
        if (filter_index < 0)
            return false;

        const resample_filter &filter = g_resample_filters[filter_index];

        m_pX_contribs = Resampler::make_clist(m_pParams->m_src_width, m_pParams->m_dst_width, m_pParams->m_boundary_op, filter.func, filter.support, p.m_filter_x_scale, p.m_x_ofs);
        if (!m_pX_contribs)
            return false;

        m_pY_contribs = Resampler::make_clist(m_pParams->m_src_height, m_pParams->m_dst_height, m_pParams->m_boundary_op, filter.func, filter.support, p.m_filter_y_scale, p.m_y_ofs);
        if (!m_pY_contribs)
            return false;

        if (!m_tmp_img.try_resize(m_pParams->m_dst_width * m_pParams->m_src_height))
            return false;

        for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
            m_pTask_pool->queue_object_task(this, &threaded_resampler::resample_x_task, i, NULL);
        m_pTask_pool->join();

        for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
            m_pTask_pool->queue_object_task(this, &threaded_resampler::resample_y_task, i, NULL);
        m_pTask_pool->join();

        m_tmp_img.clear();
        free_contrib_lists();

        return true;
    }
开发者ID:CSRedRat,项目名称:vogl,代码行数:53,代码来源:vogl_threaded_resampler.cpp

示例5: VOGL_NOTE_UNUSED

// TODO: Requires GL >= 3.2 or extension GL_ARB_sync
bool vogl_sync_state::snapshot(const vogl_context_info &context_info, vogl_handle_remapper &remapper, GLuint64 handle, GLenum target)
{
    VOGL_FUNC_TRACER

    VOGL_NOTE_UNUSED(context_info);
    VOGL_NOTE_UNUSED(target);
    VOGL_NOTE_UNUSED(remapper);

    VOGL_CHECK_GL_ERROR;

    clear();

    m_snapshot_handle = handle;

    GLsync sync = vogl_handle_to_sync(handle);

    bool any_gl_errors = false;

#define GET_INT(pname)                                                    \
    do                                                                    \
    {                                                                     \
        GLint val = 0;                                                    \
        GLsizei len = 0;                                                  \
        GL_ENTRYPOINT(glGetSynciv)(sync, pname, sizeof(val), &len, &val); \
        if (vogl_check_gl_error())                                         \
            any_gl_errors = true;                                         \
        m_params.insert(pname, 0, &val, sizeof(val));                     \
    } while (0)

    GET_INT(GL_OBJECT_TYPE);
    GET_INT(GL_SYNC_STATUS);
    GET_INT(GL_SYNC_CONDITION);
    GET_INT(GL_SYNC_FLAGS);

#undef GET_INT

    if (any_gl_errors)
    {
        clear();

        vogl_error_printf("%s: GL error while enumerating sync %" PRIu64 "'s' params\n", VOGL_METHOD_NAME, (uint64_t)handle);
        return false;
    }

    VOGL_ASSERT(m_params.get_value<GLenum>(GL_OBJECT_TYPE) == GL_SYNC_FENCE);
    VOGL_ASSERT(m_params.get_value<GLenum>(GL_SYNC_CONDITION) == GL_SYNC_GPU_COMMANDS_COMPLETE);
    VOGL_ASSERT(m_params.get_value<uint>(GL_SYNC_FLAGS) == 0);

    m_is_valid = true;

    return true;
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:53,代码来源:vogl_sync_object.cpp

示例6: lock_heap

static void lock_heap()
{
    VOGL_ASSERT(g_pHeap);

#ifndef _MSC_VER
    pthread_mutex_lock(&g_mutex);
#else
	::EnterCriticalSection( &g_mutex );
#endif

    VOGL_ASSERT(!g_allocating_flag);
    g_allocating_flag = true;
}
开发者ID:Nicky-D,项目名称:vogl,代码行数:13,代码来源:vogl_mem.cpp

示例7: VOGL_NOTE_UNUSED

    semaphore::semaphore(uint32 initialCount, uint32 maximumCount, const char *pName)
    {
        VOGL_NOTE_UNUSED(maximumCount);
        VOGL_NOTE_UNUSED(pName);

        VOGL_ASSERT(maximumCount >= initialCount);
        VOGL_ASSERT(maximumCount >= 1);

        if (sem_init(&m_sem, 0, initialCount))
        {
            VOGL_FAIL("semaphore: sem_init() failed");
        }
    }
开发者ID:Daft-Freak,项目名称:vogl,代码行数:13,代码来源:vogl_threading_pthreads.cpp

示例8: vogl_does_entrypoint_refer_to_namespace

//----------------------------------------------------------------------------------------------------------------------
// Function vogl_does_entrypoint_refer_to_namespace
//----------------------------------------------------------------------------------------------------------------------
bool vogl_does_entrypoint_refer_to_namespace(gl_entrypoint_id_t entrypoint_id, vogl_namespace_t namespace_id)
{
    VOGL_ASSERT(entrypoint_id < VOGL_NUM_ENTRYPOINTS);
    VOGL_ASSERT(namespace_id < VOGL_TOTAL_NAMESPACES);

    const gl_entrypoint_desc_t &desc = g_vogl_entrypoint_descs[entrypoint_id];
    if (desc.m_return_namespace == namespace_id)
        return true;

    for (uint32_t i = 0; i < desc.m_num_params; i++)
        if (g_vogl_entrypoint_param_descs[entrypoint_id][i].m_namespace == namespace_id)
            return true;

    return false;
}
开发者ID:Cyberbanan,项目名称:vogl,代码行数:18,代码来源:vogl_entrypoints.cpp

示例9: uint64_to_string

    bool uint64_to_string(uint64_t value, char *pDst, uint32_t len)
    {
        VOGL_ASSERT(pDst);

        // really only 20 digits (plus \0 or 21), but whatever
        const uint32_t cBufSize = 32;
        char buf[cBufSize];

        char *p = buf + cBufSize - 1;

        *p-- = '\0';

        do
        {
            *p-- = static_cast<uint8_t>('0' + (value % 10U));
            value /= 10U;
        } while (value);

        const size_t total_bytes = (buf + cBufSize - 1) - p;
        if (total_bytes > len)
        {
            if ((pDst) && (len))
                *pDst = '\0';
            return false;
        }

        for (size_t i = 0; i < total_bytes; i++)
            pDst[i] = p[1 + i];

        return true;
    }
开发者ID:Cyberbanan,项目名称:vogl,代码行数:31,代码来源:vogl_strutils.cpp

示例10: switch

 const char *get_vogl_format_string(vogl_format fmt)
 {
     switch (fmt)
     {
         case cCRNFmtDXT1:
             return "DXT1";
         case cCRNFmtDXT3:
             return "DXT3";
         case cCRNFmtDXT5:
             return "DXT5";
         case cCRNFmtDXT5_CCxY:
             return "DXT5_CCxY";
         case cCRNFmtDXT5_xGBR:
             return "DXT5_xGBR";
         case cCRNFmtDXT5_AGBR:
             return "DXT5_AGBR";
         case cCRNFmtDXT5_xGxR:
             return "DXT5_xGxR";
         case cCRNFmtDXN_XY:
             return "DXN_XY";
         case cCRNFmtDXN_YX:
             return "DXN_YX";
         case cCRNFmtDXT5A:
             return "DXT5A";
         case cCRNFmtETC1:
             return "ETC1";
         default:
             break;
     }
     VOGL_ASSERT(false);
     return "?";
 }
开发者ID:Cyberbanan,项目名称:vogl,代码行数:32,代码来源:vogl_pixel_format.cpp

示例11: get_alloc_flags_from_access

static DWORD get_alloc_flags_from_access(vogl::uint32 access_flags)
{
    // Windows flags are specified here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx
    // It's not possible to write memory without also reading memory. This is true generally, but also windows doesn't
    // have a way to specify flags that would be 'write-only.'
    VOGL_ASSERT((access_flags & PLAT_WRITE) == 0 || (access_flags & PLAT_READ) != 0);

    // Windows flags for this are kinda dumb.
    DWORD ret_flags = 0;
    if ((access_flags & (PLAT_READ | PLAT_WRITE)) == (PLAT_READ | PLAT_WRITE)) 
    {
        ret_flags |= PAGE_READWRITE;
        access_flags &= ~(PLAT_READ | PLAT_WRITE);
    }

    if ((access_flags & PLAT_READ) == PLAT_READ) 
    {
        ret_flags |= PAGE_READONLY;
        access_flags &= ~PLAT_READ;    
    }

    // If this fires, it means the code above needs to be updated to support the flag being passed in.
    VOGL_VERIFY(access_flags == 0);

    return ret_flags;
}
开发者ID:gchatelet,项目名称:vogl,代码行数:26,代码来源:vogl_port_windows.cpp

示例12: compute_gaussian_kernel

        // size_x/y should be odd
        void compute_gaussian_kernel(float *pDst, int size_x, int size_y, float sigma_sqr, uint flags)
        {
            VOGL_ASSERT(size_x & size_y & 1);

            if (!(size_x | size_y))
                return;

            int mid_x = size_x / 2;
            int mid_y = size_y / 2;

            double sum = 0;
            for (int x = 0; x < size_x; x++)
            {
                for (int y = 0; y < size_y; y++)
                {
                    float g;
                    if ((x > mid_x) && (y < mid_y))
                        g = pDst[(size_x - x - 1) + y * size_x];
                    else if ((x < mid_x) && (y > mid_y))
                        g = pDst[x + (size_y - y - 1) * size_x];
                    else if ((x > mid_x) && (y > mid_y))
                        g = pDst[(size_x - x - 1) + (size_y - y - 1) * size_x];
                    else
                        g = gauss(x - mid_x, y - mid_y, sigma_sqr);

                    pDst[x + y * size_x] = g;
                    sum += g;
                }
            }

            if (flags & cComputeGaussianFlagNormalizeCenterToOne)
            {
                sum = pDst[mid_x + mid_y * size_x];
            }

            if (flags & (cComputeGaussianFlagNormalizeCenterToOne | cComputeGaussianFlagNormalize))
            {
                double one_over_sum = 1.0f / sum;
                for (int i = 0; i < size_x * size_y; i++)
                    pDst[i] = static_cast<float>(pDst[i] * one_over_sum);

                if (flags & cComputeGaussianFlagNormalizeCenterToOne)
                    pDst[mid_x + mid_y * size_x] = 1.0f;
            }

            if (flags & cComputeGaussianFlagPrint)
            {
                printf("{\n");
                for (int y = 0; y < size_y; y++)
                {
                    printf("  ");
                    for (int x = 0; x < size_x; x++)
                    {
                        printf("%f, ", pDst[x + y * size_x]);
                    }
                    printf("\n");
                }
                printf("}");
            }
        }
开发者ID:CSRedRat,项目名称:vogl,代码行数:61,代码来源:vogl_math.cpp

示例13: VOGL_ASSERT

bool vogleditor_stateTreeStateVecMatrixRowItem::hasChanged() const
{
    if (m_pDiffBaseState == NULL)
    {
        return false;
    }

    static float baseValues[16];
    static float curValues[16];
    VOGL_ASSERT(m_numComponents <= 16);

    if (m_pDiffBaseState->get<float>(m_name, m_index, baseValues, m_numComponents, m_isIndexed) &&
        m_pState->get<float>(m_name, m_index, curValues, m_numComponents, m_isIndexed))
    {
        for(unsigned int i = 0; i < 4; i++)
        {
            if (baseValues[i + (m_rowIndex*4)] != curValues[i + (m_rowIndex*4)])
            {
                // one of the values has changed, so return early
                return true;
            }
        }
    }
    else
    {
        // the enum must have been added, so it is different
        return true;
    }
    return false;
}
开发者ID:stroyan,项目名称:vogl,代码行数:30,代码来源:vogleditor_statetreeitem.cpp

示例14: string_ptr_to_bool

    bool string_ptr_to_bool(const char *&p, bool &value)
    {
        VOGL_ASSERT(p);

        value = false;

        if (vogl_stricmp(p, "false") == 0)
        {
            p += 5;
            return true;
        }

        if (vogl_stricmp(p, "true") == 0)
        {
            p += 4;
            value = true;
            return true;
        }

        uint32_t v;
        if (string_ptr_to_uint(p, v))
        {
            if (!v)
                return true;
            else if (v == 1)
            {
                value = true;
                return true;
            }
        }

        return false;
    }
开发者ID:Cyberbanan,项目名称:vogl,代码行数:33,代码来源:vogl_strutils.cpp

示例15: uint64_to_string_with_commas

    bool uint64_to_string_with_commas(uint64_t value, char *pDst, uint32_t len)
    {
        VOGL_ASSERT(pDst);

        const uint32_t cBufSize = 32;
        char buf[cBufSize];

        char *p = buf + cBufSize - 1;

        *p-- = '\0';
        uint32_t num_chars_until_comma = 3;

        do
        {
            if (!num_chars_until_comma)
            {
                *p-- = ',';
                num_chars_until_comma = 3;
            }

            *p-- = static_cast<uint8_t>('0' + (value % 10U));
            num_chars_until_comma--;

            value /= 10U;
        } while (value);

        const size_t total_bytes = (buf + cBufSize - 1) - p;
        if (total_bytes > len)
            return false;

        for (size_t i = 0; i < total_bytes; i++)
            pDst[i] = p[1 + i];

        return true;
    }
开发者ID:Cyberbanan,项目名称:vogl,代码行数:35,代码来源:vogl_strutils.cpp


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