void										ESVideoPlatform::SetMode				(uint32_t aIndex)
{
    if(VideoMode != aIndex)
    {
        //Kill old device
        psglMakeCurrent(0, 0);
        psglDestroyDevice(Device);

        //Create new device
        static const uint32_t width[] = {0, 1920, 1280, 0, 720, 720};
        static const uint32_t height[] = {0, 1080, 720, 0, 480, 576};

        PSGLdeviceParameters params;
        memset(&params, 0, sizeof(params));

        params.enable = PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT | PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT;
        params.depthFormat = GL_NONE;
        params.width = (aIndex == 0) ? DefaultWidth : width[aIndex];
        params.height = (aIndex == 0) ? DefaultHeight : height[aIndex];

        Device = psglCreateDeviceExtended(&params);

        psglMakeCurrent(Context, Device);

        //Get parameters
        uint32_t renderWidth, renderHeight;
        psglGetRenderBufferDimensions(Device, &renderWidth, &renderHeight);
        ESVideo::SetScreenSize(renderWidth, renderHeight);
    }

    VideoMode = aIndex;
}
void										ESVideoPlatform::Shutdown				()
{
    LibESGL::Presenter::Shutdown();

    psglDestroyContext(Context);
    psglDestroyDevice(Device);

    psglExit();
}
Beispiel #3
0
static void gfx_ctx_destroy(void *data)
{
   (void)data;
#if defined(HAVE_PSGL)
   psglDestroyContext(gl_context);
   psglDestroyDevice(gl_device);

   psglExit();
#endif
}
Beispiel #4
0
static void gfx_ctx_ps3_destroy_resources(gfx_ctx_ps3_data_t *ps3)
{
   if (!ps3)
      return;

#if defined(HAVE_PSGL)
   psglDestroyContext(ps3->gl_context);
   psglDestroyDevice(ps3->gl_device);

   psglExit();
#endif
}
Beispiel #5
0
void					ESVideo::Shutdown				()
{
	delete FillerTexture;

	//Destory ShaderContext

	psglDestroyContext(Context);
	psglDestroyDevice(Device);
	
	psglExit();						

	free(VertexBuffer);
}
Beispiel #6
0
void PS3Graphics::PSGLDeInitDevice()
{
	glFinish();
	cellDbgFontExit();

	psglDestroyContext(psgl_context);
	psglDestroyDevice(psgl_device);
#if CELL_SDK_VERSION == 0x340001
	//FIXME: It will crash here for 1.92 - termination of the PSGL library - works fine for 3.41
	psglExit();
#else
	//for 1.92
	gl_width = 0;
	gl_height = 0;
	psgl_context = NULL;
	psgl_device = NULL;
#endif
}
Beispiel #7
0
bool CapApp::onInit(int argc, char* argv[])
{
	(void)argc;
	(void)argv;

	// ----------------------------------------------
	// FTP	
	cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
	cellNetCtlInit();
	cellSysmoduleLoadModule(CELL_SYSMODULE_HTTP);
	sys_net_initialize_network();
	ftp_on();

	// Load settings...
	if(!iniRead()) {
		iniWrite(); // create settings file...
	}

	cellSysmoduleLoadModule(CELL_SYSMODULE_FS);

	cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
	cellScreenShotEnable();

	InputInit();

	while(!videoOutIsReady())
	{
		// ...
	}


	PSGLinitOptions options = 
	{
		enable:					PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS,
		maxSPUs:				1,
		initializeSPUs:			GL_FALSE,
		persistentMemorySize:	0,
		transientMemorySize:	0,
		errorConsole:			0,
		fifoSize:				0,  
		hostMemorySize:			128* 1024*1024,  // 128 mbs for host memory 
	};

#if CELL_SDK_VERSION < 0x340000
	options.enable |=	PSGL_INIT_HOST_MEMORY_SIZE;
#endif

	// Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL
	sys_spu_initialize(6, 1);
	psglInit(&options);

	const unsigned int resolutions[] = { 
		CELL_VIDEO_OUT_RESOLUTION_1080, 
		CELL_VIDEO_OUT_RESOLUTION_960x1080, 
		CELL_VIDEO_OUT_RESOLUTION_720, 
		CELL_VIDEO_OUT_RESOLUTION_480 
	};

	const int numResolutions = sizeof(resolutions) / sizeof(resolutions[0]);

	int bestResolution = chooseBestResolution(resolutions,numResolutions);

	getResolutionWidthHeight(bestResolution, deviceWidth, deviceHeight);

	if(bestResolution)
	{
		PSGLdeviceParameters params;

		params.enable				= PSGL_DEVICE_PARAMETERS_COLOR_FORMAT |
									  PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT |
									  PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE;
		params.colorFormat			= GL_ARGB_SCE;
		params.depthFormat			= GL_NONE;
		params.multisamplingMode	= GL_MULTISAMPLING_NONE_SCE;
		params.enable				|= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT;
		params.width				= deviceWidth;
		params.height				= deviceHeight;

		device						= psglCreateDeviceExtended(&params);
		context						= psglCreateContext();

		psglMakeCurrent(context, device);
		psglResetCurrentContext();

		initGraphics();

		if( cellSysutilRegisterCallback( 0, callback_sysutil_exit, NULL ) < 0 ) {
			//...
		}

		dbgFontInit();

		fbaRL = new c_fbaRL();

		while(bRun)
		{
			onRender();
			onUpdate();
			cellSysutilCheckCallback();
		}

	} else {
		// resolution error...
	}

	ftp_off();

	onShutdown();

	return false;
}

void CapApp::onRender()
{
	if(fbaRL) { fbaRL->DlgDisplayFrame(); }

	// get render target buffer dimensions and set viewport	
	psglGetRenderBufferDimensions(device,&app.renderWidth,&app.renderHeight);

	glViewport(0, 0, app.renderWidth, app.renderHeight);

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	if(fbaRL) { fbaRL->RenderBackground(); }
	if(fbaRL) { fbaRL->nFrameStep = 0; fbaRL->DisplayFrame(); }
	if(fbaRL) { fbaRL->nFrameStep = 1; fbaRL->DisplayFrame(); }
	dbgFontDraw();

	psglSwap();
}

bool CapApp::onUpdate()
{
	if(!mFrame) mFrame = 0;
	mFrame++;

	InputFrameStart();
	if(fbaRL) fbaRL->InputFrame();
	InputFrameEnd();	

	return true;
}

void CapApp::onShutdown()
{
	iniWrite(); // save settings

	if(context) psglDestroyContext(context);
	if(device) psglDestroyDevice(device);

	InputExit();
	psglExit();
}