mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-12 05:40:36 +00:00
(PS3) Create reinit_fbo function
This commit is contained in:
parent
e7d3e524bb
commit
407205a4e5
@ -590,51 +590,6 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (gl->should_resize)
|
||||
{
|
||||
gl->should_resize = false;
|
||||
|
||||
if (!gl->render_to_tex)
|
||||
set_viewport(gl, gl->win_width, gl->win_height, false);
|
||||
else
|
||||
{
|
||||
// Check if we have to recreate our FBO textures.
|
||||
for (int i = 0; i < gl->fbo_pass; i++)
|
||||
{
|
||||
// Check proactively since we might suddently get sizes of tex_w width or tex_h height.
|
||||
if (gl->fbo_rect[i].max_img_width > gl->fbo_rect[i].width ||
|
||||
gl->fbo_rect[i].max_img_height > gl->fbo_rect[i].height)
|
||||
{
|
||||
unsigned img_width = gl->fbo_rect[i].max_img_width;
|
||||
unsigned img_height = gl->fbo_rect[i].max_img_height;
|
||||
unsigned max = img_width > img_height ? img_width : img_height;
|
||||
unsigned pow2_size = next_pow2(max);
|
||||
gl->fbo_rect[i].width = gl->fbo_rect[i].height = pow2_size;
|
||||
|
||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, gl->fbo[i]);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[i]);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, GL_ARGB_SCE, gl->fbo_rect[i].width, gl->fbo_rect[i].height, 0, GL_ARGB_SCE,
|
||||
GL_UNSIGNED_INT_8_8_8_8, NULL);
|
||||
|
||||
glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, gl->fbo_texture[i], 0);
|
||||
|
||||
GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_OES)
|
||||
SSNES_WARN("Failed to reinit FBO texture!\n");
|
||||
|
||||
SSNES_LOG("Recreating FBO texture #%d: %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height);
|
||||
}
|
||||
}
|
||||
|
||||
// Go back to what we're supposed to do, render to FBO #0 :D
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, gl->fbo[0]);
|
||||
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((width != gl->last_width[gl->tex_index] || height != gl->last_height[gl->tex_index]) && gl->empty_buf) // Res change. need to clear out texture.
|
||||
{
|
||||
@ -786,6 +741,53 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||
return true;
|
||||
}
|
||||
|
||||
void ps3graphics_reinit_fbos(void)
|
||||
{
|
||||
gl_t * gl = g_gl;
|
||||
|
||||
if(!gl)
|
||||
return;
|
||||
|
||||
if (!gl->render_to_tex)
|
||||
set_viewport(gl, gl->win_width, gl->win_height, false);
|
||||
else
|
||||
{
|
||||
// Check if we have to recreate our FBO textures.
|
||||
for (int i = 0; i < gl->fbo_pass; i++)
|
||||
{
|
||||
// Check proactively since we might suddently get sizes of tex_w width or tex_h height.
|
||||
if (gl->fbo_rect[i].max_img_width > gl->fbo_rect[i].width ||
|
||||
gl->fbo_rect[i].max_img_height > gl->fbo_rect[i].height)
|
||||
{
|
||||
unsigned img_width = gl->fbo_rect[i].max_img_width;
|
||||
unsigned img_height = gl->fbo_rect[i].max_img_height;
|
||||
unsigned max = img_width > img_height ? img_width : img_height;
|
||||
unsigned pow2_size = next_pow2(max);
|
||||
gl->fbo_rect[i].width = gl->fbo_rect[i].height = pow2_size;
|
||||
|
||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, gl->fbo[i]);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[i]);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, GL_ARGB_SCE, gl->fbo_rect[i].width, gl->fbo_rect[i].height, 0, GL_ARGB_SCE,
|
||||
GL_UNSIGNED_INT_8_8_8_8, NULL);
|
||||
|
||||
glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, gl->fbo_texture[i], 0);
|
||||
|
||||
GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_OES)
|
||||
SSNES_WARN("Failed to reinit FBO texture!\n");
|
||||
|
||||
SSNES_LOG("Recreating FBO texture #%d: %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height);
|
||||
}
|
||||
}
|
||||
|
||||
// Go back to what we're supposed to do, render to FBO #0 :D
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, gl->fbo[0]);
|
||||
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
|
||||
}
|
||||
}
|
||||
|
||||
static void psgl_deinit(gl_t *gl)
|
||||
{
|
||||
glFinish();
|
||||
|
@ -50,6 +50,7 @@ void ps3_next_resolution (void);
|
||||
void ps3_set_filtering(unsigned index, bool set_smooth);
|
||||
void ps3_video_deinit(void);
|
||||
void ps3graphics_block_swap (void);
|
||||
void ps3graphics_reinit_fbos (void);
|
||||
void ps3graphics_set_aspect_ratio(uint32_t aspectratio_index);
|
||||
void ps3graphics_set_orientation(uint32_t orientation);
|
||||
void ps3graphics_set_vsync(uint32_t vsync);
|
||||
|
Loading…
x
Reference in New Issue
Block a user