// VSProjectConfig::Load
//------------------------------------------------------------------------------
/*static*/ bool VSProjectConfig::Load( NodeGraph & nodeGraph, IOStream & stream, Array< VSProjectConfig > & configs )
{
    ASSERT( configs.IsEmpty() );

    uint32_t numConfigs( 0 );
    if ( !stream.Read( numConfigs ) )
    {
        return false;
    }
    configs.SetSize( numConfigs );
    for ( uint32_t i=0; i<numConfigs; ++i )
    {
        VSProjectConfig & cfg = configs[ i ];

        if ( stream.Read( cfg.m_SolutionPlatform ) == false ) { return false; }
        if ( stream.Read( cfg.m_SolutionConfig ) == false ) { return false;  }

        if ( stream.Read( cfg.m_Platform ) == false ) { return false; }
        if ( stream.Read( cfg.m_Config ) == false ) { return false; }

        if ( !Node::LoadNode( nodeGraph, stream, cfg.m_Target ) ) { return false; }

        if ( stream.Read( cfg.m_BuildCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_RebuildCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_CleanCommand ) == false ) { return false; }

        if ( stream.Read( cfg.m_Output ) == false ) { return false; }
        if ( stream.Read( cfg.m_PreprocessorDefinitions ) == false ) { return false; }
        if ( stream.Read( cfg.m_IncludeSearchPath ) == false ) { return false; }
        if ( stream.Read( cfg.m_ForcedIncludes ) == false ) { return false; }
        if ( stream.Read( cfg.m_AssemblySearchPath ) == false ) { return false; }
        if ( stream.Read( cfg.m_ForcedUsingAssemblies ) == false ) { return false; }
        if ( stream.Read( cfg.m_AdditionalOptions ) == false ) { return false; }
        if ( stream.Read( cfg.m_OutputDirectory ) == false ) { return false; }
        if ( stream.Read( cfg.m_IntermediateDirectory ) == false ) { return false; }
        if ( stream.Read( cfg.m_LayoutDir ) == false ) { return false; }
        if ( stream.Read( cfg.m_LayoutExtensionFilter ) == false ) { return false; }
        if ( stream.Read( cfg.m_Xbox360DebuggerCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_DebuggerFlavor ) == false ) { return false; }
        if ( stream.Read( cfg.m_AumidOverride ) == false ) { return false; }
        if ( stream.Read( cfg.m_PlatformToolset ) == false ) { return false; }
        if ( stream.Read( cfg.m_DeploymentType ) == false ) { return false; }
        if ( stream.Read( cfg.m_DeploymentFiles ) == false ) { return false; }

        if ( stream.Read( cfg.m_LocalDebuggerCommandArguments ) == false ) { return false; }
        if ( stream.Read( cfg.m_LocalDebuggerWorkingDirectory ) == false ) { return false; }
        if ( stream.Read( cfg.m_LocalDebuggerCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_LocalDebuggerEnvironment ) == false ) { return false; }
    }
    return true;
}
Beispiel #2
0
//-------------------------------------------------------------------------------------------------
bool GlesBox::bindEGLContext(uint32_t width, uint32_t height, uint64_t native_windows_id) {
  if (core_->display_ == nullptr) {
    // Get Display
    core_->display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    if (core_->display_ == EGL_NO_DISPLAY) {
      LOGE("Cann't get EGL display on native windows.");
      return false;
    }

    // Initialize EGL
    EGLint majorVersion(0), minorVersion(0);
    if (!eglInitialize(core_->display_, &majorVersion, &minorVersion)) {
      LOGE("Cann't eglInitialize EGL display.");
      return false;
    }
    eglBindAPI(EGL_OPENGL_ES_API);

    // Get configs
    EGLint numConfigs(0);
    if (!eglGetConfigs(core_->display_, NULL, 0, &numConfigs)) {
      LOGE("eglGetConfigs fail.");
      return false;
    }

    // Choose config
    EGLint attribList[] = {
      EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
		  EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
      EGL_RED_SIZE, 8,
      EGL_GREEN_SIZE, 8,
      EGL_BLUE_SIZE, 8,
      EGL_ALPHA_SIZE, 8,
      EGL_NONE
    };
    if (!eglChooseConfig(core_->display_, attribList, &core_->config_, 1, &numConfigs)) {
      LOGE("eglChooseConfig fail.");
      return false;
    }

    createSurface(width, height, native_windows_id);
    // Create a GL context
    EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE};
    core_->context_ = 
      eglCreateContext(core_->display_, core_->config_, EGL_NO_CONTEXT, contextAttribs);
    if (core_->context_ == EGL_NO_CONTEXT) {
      LOGE("eglCreateContext fail.");
      return false;
    }
  }

  //renew a surface because of size changed
  if (core_->width_ != width || core_->height_ != height) {
    createSurface(width, height, native_windows_id);
  }

  // Make the context current
  if ( !eglMakeCurrent(core_->display_, core_->surface_, core_->surface_, core_->context_) ) {
    LOGE("eglMakeCurrent fail.");
    return false;
  }

  return true;
}