24 September 2012, 10:44 | #1 |
Registered User
Join Date: Sep 2012
Location: Nantes - France
Posts: 138
|
HQ2X Shader lost when changing Fullscreen / Windowed mode [Solved]
Hi, here is another problem I found in FS-UAE (correction have been made with this thread) so I keep reporting bugs I find.
Here is a configuration file Code:
[config] amiga_model = A500 kickstart_file = Kickstart v1.3 rev 34.5 (1987)(Commodore)(A500-A1000-A2000-CDTV).zip kickstarts_dir = .\kickstarts\ window_width = 752 window_height = 572 fsaa = 4 keep_aspect = 1 video_sync_method = finish-swap-finish floppies_dir = .\floppies\ chip_memory = 1024 slow_memory = 512 fast_memory = 4096 keyboard_key_lctrl = action_joy_1_fire_button fullscreen_mode = fullscreen-window shader = HQ2x.OpenGL.shader Code:
<?xml version="1.0" encoding="UTF-8"?> <shader language="GLSL"> <vertex><![CDATA[ uniform vec2 rubyTextureSize; void main() { float x = 0.5 * (1.0 / rubyTextureSize.x); float y = 0.5 * (1.0 / rubyTextureSize.y); vec2 dg1 = vec2( x, y); vec2 dg2 = vec2(-x, y); vec2 dx = vec2(x, 0.0); vec2 dy = vec2(0.0, y); gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0; gl_TexCoord[1].xy = gl_TexCoord[0].xy - dg1; gl_TexCoord[1].zw = gl_TexCoord[0].xy - dy; gl_TexCoord[2].xy = gl_TexCoord[0].xy - dg2; gl_TexCoord[2].zw = gl_TexCoord[0].xy + dx; gl_TexCoord[3].xy = gl_TexCoord[0].xy + dg1; gl_TexCoord[3].zw = gl_TexCoord[0].xy + dy; gl_TexCoord[4].xy = gl_TexCoord[0].xy + dg2; gl_TexCoord[4].zw = gl_TexCoord[0].xy - dx; } ]]></vertex> <fragment filter="linear"><![CDATA[ uniform sampler2D rubyTexture; const float mx = 0.325; // start smoothing wt. const float k = -0.250; // wt. decrease factor const float max_w = 0.25; // max filter weigth const float min_w =-0.05; // min filter weigth const float lum_add = 0.25; // effects smoothing void main() { vec3 c00 = texture2D(rubyTexture, gl_TexCoord[1].xy).xyz; vec3 c10 = texture2D(rubyTexture, gl_TexCoord[1].zw).xyz; vec3 c20 = texture2D(rubyTexture, gl_TexCoord[2].xy).xyz; vec3 c01 = texture2D(rubyTexture, gl_TexCoord[4].zw).xyz; vec3 c11 = texture2D(rubyTexture, gl_TexCoord[0].xy).xyz; vec3 c21 = texture2D(rubyTexture, gl_TexCoord[2].zw).xyz; vec3 c02 = texture2D(rubyTexture, gl_TexCoord[4].xy).xyz; vec3 c12 = texture2D(rubyTexture, gl_TexCoord[3].zw).xyz; vec3 c22 = texture2D(rubyTexture, gl_TexCoord[3].xy).xyz; vec3 dt = vec3(1.0, 1.0, 1.0); float md1 = dot(abs(c00 - c22), dt); float md2 = dot(abs(c02 - c20), dt); float w1 = dot(abs(c22 - c11), dt) * md2; float w2 = dot(abs(c02 - c11), dt) * md1; float w3 = dot(abs(c00 - c11), dt) * md2; float w4 = dot(abs(c20 - c11), dt) * md1; float t1 = w1 + w3; float t2 = w2 + w4; float ww = max(t1, t2) + 0.0001; c11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww); float lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add); float lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add); w1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w); w2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w); w3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w); w4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w); gl_FragColor.xyz = w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11; } ]]></fragment> </shader> (nice... ) If the emulator is switched to full screen, the shader is lost. Furthermore, it doesn't get back when you return to windowed mode : (not so nice... ) Maybe it's because of the parameter in the config file ? Code:
fullscreen_mode = fullscreen-window But when I start with Code:
fullscreen = 1 I tested with the bundled "curavture" shader, it does the same thing. Last edited by FrodeSolheim; 04 November 2012 at 18:19. Reason: Changed title |
24 September 2012, 22:49 | #2 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
Hi, I haven't checked yet, but most likely the shaders are not reloaded properly after fullscreen/window switch (the OpenGL context is re-created by SDL when toggling fullscreen, so OpenGL stuff must be reloaded). I'll fix it, of course
Btw, for pixel enhancement shaders such as HQ2X, you'll probably get nicer results by forcing low resolution output, so pixels are not already doubled in width and height before processed by the shader: Code:
line_doubling = 0 low_resolution = 1 Last edited by FrodeSolheim; 24 September 2012 at 23:40. |
25 September 2012, 09:46 | #3 | |
Registered User
Join Date: Sep 2012
Location: Nantes - France
Posts: 138
|
Quote:
Here are the results
|
|
25 September 2012, 20:35 | #4 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
I have fixed it so the shaders are re-initialized when the switching between windowed<->fullscreen.
Windows binaries here: http://fengestad.no/fs-uae/files/1.3.27u1/ Please give it a try |
26 September 2012, 14:54 | #5 |
Registered User
Join Date: Sep 2012
Location: Nantes - France
Posts: 138
|
It works perfectly now...
Nothing to add ! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WinUAE slow in fullscreen but fast in windowed mode | carls | support.WinUAE | 12 | 03 March 2013 13:38 |
FullScreen / Windowed switch problem | Another World | support.WinUAE | 3 | 19 December 2008 23:16 |
VSync in windowed mode | andreas | request.UAE Wishlist | 4 | 08 January 2008 19:54 |
'Warp Mode' broken in 'windowed mode' | NoX1911 | support.WinUAE | 3 | 26 May 2007 01:05 |
Toggle windowed/fullscreen by keypress | abelthorne | request.UAE Wishlist | 3 | 21 February 2004 13:31 |
|
|