View Single Post
Old 05 January 2017, 20:13   #5
rsn8887
Registered User
rsn8887's Avatar
 
Join Date: Oct 2006
Location: USA
Posts: 726
Quote:
Originally Posted by mark_k View Post
Thanks very much!!!

I tried doing that over in this thread but my effort probably wasn't achieving the proper result since I never bothered to learn how to write shaders.

A couple of questions:
- Could this shader be modified to work with earlier ps/vs versions than 3.0?
- Is it necessary to initialise VS_OUTPUT OUT to 0 in vShader since you write all fields of it?

You wrote:
//If we knew the output size, this would work to always give the minimum blur:
//OUT.prescaleFactor = floor(output_size/texture_size);


At least when I experimented using a paint program to scale up then bilinear filter to the destination size, the result was marginally sharper with larger pre-scale factors. E.g. for 640-pixel input with 1024-pixel wide output, prescaling 3x or 4x before scaling down gave a slightly better result than 2x. (Should the commented-out line use ceil not floor?)
- The initialization might be removed, not sure, I just followed the other examples. Notice anything in vertex shader should not cause a performance hit, it is only executed ONCE, not per pixel. That is why I intend to pre-calculate as much in there as possible and then parse it down to the pixelshader, so the pixelshader has to calculate as little as possible.

- It should be "floor", but that is not used. I know what you mean, in programs like MAME very large pre_scale works just fine and gives a very nice image. But from my tests with WinUAE and this shader, if the integer pre-scale is too large, e.g. anytime it results in a size _larger_ than the screen output size, the result looks absolutely horrible with a lot of pixel wobble. You'll notice immediately, just move the mouse pointer and see the wobble. If you see that, just decrease the numbers.

I wish I had access to the "screen size" or "output size" from within the shader, because then the integer factors could be automatically calculated to be optimum using that floor function.

- About shader model versions. You can just try replacing the
VertexShader = compile vs_3_0 vShader();
PixelShader = compile ps_3_0 pShader();
with
VertexShader = compile vs_2_0 vShader();
PixelShader = compile ps_2_0 pShader();
or
VertexShader = compile vs_1_0 vShader();
PixelShader = compile ps_1_0 pShader();

or other combinations Tell me what you find out. If the shader fails to compile you will just get a black screen (emulation will hang)
rsn8887 is offline  
 
Page generated in 0.05396 seconds with 9 queries