Adds output size param. Should map closely to bsnes shaders now.

This commit is contained in:
Themaister 2010-11-13 12:42:07 +01:00
parent ccc73ccbdb
commit 0ae1456325
4 changed files with 16 additions and 10 deletions

View File

@ -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;

View File

@ -1,6 +1,6 @@
BUILD_OPENGL = 1
BUILD_CG = 0
BUILD_CG = 1
BUILD_FILTER = 0
BUILD_RSOUND = 0

7
gl.c
View File

@ -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

View File

@ -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);