static gctINT
GetShaderType(
    IN gctCONST_STRING FileName
    )
{
    gctCONST_STRING ext;

    gcmASSERT(FileName);

    ext = strrchr(FileName, '.');

    if (ext != gcvNULL)
    {
        if (gcmIS_SUCCESS(gcoOS_StrNCmp(ext, ".frag", 4))) return gcSHADER_TYPE_FRAGMENT;
        if (gcmIS_SUCCESS(gcoOS_StrNCmp(ext, ".vert", 4))) return gcSHADER_TYPE_VERTEX;
    }

    return gcSHADER_TYPE_FRAGMENT;
}
예제 #2
0
static gceSTATUS
_GetUserDebugOption(
    IN gcoHAL Hal
    )
{
    static gctINT envChecked = 0;

    if (!envChecked)
    {
        char* p = gcvNULL;
        gctSTRING pos = gcvNULL;

        gcoOS_GetEnv(gcvNULL, "VIV_DEBUG", &p);
        if (p)
        {
            gcoOS_StrStr(p, "MSG_LEVEL", &pos);
            if (pos)
            {
                pos += sizeof("MSG_LEVEL") - 1;
                while (pos[0] == '=')
                {
                    ++pos;
                    if (gcvSTATUS_OK == gcoOS_StrNCmp(pos, "ERROR", sizeof("ERROR") - 1))
                    {
                        /* Output error messages. */
                        gcUserDebugOption.debugMsg = gcvDEBUG_MSG_ERROR;
                        pos += sizeof("ERROR") - 1;
                    }
                    else if (gcvSTATUS_OK == gcoOS_StrNCmp(pos, "WARNING", sizeof("WARNING") - 1))
                    {
                        /* Output error messages. */
                        gcUserDebugOption.debugMsg = gcvDEBUG_MSG_WARNING;
                        pos += sizeof("WARNING") - 1;
                    }
                }
            }
        }
    }

    Hal->userDebugOption = &gcUserDebugOption;

    return gcvSTATUS_OK;
}