summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/bloom.fx
diff options
context:
space:
mode:
author Scott Stone <tafoid@users.noreply.github.com>2014-01-24 00:30:29 +0000
committer Scott Stone <tafoid@users.noreply.github.com>2014-01-24 00:30:29 +0000
commitaa896515a041551e9025db1f8d71183d81a5de94 (patch)
tree7fb78379f0dd38aa4f26f44be53b9147aa6e4022 /hlsl/bloom.fx
parent738e0aeedda637080678510ca262bed2dbae2b41 (diff)
This revert (r26927), as requested by author, fixes the regression of missing graphics for vector games using HLSL. Also reverted patch in code (r27063) to deal with "roundf" for pre-vs2013 compilers - which is no longer needed. (nw)
Diffstat (limited to 'hlsl/bloom.fx')
-rw-r--r--hlsl/bloom.fx289
1 files changed, 144 insertions, 145 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx
index 4508459e211..cec6aa3aab7 100644
--- a/hlsl/bloom.fx
+++ b/hlsl/bloom.fx
@@ -16,123 +16,123 @@ texture DiffuseK;
sampler DiffuseSampler0 = sampler_state
{
- Texture = <DiffuseA>;
- MipFilter = NONE;
- MinFilter = NONE;
- MagFilter = NONE;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseA>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler1 = sampler_state
{
- Texture = <DiffuseB>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseB>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler2 = sampler_state
{
- Texture = <DiffuseC>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseC>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler3 = sampler_state
{
- Texture = <DiffuseD>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseD>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler4 = sampler_state
{
- Texture = <DiffuseE>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseE>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler5 = sampler_state
{
- Texture = <DiffuseF>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseF>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler6 = sampler_state
{
- Texture = <DiffuseG>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseG>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler7 = sampler_state
{
- Texture = <DiffuseH>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseH>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler8 = sampler_state
{
- Texture = <DiffuseI>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseI>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSampler9 = sampler_state
{
- Texture = <DiffuseJ>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseJ>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
sampler DiffuseSamplerA = sampler_state
{
- Texture = <DiffuseK>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- AddressU = CLAMP;
- AddressV = CLAMP;
- AddressW = CLAMP;
+ Texture = <DiffuseK>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
};
//-----------------------------------------------------------------------------
@@ -141,45 +141,44 @@ sampler DiffuseSamplerA = sampler_state
struct VS_OUTPUT
{
- float4 Position : POSITION;
- float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
+ float4 Position : POSITION;
+ float4 Color : COLOR0;
+ float2 TexCoord : TEXCOORD0;
};
struct VS_INPUT
{
- float3 Position : POSITION;
- float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
- float2 Unused : TEXCOORD1;
+ float3 Position : POSITION;
+ float4 Color : COLOR0;
+ float2 TexCoord : TEXCOORD0;
+ float2 Unused : TEXCOORD1;
};
struct PS_INPUT
{
- float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
+ float4 Color : COLOR0;
+ float2 TexCoord : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Bloom Vertex Shader
//-----------------------------------------------------------------------------
-uniform float2 ScreenSize;
-uniform float2 TextureSize;
+uniform float2 TargetSize;
VS_OUTPUT vs_main(VS_INPUT Input)
{
- VS_OUTPUT Output = (VS_OUTPUT)0;
-
- Output.Position = float4(Input.Position.xyz, 1.0f);
- Output.Position.xy /= ScreenSize;
- Output.Position.y = 1.0f - Output.Position.y;
- Output.Position.xy -= float2(0.5f, 0.5f);
- Output.Position.xy *= float2(2.0f, 2.0f);
- Output.Color = Input.Color;
- Output.TexCoord = (Input.Position.xy + 0.5f) / ScreenSize;
-
- return Output;
+ VS_OUTPUT Output = (VS_OUTPUT)0;
+
+ Output.Position = float4(Input.Position.xyz, 1.0f);
+ Output.Position.xy /= TargetSize;
+ Output.Position.y = 1.0f - Output.Position.y;
+ Output.Position.xy -= float2(0.5f, 0.5f);
+ Output.Position.xy *= float2(2.0f, 2.0f);
+ Output.Color = Input.Color;
+ Output.TexCoord = (Input.Position.xy + 0.5f) / TargetSize;
+
+ return Output;
}
//-----------------------------------------------------------------------------
@@ -192,33 +191,33 @@ uniform float3 Level89AWeight;
float4 ps_main(PS_INPUT Input) : COLOR
{
- float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord).rgb;
- float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord).rgb;
- float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord).rgb;
- float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord).rgb;
- float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord).rgb;
- float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord).rgb;
- float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord).rgb;
- float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord).rgb;
- float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord).rgb;
- float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord).rgb;
- float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoord).rgb;
-
- texel0 = texel0 * Level0123Weight.x;
- texel1 = texel1 * Level0123Weight.y;
- texel2 = texel2 * Level0123Weight.z;
- texel3 = texel3 * Level0123Weight.w;
- texel4 = texel4 * Level4567Weight.x;
- texel5 = texel5 * Level4567Weight.y;
- texel6 = texel6 * Level4567Weight.z;
- texel7 = texel7 * Level4567Weight.w;
- texel8 = texel8 * Level89AWeight.x;
- texel9 = texel9 * Level89AWeight.y;
- texelA = texelA * Level89AWeight.z;
-
- float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
- texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
- return sum;
+ float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord).rgb;
+ float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord).rgb;
+ float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord).rgb;
+ float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord).rgb;
+ float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord).rgb;
+ float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord).rgb;
+ float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord).rgb;
+ float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord).rgb;
+ float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord).rgb;
+ float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord).rgb;
+ float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoord).rgb;
+
+ texel0 = texel0 * Level0123Weight.x;
+ texel1 = texel1 * Level0123Weight.y;
+ texel2 = texel2 * Level0123Weight.z;
+ texel3 = texel3 * Level0123Weight.w;
+ texel4 = texel4 * Level4567Weight.x;
+ texel5 = texel5 * Level4567Weight.y;
+ texel6 = texel6 * Level4567Weight.z;
+ texel7 = texel7 * Level4567Weight.w;
+ texel8 = texel8 * Level89AWeight.x;
+ texel9 = texel9 * Level89AWeight.y;
+ texelA = texelA * Level89AWeight.z;
+
+ float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
+ texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
+ return sum;
}
//-----------------------------------------------------------------------------
@@ -227,23 +226,23 @@ float4 ps_main(PS_INPUT Input) : COLOR
technique TestTechnique
{
- pass Pass0
- {
- Lighting = FALSE;
-
- Sampler[0] = <DiffuseSampler0>; // 2048x2048
- Sampler[1] = <DiffuseSampler1>; // 1024x1024
- Sampler[2] = <DiffuseSampler2>; // 512x512
- Sampler[3] = <DiffuseSampler3>; // 256x256
- Sampler[4] = <DiffuseSampler4>; // 128x128
- Sampler[5] = <DiffuseSampler5>; // 64x64
- Sampler[6] = <DiffuseSampler6>; // 32x32
- Sampler[7] = <DiffuseSampler7>; // 16x16
- Sampler[8] = <DiffuseSampler8>; // 8x8
- Sampler[9] = <DiffuseSampler9>; // 4x4
- Sampler[10] = <DiffuseSamplerA>; // 2x2
-
- VertexShader = compile vs_3_0 vs_main();
- PixelShader = compile ps_3_0 ps_main();
- }
+ pass Pass0
+ {
+ Lighting = FALSE;
+
+ Sampler[0] = <DiffuseSampler0>; // 2048x2048
+ Sampler[1] = <DiffuseSampler1>; // 1024x1024
+ Sampler[2] = <DiffuseSampler2>; // 512x512
+ Sampler[3] = <DiffuseSampler3>; // 256x256
+ Sampler[4] = <DiffuseSampler4>; // 128x128
+ Sampler[5] = <DiffuseSampler5>; // 64x64
+ Sampler[6] = <DiffuseSampler6>; // 32x32
+ Sampler[7] = <DiffuseSampler7>; // 16x16
+ Sampler[8] = <DiffuseSampler8>; // 8x8
+ Sampler[9] = <DiffuseSampler9>; // 4x4
+ Sampler[10] = <DiffuseSamplerA>; // 2x2
+
+ VertexShader = compile vs_3_0 vs_main();
+ PixelShader = compile ps_3_0 ps_main();
+ }
}