mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 22:20:31 +00:00
Updates interface for use with CRT shader. Should work with any reso
now. :)
This commit is contained in:
parent
ea4aad7b07
commit
7fa5ec216a
2
config.h
2
config.h
@ -65,7 +65,7 @@ static const bool vsync = true;
|
|||||||
static const bool video_smooth = false;
|
static const bool video_smooth = false;
|
||||||
|
|
||||||
// Path to custom Cg shader. If using custom shaders, it is recommended to disable video_smooth and VIDEO_FILTER.
|
// Path to custom Cg shader. If using custom shaders, it is recommended to disable video_smooth and VIDEO_FILTER.
|
||||||
static const char *cg_shader_path = "hqflt/HDR-TV.cg";
|
static const char *cg_shader_path = "hqflt/crt.cg";
|
||||||
|
|
||||||
// On resize and fullscreen, rendering area will stay 4:3
|
// On resize and fullscreen, rendering area will stay 4:3
|
||||||
static const bool force_aspect = true;
|
static const bool force_aspect = true;
|
||||||
|
13
gl.c
13
gl.c
@ -31,11 +31,12 @@
|
|||||||
static CGcontext cgCtx;
|
static CGcontext cgCtx;
|
||||||
static CGprogram cgPrg;
|
static CGprogram cgPrg;
|
||||||
static CGprofile cgVProf;
|
static CGprofile cgVProf;
|
||||||
|
|
||||||
|
static CGparameter cg_video_size, cg_texture_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Lots of globals, yes I know. :(
|
// Lots of globals, yes I know. :(
|
||||||
static GLuint texture;
|
static GLuint texture;
|
||||||
static uint8_t *gl_buffer;
|
|
||||||
static bool keep_aspect = true;
|
static bool keep_aspect = true;
|
||||||
static GLuint tex_filter;
|
static GLuint tex_filter;
|
||||||
|
|
||||||
@ -232,6 +233,11 @@ static bool gl_frame(void *data, const uint16_t* frame, int width, int height, i
|
|||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
#if HAVE_CG
|
||||||
|
cgGLSetParameter2f(cg_video_size, width, height);
|
||||||
|
cgGLSetParameter2f(cg_texture_size, width, height);
|
||||||
|
#endif
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> 1);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> 1);
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
glTexImage2D(GL_TEXTURE_2D,
|
||||||
0, GL_RGBA, width, height, 0, GL_BGRA,
|
0, GL_RGBA, width, height, 0, GL_BGRA,
|
||||||
@ -253,7 +259,6 @@ static void gl_free(void *data)
|
|||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glDeleteTextures(1, &texture);
|
glDeleteTextures(1, &texture);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
free(gl_buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl_set_nonblock_state(void *data, bool state)
|
static void gl_set_nonblock_state(void *data, bool state)
|
||||||
@ -348,6 +353,10 @@ static void* gl_init(video_info_t *video, const input_driver_t **input)
|
|||||||
cgGLLoadProgram(cgPrg);
|
cgGLLoadProgram(cgPrg);
|
||||||
cgGLEnableProfile(cgVProf);
|
cgGLEnableProfile(cgVProf);
|
||||||
cgGLBindProgram(cgPrg);
|
cgGLBindProgram(cgPrg);
|
||||||
|
|
||||||
|
cg_video_size = cgGetNamedParameter(cgPrg, "IN.video_size");
|
||||||
|
cg_texture_size = cgGetNamedParameter(cgPrg, "IN.texture_size");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*input = &input_glfw;
|
*input = &input_glfw;
|
||||||
|
16
hqflt/crt.cg
16
hqflt/crt.cg
@ -11,10 +11,12 @@ struct output
|
|||||||
float4 color : COLOR;
|
float4 color : COLOR;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct input
|
||||||
|
{
|
||||||
|
float2 video_size;
|
||||||
|
float2 texture_size;
|
||||||
|
};
|
||||||
|
|
||||||
//uniform float2 rubyInputSize;
|
|
||||||
//uniform float2 rubyOutputSize;
|
|
||||||
//uniform float2 rubyTextureSize;
|
|
||||||
|
|
||||||
float2 fract(float2 v)
|
float2 fract(float2 v)
|
||||||
{
|
{
|
||||||
@ -32,13 +34,13 @@ float2 barrelDistortion(float2 coord) {
|
|||||||
return coord + cc * (dist + distortion * dist * dist) * distortion;
|
return coord + cc * (dist + distortion * dist * dist) * distortion;
|
||||||
}
|
}
|
||||||
|
|
||||||
output main(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXUNIT0)
|
output main(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXUNIT0, uniform input IN)
|
||||||
{
|
{
|
||||||
output OUT;
|
output OUT;
|
||||||
|
|
||||||
float2 rubyInputSize = float2(256, 224);
|
float2 rubyInputSize = IN.video_size;
|
||||||
float2 rubyOutputSize = float2(256, 224);
|
float2 rubyOutputSize = IN.video_size;
|
||||||
float2 rubyTextureSize = float2(256, 224);
|
float2 rubyTextureSize = IN.texture_size;
|
||||||
|
|
||||||
float2 xy = barrelDistortion(texCoord.xy);
|
float2 xy = barrelDistortion(texCoord.xy);
|
||||||
float2 one = 1.0/rubyTextureSize;
|
float2 one = 1.0/rubyTextureSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user