From e57c90084c5d1dd9f6cdb0bbbf8782dc4f369cda Mon Sep 17 00:00:00 2001 From: ImJezze Date: Sat, 20 Feb 2016 21:58:56 +0100 Subject: Quality and Performance improvements - HLSL now uses NPOT sized target surfaces (breaks compatibility with graphics cards based on R300/R400/NV30 and older) - HLSL target surfaces now have the size of the screen canvas - removed HLSL pre-scale factor - HLSL now uses a sharp bilinear interpolation to pre-scale textures to screen canvas size, based on [Themaister's] implementation - improved overall performance (based on the previously required pre-scale factor, you might notice a 5-50% speed-up depending on your graphics card, more if you used a higher pre-scale factor) - improved shadow mask quality (pixel-perfect) in screen-mode - fixed half source texel offset of bloom level alignment - removed ./hlsl/artwork_support folder - all shaders after pre-scale are now based on screen coordinate (workaground, till both raster and vector pass can work on texture coordinates) - disabled distortion shader for more than one screen and for artworks in full mode, does not affect artworks in copped mode (workaground, till both raster and vector pass can work on texture coordinates) - moved compute_texture_size() from texture_info to texture_manager (nw) --- hlsl/downsample.fx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'hlsl/downsample.fx') diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx index 6cb18f53935..3afcdc703dd 100644 --- a/hlsl/downsample.fx +++ b/hlsl/downsample.fx @@ -53,9 +53,11 @@ struct PS_INPUT uniform float2 ScreenDims; uniform float2 TargetDims; +uniform float2 SourceDims; uniform float2 SourceRect; +uniform float2 QuadDims; -uniform bool PrepareVector; +uniform bool VectorScreen; static const float2 Coord0Offset = float2(-0.5f, -0.5f); static const float2 Coord1Offset = float2( 0.5f, -0.5f); @@ -67,6 +69,8 @@ VS_OUTPUT vs_main(VS_INPUT Input) VS_OUTPUT Output = (VS_OUTPUT)0; float2 TargetTexelDims = 1.0f / TargetDims; + float2 ScreenTexelDims = 1.0f / ScreenDims; + float2 SourceTexelDims = 1.0f / SourceDims; Output.Position = float4(Input.Position.xyz, 1.0f); Output.Position.xy /= ScreenDims; @@ -79,6 +83,13 @@ VS_OUTPUT vs_main(VS_INPUT Input) float2 TexCoord = Input.Position.xy / ScreenDims; TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9) + float2 VectorTexelOffset = ScreenTexelDims * -0.5; + float2 RasterTexelOffset = SourceTexelDims * (0.5f * SourceRect) * (1.0f - (QuadDims / ScreenDims)); + + TexCoord += VectorScreen + ? VectorTexelOffset + : RasterTexelOffset; + Output.TexCoord01.xy = TexCoord + Coord0Offset * TargetTexelDims; Output.TexCoord01.zw = TexCoord + Coord1Offset * TargetTexelDims; Output.TexCoord23.xy = TexCoord + Coord2Offset * TargetTexelDims; -- cgit v1.2.3-70-g09d2