Exemplo n.º 1
0
void AbstractUniform::update(Program * program)
{
    assert(program != nullptr);

    if (!program->isLinked())
    {
        return;
    }

    if (!m_cacheDSA) // TODO: move caching to a per context caching
    {
        m_cacheDSA = true;

        m_directStateAccess = hasExtension(GLOW_EXT_direct_state_access);
    }

    if (m_directStateAccess)
    {
		setValueAt(program, locationFor(program));
    }
    else
    {
        program->use();

        setValueAt(locationFor(program));
    }
}
Exemplo n.º 2
0
Arquivo: lexer.cpp Projeto: aep/clay
static bool nextDocToken(Token &x) {
    x = Token();
    const char *p = save();

    for (;;) {
        p = save();
        if(!docSpace()) {
            restore(p);
            break;
        }
    }

    if (docIsBlock) {
        if (docEndBlock(x))  goto success;
    } else {
        if (docEndLine(x))  goto success;
    }

    restore(p); if (docProperty(x))  goto success;
    restore(p); if (docText(x)) goto success;
    if (p != end) {
        pushLocation(locationFor(p));
        error("invalid doc token");
    }
    return false;
success :
    assert(x.tokenKind != T_NONE);
    if (!x.location.ok())
        x.location = locationFor(p);
    return true;
}
Exemplo n.º 3
0
Arquivo: lexer.cpp Projeto: aep/clay
static bool nextToken(Token &x) {
    x = Token();
    const char *p = save();
    if (space(x)) goto success;
    restore(p); if (docStartLine(x)) goto success;
    restore(p); if (docStartBlock(x)) goto success;
    restore(p); if (lineComment(x)) goto success;
    restore(p); if (blockComment(x)) goto success;
    restore(p); if (staticIndex(x)) goto success;
    restore(p); if (opIdentifier(x)) goto success;
    restore(p); if (symbol(x)) goto success;
    restore(p); if (op(x)) goto success;
    restore(p); if (llvmToken(x)) goto success;
    restore(p); if (keywordIdentifier(x)) goto success;
    restore(p); if (charToken(x)) goto success;
    restore(p); if (stringToken(x)) goto success;
    restore(p); if (floatToken(x)) goto success;
    restore(p); if (intToken(x)) goto success;
    if (p != end) {
        pushLocation(locationFor(p));
        error("invalid token");
    }
    return false;
success :
    assert(x.tokenKind != T_NONE);
    if (!x.location.ok())
        x.location = locationFor(p);
    return true;
}
Exemplo n.º 4
0
Arquivo: lexer.cpp Projeto: aep/clay
static bool docProperty(Token &x) {
    char c;
    if (!next(c)) return false;
    while (isSpace(c))
        if (!next(c))
            break;
    if (c != '@') return false;


    const char *begin = save();
    while (!isSpace(c))
        if (!next(c)) return false;

    const char *end = save();
    x = Token(T_DOC_PROPERTY, llvm::StringRef(begin, end - begin - 1));
    x.location = locationFor(begin);
    return true;
}
Exemplo n.º 5
0
Arquivo: lexer.cpp Projeto: aep/clay
static bool llvmToken(Token &x) {
    const char *prefix = "__llvm__";
    while (*prefix) {
        char c;
        if (!next(c)) return false;
        if (c != *prefix) return false;
        ++prefix;
    }
    const char *p = save();
    while (true) {
        char c;
        if (!next(c)) return false;
        if (!isSpace(c))
            break;
        p = save();
    }
    restore(p);
    const char *begin = save();
    if (!llvmBraces()) return false;
    const char *end = save();
    x = Token(T_LLVM, llvm::StringRef(begin, end-begin));
    x.location = locationFor(begin);
    return true;
}