Пример #1
0
void GLBackend::do_glUniformMatrix4fv(Batch& batch, uint32 paramOffset) {
    glUniformMatrix4fv(
        batch._params[paramOffset + 3]._int,
        batch._params[paramOffset + 2]._uint,
        batch._params[paramOffset + 1]._uint,
        (const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint));
    (void) CHECK_GL_ERROR();
}
Пример #2
0
void GLBackend::do_setViewportTransform(Batch& batch, size_t paramOffset) {
    memcpy(&_transform._viewport, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));

    if (!_inRenderTransferPass && !isStereo()) {
        ivec4& vp = _transform._viewport;
        glViewport(vp.x, vp.y, vp.z, vp.w);
    }

    // The Viewport is tagged invalid because the CameraTransformUBO is not up to date and will need update on next drawcall
    _transform._invalidViewport = true;
}
Пример #3
0
void GLBackend::do_setStateScissorRect(Batch& batch, size_t paramOffset) {
    Vec4i rect;
    memcpy(&rect, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));

    if (_stereo._enable) {
        rect.z /= 2;
        if (_stereo._pass) {
            rect.x += rect.z;
        }
    }
    glScissor(rect.x, rect.y, rect.z, rect.w);
    (void)CHECK_GL_ERROR();
}
Пример #4
0
void GLBackend::do_glUniformMatrix4fv(Batch& batch, uint32 paramOffset) {
    if (_pipeline._program == 0) {
        // We should call updatePipeline() to bind the program but we are not doing that
        // because these uniform setters are deprecated and we don;t want to create side effect
        return;
    }
    updatePipeline();
    glUniformMatrix4fv(
        batch._params[paramOffset + 3]._int,
        batch._params[paramOffset + 2]._uint,
        batch._params[paramOffset + 1]._uint,
        (const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint));
    (void) CHECK_GL_ERROR();
}
Пример #5
0
void GLBackend::do_glUniform4fv(Batch& batch, size_t paramOffset) {
    if (_pipeline._program == 0) {
        // We should call updatePipeline() to bind the program but we are not doing that
        // because these uniform setters are deprecated and we don;t want to create side effect
        return;
    }
    updatePipeline();
    
    GLint location = batch._params[paramOffset + 2]._int;
    GLsizei count = batch._params[paramOffset + 1]._uint;
    const GLfloat* value = (const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint);
    glUniform4fv(location, count, value);

    (void) CHECK_GL_ERROR();
}
Пример #6
0
void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
    memcpy(&_transform._viewport, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));

    ivec4& vp = _transform._viewport;

    // Where we assign the GL viewport
    if (_stereo._enable) {
        vp.z /= 2;
        if (_stereo._pass) {
            vp.x += vp.z;
        }
    } 

    glViewport(vp.x, vp.y, vp.z, vp.w);

    // The Viewport is tagged invalid because the CameraTransformUBO is not up to date and will need update on next drawcall
    _transform._invalidViewport = true;
}
Пример #7
0
void GLBackend::do_setProjectionTransform(Batch& batch, size_t paramOffset) {
    memcpy(&_transform._projection, batch.editData(batch._params[paramOffset]._uint), sizeof(Mat4));
    _transform._invalidProj = true;
}
Пример #8
0
void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
    memcpy(&_transform._viewport, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));
    _transform._invalidViewport = true;
}
Пример #9
0
void GLBackend::do_glDrawBuffers(Batch& batch, uint32 paramOffset) {
    glDrawBuffers(
        batch._params[paramOffset + 1]._uint,
        (const GLenum*)batch.editData(batch._params[paramOffset + 0]._uint));
    (void) CHECK_GL_ERROR();
}