예제 #1
0
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{
   (void)data;
#if defined(HAVE_PSGL)
   psglGetDeviceDimensions(gl_device, width, height); 
#endif
}
예제 #2
0
static void gfx_ctx_ps3_get_video_size(void *data,
      unsigned *width, unsigned *height)
{
   gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)data;

#if defined(HAVE_PSGL)
   if (ps3)
      psglGetDeviceDimensions(ps3->gl_device, width, height); 
#endif
}
예제 #3
0
static void gfx_ctx_ps3_get_video_size(void *data,
      unsigned *width, unsigned *height)
{
   driver_t *driver = driver_get_ptr();
   gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)driver->video_context_data;

   (void)data;

#if defined(HAVE_PSGL)
   if (ps3)
      psglGetDeviceDimensions(ps3->gl_device, width, height); 
#endif
}
예제 #4
0
void										ESVideoPlatform::Initialize				(uint32_t& aWidth, uint32_t& aHeight)
{
    //Init PSGL
    PSGLinitOptions initOpts = {PSGL_INIT_MAX_SPUS | PSGL_INIT_HOST_MEMORY_SIZE, 1, false, 0, 0, 0, 0, 32 * 1024 * 1024};
    psglInit(&initOpts);

    Device = psglCreateDeviceAuto(GL_ARGB_SCE, GL_NONE, GL_MULTISAMPLING_NONE_SCE);
    Context = psglCreateContext();
    psglMakeCurrent(Context, Device);
    psglResetCurrentContext();

    //Get Screen Info
    psglGetRenderBufferDimensions(Device, &aWidth, &aHeight);
    psglGetDeviceDimensions(Device, &DefaultWidth, &DefaultHeight);
//	WideScreen = psglGetDeviceAspectRatio(Device) > 1.5f;

    //Some settings
    glEnable(GL_VSYNC_SCE);
    VSyncOn = true;

    //Init shaders
    cgRTCgcInit();
    LibESGL::Presenter::Initialize();
}
예제 #5
0
//-----------------------------------------------------------------------------
// Purpose: Initialize the PSGL rendering interfaces and default state
//-----------------------------------------------------------------------------
bool CGameEnginePS3::BInitializePSGL()
{
	// Clear any errors
	glGetError();

	// First, initialize PSGL
	// Note that since we initialized the SPUs ourselves earlier we should
	// make sure that PSGL doesn't try to do so as well.
	PSGLinitOptions initOpts = {
		enable: PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS | PSGL_INIT_HOST_MEMORY_SIZE,
		maxSPUs: 1,
		initializeSPUs: false,
						// We're not specifying values for these options, the code is only here
						// to alleviate compiler warnings.
		persistentMemorySize: 0,
		transientMemorySize: 0,
		errorConsole: 0,
		fifoSize: 0,	
		hostMemorySize: 128*1024*1024,  // 128 mbs for host memory 
	};

	psglInit( &initOpts );

	m_pPSGLDevice = psglCreateDeviceAuto( GL_ARGB_SCE, GL_DEPTH_COMPONENT24, GL_MULTISAMPLING_4X_SQUARE_ROTATED_SCE );
	if ( !m_pPSGLDevice )
	{
		OutputDebugString( "!! Failed to init the device \n" ); 
		return false;
	}

	GLuint width, height;
	psglGetDeviceDimensions( m_pPSGLDevice, &width, &height );
	m_nWindowHeight = height;
	m_nWindowWidth = width;

	// Now create a PSGL context
	m_pPSGLContext = psglCreateContext();
	if ( !m_pPSGLContext ) 
	{
		OutputDebugString( "Error creating PSGL context\n" );
		return false;
	}

	// Make this context current for the device we initialized
	psglMakeCurrent( m_pPSGLContext, m_pPSGLDevice );

	// Since we're using fixed function stuff (i.e. not using our own shader
	// yet), we need to load shaders.bin that contains the fixed function 
	// shaders.
	psglLoadShaderLibrary( SYS_APP_HOME"/shaders.bin" );

	// Reset the context
	psglResetCurrentContext();

	glViewport( 0, 0, width, height );
	glScissor( 0, 0, width, height );
	glClearDepthf(1.0f);
	glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
	glEnable( GL_VSYNC_SCE );

	glEnable( GL_BLEND );
	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

	glDisable( GL_CULL_FACE );
	glDisable( GL_ALPHA_TEST );
	glDisable( GL_STENCIL_TEST );
	glDisable( GL_SCISSOR_TEST );
	glDisable( GL_LIGHTING );
	glDisable( GL_DEPTH_TEST );
	glDisable( GL_FOG );

	glDepthMask( GL_FALSE );

	// We always need these two
	glEnableClientState( GL_COLOR_ARRAY );
	glEnableClientState( GL_VERTEX_ARRAY );

	// This we'll enable as needed
	glDisableClientState( GL_TEXTURE_COORD_ARRAY );

	glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	glOrthof( 0, width, height, 0, -1.0f, 1.0f );
	glTranslatef( 0, 0, 0 );

	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glTranslatef( 0, 0, 0 );

	glMatrixMode( GL_TEXTURE );
	glLoadIdentity();
	glTranslatef( 0, 0, 0 );

	glDepthRangef( 0.0f, 1.0f );

	// PSGL doesn't clear the screen on startup, so let's do that here.
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
	psglSwap();

	return true;
}


//-----------------------------------------------------------------------------
// Purpose: Initialize the debug font library
//-----------------------------------------------------------------------------
bool CGameEnginePS3::BInitializeCellDbgFont()
{
	// initialize debug font library, then open 2 consoles
	CellDbgFontConfig cfg;
	cfg.bufSize      = 4096;
	cfg.screenWidth  = m_nWindowWidth;
	cfg.screenHeight = m_nWindowHeight;
	if ( cellDbgFontInit( &cfg) != CELL_OK )
	{
		OutputDebugString( "Failed initializing CellDbgFont\n" );
	}

	CellDbgFontConsoleConfig ccfg0;
	ccfg0.posLeft     = 0.18f;
	ccfg0.posTop      = 0.82f;
	ccfg0.cnsWidth    = 128;
	ccfg0.cnsHeight   = 8;
	ccfg0.scale       = 0.65f;
	ccfg0.color       = 0xff0080ff;  // ABGR -> orange
	g_DbgFontConsoleID = m_DbgFontConsoleID = cellDbgFontConsoleOpen( &ccfg0 );
	if ( g_DbgFontConsoleID < 0 )
	{
		OutputDebugString( "Failed creating CellDbgFontConsole\n" );
	}

	return true;
}
예제 #6
0
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
   psglGetDeviceDimensions(gl_device, width, height); 
}
예제 #7
0
static void						CalculateUnderscan				()
{
	/* Setup libpad for our needs */
	CellPadData data;
	uint32_t buttons = 0;

	/* Get the current button state */
	if(CELL_OK == cellPadGetData(0, &data) && data.len >= 8)
	{
		buttons = data.button[2] | (data.button[3] << 8);
	}

	/* If we didn't get anything from the rcfile, or the user is holding select */
	if(!GotUnderscanValues || buttons & 1)
	{
		UnderscanX = 0;
		UnderscanY = 0;

		/* Get the screen size */
		uint32_t width, height;
		psglGetDeviceDimensions(psglGetCurrentDevice(), &width, &height);

		/* Generate image */
		uint32_t* img = malloc((width / 10) * (height / 10) * 4);
		for(int i = 0; i != height / 10; i ++)
		{
			for(int j = 0; j != width / 10; j ++)
			{
				img[i * (width / 10) + j] = (i == 0 || j == 0 || i == (height / 10 - 1) || j == (width / 10 - 1)) ? 0xFF0000FF : 0xFF000000;
			}
		}

		CELL_IMAGE_Load(&overimage, 0, 0, width, height, img, width / 10, height / 10);

		free(img);

		CELL_IMAGE_Load(&helpimage, width / 2 - OVER_WIDTH / 2, height / 2 - OVER_HEIGHT / 2, OVER_WIDTH, OVER_HEIGHT, OverscanHelpImage, OVER_WIDTH, OVER_HEIGHT);

		/* Setup drawing */
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrthof(0, width, height, 0, -1, 1);

		/* Loop */
		while(1)
		{
			/* Draw screen */
			float widthP = ((float)width) * (((float)(UnderscanX)) / 100.0f);
			float heightP = ((float)height) * (((float)(UnderscanY)) / 100.0f);
			glViewport(widthP, heightP, width - widthP * 2, height - heightP * 2);
			glClear(GL_COLOR_BUFFER_BIT);
			CELL_IMAGE_Draw(&overimage);
			CELL_IMAGE_Draw(&helpimage);
			psglSwap();

			/* Update buttons */
			if(CELL_OK == cellPadGetData(0, &data) && data.len >= 8)
			{
				buttons = data.button[2] | (data.button[3] << 8);
			}

			/* Update state */
			if(buttons & 0x4000)		break;
			if(buttons & 0x10)			UnderscanY --;
			if(buttons & 0x40)			UnderscanY ++;
			if(buttons & 0x20)			UnderscanX --;
			if(buttons & 0x80)			UnderscanX ++;

			UnderscanX = (UnderscanX < -5) ? -5 : UnderscanX;
			UnderscanY = (UnderscanY < -5) ? -5 : UnderscanY;
			UnderscanX = (UnderscanX > 25) ? 25 : UnderscanX;
			UnderscanY = (UnderscanY > 25) ? 25 : UnderscanY;

			SDL_Delay(50);
		}

		/* Release the image */
//		CELL_IMAGE_Free(&overimage);
		CELL_IMAGE_Free(&helpimage);
	}

	CELL_PSGL_SetUnderscan(UnderscanX, UnderscanY);
}
예제 #8
0
void PS3Graphics::PSGLInitDevice(uint32_t resolutionId, uint16_t pal60Hz/*, uint16_t tripleBuffering*/)
{
	PSGLdeviceParameters params;
	PSGLinitOptions options;
	options.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS;
#if CELL_SDK_VERSION == 0x340001
	options.enable |= PSGL_INIT_TRANSIENT_MEMORY_SIZE;
#else
	options.enable |=	PSGL_INIT_HOST_MEMORY_SIZE;
#endif
	options.maxSPUs = 1;
	options.initializeSPUs = GL_FALSE;
	options.persistentMemorySize = 0;
	options.transientMemorySize = 0;
	options.errorConsole = 0;
	options.fifoSize = 0;
	options.hostMemorySize = 0;

	psglInit(&options);

	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;

	/*
	if (tripleBuffering)
	{
		params.enable |= PSGL_DEVICE_PARAMETERS_BUFFERING_MODE;
		params.bufferingMode = PSGL_BUFFERING_MODE_TRIPLE;
	}
	*/

	if (pal60Hz)
	{
		params.enable |= PSGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE;
		params.rescPalTemporalMode = RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE;
		params.enable |= PSGL_DEVICE_PARAMETERS_RESC_RATIO_MODE;
		params.rescRatioMode = RESC_RATIO_MODE_FULLSCREEN;
	}

	if (resolutionId)
	{
		//Resolution setting
		CellVideoOutResolution resolution;
		cellVideoOutGetResolution(resolutionId, &resolution);

		params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT;
		params.width = resolution.width;
		params.height = resolution.height;
		m_currentResolutionId = resolutionId;
	}

	psgl_device = psglCreateDeviceExtended(&params);

	// Get the dimensions of the screen in question, and do stuff with it :)
	psglGetDeviceDimensions(psgl_device, &gl_width, &gl_height); 

	// Create a context and bind it to the current display.
	psgl_context = psglCreateContext();

	/*
	if(m_viewport_width == 0)
		m_viewport_width = gl_width;
	if(m_viewport_height == 0)
		m_viewport_height = gl_height;
	*/

	psglMakeCurrent(psgl_context, psgl_device);

	psglResetCurrentContext();
}