summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--hlsl/bloom.fx49
-rw-r--r--src/osd/windows/d3dhlsl.c32
-rw-r--r--src/osd/windows/d3dhlsl.h2
3 files changed, 57 insertions, 26 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx
index cec6aa3aab7..69cc930c357 100644
--- a/hlsl/bloom.fx
+++ b/hlsl/bloom.fx
@@ -143,7 +143,12 @@ struct VS_OUTPUT
{
float4 Position : POSITION;
float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
+ float4 TexCoord01 : TEXCOORD0;
+ float4 TexCoord23 : TEXCOORD1;
+ float4 TexCoord45 : TEXCOORD2;
+ float4 TexCoord67 : TEXCOORD3;
+ float4 TexCoord89 : TEXCOORD4;
+ float2 TexCoordA : TEXCOORD5;
};
struct VS_INPUT
@@ -157,7 +162,12 @@ struct VS_INPUT
struct PS_INPUT
{
float4 Color : COLOR0;
- float2 TexCoord : TEXCOORD0;
+ float4 TexCoord01 : TEXCOORD0;
+ float4 TexCoord23 : TEXCOORD1;
+ float4 TexCoord45 : TEXCOORD2;
+ float4 TexCoord67 : TEXCOORD3;
+ float4 TexCoord89 : TEXCOORD4;
+ float2 TexCoordA : TEXCOORD5;
};
//-----------------------------------------------------------------------------
@@ -165,6 +175,12 @@ struct PS_INPUT
//-----------------------------------------------------------------------------
uniform float2 TargetSize;
+uniform float4 Level01Size;
+uniform float4 Level23Size;
+uniform float4 Level45Size;
+uniform float4 Level67Size;
+uniform float4 Level89Size;
+uniform float2 LevelASize;
VS_OUTPUT vs_main(VS_INPUT Input)
{
@@ -176,7 +192,12 @@ VS_OUTPUT vs_main(VS_INPUT Input)
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;
+ Output.TexCoord01 = Input.Position.xyxy / TargetSize.xyxy - 0.5f / Level01Size;
+ Output.TexCoord23 = Input.Position.xyxy / TargetSize.xyxy - 0.5f / Level23Size;
+ Output.TexCoord45 = Input.Position.xyxy / TargetSize.xyxy - 0.5f / Level45Size;
+ Output.TexCoord67 = Input.Position.xyxy / TargetSize.xyxy - 0.5f / Level67Size;
+ Output.TexCoord89 = Input.Position.xyxy / TargetSize.xyxy - 0.5f / Level89Size;
+ Output.TexCoordA = Input.Position.xy / TargetSize - 0.5f / LevelASize;
return Output;
}
@@ -191,17 +212,17 @@ 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;
+ float3 texel0 = tex2D(DiffuseSampler0, Input.TexCoord01.xy).rgb;
+ float3 texel1 = tex2D(DiffuseSampler1, Input.TexCoord01.zw).rgb;
+ float3 texel2 = tex2D(DiffuseSampler2, Input.TexCoord23.xy).rgb;
+ float3 texel3 = tex2D(DiffuseSampler3, Input.TexCoord23.zw).rgb;
+ float3 texel4 = tex2D(DiffuseSampler4, Input.TexCoord45.xy).rgb;
+ float3 texel5 = tex2D(DiffuseSampler5, Input.TexCoord45.zw).rgb;
+ float3 texel6 = tex2D(DiffuseSampler6, Input.TexCoord67.xy).rgb;
+ float3 texel7 = tex2D(DiffuseSampler7, Input.TexCoord67.zw).rgb;
+ float3 texel8 = tex2D(DiffuseSampler8, Input.TexCoord89.xy).rgb;
+ float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord89.zw).rgb;
+ float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoordA).rgb;
texel0 = texel0 * Level0123Weight.x;
texel1 = texel1 * Level0123Weight.y;
diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c
index 4cdc1a4fea0..d2401c8c4ba 100644
--- a/src/osd/windows/d3dhlsl.c
+++ b/src/osd/windows/d3dhlsl.c
@@ -1664,11 +1664,12 @@ void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta,
float bloom_height = rt->target_height;
vec2f screendims = d3d->get_dims();
curr_effect->set_vector("ScreenSize", 2, &screendims.c.x);
+ float bloom_dims[11][2];
for(; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
{
- target_size[0] = bloom_width;
- target_size[1] = bloom_height;
- curr_effect->set_vector("TargetSize", 2, target_size);
+ bloom_dims[bloom_index][0] = bloom_width;
+ bloom_dims[bloom_index][1] = bloom_height;
+ curr_effect->set_vector("TargetSize", 2, bloom_dims[bloom_index]);
curr_effect->begin(&num_passes, 0);
@@ -1698,13 +1699,20 @@ void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta,
curr_effect = bloom_effect;
+ float target_size[2] = { d3d->get_width(), d3d->get_height() };
+ curr_effect->set_vector("TargetSize", 2, target_size);
float weight0123[4] = { options->bloom_level0_weight, options->bloom_level1_weight, options->bloom_level2_weight, options->bloom_level3_weight };
float weight4567[4] = { options->bloom_level4_weight, options->bloom_level5_weight, options->bloom_level6_weight, options->bloom_level7_weight };
float weight89A[3] = { options->bloom_level8_weight, options->bloom_level9_weight, options->bloom_level10_weight };
curr_effect->set_vector("Level0123Weight", 4, weight0123);
curr_effect->set_vector("Level4567Weight", 4, weight4567);
curr_effect->set_vector("Level89AWeight", 3, weight89A);
- curr_effect->set_vector("TargetSize", 2, &screendims.c.x);
+ curr_effect->set_vector("Level01Size", 4, bloom_dims[0]);
+ curr_effect->set_vector("Level23Size", 4, bloom_dims[2]);
+ curr_effect->set_vector("Level45Size", 4, bloom_dims[4]);
+ curr_effect->set_vector("Level67Size", 4, bloom_dims[6]);
+ curr_effect->set_vector("Level89Size", 4, bloom_dims[8]);
+ curr_effect->set_vector("LevelASize", 2, bloom_dims[10]);
curr_effect->set_texture("DiffuseA", rt->render_texture[2]);
@@ -1846,11 +1854,12 @@ void shaders::render_quad(poly_info *poly, int vertnum)
float bloom_height = rt->target_height;
float screen_size[2] = { d3d->get_width(), d3d->get_height() };
curr_effect->set_vector("ScreenSize", 2, screen_size);
+ float bloom_dims[11][2];
for(; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
{
- target_size[0] = bloom_width;
- target_size[1] = bloom_height;
- curr_effect->set_vector("TargetSize", 2, target_size);
+ bloom_dims[bloom_index][0] = bloom_width;
+ bloom_dims[bloom_index][1] = bloom_height;
+ curr_effect->set_vector("TargetSize", 2, bloom_dims[bloom_index]);
curr_effect->begin(&num_passes, 0);
@@ -1891,6 +1900,12 @@ void shaders::render_quad(poly_info *poly, int vertnum)
curr_effect->set_vector("Level0123Weight", 4, weight0123);
curr_effect->set_vector("Level4567Weight", 4, weight4567);
curr_effect->set_vector("Level89AWeight", 3, weight89A);
+ curr_effect->set_vector("Level01Size", 4, bloom_dims[0]);
+ curr_effect->set_vector("Level23Size", 4, bloom_dims[2]);
+ curr_effect->set_vector("Level45Size", 4, bloom_dims[4]);
+ curr_effect->set_vector("Level67Size", 4, bloom_dims[6]);
+ curr_effect->set_vector("Level89Size", 4, bloom_dims[8]);
+ curr_effect->set_vector("LevelASize", 2, bloom_dims[10]);
curr_effect->set_texture("DiffuseA", rt->render_texture[0]);
@@ -3140,9 +3155,6 @@ void uniform::update()
m_shader->set_vector("Floor", 3, options->floor);
break;
- case CU_BLOOM_TARGET_SIZE:
- m_shader->set_vector("TargetSize", 2, shadersys->target_size);
- break;
case CU_BLOOM_RESCALE:
m_shader->set_float("BloomRescale", options->raster_bloom_scale);
break;
diff --git a/src/osd/windows/d3dhlsl.h b/src/osd/windows/d3dhlsl.h
index 2b7ab013418..ac00d107f70 100644
--- a/src/osd/windows/d3dhlsl.h
+++ b/src/osd/windows/d3dhlsl.h
@@ -88,7 +88,6 @@ public:
CU_POST_POWER,
CU_POST_FLOOR,
- CU_BLOOM_TARGET_SIZE,
CU_BLOOM_RESCALE,
CU_BLOOM_LVL0123_WEIGHTS,
CU_BLOOM_LVL4567_WEIGHTS,
@@ -402,7 +401,6 @@ private:
texture_info * curr_texture;
bool phosphor_passthrough;
- float target_size[2];
public:
render_target * targethead;