Esempio n. 1
0
static void gl_check_fbo_dimension(gl_t *gl, unsigned i,
      GLuint fbo, GLuint texture, bool update_feedback)
{
   unsigned img_width, img_height, max, pow2_size;
   bool check_dimensions         = false;
   struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i];

   if (!fbo_rect)
      return;

   check_dimensions = 
      (fbo_rect->max_img_width > fbo_rect->width) ||
      (fbo_rect->max_img_height > fbo_rect->height);

   if (!check_dimensions)
      return;

   /* Check proactively since we might suddently 
    * get sizes of tex_w width or tex_h height. */
   img_width             = fbo_rect->max_img_width;
   img_height            = fbo_rect->max_img_height;
   max                   = img_width > img_height ? img_width : img_height;
   pow2_size             = next_pow2(max);

   fbo_rect->width = fbo_rect->height = pow2_size;

   gl_recreate_fbo(fbo_rect, fbo, texture);

   /* Update feedback texture in-place so we avoid having to 
    * juggle two different fbo_rect structs since they get updated here. */
   if (update_feedback)
   {
      if (gl_recreate_fbo(fbo_rect, gl->fbo_feedback,
               gl->fbo_feedback_texture))
      {
         /* Make sure the feedback textures are cleared 
          * so we don't feedback noise. */
         glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
         glClear(GL_COLOR_BUFFER_BIT);
      }
   }

   RARCH_LOG("[GL]: Recreating FBO texture #%d: %ux%u\n",
         i, fbo_rect->width, fbo_rect->height);
}
Esempio n. 2
0
static void gl_check_fbo_dimension(gl_t *gl,
      void *chain_data,
      unsigned i,
      bool update_feedback)
{
   struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i];
   /* Check proactively since we might suddently
    * get sizes of tex_w width or tex_h height. */
   gl2_renderchain_t *chain        = (gl2_renderchain_t*)chain_data;
   unsigned img_width              = fbo_rect->max_img_width;
   unsigned img_height             = fbo_rect->max_img_height;
   unsigned max                    = img_width > img_height ? img_width : img_height;
   unsigned pow2_size              = next_pow2(max);

   fbo_rect->width                 = pow2_size;
   fbo_rect->height                = pow2_size;

   gl_recreate_fbo(fbo_rect, chain->fbo[i], &chain->fbo_texture[i]);

   /* Update feedback texture in-place so we avoid having to
    * juggle two different fbo_rect structs since they get updated here. */
   if (update_feedback)
   {
      if (gl_recreate_fbo(fbo_rect, gl->fbo_feedback,
               &gl->fbo_feedback_texture))
      {
         /* Make sure the feedback textures are cleared
          * so we don't feedback noise. */
         glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
         glClear(GL_COLOR_BUFFER_BIT);
      }
   }

   RARCH_LOG("[GL]: Recreating FBO texture #%d: %ux%u\n",
         i, fbo_rect->width, fbo_rect->height);
}