void sdl2_gl_scanout(DisplayChangeListener *dcl,

                     uint32_t backing_id, bool backing_y_0_top,


                     uint32_t x, uint32_t y,

                     uint32_t w, uint32_t h)

{

    struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);



    assert(scon->opengl);

    scon->x = x;

    scon->y = y;

    scon->w = w;

    scon->h = h;

    scon->tex_id = backing_id;

    scon->y0_top = backing_y_0_top;



    SDL_GL_MakeCurrent(scon->real_window, scon->winctx);



    if (scon->tex_id == 0 || scon->w == 0 || scon->h == 0) {

        sdl2_set_scanout_mode(scon, false);

        return;

    }



    sdl2_set_scanout_mode(scon, true);

    if (!scon->fbo_id) {

        glGenFramebuffers(1, &scon->fbo_id);

    }



    glBindFramebuffer(GL_FRAMEBUFFER_EXT, scon->fbo_id);

    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,

                              GL_TEXTURE_2D, scon->tex_id, 0);

}
void sdl2_gl_scanout(DisplayChangeListener *dcl,

                     uint32_t backing_id, bool backing_y_0_top,


                     uint32_t x, uint32_t y,

                     uint32_t w, uint32_t h)

{

    struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);



    assert(scon->opengl);

    scon->x = x;

    scon->y = y;

    scon->w = w;

    scon->h = h;

    scon->tex_id = backing_id;

    scon->y0_top = backing_y_0_top;



    SDL_GL_MakeCurrent(scon->real_window, scon->winctx);



    if (scon->tex_id == 0 || scon->w == 0 || scon->h == 0) {

        sdl2_set_scanout_mode(scon, false);

        return;

    }



    sdl2_set_scanout_mode(scon, true);

    if (!scon->fbo_id) {

        glGenFramebuffers(1, &scon->fbo_id);

    }



    glBindFramebuffer(GL_FRAMEBUFFER_EXT, scon->fbo_id);

    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,

                              GL_TEXTURE_2D, scon->tex_id, 0);

}
void FUNC_0(DisplayChangeListener *VAR_0,

                     uint32_t VAR_1, bool VAR_2,


                     uint32_t VAR_3, uint32_t VAR_4,

                     uint32_t VAR_5, uint32_t VAR_6)

{

    struct sdl2_console *VAR_7 = container_of(VAR_0, struct sdl2_console, VAR_0);



    assert(VAR_7->opengl);

    VAR_7->VAR_3 = VAR_3;

    VAR_7->VAR_4 = VAR_4;

    VAR_7->VAR_5 = VAR_5;

    VAR_7->VAR_6 = VAR_6;

    VAR_7->tex_id = VAR_1;

    VAR_7->y0_top = VAR_2;



    SDL_GL_MakeCurrent(VAR_7->real_window, VAR_7->winctx);



    if (VAR_7->tex_id == 0 || VAR_7->VAR_5 == 0 || VAR_7->VAR_6 == 0) {

        sdl2_set_scanout_mode(VAR_7, false);

        return;

    }



    sdl2_set_scanout_mode(VAR_7, true);

    if (!VAR_7->fbo_id) {

        glGenFramebuffers(1, &VAR_7->fbo_id);

    }



    glBindFramebuffer(GL_FRAMEBUFFER_EXT, VAR_7->fbo_id);

    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,

                              GL_TEXTURE_2D, VAR_7->tex_id, 0);

}
void FUNC_0(DisplayChangeListener *VAR_0,
uint32_t VAR_1, bool VAR_2,
uint32_t VAR_3, uint32_t VAR_4,
uint32_t VAR_5, uint32_t VAR_6)
{ struct sdl2_console *VAR_7 = container_of(VAR_0, struct sdl2_console, VAR_0); assert(VAR_7->opengl); VAR_7->VAR_3 = VAR_3; VAR_7->VAR_4 = VAR_4; VAR_7->VAR_5 = VAR_5; VAR_7->VAR_6 = VAR_6; VAR_7->tex_id = VAR_1; VAR_7->y0_top = VAR_2; SDL_GL_MakeCurrent(VAR_7->real_window, VAR_7->winctx); if (VAR_7->tex_id == 0 || VAR_7->VAR_5 == 0 || VAR_7->VAR_6 == 0) { sdl2_set_scanout_mode(VAR_7, false); return; } sdl2_set_scanout_mode(VAR_7, true); if (!VAR_7->fbo_id) { glGenFramebuffers(1, &VAR_7->fbo_id); } glBindFramebuffer(GL_FRAMEBUFFER_EXT, VAR_7->fbo_id); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, VAR_7->tex_id, 0); }