From 0ae1456325ab5bd861485e1742e90b99fac66cde Mon Sep 17 00:00:00 2001 From: Themaister Date: Sat, 13 Nov 2010 12:42:07 +0100 Subject: [PATCH] Adds output size param. Should map closely to bsnes shaders now. --- config.h | 14 +++++++------- config.mk | 2 +- gl.c | 7 ++++++- hqflt/crt.cg | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/config.h b/config.h index f605281bb8..7054520099 100644 --- a/config.h +++ b/config.h @@ -55,17 +55,17 @@ static const float yscale = 4.0; // Real y res = 224 * yscale // Fullscreen static bool fullscreen = false; // To start in Fullscreen or not -static const unsigned fullscreen_x = 1280; -static const unsigned fullscreen_y = 720; +static const unsigned fullscreen_x = 1920; +static const unsigned fullscreen_y = 1200; // Video VSYNC (recommended) static const bool vsync = true; // Smooths picture -static const bool video_smooth = true; +static const bool video_smooth = false; // Path to custom Cg shader. If using custom shaders, it is recommended to disable video_smooth. -static const char *cg_shader_path = "hqflt/crt.cg"; +static const char *cg_shader_path = "hqflt/hq2x.cg"; // On resize and fullscreen, rendering area will stay 4:3 static const bool force_aspect = true; @@ -91,17 +91,17 @@ static const bool force_aspect = true; static const bool audio_enable = true; // Output samplerate -static const unsigned out_rate = 48000; +static const unsigned out_rate = 96000; // Input samplerate from libSNES. // Lower this (slightly) if you are experiencing frequent audio dropouts while vsync is enabled. static const unsigned in_rate = 31950; // Audio device (e.g. hw:0,0 or /dev/audio). If NULL, will use defaults. -static const char* audio_device = NULL; +static const char* audio_device = "hw:0"; // Desired audio latency in milliseconds. Might not be honored if driver can't provide given latency. -static const int out_latency = 64; +static const int out_latency = 8; // Will sync audio. (recommended) static const bool audio_sync = true; diff --git a/config.mk b/config.mk index 64e9c95494..6907ff9c5b 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,6 @@ BUILD_OPENGL = 1 -BUILD_CG = 0 +BUILD_CG = 1 BUILD_FILTER = 0 BUILD_RSOUND = 0 diff --git a/gl.c b/gl.c index 03b45d41c4..e73c23bcb6 100644 --- a/gl.c +++ b/gl.c @@ -48,6 +48,7 @@ static bool keep_aspect = true; #ifdef HAVE_CG static CGparameter cg_mvp_matrix; #endif +static GLuint gl_width = 0, gl_height = 0; typedef struct gl { bool vsync; @@ -57,7 +58,7 @@ typedef struct gl CGprogram cgVPrg; CGprofile cgFProf; CGprofile cgVProf; - CGparameter cg_video_size, cg_texture_size; + CGparameter cg_video_size, cg_texture_size, cg_output_size; #endif GLuint texture; GLuint tex_filter; @@ -194,6 +195,8 @@ static void GLFWCALL resize(int width, int height) #ifdef HAVE_CG cgGLSetStateMatrixParameter(cg_mvp_matrix, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); #endif + gl_width = width; + gl_height = height; } static float tv_to_fps(const struct timeval *tv, const struct timeval *new_tv, int frames) @@ -239,6 +242,7 @@ static bool gl_frame(void *data, const uint16_t* frame, int width, int height, i #if HAVE_CG cgGLSetParameter2f(gl->cg_video_size, width, height); cgGLSetParameter2f(gl->cg_texture_size, width, height); + cgGLSetParameter2f(gl->cg_output_size, gl_width, gl_height); #endif glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> 1); @@ -366,6 +370,7 @@ static void* gl_init(video_info_t *video, const input_driver_t **input) gl->cg_video_size = cgGetNamedParameter(gl->cgFPrg, "IN.video_size"); gl->cg_texture_size = cgGetNamedParameter(gl->cgFPrg, "IN.texture_size"); + gl->cg_output_size = cgGetNamedParameter(gl->cgFPrg, "IN.output_size"); cg_mvp_matrix = cgGetNamedParameter(gl->cgVPrg, "modelViewProj"); cgGLSetStateMatrixParameter(cg_mvp_matrix, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); #endif diff --git a/hqflt/crt.cg b/hqflt/crt.cg index e63b472505..1823c8cd63 100644 --- a/hqflt/crt.cg +++ b/hqflt/crt.cg @@ -33,6 +33,7 @@ struct input { float2 video_size; float2 texture_size; + float2 output_size; }; @@ -58,7 +59,7 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU output OUT; float2 rubyInputSize = IN.video_size; - float2 rubyOutputSize = IN.video_size; + float2 rubyOutputSize = IN.output_size; float2 rubyTextureSize = IN.texture_size; float2 xy = barrelDistortion(texCoord.xy);