(PS3) Hook up menu shader code - crashes currently

This commit is contained in:
TwinAphex51224 2012-01-25 23:28:50 +01:00
parent 388e2bb5fc
commit 0a81b47932
3 changed files with 23 additions and 50 deletions

View File

@ -1361,6 +1361,7 @@ void menu_loop(void)
{
//ps3graphics_draw_menu();
glClear(GL_COLOR_BUFFER_BIT);
//gl_frame_menu();
g_frame_count++;
switch(menuStack[menuStackindex].enum_id)

View File

@ -129,21 +129,6 @@ typedef struct gl
unsigned base_size; // 2 or 4
} gl_t;
/* menu */
static CGprogram _vertexProgram;
static CGprogram _fragmentProgram;
static CGparameter _cgpModelViewProj;
static CGparameter _cgpVideoSize;
static CGparameter _cgpTextureSize;
static CGparameter _cgpOutputSize;
static CGparameter _cgp_vertex_VideoSize;
static CGparameter _cgp_vertex_TextureSize;
static CGparameter _cgp_vertex_OutputSize;
static CGparameter _cgp_timer;
static CGparameter _cgp_vertex_timer;
static bool gl_shader_init(void)
{
switch (g_settings.video.shader_type)
@ -480,6 +465,22 @@ static inline void set_texture_coords(GLfloat *coords, GLfloat xamt, GLfloat yam
coords[7] = yamt;
}
void gl_frame_menu (void)
{
gl_t *gl = g_gl;
g_frame_count++;
if(!gl)
return;
gl_shader_use(SSNES_CG_MENU_SHADER_INDEX);
gl_cg_set_params(gl->win_width, gl->win_height, gl->win_width,
gl->win_height, gl->win_width, gl->win_height, g_frame_count,
NULL, NULL, NULL, 0);
}
static bool gl_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg)
{
gl_t *gl = data;
@ -840,38 +841,6 @@ static bool psgl_init_device(gl_t *gl, const video_info_t *video, uint32_t resol
return true;
}
void psgl_init_menu_shader (void)
{
gl_t *gl = g_gl;
const char* args[] = { "-fastmath", "-unroll=all", "-ifcvt=all", 0 };
_vertexProgram = cgCreateProgramFromFile(gl->gl_context, CG_SOURCE, DEFAULT_MENU_SHADER_FILE, CG_PROFILE_SCE_VP_RSX,
"main_vertex", args);
cgGLLoadProgram(_vertexProgram);
_fragmentProgram = cgCreateProgramFromFile(gl->gl_context, CG_SOURCE, DEFAULT_MENU_SHADER_FILE, CG_PROFILE_SCE_FP_RSX,
"main_fragment", args);
cgGLLoadProgram(_fragmentProgram);
/* bind and enable the vertex and fragment programs*/
cgGLEnableProfile(CG_PROFILE_SCE_VP_RSX);
cgGLEnableProfile(CG_PROFILE_SCE_FP_RSX);
cgGLBindProgram(_vertexProgram);
cgGLBindProgram(_fragmentProgram);
/* acquire mvp param from v shader*/
_cgpModelViewProj = cgGetNamedParameter(_vertexProgram, "modelViewProj");
_cgpVideoSize = cgGetNamedParameter(_fragmentProgram, "IN.video_size");
_cgpTextureSize = cgGetNamedParameter(_fragmentProgram, "IN.texture_size");
_cgpOutputSize = cgGetNamedParameter(_fragmentProgram, "IN.output_size");
_cgp_vertex_VideoSize = cgGetNamedParameter(_vertexProgram, "IN.video_size");
_cgp_vertex_TextureSize = cgGetNamedParameter(_vertexProgram, "IN.texture_size");
_cgp_vertex_OutputSize = cgGetNamedParameter(_vertexProgram, "IN.output_size");
_cgp_timer = cgGetNamedParameter(_fragmentProgram, "IN.frame_count");
_cgp_vertex_timer = cgGetNamedParameter(_vertexProgram, "IN.frame_count");
}
static void psgl_init_dbgfont(gl_t *gl)
{
CellDbgFontConfig cfg;
@ -894,6 +863,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
if (!psgl_init_device(gl, video, 0))
return NULL;
SSNES_LOG("Detecting resolution %ux%u.\n", gl->win_width, gl->win_height);
video->vsync ? glEnable(GL_VSYNC_SCE) : glDisable(GL_VSYNC_SCE);
@ -902,9 +872,12 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
SSNES_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
SSNES_LOG("GL: Initing debug fonts \n");
SSNES_LOG("GL: Initializing debug fonts \n");
psgl_init_dbgfont(gl);
SSNES_LOG("Initializing menu shader\n");
gl_cg_set_menu_shader(DEFAULT_MENU_SHADER_FILE);
if (!gl_shader_init())
{
SSNES_ERR("Shader init failed.\n");
@ -1173,8 +1146,6 @@ void ps3_video_init(void)
video_info.input_scale = 2;
g_gl = gl_init(&video_info, NULL, NULL);
//SSNES_LOG("Initializing menu shader\n");
//psgl_init_menu_shader();
get_all_available_resolutions();
ps3_set_resolution();

View File

@ -31,6 +31,7 @@ const char * ps3_get_resolution_label(uint32_t resolution);
int ps3_check_resolution(uint32_t resolution_id);
void ps3_block_swap (void);
void ps3_unblock_swap (void);
void gl_frame_menu(void);
extern void *g_gl;