summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-03-28 20:19:01 +0200
committer ImJezze <jezze@gmx.net>2016-03-28 20:19:01 +0200
commitfe9dfdbf991ead01d9ff63042532cc82440de7a5 (patch)
tree89a842c4573bf96a17965100daf5537b8cc9d073
parent839718373d2269d7f0e258d170595cd5c3740195 (diff)
Refactored Bloom
- reduced raster bloom level to 8 - extended vector bloom level to 15 - changed vector bloom to be less blocky - removed bloom_lvl9_weight and bloom_lvl10_weight options
-rw-r--r--docs/hlsl.txt6
-rw-r--r--hlsl/bloom.fx324
-rw-r--r--ini/gameboy.ini6
-rw-r--r--ini/gba.ini6
-rw-r--r--ini/raster.ini6
-rw-r--r--ini/vector.ini18
-rw-r--r--src/osd/modules/render/d3d/d3dcomm.h12
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp61
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.h2
-rw-r--r--src/osd/modules/render/drawd3d.cpp8
-rw-r--r--src/osd/windows/winmain.cpp8
-rw-r--r--src/osd/windows/winmain.h4
12 files changed, 245 insertions, 216 deletions
diff --git a/docs/hlsl.txt b/docs/hlsl.txt
index cbc2ecd6871..511ce4f1c9d 100644
--- a/docs/hlsl.txt
+++ b/docs/hlsl.txt
@@ -111,9 +111,7 @@ bloom_lvl1_weight 0.64 Bloom level 1 (1/2-size target) weight.
bloom_lvl2_weight 0.32 Bloom level 2 (1/4-size target) weight. (0.00-1.00)
bloom_lvl3_weight 0.16 Bloom level 3 (1/8-size target) weight. (0.00-1.00)
bloom_lvl4_weight 0.08 Bloom level 4 (1/16-size target) weight. (0.00-1.00)
-bloom_lvl5_weight 0.04 Bloom level 5 (1/32-size target) weight. (0.00-1.00)
+bloom_lvl5_weight 0.06 Bloom level 5 (1/32-size target) weight. (0.00-1.00)
bloom_lvl6_weight 0.04 Bloom level 6 (1/64-size target) weight. (0.00-1.00)
bloom_lvl7_weight 0.02 Bloom level 7 (1/128-size target) weight. (0.00-1.00)
-bloom_lvl8_weight 0.02 Bloom level 8 (1/256-size target) weight. (0.00-1.00)
-bloom_lvl9_weight 0.01 Bloom level 9 (1/512-size target) weight. (0.00-1.00)
-bloom_lvl10_weight 0.01 Bloom level 10 (1/1024-size target) weight. (0.00-1.00)
+bloom_lvl8_weight 0.01 Bloom level 8 (1/256-size target) weight. (0.00-1.00)
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx
index c019870d685..5911e1ee8b5 100644
--- a/hlsl/bloom.fx
+++ b/hlsl/bloom.fx
@@ -8,21 +8,29 @@
// Sampler Definitions
//-----------------------------------------------------------------------------
-texture DiffuseA;
-texture DiffuseB;
-texture DiffuseC;
-texture DiffuseD;
-texture DiffuseE;
-texture DiffuseF;
-texture DiffuseG;
-texture DiffuseH;
-texture DiffuseI;
-texture DiffuseJ;
-texture DiffuseK;
-
-sampler DiffuseSampler0 = sampler_state
+texture DiffuseTexture;
+
+texture BloomTextureA;
+texture BloomTextureB;
+texture BloomTextureC;
+texture BloomTextureD;
+texture BloomTextureE;
+texture BloomTextureF;
+texture BloomTextureG;
+texture BloomTextureH;
+
+// vector screen uses twice -1 as many bloom levels
+texture BloomTextureI;
+texture BloomTextureJ;
+texture BloomTextureK;
+texture BloomTextureL;
+texture BloomTextureM;
+texture BloomTextureN;
+texture BloomTextureO;
+
+sampler DiffuseSampler = sampler_state
{
- Texture = <DiffuseA>;
+ Texture = <DiffuseTexture>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -31,9 +39,9 @@ sampler DiffuseSampler0 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler1 = sampler_state
+sampler BloomSamplerA = sampler_state
{
- Texture = <DiffuseB>;
+ Texture = <BloomTextureA>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -42,9 +50,9 @@ sampler DiffuseSampler1 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler2 = sampler_state
+sampler BloomSamplerB = sampler_state
{
- Texture = <DiffuseC>;
+ Texture = <BloomTextureB>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -53,9 +61,9 @@ sampler DiffuseSampler2 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler3 = sampler_state
+sampler BloomSamplerC = sampler_state
{
- Texture = <DiffuseD>;
+ Texture = <BloomTextureC>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -64,9 +72,9 @@ sampler DiffuseSampler3 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler4 = sampler_state
+sampler BloomSamplerD = sampler_state
{
- Texture = <DiffuseE>;
+ Texture = <BloomTextureD>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -75,9 +83,9 @@ sampler DiffuseSampler4 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler5 = sampler_state
+sampler BloomSamplerE = sampler_state
{
- Texture = <DiffuseF>;
+ Texture = <BloomTextureE>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -86,9 +94,9 @@ sampler DiffuseSampler5 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler6 = sampler_state
+sampler BloomSamplerF = sampler_state
{
- Texture = <DiffuseG>;
+ Texture = <BloomTextureF>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -97,9 +105,9 @@ sampler DiffuseSampler6 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler7 = sampler_state
+sampler BloomSamplerG = sampler_state
{
- Texture = <DiffuseH>;
+ Texture = <BloomTextureG>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -108,9 +116,9 @@ sampler DiffuseSampler7 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler8 = sampler_state
+sampler BloomSamplerH = sampler_state
{
- Texture = <DiffuseI>;
+ Texture = <BloomTextureH>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -119,9 +127,9 @@ sampler DiffuseSampler8 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSampler9 = sampler_state
+sampler BloomSamplerI = sampler_state
{
- Texture = <DiffuseJ>;
+ Texture = <BloomTextureI>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -130,9 +138,64 @@ sampler DiffuseSampler9 = sampler_state
AddressW = CLAMP;
};
-sampler DiffuseSamplerA = sampler_state
+sampler BloomSamplerJ = sampler_state
{
- Texture = <DiffuseK>;
+ Texture = <BloomTextureJ>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
+};
+
+sampler BloomSamplerK = sampler_state
+{
+ Texture = <BloomTextureK>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
+};
+
+sampler BloomSamplerL = sampler_state
+{
+ Texture = <BloomTextureL>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
+};
+
+sampler BloomSamplerM = sampler_state
+{
+ Texture = <BloomTextureM>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
+};
+
+sampler BloomSamplerN = sampler_state
+{
+ Texture = <BloomTextureN>;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ AddressW = CLAMP;
+};
+
+sampler BloomSamplerO = sampler_state
+{
+ Texture = <BloomTextureO>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
@@ -149,12 +212,8 @@ struct VS_OUTPUT
{
float4 Position : POSITION;
float4 Color : COLOR0;
- float2 TexCoord0 : TEXCOORD0;
- float4 TexCoord12 : TEXCOORD1;
- float4 TexCoord34 : TEXCOORD2;
- float4 TexCoord56 : TEXCOORD3;
- float4 TexCoord78 : TEXCOORD4;
- float4 TexCoord9A : TEXCOORD5;
+ float2 TexCoord : TEXCOORD0;
+ float2 BloomCoord : TEXCOORD1;
};
struct VS_INPUT
@@ -167,12 +226,8 @@ struct VS_INPUT
struct PS_INPUT
{
float4 Color : COLOR0;
- float2 TexCoord0 : TEXCOORD0;
- float4 TexCoord12 : TEXCOORD1;
- float4 TexCoord34 : TEXCOORD2;
- float4 TexCoord56 : TEXCOORD3;
- float4 TexCoord78 : TEXCOORD4;
- float4 TexCoord9A : TEXCOORD5;
+ float2 TexCoord : TEXCOORD0;
+ float2 BloomCoord : TEXCOORD1;
};
//-----------------------------------------------------------------------------
@@ -204,14 +259,6 @@ uniform float2 ScreenDims;
uniform float2 TargetDims;
uniform float2 SourceDims;
-// level dimensions not necessary anymore?
-uniform float2 Level0Size;
-uniform float4 Level12Size;
-uniform float4 Level34Size;
-uniform float4 Level56Size;
-uniform float4 Level78Size;
-uniform float4 Level9ASize;
-
uniform bool VectorScreen = false;
VS_OUTPUT vs_main(VS_INPUT Input)
@@ -229,17 +276,13 @@ VS_OUTPUT vs_main(VS_INPUT Input)
float2 TexCoord = Input.TexCoord;
TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9)
- Output.TexCoord0 = TexCoord.xy; // + (0.5f / Level0Size);
+ Output.TexCoord = TexCoord.xy;
TexCoord += VectorScreen
? 0.5f / TargetDims.xy
: 0.5f / SourceDims.xy;
- Output.TexCoord12 = TexCoord.xyxy; // + (0.5f / Level12Size);
- Output.TexCoord34 = TexCoord.xyxy; // + (0.5f / Level34Size);
- Output.TexCoord56 = TexCoord.xyxy; // + (0.5f / Level56Size);
- Output.TexCoord78 = TexCoord.xyxy; // + (0.5f / Level78Size);
- Output.TexCoord9A = TexCoord.xyxy; // + (0.5f / Level9ASize);
+ Output.BloomCoord = TexCoord.xy;
return Output;
}
@@ -249,11 +292,14 @@ VS_OUTPUT vs_main(VS_INPUT Input)
//-----------------------------------------------------------------------------
uniform float Level0Weight;
-uniform float2 Level12Weight;
-uniform float2 Level34Weight;
-uniform float2 Level56Weight;
-uniform float2 Level78Weight;
-uniform float2 Level9AWeight;
+uniform float Level1Weight;
+uniform float Level2Weight;
+uniform float Level3Weight;
+uniform float Level4Weight;
+uniform float Level5Weight;
+uniform float Level6Weight;
+uniform float Level7Weight;
+uniform float Level8Weight;
uniform int BloomBlendMode = 0; // 0 brighten, 1 darken
uniform float BloomScale;
@@ -267,48 +313,80 @@ float3 GetNoiseFactor(float3 n, float random)
float4 ps_main(PS_INPUT Input) : COLOR
{
- float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord0).rgb;
- float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord12.xy).rgb;
- float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord12.zw).rgb;
- float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord34.xy).rgb;
- float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord34.zw).rgb;
- float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord56.xy).rgb;
- float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord56.zw).rgb;
- float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord78.xy).rgb;
- float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord78.zw).rgb;
- float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord9A.xy).rgb;
- float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoord9A.zw).rgb;
+ float3 texel = tex2D(DiffuseSampler, Input.TexCoord).rgb;
+
+ float3 texelA = tex2D(BloomSamplerA, Input.BloomCoord.xy).rgb;
+ float3 texelB = tex2D(BloomSamplerB, Input.BloomCoord.xy).rgb;
+ float3 texelC = tex2D(BloomSamplerC, Input.BloomCoord.xy).rgb;
+ float3 texelD = tex2D(BloomSamplerD, Input.BloomCoord.xy).rgb;
+ float3 texelE = tex2D(BloomSamplerE, Input.BloomCoord.xy).rgb;
+ float3 texelF = tex2D(BloomSamplerF, Input.BloomCoord.xy).rgb;
+ float3 texelG = tex2D(BloomSamplerG, Input.BloomCoord.xy).rgb;
+ float3 texelH = tex2D(BloomSamplerH, Input.BloomCoord.xy).rgb;
+
+ float3 texelI = float3(0.0f, 0.0f, 0.0f);
+ float3 texelJ = float3(0.0f, 0.0f, 0.0f);
+ float3 texelK = float3(0.0f, 0.0f, 0.0f);
+ float3 texelL = float3(0.0f, 0.0f, 0.0f);
+ float3 texelM = float3(0.0f, 0.0f, 0.0f);
+ float3 texelN = float3(0.0f, 0.0f, 0.0f);
+ float3 texelO = float3(0.0f, 0.0f, 0.0f);
+
+ // vector screen uses twice -1 as many bloom levels
+ if (VectorScreen)
+ {
+ texelI = tex2D(BloomSamplerI, Input.BloomCoord.xy).rgb;
+ texelJ = tex2D(BloomSamplerJ, Input.BloomCoord.xy).rgb;
+ texelK = tex2D(BloomSamplerK, Input.BloomCoord.xy).rgb;
+ texelL = tex2D(BloomSamplerL, Input.BloomCoord.xy).rgb;
+ texelM = tex2D(BloomSamplerM, Input.BloomCoord.xy).rgb;
+ texelN = tex2D(BloomSamplerN, Input.BloomCoord.xy).rgb;
+ texelO = tex2D(BloomSamplerO, Input.BloomCoord.xy).rgb;
+ }
float3 blend;
// brighten
if (BloomBlendMode == 0)
{
- texel0 *= Level0Weight;
- texel1 *= Level12Weight.x;
- texel2 *= Level12Weight.y;
- texel3 *= Level34Weight.x;
- texel4 *= Level34Weight.y;
- texel5 *= Level56Weight.x;
- texel6 *= Level56Weight.y;
- texel7 *= Level78Weight.x;
- texel8 *= Level78Weight.y;
- texel9 *= Level9AWeight.x;
- texelA *= Level9AWeight.y;
-
- float3 bloom = float3(
- texel1 +
- texel2 +
- texel3 +
- texel4 +
- texel5 +
- texel6 +
- texel7 +
- texel8 +
- texel9 +
- texelA) * BloomScale;
-
- float3 bloomOverdrive = max(0.0f, texel0 + bloom - 1.0f) * BloomOverdrive;
+ float3 bloom = float3(0.0f, 0.0f, 0.0f);
+
+ texel *= Level0Weight;
+
+ if (!VectorScreen)
+ {
+ bloom += texelA * Level1Weight;
+ bloom += texelB * Level2Weight;
+ bloom += texelC * Level3Weight;
+ bloom += texelD * Level4Weight;
+ bloom += texelE * Level5Weight;
+ bloom += texelF * Level6Weight;
+ bloom += texelG * Level7Weight;
+ bloom += texelH * Level8Weight;
+ }
+ // vector screen uses twice -1 as many bloom levels
+ else
+ {
+ bloom += texelA * (Level1Weight);
+ bloom += texelB * (Level1Weight + Level2Weight) * 0.5f;
+ bloom += texelC * (Level2Weight);
+ bloom += texelD * (Level2Weight + Level3Weight) * 0.5f;
+ bloom += texelE * (Level3Weight);
+ bloom += texelF * (Level3Weight + Level4Weight) * 0.5f;
+ bloom += texelG * (Level4Weight);
+ bloom += texelH * (Level4Weight + Level5Weight) * 0.5f;
+ bloom += texelI * (Level5Weight);
+ bloom += texelJ * (Level5Weight + Level6Weight) * 0.5f;
+ bloom += texelK * (Level6Weight);
+ bloom += texelL * (Level6Weight + Level7Weight) * 0.5f;
+ bloom += texelM * (Level7Weight);
+ bloom += texelN * (Level7Weight + Level8Weight) * 0.5f;
+ bloom += texelO * (Level8Weight);
+ }
+
+ bloom *= BloomScale;
+
+ float3 bloomOverdrive = max(0.0f, texel + bloom - 1.0f) * BloomOverdrive;
bloom.r += bloomOverdrive.g * 0.5f;
bloom.r += bloomOverdrive.b * 0.5f;
@@ -317,37 +395,33 @@ float4 ps_main(PS_INPUT Input) : COLOR
bloom.b += bloomOverdrive.r * 0.5f;
bloom.b += bloomOverdrive.g * 0.5f;
- float2 NoiseCoord = Input.TexCoord0;
+ float2 NoiseCoord = Input.TexCoord;
float3 NoiseFactor = GetNoiseFactor(bloom, random(NoiseCoord));
- blend = texel0 + bloom * NoiseFactor;
+ blend = texel + bloom * NoiseFactor;
}
// darken
else
{
- texel1 = min(texel0, texel1);
- texel2 = min(texel0, texel2);
- texel3 = min(texel0, texel3);
- texel4 = min(texel0, texel4);
- texel5 = min(texel0, texel5);
- texel6 = min(texel0, texel6);
- texel7 = min(texel0, texel7);
- texel8 = min(texel0, texel8);
- texel9 = min(texel0, texel9);
- texelA = min(texel0, texelA);
-
- blend = texel0 * Level0Weight;
- blend = lerp(blend, texel1, Level12Weight.x * BloomScale);
- blend = lerp(blend, texel2, Level12Weight.y * BloomScale);
- blend = lerp(blend, texel3, Level34Weight.x * BloomScale);
- blend = lerp(blend, texel4, Level34Weight.y * BloomScale);
- blend = lerp(blend, texel5, Level56Weight.x * BloomScale);
- blend = lerp(blend, texel6, Level56Weight.y * BloomScale);
- blend = lerp(blend, texel7, Level78Weight.x * BloomScale);
- blend = lerp(blend, texel8, Level78Weight.y * BloomScale);
- blend = lerp(blend, texel9, Level9AWeight.x * BloomScale);
- blend = lerp(blend, texelA, Level9AWeight.y * BloomScale);
+ texelA = min(texel, texelA);
+ texelB = min(texel, texelB);
+ texelC = min(texel, texelC);
+ texelD = min(texel, texelD);
+ texelE = min(texel, texelE);
+ texelF = min(texel, texelF);
+ texelG = min(texel, texelG);
+ texelH = min(texel, texelH);
+
+ blend = texel * Level0Weight;
+ blend = lerp(blend, texelA, Level1Weight * BloomScale);
+ blend = lerp(blend, texelB, Level2Weight * BloomScale);
+ blend = lerp(blend, texelC, Level3Weight * BloomScale);
+ blend = lerp(blend, texelD, Level4Weight * BloomScale);
+ blend = lerp(blend, texelE, Level5Weight * BloomScale);
+ blend = lerp(blend, texelF, Level6Weight * BloomScale);
+ blend = lerp(blend, texelG, Level7Weight * BloomScale);
+ blend = lerp(blend, texelH, Level8Weight * BloomScale);
}
return float4(blend, 1.0f);
diff --git a/ini/gameboy.ini b/ini/gameboy.ini
index d35ed5fe55d..763ce5b78d5 100644
--- a/ini/gameboy.ini
+++ b/ini/gameboy.ini
@@ -47,9 +47,7 @@ bloom_lvl1_weight 0.64
bloom_lvl2_weight 0.32
bloom_lvl3_weight 0.16
bloom_lvl4_weight 0.08
-bloom_lvl5_weight 0.04
+bloom_lvl5_weight 0.06
bloom_lvl6_weight 0.04
bloom_lvl7_weight 0.02
-bloom_lvl8_weight 0.02
-bloom_lvl9_weight 0.01
-bloom_lvl10_weight 0.01
+bloom_lvl8_weight 0.01
diff --git a/ini/gba.ini b/ini/gba.ini
index 0b1bf100da9..0c8308fc072 100644
--- a/ini/gba.ini
+++ b/ini/gba.ini
@@ -47,9 +47,7 @@ bloom_lvl1_weight 0.64
bloom_lvl2_weight 0.32
bloom_lvl3_weight 0.16
bloom_lvl4_weight 0.08
-bloom_lvl5_weight 0.04
+bloom_lvl5_weight 0.06
bloom_lvl6_weight 0.04
bloom_lvl7_weight 0.02
-bloom_lvl8_weight 0.02
-bloom_lvl9_weight 0.01
-bloom_lvl10_weight 0.01
+bloom_lvl8_weight 0.01
diff --git a/ini/raster.ini b/ini/raster.ini
index 03683cd5b35..7e589fe9cb2 100644
--- a/ini/raster.ini
+++ b/ini/raster.ini
@@ -53,9 +53,7 @@ bloom_lvl1_weight 0.64
bloom_lvl2_weight 0.32
bloom_lvl3_weight 0.16
bloom_lvl4_weight 0.08
-bloom_lvl5_weight 0.04
+bloom_lvl5_weight 0.06
bloom_lvl6_weight 0.04
bloom_lvl7_weight 0.02
-bloom_lvl8_weight 0.02
-bloom_lvl9_weight 0.01
-bloom_lvl10_weight 0.01
+bloom_lvl8_weight 0.01
diff --git a/ini/vector.ini b/ini/vector.ini
index 8e7a98b64a9..1aeb22c5f86 100644
--- a/ini/vector.ini
+++ b/ini/vector.ini
@@ -56,16 +56,14 @@ vector_length_ratio 500.0
# BLOOM POST-PROCESSING OPTIONS
#
bloom_blend_mode 0
-bloom_scale 1.50
+bloom_scale 0.75
bloom_overdrive 1.00,1.00,1.00
bloom_lvl0_weight 1.00
-bloom_lvl1_weight 0.64
+bloom_lvl1_weight 0.48
bloom_lvl2_weight 0.32
-bloom_lvl3_weight 0.16
-bloom_lvl4_weight 0.24
-bloom_lvl5_weight 0.32
-bloom_lvl6_weight 0.48
-bloom_lvl7_weight 0.32
-bloom_lvl8_weight 0.24
-bloom_lvl9_weight 0.16
-bloom_lvl10_weight 0.08
+bloom_lvl3_weight 0.24
+bloom_lvl4_weight 0.16
+bloom_lvl5_weight 0.24
+bloom_lvl6_weight 0.32
+bloom_lvl7_weight 0.48
+bloom_lvl8_weight 0.64
diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h
index 51758bb70b6..3d84ea567a3 100644
--- a/src/osd/modules/render/d3d/d3dcomm.h
+++ b/src/osd/modules/render/d3d/d3dcomm.h
@@ -10,6 +10,12 @@
#define __WIN_D3DCOMM__
//============================================================
+// CONSTANTS
+//============================================================
+
+#define MAX_BLOOM_COUNT 15 // shader model 3.0 support up to 16 samplers, but we need the last for the original texture
+
+//============================================================
// FORWARD DECLARATIONS
//============================================================
@@ -292,10 +298,10 @@ public:
d3d_render_target *next;
d3d_render_target *prev;
- surface *bloom_surface[11];
- texture *bloom_texture[11];
+ surface *bloom_surface[MAX_BLOOM_COUNT];
+ texture *bloom_texture[MAX_BLOOM_COUNT];
- float bloom_dims[11][2];
+ float bloom_dims[MAX_BLOOM_COUNT][2];
int bloom_count;
};
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index 9d22e045b91..ca2c29078da 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -739,8 +739,6 @@ void shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
options->bloom_level6_weight = winoptions.screen_bloom_lvl6_weight();
options->bloom_level7_weight = winoptions.screen_bloom_lvl7_weight();
options->bloom_level8_weight = winoptions.screen_bloom_lvl8_weight();
- options->bloom_level9_weight = winoptions.screen_bloom_lvl9_weight();
- options->bloom_level10_weight = winoptions.screen_bloom_lvl10_weight();
options->params_init = true;
}
@@ -1460,59 +1458,34 @@ int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly
return next_index;
}
- float weight12[2] = {
- options->bloom_level1_weight,
- options->bloom_level2_weight
- };
- float weight34[2] = {
- options->bloom_level3_weight,
- options->bloom_level4_weight
- };
- float weight56[2] = {
- options->bloom_level5_weight,
- options->bloom_level6_weight,
- };
- float weight78[2] = {
- options->bloom_level7_weight,
- options->bloom_level8_weight
- };
- float weight9A[2] = {
- options->bloom_level9_weight,
- options->bloom_level10_weight
- };
-
curr_effect = bloom_effect;
curr_effect->update_uniforms();
- curr_effect->set_float ("Level0Weight", options->bloom_level0_weight);
- curr_effect->set_vector("Level12Weight", 2, weight12);
- curr_effect->set_vector("Level34Weight", 2, weight34);
- curr_effect->set_vector("Level56Weight", 2, weight56);
- curr_effect->set_vector("Level78Weight", 2, weight78);
- curr_effect->set_vector("Level9AWeight", 2, weight9A);
-
- curr_effect->set_vector("Level0Size", 2, rt->bloom_dims[0]);
- curr_effect->set_vector("Level12Size", 4, rt->bloom_dims[1]);
- curr_effect->set_vector("Level34Size", 4, rt->bloom_dims[3]);
- curr_effect->set_vector("Level56Size", 4, rt->bloom_dims[5]);
- curr_effect->set_vector("Level78Size", 4, rt->bloom_dims[7]);
- curr_effect->set_vector("Level9ASize", 4, rt->bloom_dims[9]);
+ curr_effect->set_float("Level0Weight", options->bloom_level0_weight);
+ curr_effect->set_float("Level1Weight", options->bloom_level1_weight);
+ curr_effect->set_float("Level2Weight", options->bloom_level2_weight);
+ curr_effect->set_float("Level3Weight", options->bloom_level3_weight);
+ curr_effect->set_float("Level4Weight", options->bloom_level4_weight);
+ curr_effect->set_float("Level5Weight", options->bloom_level5_weight);
+ curr_effect->set_float("Level6Weight", options->bloom_level6_weight);
+ curr_effect->set_float("Level7Weight", options->bloom_level7_weight);
+ curr_effect->set_float("Level8Weight", options->bloom_level8_weight);
curr_effect->set_int("BloomBlendMode", options->bloom_blend_mode);
curr_effect->set_float("BloomScale", options->bloom_scale);
curr_effect->set_vector("BloomOverdrive", 3, options->bloom_overdrive);
- curr_effect->set_texture("DiffuseA", rt->target_texture[next_index]);
+ curr_effect->set_texture("DiffuseTexture", rt->target_texture[next_index]);
- char name[9] = "Diffuse*";
+ char name[14] = "BloomTexture*";
for (int index = 1; index < rt->bloom_count; index++)
{
- name[7] = 'A' + index;
+ name[12] = 'A' + index - 1;
curr_effect->set_texture(name, rt->bloom_texture[index - 1]);
}
- for (int index = rt->bloom_count; index < 11; index++)
+ for (int index = rt->bloom_count; index < MAX_BLOOM_COUNT; index++)
{
- name[7] = 'A' + index;
+ name[12] = 'A' + index - 1;
curr_effect->set_texture(name, black_texture);
}
@@ -2315,8 +2288,6 @@ enum slider_option
SLIDER_BLOOM_LVL6_SCALE,
SLIDER_BLOOM_LVL7_SCALE,
SLIDER_BLOOM_LVL8_SCALE,
- SLIDER_BLOOM_LVL9_SCALE,
- SLIDER_BLOOM_LVL10_SCALE,
SLIDER_NTSC_ENABLE,
SLIDER_NTSC_JITTER,
SLIDER_NTSC_A_VALUE,
@@ -2392,8 +2363,6 @@ slider_desc shaders::s_sliders[] =
{ "Bloom Level 6 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL6_SCALE, 0.01f, "%1.2f", {} },
{ "Bloom Level 7 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL7_SCALE, 0.01f, "%1.2f", {} },
{ "Bloom Level 8 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL8_SCALE, 0.01f, "%1.2f", {} },
- { "Bloom Level 9 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL9_SCALE, 0.01f, "%1.2f", {} },
- { "Bloom Level 10 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL10_SCALE, 0.01f, "%1.2f", {} },
{ "NTSC processing", 0, 0, 1, 1, SLIDER_INT_ENUM, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_NTSC_ENABLE, 0, "%s", { "Off", "On" } },
{ "Signal Jitter", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_NTSC_JITTER, 0.01f, "%1.2f", {} },
{ "A Value", -100, 50, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_NTSC_A_VALUE, 0.01f, "%1.2f", {} },
@@ -2467,8 +2436,6 @@ void *shaders::get_slider_option(int id, int index)
case SLIDER_BLOOM_LVL6_SCALE: return &(options->bloom_level6_weight);
case SLIDER_BLOOM_LVL7_SCALE: return &(options->bloom_level7_weight);
case SLIDER_BLOOM_LVL8_SCALE: return &(options->bloom_level8_weight);
- case SLIDER_BLOOM_LVL9_SCALE: return &(options->bloom_level9_weight);
- case SLIDER_BLOOM_LVL10_SCALE: return &(options->bloom_level10_weight);
case SLIDER_NTSC_ENABLE: return &(options->yiq_enable);
case SLIDER_NTSC_JITTER: return &(options->yiq_jitter);
case SLIDER_NTSC_A_VALUE: return &(options->yiq_a);
diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h
index a4c9f13b9ed..af5db351efe 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.h
+++ b/src/osd/modules/render/d3d/d3dhlsl.h
@@ -260,8 +260,6 @@ struct hlsl_options
float bloom_level6_weight;
float bloom_level7_weight;
float bloom_level8_weight;
- float bloom_level9_weight;
- float bloom_level10_weight;
};
struct slider_desc
diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp
index 4b8cc430640..708ed01cd6c 100644
--- a/src/osd/modules/render/drawd3d.cpp
+++ b/src/osd/modules/render/drawd3d.cpp
@@ -2795,7 +2795,7 @@ bool cache_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_width,
d3d_render_target::~d3d_render_target()
{
- for (int index = 0; index < 11; index++)
+ for (int index = 0; index < MAX_BLOOM_COUNT; index++)
{
if (bloom_texture[index] != nullptr)
{
@@ -2869,13 +2869,13 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_w
bool vector_screen =
d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
- // larger blur width for vector screens than raster screens
- float scale_factor = vector_screen ? 0.5f : 0.75f;
+ float scale_factor = 0.75f;
+ int scale_count = vector_screen ? MAX_BLOOM_COUNT : MAX_BLOOM_COUNT / 2;
float bloom_width = (float)source_width;
float bloom_height = (float)source_height;
float bloom_size = bloom_width < bloom_height ? bloom_width : bloom_height;
- for (int bloom_index = 0; bloom_index < 11 && bloom_size >= 2.0f; bloom_size *= scale_factor)
+ for (int bloom_index = 0; bloom_index < scale_count && bloom_size >= 2.0f; bloom_size *= scale_factor)
{
this->bloom_dims[bloom_index][0] = (int)bloom_width;
this->bloom_dims[bloom_index][1] = (int)bloom_height;
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index 0efb762a079..50c671ef24d 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -350,13 +350,11 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_BLOOM_LEVEL2_WEIGHT, "0.32", OPTION_FLOAT, "Bloom level 2 (1/4-size target) weight" },
{ WINOPTION_BLOOM_LEVEL3_WEIGHT, "0.16", OPTION_FLOAT, "Bloom level 3 (1/8-size target) weight" },
{ WINOPTION_BLOOM_LEVEL4_WEIGHT, "0.08", OPTION_FLOAT, "Bloom level 4 (1/16-size target) weight" },
- { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.04", OPTION_FLOAT, "Bloom level 5 (1/32-size target) weight" },
+ { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.06", OPTION_FLOAT, "Bloom level 5 (1/32-size target) weight" },
{ WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.04", OPTION_FLOAT, "Bloom level 6 (1/64-size target) weight" },
{ WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.02", OPTION_FLOAT, "Bloom level 7 (1/128-size target) weight" },
- { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.02", OPTION_FLOAT, "Bloom level 8 (1/256-size target) weight" },
- { WINOPTION_BLOOM_LEVEL9_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 9 (1/512-size target) weight" },
- { WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 10 (1/1024-size target) weight" },
-
+ { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 8 (1/256-size target) weight" },
+
// full screen options
{ nullptr, nullptr, OPTION_HEADER, "FULL SCREEN OPTIONS" },
{ WINOPTION_TRIPLEBUFFER ";tb", "0", OPTION_BOOLEAN, "enables triple buffering" },
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index dd348ee4491..fec09444446 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -96,8 +96,6 @@
#define WINOPTION_BLOOM_LEVEL6_WEIGHT "bloom_lvl6_weight"
#define WINOPTION_BLOOM_LEVEL7_WEIGHT "bloom_lvl7_weight"
#define WINOPTION_BLOOM_LEVEL8_WEIGHT "bloom_lvl8_weight"
-#define WINOPTION_BLOOM_LEVEL9_WEIGHT "bloom_lvl9_weight"
-#define WINOPTION_BLOOM_LEVEL10_WEIGHT "bloom_lvl10_weight"
// full screen options
#define WINOPTION_TRIPLEBUFFER "triplebuffer"
@@ -191,8 +189,6 @@ public:
float screen_bloom_lvl6_weight() const { return float_value(WINOPTION_BLOOM_LEVEL6_WEIGHT); }
float screen_bloom_lvl7_weight() const { return float_value(WINOPTION_BLOOM_LEVEL7_WEIGHT); }
float screen_bloom_lvl8_weight() const { return float_value(WINOPTION_BLOOM_LEVEL8_WEIGHT); }
- float screen_bloom_lvl9_weight() const { return float_value(WINOPTION_BLOOM_LEVEL9_WEIGHT); }
- float screen_bloom_lvl10_weight() const { return float_value(WINOPTION_BLOOM_LEVEL10_WEIGHT); }
const char *screen_offset() const { return value(WINOPTION_OFFSET); }
const char *screen_scale() const { return value(WINOPTION_SCALE); }
const char *screen_power() const { return value(WINOPTION_POWER); }