Example #1
0
template <class T> inline void MarkSweep::follow_root(T* p) {
  assert(!Universe::heap()->is_in_reserved(p),
         "roots shouldn't be things within the heap");
  T heap_oop = oopDesc::load_heap_oop(p);
  if (!oopDesc::is_null(heap_oop)) {
    oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
    if (!obj->mark()->is_marked()) {
      mark_object(obj);
      follow_object(obj);
    }
  }
  follow_stack();
}
Example #2
0
void screen_redraw()
{
  //d3dmgr->EndShapesBatching(); //If called inside bound surface we need to finish drawing
  d3dmgr->BeginScene();
  // Clean up any textures that ENIGMA may still think are binded but actually are not
  d3d_set_zwriteenable(true);
  if (!view_enabled)
  {
    screen_set_viewport(0, 0, window_get_region_width_scaled(), window_get_region_height_scaled());
    
    clear_view(0, 0, room_width, room_height, 0, background_showcolor);
    draw_back();
    draw_insts();
    draw_tiles();
  }
  else
  {
    //TODO: Possibly implement view option from Stupido to control which view clears the background
    // Only clear the background on the first visible view by checking if it hasn't been cleared yet
    bool draw_backs = true;
    bool background_allviews = true; // FIXME: Create a setting for this.
    for (view_current = 0; view_current < 8; view_current++)
    {
      int vc = (int)view_current;
      if (!view_visible[vc])
        continue;
      
      int vob = (int)view_object[vc];
      if (vob != -1)
        follow_object(vob, vc);

      screen_set_viewport(view_xport[vc], view_yport[vc], view_wport[vc], view_hport[vc]);
	  
      clear_view(view_xview[vc], view_yview[vc], view_wview[vc], view_hview[vc], view_angle[vc], background_showcolor && draw_backs);

      if (draw_backs)
        draw_back();
      
      draw_insts();
      
      if (draw_tiles())
        break;
      draw_backs = background_allviews;
    }
    view_current = 0;
  }

  // Now process the sub event of draw called draw gui
  // It is for drawing GUI elements without view scaling and transformation
  if (enigma::gui_used)
  {
    screen_set_viewport(0, 0, window_get_region_width_scaled(), window_get_region_height_scaled());
    d3d_set_projection_ortho(0, 0, enigma::gui_width, enigma::gui_height, 0);
	
    // Clear the depth buffer if hidden surface removal is on at the beginning of the draw step.
    if (enigma::d3dMode)
      d3dmgr->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

    draw_gui();
  }

  d3dmgr->EndScene();

  ///TODO: screen_refresh() shouldn't be in screen_redraw(). They are separate functions for a reason.
  screen_refresh();
}
Example #3
0
void screen_redraw()
{
  // Clean up any textures that ENIGMA may still think are binded but actually are not
  d3d_set_zwriteenable(true);
  if (!view_enabled)
  {
    if (bound_framebuffer != 0) //This fixes off-by-one error when rendering on surfaces. This should be checked to see if other GPU's have the same effect
      screen_set_viewport(1, 1, window_get_region_width_scaled(), window_get_region_height_scaled());
    else
      screen_set_viewport(0, 0, window_get_region_width_scaled(), window_get_region_height_scaled());
    
    clear_view(0, 0, room_width, room_height, background_showcolor);
    draw_back();
    draw_insts();
    draw_tiles();
  }
  else
  {
    //TODO: Possibly implement view option from Stupido to control which view clears the background
    // Only clear the background on the first visible view by checking if it hasn't been cleared yet
    bool draw_backs = true;
    bool background_allviews = true; // FIXME: Create a setting for this.
    for (view_current = 0; view_current < 8; view_current++)
    {
      int vc = (int)view_current;
      if (!view_visible[vc])
        continue;
      
      int vob = (int)view_object[vc];
      if (vob != -1)
        follow_object(vob, vc);

      if (bound_framebuffer != 0) //This fixes off-by-one error when rendering on surfaces. This should be checked to see if other GPU's have the same effect
        screen_set_viewport(view_xport[vc]+1, view_yport[vc]+1, view_wport[vc], view_hport[vc]);
      else
        printf("%d %d %d %d\n", (int)view_xport[vc], (int)view_yport[vc], (int)view_wport[vc], (int)view_hport[vc]),
        screen_set_viewport(view_xport[vc], view_yport[vc], view_wport[vc], view_hport[vc]);
	  
      clear_view(view_xview[vc], view_yview[vc], view_wview[vc], view_hview[vc], background_showcolor && draw_backs);

      if (draw_backs)
        draw_back();
      
      draw_insts();
      
      if (draw_tiles())
        break;
      draw_backs = background_allviews;
    }
    view_current = 0;
  }

  // Now process the sub event of draw called draw gui
  // It is for drawing GUI elements without view scaling and transformation
  if (enigma::gui_used)
  {
    screen_set_viewport(0, 0, window_get_region_width_scaled(), window_get_region_height_scaled());
	d3d_set_projection_ortho(0, 0, enigma::gui_width, enigma::gui_height, 0);
	
    // Clear the depth buffer if hidden surface removal is on at the beginning of the draw step.
    if (enigma::d3dMode)
      glClear(GL_DEPTH_BUFFER_BIT);

    draw_gui();
  }

  if (enigma::msaa_fbo != 0) {
    GLint fbo;
    glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &fbo);
    glBindFramebuffer(GL_READ_FRAMEBUFFER, enigma::msaa_fbo);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
    //TODO: Change the code below to fix this to size properly to views
    glBlitFramebuffer(0, 0, window_get_region_width_scaled(), window_get_region_height_scaled(), 0, 0, window_get_region_width_scaled(), window_get_region_height_scaled(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
    // glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
  }

  ///TODO: screen_refresh() shouldn't be in screen_redraw(). They are separate functions for a reason.
  if (bound_framebuffer==0 || enigma::msaa_fbo != 0) { screen_refresh(); }
}