This commit is contained in:
Themaister 2010-11-24 15:45:07 +01:00
parent 3835100101
commit ed9e0d746a
4 changed files with 76 additions and 31 deletions

View File

@ -4,7 +4,7 @@ TARGET = ssnes
DEFINES =
OBJ = ssnes.o
libsnes = -lsnes
libsnes = libsnes.a
LIBS = -lsamplerate $(libsnes)
@ -46,7 +46,7 @@ ifeq ($(BUILD_FILTER), 1)
OBJ += hqflt/snes_ntsc/snes_ntsc.o
endif
CFLAGS = -Wall -O3 -march=native -std=gnu99 -Wno-unused-variable -I. $(DEFINES)
CFLAGS = -Wall -O3 -std=gnu99 -Wno-unused-variable -I. $(DEFINES) -fprofile-use
all: $(TARGET)

View File

@ -41,7 +41,7 @@
// Chooses which video and audio subsystem to use. Remember to update config.mk if you change these.
#define VIDEO_DRIVER VIDEO_GL
#define AUDIO_DRIVER AUDIO_ALSA
#define AUDIO_DRIVER AUDIO_RSOUND
////////////////
@ -54,14 +54,14 @@ static const float yscale = 3.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.
#ifdef HAVE_CG
@ -93,7 +93,7 @@ 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.
@ -103,7 +103,7 @@ static const unsigned in_rate = 31950;
static const char* audio_device = NULL;
// 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 = 32;
// Will sync audio. (recommended)
static const bool audio_sync = true;

View File

@ -3,9 +3,9 @@ BUILD_OPENGL = 1
BUILD_CG = 1
BUILD_FILTER = 0
BUILD_RSOUND = 0
BUILD_RSOUND = 1
BUILD_OSS = 0
BUILD_ALSA = 1
BUILD_ALSA = 0
BUILD_ROAR = 0
BUILD_AL = 0

View File

@ -1,21 +1,62 @@
/* Default Vertex shader */
void main_vertex
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
};
struct VERTEX_OUTPUT
{
float4 position : POSITION;
float4 color : COLOR;
float2 texCoord : TEXCOORD0;
float4 t1 : TEXCOORD1;
float4 t2 : TEXCOORD2;
float4 t3 : TEXCOORD3;
float4 t4 : TEXCOORD4;
};
struct VERTEX_INPUT
{
float4 position : POSITION;
float4 color : COLOR;
float2 CT : TEXCOORD0;
float4 t1 : TEXCOORD1;
float4 t2 : TEXCOORD2;
float4 t3 : TEXCOORD3;
float4 t4 : TEXCOORD4;
};
VERTEX_OUTPUT main_vertex
(
float4 position : POSITION,
float4 color : COLOR,
float2 texCoord : TEXCOORD0,
uniform float4x4 modelViewProj,
out float4 oPosition : POSITION,
out float4 oColor : COLOR,
out float2 otexCoord : TEXCOORD
uniform input IN
)
{
oPosition = mul(modelViewProj, position);
oColor = color;
otexCoord = texCoord;
VERTEX_OUTPUT OUT;
OUT.position = mul(modelViewProj, position);
OUT.color = color;
OUT.texCoord = texCoord;
float2 ps = float2(1.0/IN.texture_size.x, 1.0/IN.texture_size.y);
float dx = ps.x;
float dy = ps.y;
OUT.texCoord = texCoord;
OUT.t1.xy = texCoord + float2(-dx, 0);
OUT.t2.xy = texCoord + float2( dx, 0);
OUT.t3.xy = texCoord + float2( 2 * dx, 0);
OUT.t4.xy = texCoord + float2( 0, dy);
OUT.t1.zw = texCoord + float2(-dx,-dy);
OUT.t2.zw = texCoord + float2(-dx, dy);
OUT.t3.zw = texCoord + float2( 2 * dx, dy);
OUT.t4.zw = texCoord + float2( dx, dy);
return OUT;
}
#define TEX2D(c) tex2D(decal,(c))
@ -29,12 +70,6 @@ struct output
float4 color : COLOR;
};
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
};
float2 barrelDistortion(float2 coord)
{
@ -43,7 +78,7 @@ float2 barrelDistortion(float2 coord)
return coord + cc * (dist + distortion * dist * dist) * distortion;
}
output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXUNIT0, uniform input IN)
output main_fragment(in VERTEX_INPUT VAR, uniform sampler2D decal : TEXUNIT0, uniform input IN)
{
output OUT;
@ -51,10 +86,11 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU
float2 rubyOutputSize = IN.output_size;
float2 rubyTextureSize = IN.texture_size;
float2 xy = barrelDistortion(texCoord.xy);
float2 one = 1.0/rubyTextureSize;
xy = xy + float2(0.0 , -0.5 * (phase + (1-phase) * rubyInputSize.y/rubyOutputSize.y) * one.y);
//float2 xy = barrelDistortion(texCoord.xy);
//float2 one = 1.0/rubyTextureSize;
//xy = xy + float2(0.0 , -0.5 * (phase + (1-phase) * rubyInputSize.y/rubyOutputSize.y) * one.y);
float4 texels[8];
/*
texels[0] = TEX2D(xy + float2(-one.x,0.0));
texels[1] = TEX2D(xy);
texels[2] = TEX2D(xy + float2(one.x, 0.0));
@ -63,9 +99,18 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU
texels[5] = TEX2D(xy + float2(0.0, one.y));
texels[6] = TEX2D(xy + one);
texels[7] = TEX2D(xy + float2(2 * one.x, one.y));
*/
texels[0] = TEX2D(VAR.t1.xy);
texels[1] = TEX2D(VAR.CT);
texels[2] = TEX2D(VAR.t2.xy);
texels[3] = TEX2D(VAR.t3.xy);
texels[4] = TEX2D(VAR.t2.zw);
texels[5] = TEX2D(VAR.t4.xy);
texels[6] = TEX2D(VAR.t4.zw);
texels[7] = TEX2D(VAR.t3.zw);
float2 uv_ratio = frac(xy*rubyTextureSize);
float2 uv_ratio = frac(VAR.CT * rubyTextureSize);
float4 col, col2;
@ -86,7 +131,7 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU
weights2 = 0.51*exp(-pow(weights2*sqrt(2/wid),wid))/0.3/(0.6+0.2*wid);
float4 mcol = 1.0;
if ( fmod(xy.x*rubyOutputSize.x,2.0) < 1.0)
if ( fmod(VAR.CT.x*rubyOutputSize.x,2.0) < 1.0)
mcol.g = 0.7;
else
mcol.rb = 0.7;