crt shader moved to the COnfig

This commit is contained in:
BADIM-PC\Vadim committed 2018-02-26 13:56:54 +03:00
1 parent 81153f627c
commit bb8ca0e0ab
10 files changed
+130 -198

No files matched your search

+1 -1
View File
@@ -251,7 +251,7 @@ bin/menu.o: src/menu.c $(TIC80_H) $(TIC_H)
bin/surf.o: src/surf.c $(TIC80_H) $(TIC_H)
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
bin/system.o: src/system.c src/keycodes.c src/ext/shader/* $(TIC80_H) $(TIC_H)
bin/system.o: src/system.c src/keycodes.c $(TIC80_H) $(TIC_H)
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
bin/chip.o: src/system/chip.c src/keycodes.c $(TIC80_H) $(TIC_H)
+1 -1
View File
@@ -1 +1 @@
0x78, 0xda, 0xed, 0x59, 0x5d, 0x68, 0x5b, 0xc9, 0x15, 0x1e, 0xe7, 0x67, 0xbb, 0x52, 0xdc, 0x8c, 0x05, 0x65, 0xe9, 0xcf, 0xb6, 0x11, 0xea, 0x3e, 0x38, 0x60, 0x13, 0xc5, 0x72, 0xd3, 0x62, 0x50, 0xa9, 0x22, 0xdd, 0x58, 0xea, 0xda, 0x92, 0xd1, 0xcf, 0xba, 0x21, 0xb0, 0xae, 0xea, 0xe8, 0x26, 0x06, 0xdb, 0xda, 0x5a, 0x4e, 0x43, 0xb7, 0xb8, 0x2c, 0x81, 0x05, 0xf5, 0xc9, 0x7d, 0x48, 0xa1, 0x7a, 0xd2, 0x96, 0xbc, 0xb9, 0x2f, 0x7d, 0xf1, 0x4b, 0xf5, 0x60, 0xba, 0x8f, 0x0b, 0x2d, 0x65, 0x29, 0x7d, 0x28, 0xcb, 0xbe, 0x94, 0xbe, 0x5e, 0xcf, 0x53, 0x68, 0x58, 0xc8, 0xf4, 0xcc, 0xdc, 0xb9, 0xd2, 0xdc, 0xb9, 0x67, 0x64, 0x17, 0xb6, 0x2d, 0x14, 0xcd, 0xcd, 0xf1, 0x99, 0x99, 0x73, 0xcf, 0x99,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, 0xf9, 0x04, 0xdc, 0xab, 0x11, 0xf2, 0xbd, 0x39, 0x92, 0x40, 0x8b, 0xe0, 0xfe, 0x84, 0xf1, 0x8f, 0x6d, 0x14, 0xdf, 0xdf, 0xc3, 0x55, 0xe4, 0xb0, 0xe0, 0x5e, 0x24, 0x99, 0x5f, 0xea, 0x3e, 0xde, 0x54, 0x94, 0x08, 0x1a, 0x32, 0x01, 0x7b, 0x4d, 0x8c, 0xae, 0x0b, 0xb3, 0x5e, 0x8d, 0xed, 0xe3, 0x8a, 0xbd, 0x5d, 0xaf, 0x1f, 0xa6, 0xc0, 0xec, 0x45, 0x89, 0xa0, 0xc3, 0x6d, 0x1c, 0x86, 0x0b, 0xa6, 0x50, 0x3f, 0x34, 0x99, 0xbe, 0x4b, 0xbd, 0xb5, 0x4a, 0x0c, 0xdf, 0x0d, 0xec, 0x13, 0xf5, 0x8f, 0xde, 0xbe, 0x8a, 0x94, 0xff, 0xe0, 0Line truncated
BIN
View File
Binary file not shown.
+31
View File
@@ -76,6 +76,31 @@ static void readConfigShowSync(Config* config, lua_State* lua)
lua_pop(lua, 1);
}
static void readConfigCrtMonitor(Config* config, lua_State* lua)
{
lua_getglobal(lua, "CRT_MONITOR");
if(lua_isboolean(lua, -1))
config->data.crtMonitor = lua_toboolean(lua, -1);
lua_pop(lua, 1);
}
static void readConfigCrtShader(Config* config, lua_State* lua)
{
lua_getglobal(lua, "CRT_SHADER");
if(lua_isstring(lua, -1))
{
if(!config->data.crtShader)
config->data.crtShader = calloc(1, sizeof(tic_code));
strcpy((char*)config->data.crtShader, lua_tostring(lua, -1));
}
lua_pop(lua, 1);
}
static void readCursorTheme(Config* config, lua_State* lua)
{
lua_getfield(lua, -1, "CURSOR");
@@ -222,9 +247,15 @@ static void readConfig(Config* config)
readConfigCheckNewVersion(config, lua);
readConfigNoSound(config, lua);
readConfigShowSync(config, lua);
readConfigCrtMonitor(config, lua);
readTheme(config, lua);
}
if(luaL_loadstring(lua, config->tic->config.bank1.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
{
readConfigCrtShader(config, lua);
}
lua_close(lua);
}
}
+2 -2
View File
@@ -277,9 +277,9 @@ static bool AddLoop(GifFileType *gif)
static const u8* toColor(const u8* ptr, gif_color* color)
{
color->b = *ptr++;
color->g = *ptr++;
color->r = *ptr++;
color->g = *ptr++;
color->b = *ptr++;
ptr++;
return ptr;
-133
View File
@@ -1,133 +0,0 @@
SHADER(#version 100\n
precision highp float;
varying vec2 texCoord;
uniform sampler2D source;
uniform float trg_x;
uniform float trg_y;
uniform float trg_w;
uniform float trg_h;
uniform float scr_w;
uniform float scr_h;
// Emulated input resolution.
vec2 res=vec2(256.0,144.0);
// Hardness of scanline.
// -8.0 = soft
// -16.0 = medium
float hardScan=-8.0;
// Hardness of pixels in scanline.
// -2.0 = soft
// -4.0 = hard
float hardPix=-3.0;
// Display warp.
// 0.0 = none
// 1.0/8.0 = extreme
vec2 warp=vec2(1.0/32.0,1.0/24.0);
// Amount of shadow mask.
float maskDark=0.5;
float maskLight=1.5;
//------------------------------------------------------------------------
// sRGB to Linear.
// Assuing using sRGB typed textures this should not be needed.
float ToLinear1(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);}
vec3 ToLinear(vec3 c){return vec3(ToLinear1(c.r),ToLinear1(c.g),ToLinear1(c.b));}
// Linear to sRGB.
// Assuing using sRGB typed textures this should not be needed.
float ToSrgb1(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);}
vec3 ToSrgb(vec3 c){return vec3(ToSrgb1(c.r),ToSrgb1(c.g),ToSrgb1(c.b));}
// Nearest emulated sample given floating point position and texel offset.
// Also zero's off screen.
vec3 Fetch(vec2 pos,vec2 off){
pos=(floor(pos*res+off)+vec2(0.5,0.5))/res;
return ToLinear(1.2 * texture2D(source,pos.xy,-16.0).rgb);}
// Distance in emulated pixels to nearest texel.
vec2 Dist(vec2 pos){pos=pos*res;return -((pos-floor(pos))-vec2(0.5));}
// 1D Gaussian.
float Gaus(float pos,float scale){return exp2(scale*pos*pos);}
// 3-tap Gaussian filter along horz line.
vec3 Horz3(vec2 pos,float off){
vec3 b=Fetch(pos,vec2(-1.0,off));
vec3 c=Fetch(pos,vec2( 0.0,off));
vec3 d=Fetch(pos,vec2( 1.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=hardPix;
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
// Return filtered sample.
return (b*wb+c*wc+d*wd)/(wb+wc+wd);}
// 5-tap Gaussian filter along horz line.
vec3 Horz5(vec2 pos,float off){
vec3 a=Fetch(pos,vec2(-2.0,off));
vec3 b=Fetch(pos,vec2(-1.0,off));
vec3 c=Fetch(pos,vec2( 0.0,off));
vec3 d=Fetch(pos,vec2( 1.0,off));
vec3 e=Fetch(pos,vec2( 2.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=hardPix;
float wa=Gaus(dst-2.0,scale);
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
float we=Gaus(dst+2.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we)/(wa+wb+wc+wd+we);}
// Return scanline weight.
float Scan(vec2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,hardScan);}
// Allow nearest three lines to effect pixel.
vec3 Tri(vec2 pos){
vec3 a=Horz3(pos,-1.0);
vec3 b=Horz5(pos, 0.0);
vec3 c=Horz3(pos, 1.0);
float wa=Scan(pos,-1.0);
float wb=Scan(pos, 0.0);
float wc=Scan(pos, 1.0);
return a*wa+b*wb+c*wc;}
// Distortion of scanlines, and end of screen alpha.
vec2 Warp(vec2 pos){
pos=pos*2.0-1.0;
pos*=vec2(1.0+(pos.y*pos.y)*warp.x,1.0+(pos.x*pos.x)*warp.y);
return pos*0.5+0.5;}
// Shadow mask.
vec3 Mask(vec2 pos){
pos.x+=pos.y*3.0;
vec3 mask=vec3(maskDark,maskDark,maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=maskLight;
else if(pos.x<0.666)mask.g=maskLight;
else mask.b=maskLight;
return mask;}
void main() {
hardScan=-12.0;
// maskDark=maskLight;
vec2 start=gl_FragCoord.xy-vec2(trg_x, trg_y);
start.y=scr_h-start.y;
vec2 pos=Warp(start/vec2(trg_w, trg_h));
gl_FragColor.rgb=Tri(pos)*Mask(gl_FragCoord.xy);
gl_FragColor = vec4(ToSrgb(gl_FragColor.rgb), 1.0);
})
+4 -1
View File
@@ -1637,8 +1637,9 @@ void studioConfigChanged()
if(code->update)
code->update(code);
// initTouchGamepad();
updateSystemFont();
getSystem()->updateConfig();
}
u32 unzip(u8** dest, const u8* source, size_t size)
@@ -1764,6 +1765,8 @@ static void studioTick()
static void studioClose()
{
free((void*)getConfig()->crtShader);
{
for(s32 i = 0; i < TIC_EDITOR_BANKS; i++)
{
+75 -60
View File
@@ -12,7 +12,7 @@
#include <emscripten.h>
#endif
#define STUDIO_UI_SCALE 4
#define STUDIO_UI_SCALE 3
#define STUDIO_PIXEL_FORMAT GPU_FORMAT_RGBA
#define TEXTURE_SIZE (TIC80_FULLWIDTH)
#define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2)
@@ -30,7 +30,6 @@ static struct
GPU_Image* texture;
u32 shader;
GPU_ShaderBlock block;
bool useShader;
} gpu;
struct
@@ -212,7 +211,7 @@ static void calcTextureRect(SDL_Rect* rect)
{
SDL_GetWindowSize(platform.window, &rect->w, &rect->h);
if(platform.gpu.useShader)
if(platform.studio->config()->crtMonitor)
{
enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT};
@@ -279,7 +278,7 @@ static void processMouse()
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
if(platform.gpu.useShader)
if(platform.studio->config()->crtMonitor)
{
if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_FULLWIDTH / rect.w - OFFSET_LEFT;
if(rect.h) input->mouse.y = (my - rect.y) * TIC80_FULLHEIGHT / rect.h - OFFSET_TOP;
@@ -946,6 +945,73 @@ static void preseed()
#endif
}
static void loadCrtShader()
{
static const char* VertexShader = "#version 100\n\
precision highp float;\n\
precision mediump int;\n\
attribute vec2 gpu_Vertex;\n\
attribute vec2 gpu_TexCoord;\n\
attribute mediump vec4 gpu_Color;\n\
uniform mat4 gpu_ModelViewProjectionMatrix;\n\
varying mediump vec4 color;\n\
varying vec2 texCoord;\n\
void main(void)\n\
{\n\
color = gpu_Color;\n\
texCoord = vec2(gpu_TexCoord);\n\
gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 0.0, 1.0);\n\
}";
u32 vertex = GPU_CompileShader(GPU_VERTEX_SHADER, VertexShader);
if(!vertex)
{
char msg[1024];
sprintf(msg, "Failed to load vertex shader: %s\n", GPU_GetShaderMessage());
showMessageBox("Error", msg);
return;
}
u32 fragment = GPU_CompileShader(GPU_PIXEL_SHADER, platform.studio->config()->crtShader);
if(!fragment)
{
char msg[1024];
sprintf(msg, "Failed to load fragment shader: %s\n", GPU_GetShaderMessage());
showMessageBox("Error", msg);
return;
}
if(platform.gpu.shader)
GPU_FreeShaderProgram(platform.gpu.shader);
platform.gpu.shader = GPU_LinkShaders(vertex, fragment);
if(platform.gpu.shader)
{
platform.gpu.block = GPU_LoadShaderBlock(platform.gpu.shader, "gpu_Vertex", "gpu_TexCoord", "gpu_Color", "gpu_ModelViewProjectionMatrix");
GPU_ActivateShaderProgram(platform.gpu.shader, &platform.gpu.block);
}
else
{
char msg[1024];
sprintf(msg, "Failed to link shader program: %s\n", GPU_GetShaderMessage());
showMessageBox("Error", msg);
}
}
static void updateConfig()
{
if(platform.gpu.screen)
{
initTouchGamepad();
if(platform.studio->config()->crtMonitor)
loadCrtShader();
}
}
static System systemInterface =
{
.setClipboardText = setClipboardText,
@@ -966,6 +1032,7 @@ static System systemInterface =
.openSystemPath = openSystemPath,
.preseed = preseed,
.poll = pollEvent,
.updateConfig = updateConfig,
};
static void gpuTick()
@@ -990,7 +1057,7 @@ static void gpuTick()
GPU_UpdateImageBytes(platform.gpu.texture, NULL, (const u8*)tic->screen, TIC80_FULLWIDTH * sizeof(u32));
{
if(platform.gpu.useShader)
if(platform.studio->config()->crtMonitor && platform.gpu.shader)
{
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
@@ -1012,10 +1079,11 @@ static void gpuTick()
GPU_BlitScale(platform.gpu.texture, NULL, platform.gpu.screen, rect.x, rect.y,
(float)rect.w / TIC80_FULLWIDTH, (float)rect.h / TIC80_FULLHEIGHT);
GPU_ActivateShaderProgram(0, NULL);
GPU_DeactivateShaderProgram();
}
else
{
GPU_DeactivateShaderProgram();
blitGpuTexture(platform.gpu.screen, platform.gpu.texture);
}
}
@@ -1077,57 +1145,6 @@ static void emsGpuTick()
#endif
#define SHADER(...) #__VA_ARGS__
static void loadCrtShader()
{
static const char* VertexShader = "#version 100\n\
precision highp float;\n\
precision mediump int;\n\
attribute vec2 gpu_Vertex;\n\
attribute vec2 gpu_TexCoord;\n\
attribute mediump vec4 gpu_Color;\n\
uniform mat4 gpu_ModelViewProjectionMatrix;\n\
varying mediump vec4 color;\n\
varying vec2 texCoord;\n\
void main(void)\n\
{\n\
color = gpu_Color;\n\
texCoord = vec2(gpu_TexCoord);\n\
gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 0.0, 1.0);\n\
}";
u32 vertex = GPU_CompileShader(GPU_VERTEX_SHADER, VertexShader);
if(!vertex)
{
GPU_LogError("Failed to load vertex shader: %s\n", GPU_GetShaderMessage());
return;
}
static const char* PixelShader =
#include "ext/shader/crt-lottes.frag"
;
u32 fragment = GPU_CompileShader(GPU_PIXEL_SHADER, PixelShader);
if(!fragment)
{
GPU_LogError("Failed to load fragment shader: %s\n", GPU_GetShaderMessage());
return;
}
platform.gpu.shader = GPU_LinkShaders(vertex, fragment);
if(platform.gpu.shader)
{
platform.gpu.block = GPU_LoadShaderBlock(platform.gpu.shader, "gpu_Vertex", "gpu_TexCoord", "gpu_Color", "gpu_ModelViewProjectionMatrix");
GPU_ActivateShaderProgram(platform.gpu.shader, &platform.gpu.block);
}
else
GPU_LogError("Failed to link shader program: %s\n", GPU_GetShaderMessage());
}
static s32 start(s32 argc, char **argv, const char* folder)
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
@@ -1155,9 +1172,7 @@ static s32 start(s32 argc, char **argv, const char* folder)
GPU_SetAnchor(platform.gpu.texture, 0, 0);
GPU_SetImageFilter(platform.gpu.texture, GPU_FILTER_NEAREST);
platform.gpu.useShader = true;
if(platform.gpu.useShader)
if(platform.studio->config()->crtMonitor)
loadCrtShader();
#if defined(__EMSCRIPTEN__)
+5
View File
@@ -25,6 +25,8 @@ typedef struct
void (*preseed)();
void (*poll)();
void (*updateConfig)();
} System;
typedef struct
@@ -67,6 +69,9 @@ typedef struct
bool checkNewVersion;
bool noSound;
bool showSync;
bool crtMonitor;
const char* crtShader;
} StudioConfig;
+11
View File
@@ -339,8 +339,19 @@ typedef struct
typedef struct
{
union
{
struct
{
tic_bank bank0;
tic_bank bank1;
tic_bank bank2;
tic_bank bank3;
tic_bank bank4;
tic_bank bank5;
tic_bank bank6;
tic_bank bank7;
};
tic_bank banks[TIC_BANKS];
};