- Fix for pixel gaps between multi-screen games in HLSL mode. [MooglyGuy]

This commit is contained in:
Ryan Holtz 2014-01-04 03:17:31 +00:00
parent 1c5f0dfe04
commit 3312b67f93
4 changed files with 249 additions and 243 deletions

View File

@ -16,123 +16,123 @@ texture DiffuseK;
sampler DiffuseSampler0 = sampler_state
{
Texture = <DiffuseA>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
Texture = <DiffuseA>;
MipFilter = NONE;
MinFilter = NONE;
MagFilter = NONE;
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,44 +141,45 @@ 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 TargetSize;
uniform float2 ScreenSize;
uniform float2 TextureSize;
VS_OUTPUT vs_main(VS_INPUT Input)
{
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;
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;
return Output;
}
//-----------------------------------------------------------------------------
@ -191,33 +192,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;
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;
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;
float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 +
texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f);
return sum;
}
//-----------------------------------------------------------------------------
@ -226,23 +227,23 @@ float4 ps_main(PS_INPUT Input) : COLOR
technique TestTechnique
{
pass Pass0
{
Lighting = FALSE;
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
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();
}
VertexShader = compile vs_3_0 vs_main();
PixelShader = compile ps_3_0 ps_main();
}
}

View File

@ -6,26 +6,26 @@ texture DiffuseTexture;
sampler DiffuseSampler = sampler_state
{
Texture = <DiffuseTexture>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
Texture = <DiffuseTexture>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
};
texture ShadowTexture;
sampler ShadowSampler = sampler_state
{
Texture = <ShadowTexture>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
AddressW = WRAP;
Texture = <ShadowTexture>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
AddressW = WRAP;
};
//-----------------------------------------------------------------------------
@ -34,23 +34,23 @@ sampler ShadowSampler = 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
{
float4 Position : POSITION;
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
float2 Unused : TEXCOORD1;
float4 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;
};
//-----------------------------------------------------------------------------
@ -63,17 +63,17 @@ uniform float2 SourceRect;
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
Output.Position.y = 1.0f - Output.Position.y;
Output.Position.xy -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color;
Output.TexCoord = Input.TexCoord + 0.5f / SourceDims;
VS_OUTPUT Output = (VS_OUTPUT)0;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
Output.Position.y = 1.0f - Output.Position.y;
Output.Position.xy -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
Output.Color = Input.Color;
Output.TexCoord = Input.TexCoord + 0.5f / SourceDims;
return Output;
return Output;
}
//-----------------------------------------------------------------------------
@ -102,69 +102,69 @@ uniform float3 Floor = float3(0.0f, 0.0f, 0.0f);
float4 ps_main(PS_INPUT Input) : COLOR
{
float2 UsedArea = 1.0f / SourceRect;
float2 HalfRect = SourceRect * 0.5f;
float2 R2 = 1.0f / pow(length(UsedArea), 2.0f);
// -- Screen Pincushion Calculation --
float2 PinUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
float PincushionR2 = pow(length(PinUnitCoord), 2.0f) * R2;
float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
float2 BaseCoord = Input.TexCoord;
float2 ScanCoord = BaseCoord - 0.5f / ScreenDims;
BaseCoord -= HalfRect;
BaseCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
BaseCoord += HalfRect;
BaseCoord += PincushionCurve;
float2 UsedArea = 1.0f / SourceRect;
float2 HalfRect = SourceRect * 0.5f;
float2 R2 = 1.0f / pow(length(UsedArea), 2.0f);
// -- Screen Pincushion Calculation --
float2 PinUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
float PincushionR2 = pow(length(PinUnitCoord), 2.0f) * R2;
float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
float2 BaseCoord = Input.TexCoord;
float2 ScanCoord = BaseCoord - 0.5f / ScreenDims;
BaseCoord -= HalfRect;
BaseCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
BaseCoord += HalfRect;
BaseCoord += PincushionCurve;
ScanCoord -= HalfRect;
ScanCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
ScanCoord += HalfRect;
ScanCoord += PincushionCurve;
ScanCoord -= HalfRect;
ScanCoord *= 1.0f - PincushionAmount * UsedArea * 0.2f; // Warning: Magic constant
ScanCoord += HalfRect;
ScanCoord += PincushionCurve;
float2 CurveClipUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
float CurvatureClipR2 = pow(length(CurveClipUnitCoord), 2.0f) * R2;
float2 CurvatureClipCurve = CurveClipUnitCoord * CurvatureAmount * CurvatureClipR2;
float2 ScreenClipCoord = Input.TexCoord;
ScreenClipCoord -= HalfRect;
ScreenClipCoord *= 1.0f - CurvatureAmount * UsedArea * 0.2f; // Warning: Magic constant
ScreenClipCoord += HalfRect;
ScreenClipCoord += CurvatureClipCurve;
float2 CurveClipUnitCoord = Input.TexCoord * UsedArea * 2.0f - 1.0f;
float CurvatureClipR2 = pow(length(CurveClipUnitCoord), 2.0f) * R2;
float2 CurvatureClipCurve = CurveClipUnitCoord * CurvatureAmount * CurvatureClipR2;
float2 ScreenClipCoord = Input.TexCoord;
ScreenClipCoord -= HalfRect;
ScreenClipCoord *= 1.0f - CurvatureAmount * UsedArea * 0.2f; // Warning: Magic constant
ScreenClipCoord += HalfRect;
ScreenClipCoord += CurvatureClipCurve;
// RGB Pincushion Calculation
float3 PincushionCurveX = PinUnitCoord.x * PincushionAmount * PincushionR2;
float3 PincushionCurveY = PinUnitCoord.y * PincushionAmount * PincushionR2;
// RGB Pincushion Calculation
float3 PincushionCurveX = PinUnitCoord.x * PincushionAmount * PincushionR2;
float3 PincushionCurveY = PinUnitCoord.y * PincushionAmount * PincushionR2;
float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord);
float4 BaseTexel = tex2D(DiffuseSampler, BaseCoord);
// -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
clip((BaseCoord < 1.0f / SourceDims) ? -1 : 1);
clip((BaseCoord > (SourceRect + 1.0f / SourceDims)) ? -1 : 1);
// -- Alpha Clipping (1px border in drawd3d does not work for some reason) --
clip((BaseCoord < 1.0f / SourceDims) ? -1 : 1);
clip((BaseCoord > (SourceRect + 1.0f / SourceDims)) ? -1 : 1);
// -- Scanline Simulation --
float InnerSine = ScanCoord.y * SourceDims.y * ScanlineScale;
float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * SourceDims.y);
float3 ScanBrightness = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAlpha);
float3 Scanned = BaseTexel.rgb * ScanBrightness;
// -- Scanline Simulation --
float InnerSine = ScanCoord.y * SourceDims.y * ScanlineScale;
float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * SourceDims.y);
float3 ScanBrightness = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAlpha);
float3 Scanned = BaseTexel.rgb * ScanBrightness;
// -- Color Compression (increasing the floor of the signal without affecting the ceiling) --
Scanned = Floor + (1.0f - Floor) * Scanned;
// -- Color Compression (increasing the floor of the signal without affecting the ceiling) --
Scanned = Floor + (1.0f - Floor) * Scanned;
// Shadow mask
// Note: This is broken right now and needs fixed
float2 ShadowFrac = frac(BaseCoord * ShadowCount);
float2 ShadowCoord = ShadowFrac * ShadowUV + 0.5f / ShadowDims;
float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord).rgb, ShadowAlpha);
// -- Final Pixel --
float4 Output = float4(Scanned * ShadowTexel, BaseTexel.a) * Input.Color;
Output.r = pow(Output.r, Power.r);
Output.g = pow(Output.g, Power.g);
Output.b = pow(Output.b, Power.b);
Output.a = 1.0f;
// Shadow mask
// Note: This is broken right now and needs fixed
float2 ShadowFrac = frac(BaseCoord * ShadowCount);
float2 ShadowCoord = ShadowFrac * ShadowUV + 0.5f / ShadowDims;
float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord).rgb, ShadowAlpha);
// -- Final Pixel --
float4 Output = float4(Scanned * ShadowTexel, BaseTexel.a) * Input.Color;
Output.r = pow(Output.r, Power.r);
Output.g = pow(Output.g, Power.g);
Output.b = pow(Output.b, Power.b);
Output.a = 1.0f;
return Output;
return Output;
}
//-----------------------------------------------------------------------------
@ -173,13 +173,13 @@ float4 ps_main(PS_INPUT Input) : COLOR
technique ScanMaskTechnique
{
pass Pass0
{
Lighting = FALSE;
pass Pass0
{
Lighting = FALSE;
//Sampler[0] = <DiffuseSampler>;
//Sampler[0] = <DiffuseSampler>;
VertexShader = compile vs_3_0 vs_main();
PixelShader = compile ps_3_0 ps_main();
}
VertexShader = compile vs_3_0 vs_main();
PixelShader = compile ps_3_0 ps_main();
}
}

View File

@ -1051,6 +1051,8 @@ int shaders::create_resources(bool reset)
post_effect->add_uniform("Power", uniform::UT_VEC3, uniform::CU_POST_POWER);
post_effect->add_uniform("Floor", uniform::UT_VEC3, uniform::CU_POST_FLOOR);
bloom_effect->add_uniform("SourceRect", uniform::UT_VEC2, uniform::CU_SOURCE_RECT);
initialized = true;
return 0;
@ -1629,7 +1631,7 @@ void shaders::screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta,
HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, rt->target[2]);
result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(1,0,0,0), 0, 0);
result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
curr_effect->begin(&num_passes, 0);
@ -1697,14 +1699,17 @@ void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta,
}
curr_effect = bloom_effect;
curr_effect->update_uniforms();
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 };
float temp0[2] = { 1024.0f, 512.0f };
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("ScreenSize", 2, &screendims.c.x);
curr_effect->set_vector("TextureSize", 2, temp0);
curr_effect->set_texture("DiffuseA", rt->render_texture[2]);

View File

@ -1690,14 +1690,14 @@ void renderer::draw_quad(const render_primitive *prim)
return;
// fill in the vertexes clockwise
vertex[0].x = prim->bounds.x0 - 0.5f;
vertex[0].y = prim->bounds.y0 - 0.5f;
vertex[1].x = prim->bounds.x1 - 0.5f;
vertex[1].y = prim->bounds.y0 - 0.5f;
vertex[2].x = prim->bounds.x0 - 0.5f;
vertex[2].y = prim->bounds.y1 - 0.5f;
vertex[3].x = prim->bounds.x1 - 0.5f;
vertex[3].y = prim->bounds.y1 - 0.5f;
vertex[0].x = roundf(prim->bounds.x0) - 0.5f;
vertex[0].y = roundf(prim->bounds.y0) - 0.5f;
vertex[1].x = roundf(prim->bounds.x1) - 0.5f;
vertex[1].y = roundf(prim->bounds.y0) - 0.5f;
vertex[2].x = roundf(prim->bounds.x0) - 0.5f;
vertex[2].y = roundf(prim->bounds.y1) - 0.5f;
vertex[3].x = roundf(prim->bounds.x1) - 0.5f;
vertex[3].y = roundf(prim->bounds.y1) - 0.5f;
float width = prim->bounds.x1 - prim->bounds.x0;
float height = prim->bounds.y1 - prim->bounds.y0;