mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
Fixing some scanline-alignment issues.
This commit is contained in:
parent
6bacece859
commit
37e8c1d7e4
3 changed files with 16 additions and 2 deletions
|
@ -79,7 +79,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
|||
|
||||
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight);
|
||||
Output.TexCoord = Input.TexCoord + 0.5f * InvTexSize;
|
||||
Output.PrevCoord = Output.TexCoord + 0.5f * InvTexSize;
|
||||
Output.PrevCoord = Input.TexCoord + 0.5f * InvTexSize;
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,9 @@ uniform float RedFloor = 0.0f;
|
|||
uniform float GrnFloor = 0.0f;
|
||||
uniform float BluFloor = 0.0f;
|
||||
|
||||
uniform float SnapX = 0.0f;
|
||||
uniform float SnapY = 0.0f;
|
||||
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 Ratios = float2(WidthRatio, HeightRatio);
|
||||
|
@ -125,7 +128,11 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
|||
float2 PinUnitCoord = (Input.TexCoord + PinViewpointOffset) * Ratios * 2.0f - 1.0f;
|
||||
float PincushionR2 = pow(length(PinUnitCoord), 2.0f) / pow(length(Ratios), 2.0f);
|
||||
float2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
|
||||
float2 BaseCoord = Input.TexCoord;
|
||||
float2 BaseCoord = Input.TexCoord + float2(0.0f, 0.0f / TargetHeight);
|
||||
BaseCoord.y *= TargetHeight;
|
||||
BaseCoord.y -= frac(BaseCoord.y);
|
||||
BaseCoord.y += 0.5f;
|
||||
BaseCoord.y /= TargetHeight;
|
||||
BaseCoord -= 0.5f / Ratios;
|
||||
BaseCoord *= 1.0f - PincushionAmount * Ratios * 0.2f; // Warning: Magic constant
|
||||
BaseCoord += 0.5f / Ratios;
|
||||
|
|
|
@ -2976,6 +2976,8 @@ static void primitive_flush_pending(d3d_info *d3d)
|
|||
(*d3dintf->effect.set_float)(curr_effect, "RedFloor", options->screen_red_floor);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "GrnFloor", options->screen_green_floor);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "BluFloor", options->screen_blue_floor);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "SnapX", d3d->hlsl_snap_width);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "SnapY", d3d->hlsl_snap_height);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->screen_pincushion);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "CurvatureAmount", options->screen_curvature);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "UseShadow", d3d->shadow_texture == NULL ? 0.0f : 1.0f);
|
||||
|
@ -3388,6 +3390,8 @@ static void primitive_flush_pending(d3d_info *d3d)
|
|||
|
||||
(*d3dintf->effect.set_texture)(curr_effect, "Diffuse", d3d->hlsltexture0[poly->texture->target_index]);
|
||||
|
||||
(*d3dintf->effect.set_float)(curr_effect, "SnapX", d3d->hlsl_snap_width);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "SnapY", d3d->hlsl_snap_height);
|
||||
result = (*d3dintf->device.set_render_target)(d3d->device, 0, d3d->hlsl_snap_target);
|
||||
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
|
||||
|
||||
|
@ -3407,6 +3411,9 @@ static void primitive_flush_pending(d3d_info *d3d)
|
|||
d3d->hlsl_snap_rendered = true;
|
||||
}
|
||||
|
||||
(*d3dintf->effect.set_float)(curr_effect, "SnapX", d3d->width);
|
||||
(*d3dintf->effect.set_float)(curr_effect, "SnapY", d3d->height);
|
||||
|
||||
/* Scanlines and shadow mask */
|
||||
curr_effect = d3d->post_effect;
|
||||
|
||||
|
|
Loading…
Reference in a new issue