UAE4All 2.0


Cool, out of interest, what was causing the screen flashing bug?
Went through the whole code and disabled one part after another. Mostly whole functions, later parts of functions. If the bug stayed I enabled the part again and disabled the next and so on.


Of course the bug only disappeared after I reached almost the end of the file...


Can't exactly explain why because it was mostly trial and error, but after disabling certain parts in this function the bug was gone (see the commented lines):



Code:
static __inline__ void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)

{

   int border = 0;


   dp_for_drawing = line_decisions + lineno;

   dip_for_drawing = curr_drawinfo + lineno;

   if (dp_for_drawing->plfleft == -1)

	  border = 1;


   linestate[lineno] = LINE_DONE;

   xlinebuffer = row_map[gfx_ypos];

   xlinebuffer -= LINETOSCR_X_ADJUST_BYTES + moveX;


   if (border == 0)

   {

//	  uae_u8 change = line_changes[lineno];


//	  if (change | dip_for_drawing->nr_sprites) {

		 pfield_expand_dp_bplcon ();

		 pfield_init_linetoscr ();

//	  }


//	  if (change)

		 pfield_draw_line_1 ();


	  /* Lines in which sprites are drawn (transparent color is ignored),

	   * have to be redrawn as well.

	   */

//	  line_changes_sprites = 0;

	  if (dip_for_drawing->nr_sprites)

	  {

		 int i;

		 decide_draw_sprites();

		 for (i = 0; i < dip_for_drawing->nr_sprites; i++) {

			if (currprefs.chipset_mask & CSMASK_AGA)

			   draw_sprites_aga (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i);

			else

			   draw_sprites_ecs (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i);

		 }

	  }


	  /* Line was changed or sprites have been drawn in it? */

//	  if (line_changes[lineno] | line_changes_sprites) {

		 do_color_changes (pfield_do_fill_line, (void (*)(int, int))pfield_do_linetoscr);

		 do_flush_line (gfx_ypos);

//	  }


	  /* Lines in which sprites were drawn will have to be redrawn in the

	   * next frame to clear old data as sprite moves up or down.

	   */

//	  SET_LINE_CHANGE(lineno, line_changes_sprites)

   }

   else if (border == 1)

   {

	  adjust_drawing_colors (dp_for_drawing->ctable, 0);


	  if (dip_for_drawing->nr_color_changes == 0)

	  {

		 fill_line ();

		 do_flush_line (gfx_ypos);

		 return;

	  }


	  playfield_start = VISIBLE_RIGHT_BORDER;

	  playfield_end = VISIBLE_RIGHT_BORDER;

	  do_color_changes(pfield_do_fill_line, pfield_do_fill_line);


	  do_flush_line (gfx_ypos);

   }

   else

   {

	  xcolnr tmp = colors_for_drawing.acolors[0];

	  colors_for_drawing.acolors[0] = getxcolor (0);

	  fill_line ();

	  do_flush_line (gfx_ypos);

	  colors_for_drawing.acolors[0] = tmp;

   }

}


Thanks again for helping me with the linking errors!
 
Last edited by a moderator:
Looks like it only tries to redraw a line, if it is changed and you made it draw everything every frame.
 
Yeah, looks that way. But that's how it was done in the old drawing.cpp, too (that didn't have these if(change), if(line_changes), etc. at this point).
 
Last edited by a moderator:
Maybe this is a hack, that tries to gain some speed and doesn't play nice with stuff like doublebuffering or other features of notaz sdl.


Edit: Isn't doublebuffering forced with notaz sdl? Maybe try to deactivate it?


Or if it has a SDL_DOUBLEBUFF in video init try to remove that one.
 
Last edited by a moderator:
Yes, I think that's it. Glad we can do without this "optimization" since Pandora has enough cpu power.
 
Back
Top