コード例 #1
0
FX_ENTRY void FX_CALL
grSstOrigin(GrOriginLocation_t  origin)
{
   LOG("grSstOrigin(%d)\r\n", origin);
   if (origin != GR_ORIGIN_UPPER_LEFT)
      DISPLAY_WARNING("grSstOrigin : %x", origin);
}
コード例 #2
0
FX_ENTRY void FX_CALL
grDepthBufferFunction( GrCmpFnc_t function )
{
   LOG("grDepthBufferFunction(%d)\r\n", function);
   switch(function)
   {
      case GR_CMP_GEQUAL:
         glDepthFunc(GL_GEQUAL);
         break;
      case GR_CMP_LEQUAL:
         glDepthFunc(GL_LEQUAL);
         break;
      case GR_CMP_LESS:
         glDepthFunc(GL_LESS);
         break;
      case GR_CMP_ALWAYS:
         glDepthFunc(GL_ALWAYS);
         break;
      case GR_CMP_EQUAL:
         glDepthFunc(GL_EQUAL);
         break;
      case GR_CMP_GREATER:
         glDepthFunc(GL_GREATER);
         break;
      case GR_CMP_NEVER:
         glDepthFunc(GL_NEVER);
         break;
      case GR_CMP_NOTEQUAL:
         glDepthFunc(GL_NOTEQUAL);
         break;

      default:
         DISPLAY_WARNING("unknown depth buffer function : %x", function);
   }
}
コード例 #3
0
FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t  		tmu,
                                         FxU32 				startAddress,
                                         GrLOD_t 			lodmin,
                                         GrLOD_t 			lodmax,
                                         GrAspectRatio_t 	aspect,
                                         GrTextureFormat_t 	fmt,
                                         FxU32 				evenOdd)
{
   int i;
   static int fbs_init = 0;

   //printf("grTextureBufferExt(%d, %d, %d, %d, %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
   LOG("grTextureBufferExt(%d, %d, %d, %d %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
   if (lodmin != lodmax)DISPLAY_WARNING("grTextureBufferExt : loading more than one LOD");
   {
      if (!render_to_texture) //initialization
      {
         if(!fbs_init)
         {
            for(i=0; i<100; i++) fbs[i].address = 0;
            fbs_init = 1;
            nb_fb = 0;
         }
         return; //no need to allocate FBO if render buffer is not texture buffer
      }

      render_to_texture = 2;

      if (aspect < 0)
      {
         pBufferHeight = 1 << lodmin;
         pBufferWidth = pBufferHeight >> -aspect;
      }
      else
      {
コード例 #4
0
FX_ENTRY void FX_CALL
grCullMode( GrCullMode_t mode )
{
   LOG("grCullMode(%d)\r\n", mode);
   static int oldmode = -1, oldinv = -1;
   culling_mode = mode;
   if (inverted_culling == oldinv && oldmode == mode)
      return;
   oldmode = mode;
   oldinv = inverted_culling;
   switch(mode)
   {
      case GR_CULL_DISABLE:
         glDisable(GL_CULL_FACE);
         break;
      case GR_CULL_NEGATIVE:
         if (!inverted_culling)
            glCullFace(GL_FRONT);
         else
            glCullFace(GL_BACK);
         glEnable(GL_CULL_FACE);
         break;
      case GR_CULL_POSITIVE:
         if (!inverted_culling)
            glCullFace(GL_BACK);
         else
            glCullFace(GL_FRONT);
         glEnable(GL_CULL_FACE);
         break;
      default:
         DISPLAY_WARNING("unknown cull mode : %x", mode);
   }
}
コード例 #5
0
FX_ENTRY void FX_CALL
grCoordinateSpace( GrCoordinateSpaceMode_t mode )
{
   LOG("grCoordinateSpace(%d)\r\n", mode);
   switch(mode)
   {
      case GR_WINDOW_COORDS:
         break;
      default:
         DISPLAY_WARNING("unknwown coordinate space : %x", mode);
   }
}
コード例 #6
0
FX_ENTRY FxU32 FX_CALL
grTexTextureMemRequired( FxU32     evenOdd,
                        GrTexInfo *info   )
{
   int width, height;
   LOG("grTextureMemRequired(%d)\r\n", evenOdd);
#ifndef NDEBUG
   if (info->largeLodLog2 != info->smallLodLog2) DISPLAY_WARNING("grTexTextureMemRequired : loading more than one LOD");
#endif

   if (info->aspectRatioLog2 < 0)
   {
      height = 1 << info->largeLodLog2;
      width = height >> -info->aspectRatioLog2;
   }
コード例 #7
0
FX_ENTRY void FX_CALL
grDepthBufferMode( GrDepthBufferMode_t mode )
{
   LOG("grDepthBufferMode(%d)\r\n", mode);
   switch(mode)
   {
      case GR_DEPTHBUFFER_DISABLE:
         glDisable(GL_DEPTH_TEST);
         return;
      case GR_DEPTHBUFFER_ZBUFFER:
      case GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS:
         glEnable(GL_DEPTH_TEST);
         break;
      default:
         DISPLAY_WARNING("unknown depth buffer mode : %x", mode);
   }
}
コード例 #8
0
FX_ENTRY void FX_CALL
grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode)
{
   LOG("grVertexLayout(%d,%d,%d)\r\n", param, offset, mode);
   switch(param)
   {
      case GR_PARAM_XY:
         xy_en = mode;
         xy_off = offset;
         break;
      case GR_PARAM_Z:
         z_en = mode;
         z_off = offset;
         break;
      case GR_PARAM_Q:
         q_en = mode;
         q_off = offset;
         break;
      case GR_PARAM_FOG_EXT:
         fog_ext_en = mode;
         fog_ext_off = offset;
         break;
      case GR_PARAM_PARGB:
         pargb_en = mode;
         pargb_off = offset;
         break;
      case GR_PARAM_ST0:
         st0_en = mode;
         st0_off = offset;
         break;
      case GR_PARAM_ST1:
         st1_en = mode;
         st1_off = offset;
         break;
      default:
         DISPLAY_WARNING("unknown grVertexLayout parameter : %x", param);
   }
}
コード例 #9
0
FX_ENTRY GrContext_t FX_CALL
grSstWinOpen(
             GrScreenResolution_t screen_resolution,
             GrScreenRefresh_t    refresh_rate,
             GrColorFormat_t      color_format,
             GrOriginLocation_t   origin_location,
             int                  nColBuffers,
             int                  nAuxBuffers)
{
   uint32_t screen_width, screen_height;
   struct retro_variable var = { "mupen64-screensize", 0 };
   // ZIGGY
   // allocate static texture names
   // the initial value should be big enough to support the maximal resolution
   free_texture = 32*1024*1024;
   default_texture = free_texture++;
   color_texture = free_texture++;
   depth_texture = free_texture++;

   LOG("grSstWinOpen(%d, %d, %d, %d, %d %d)\r\n", screen_resolution&~0x80000000, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);

   width = 640;
   height = 480;
   bool ret = environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
   if (ret && var.value)
   {
      if (sscanf(var.value ? var.value : "640x480", "%dx%d", &width, &height) != 2)
      {
         width = 640;
         height = 480;
      }
   }
   glViewport(0, 0, width, height);

   lfb_color_fmt = color_format;
   if (origin_location != GR_ORIGIN_UPPER_LEFT) DISPLAY_WARNING("origin must be in upper left corner");
   if (nColBuffers != 2) DISPLAY_WARNING("number of color buffer is not 2");
   if (nAuxBuffers != 1) DISPLAY_WARNING("number of auxiliary buffer is not 1");

   if (isExtensionSupported("GL_ARB_texture_env_combine") == 0 &&
         isExtensionSupported("GL_EXT_texture_env_combine") == 0)
      DISPLAY_WARNING("Your video card doesn't support GL_ARB_texture_env_combine extension");
   if (isExtensionSupported("GL_ARB_multitexture") == 0)
      DISPLAY_WARNING("Your video card doesn't support GL_ARB_multitexture extension");
   if (isExtensionSupported("GL_ARB_texture_mirrored_repeat") == 0)
      DISPLAY_WARNING("Your video card doesn't support GL_ARB_texture_mirrored_repeat extension");

   nbAuxBuffers = 4;
   //glGetIntegerv(GL_AUX_BUFFERS, &nbAuxBuffers);
   if (nbAuxBuffers > 0)
      printf("Congratulations, you have %d auxilliary buffers, we'll use them wisely !\n", nbAuxBuffers);

   blend_func_separate_support = 1;
   packed_pixels_support = 0;
   
   if (isExtensionSupported("GL_EXT_blend_func_separate") == 0)
   {
      DISPLAY_WARNING("GL_EXT_blend_func_separate not supported.\n");
      blend_func_separate_support = 0;
   }
   else
   {
      printf("GL_EXT_blend_func_separate supported.\n");
      blend_func_separate_support = 1;
   }

   // we can assume that non-GLES has GL_EXT_packed_pixels
   // support -it's included since OpenGL 1.2
#ifdef GLES
   if (isExtensionSupported("GL_EXT_packed_pixels") != 0)
#endif
      packed_pixels_support = 1;

   if (isExtensionSupported("GL_ARB_texture_non_power_of_two") == 0)
   {
      DISPLAY_WARNING("GL_ARB_texture_non_power_of_two supported.\n");
      npot_support = 0;
   }
   else
   {
      printf("GL_ARB_texture_non_power_of_two supported.\n");
      npot_support = 1;
   }

   if (isExtensionSupported("GL_EXT_fog_coord") == 0)
   {
      DISPLAY_WARNING("GL_EXT_fog_coord not supported.\n");
      fog_coord_support = 0;
   }
   else
   {
      printf("GL_EXT_fog_coord supported.\n");
      fog_coord_support = 1;
   }

   if (isExtensionSupported("GL_ARB_shading_language_100") &&
         isExtensionSupported("GL_ARB_shader_objects") &&
         isExtensionSupported("GL_ARB_fragment_shader") &&
         isExtensionSupported("GL_ARB_vertex_shader"))
   {}

#ifdef GLES
   if (isExtensionSupported("GL_EXT_texture_format_BGRA8888"))
   {
      printf("GL_EXT_texture_format_BGRA8888 supported.\n");
      bgra8888_support = 1;
   }
   else
   {
      DISPLAY_WARNING("GL_EXT_texture_format_BGRA8888 not supported.\n");
      bgra8888_support = 0;
   }
#endif

   glViewport(0, 0, width, height);
   viewport_width = width;
   viewport_height = height;

   // VP try to resolve z precision issues
   //  glMatrixMode(GL_MODELVIEW);
   //  glLoadIdentity();
   //  glTranslatef(0, 0, 1-zscale);
   //  glScalef(1, 1, zscale);

   widtho = width/2;
   heighto = height/2;

   pBufferWidth = pBufferHeight = -1;

   current_buffer = GL_BACK;

   texture_unit = GL_TEXTURE0;

   {
      int i;
      for (i=0; i<NB_TEXBUFS; i++)
         texbufs[i].start = texbufs[i].end = 0xffffffff;
   }

   FindBestDepthBias();

   init_geometry();
   init_textures();
   init_combiner();

   return 1;
}
コード例 #10
0
ファイル: main_arm.cpp プロジェクト: RonDePrez/opentx
void perMain()
{
#if defined(PCBSKY9X) && !defined(REVA)
  calcConsumption();
#endif
  checkSpeakerVolume();
  checkEeprom();
  sdMountPoll();
  writeLogs();
  handleUsbConnection();
  checkTrainerSettings();
  checkBattery();

  uint8_t evt = getEvent(false);
  if (evt && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) backlightOn(); // on keypress turn the light on
  checkBacklight();
#if defined(NAVIGATION_STICKS)
  uint8_t sticks_evt = getSticksNavigationEvent();
  if (sticks_evt) evt = sticks_evt;
#endif

#if defined(USB_MASS_STORAGE)
  if (usbPlugged()) {
    // disable access to menus
    lcd_clear();
    menuMainView(0);
    lcdRefresh();
    return;
  }
#endif

#if defined(LUA)
  uint32_t t0 = get_tmr10ms();
  static uint32_t lastLuaTime = 0;
  uint16_t interval = (lastLuaTime == 0 ? 0 : (t0 - lastLuaTime));
  lastLuaTime = t0;
  if (interval > maxLuaInterval) {
    maxLuaInterval = interval;
  }

  // run Lua scripts that don't use LCD (to use CPU time while LCD DMA is running)
  luaTask(0, RUN_MIX_SCRIPT | RUN_FUNC_SCRIPT | RUN_TELEM_BG_SCRIPT, false);

  // wait for LCD DMA to finish before continuing, because code from this point 
  // is allowed to change the contents of LCD buffer
  // 
  // WARNING: make sure no code above this line does any change to the LCD display buffer!
  //
  lcdRefreshWait();

  // draw LCD from menus or from Lua script
  // run Lua scripts that use LCD

  bool standaloneScriptWasRun = luaTask(evt, RUN_STNDAL_SCRIPT, true);
  bool refreshScreen = true;
  if (!standaloneScriptWasRun) {
    refreshScreen = !luaTask(evt, RUN_TELEM_FG_SCRIPT, true);
  }

  t0 = get_tmr10ms() - t0;
  if (t0 > maxLuaDuration) {
    maxLuaDuration = t0;
  }

  if (!standaloneScriptWasRun)
#else
  lcdRefreshWait();   // WARNING: make sure no code above this line does any change to the LCD display buffer!
  const bool refreshScreen = true;
#endif
  {
    // normal GUI from menus
    const char *warn = s_warning;
    uint8_t menu = s_menu_count;
    if (refreshScreen) {
      lcd_clear();
    }
    if (menuEvent) {
      m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
      m_posHorz = 0;
      evt = menuEvent;
      menuEvent = 0;
      AUDIO_MENUS();
    }
    g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
    if (warn) DISPLAY_WARNING(evt);
    if (menu) {
      const char * result = displayMenu(evt);
      if (result) {
        menuHandler(result);
        putEvent(EVT_MENU_UP);
      }
    }
    drawStatusLine();
  }

  lcdRefresh();

#if defined(REV9E) && !defined(SIMU)
  topLcdRefreshStart();
  setTopFirstTimer(getValue(MIXSRC_FIRST_TIMER+g_model.topLcdTimer));
  setTopSecondTimer(g_eeGeneral.globalTimer + sessionTimer);
  setTopRssi(TELEMETRY_RSSI());
  setTopBatteryValue(g_vbat100mV);
  setTopBatteryState(GET_TXBATT_BARS(), IS_TXBATT_WARNING());
  topLcdRefreshEnd();
#endif

#if defined(REV9E) && !defined(SIMU)
  bluetoothWakeup();
#endif

#if defined(PCBTARANIS)
  if (requestScreenshot) {
    requestScreenshot = false;
    writeScreenshot();
  }
#endif

}