mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Add PSP color shader
This adds the PSP color shader ported from RetroArch courtesy from @jdgleaver (https://forums.ppsspp.org/showthread.php?tid=6594&pid=130635#pid130635) to PPSSPP Also updated with up to date changes found here (https://github.com/libretro/glsl-shaders/blob/master/handheld/shaders/color/psp-color.glsl)
This commit is contained in:
parent
0d3a5a27aa
commit
0f34a7427b
58
assets/shaders/psp_color.fsh
Normal file
58
assets/shaders/psp_color.fsh
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
psp_color vertex shader
|
||||
|
||||
Original code written by hunterk, modified by Pokefan531 and
|
||||
released into the public domain
|
||||
|
||||
'Ported' (i.e. copy/paste) to PPSSPP format by jdgleaver
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
Notes: This shader replicates the LCD dynamics of the PSP 1000 and PSP 2000
|
||||
*/
|
||||
|
||||
//================
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
// For android, use this instead...
|
||||
//precision highp float;
|
||||
//precision highp int;
|
||||
//
|
||||
#endif
|
||||
|
||||
//================
|
||||
#define target_gamma 2.21
|
||||
#define display_gamma 2.2
|
||||
#define r 0.98
|
||||
#define g 0.795
|
||||
#define b 0.98
|
||||
#define rg 0.04
|
||||
#define rb 0.01
|
||||
#define gr 0.20
|
||||
#define gb 0.01
|
||||
#define br -0.18
|
||||
#define bg 0.165
|
||||
|
||||
//================
|
||||
uniform sampler2D sampler0;
|
||||
varying vec2 v_texcoord0;
|
||||
|
||||
//================
|
||||
void main()
|
||||
{
|
||||
// Apply colour correction
|
||||
vec3 screen = pow(texture2D(sampler0, v_texcoord0.xy).rgb, vec3(target_gamma));
|
||||
screen = clamp(screen, 0.0, 1.0);
|
||||
screen = pow(
|
||||
mat3(r, rg, rb,
|
||||
gr, g, gb,
|
||||
br, bg, b) * screen,
|
||||
vec3(1.0 / display_gamma)
|
||||
);
|
||||
|
||||
gl_FragColor = vec4(screen, 1.0);
|
||||
}
|
6
assets/shaders/psp_color.ini
Normal file
6
assets/shaders/psp_color.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[PSP Color]
|
||||
Name=PSP Color
|
||||
Author=hunterk, Pokefan531 (ported by jdgleaver)
|
||||
Fragment=psp_color.fsh
|
||||
Vertex=psp_color.vsh
|
||||
OutputResolution=True
|
23
assets/shaders/psp_color.vsh
Normal file
23
assets/shaders/psp_color.vsh
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
psp_color vertex shader
|
||||
|
||||
Original code written by hunterk, modified by Pokefan531 and
|
||||
released into the public domain
|
||||
|
||||
'Ported' (i.e. copy/paste) to PPSSPP format by jdgleaver
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
*/
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texcoord0;
|
||||
varying vec2 v_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
v_texcoord0 = a_texcoord0; // + 0.000001; // HLSL precision workaround (is this needed???)
|
||||
gl_Position = a_position;
|
||||
}
|
Loading…
Reference in New Issue
Block a user