diff --git a/hlsl/ntsc.fx b/hlsl/ntsc.fx index ed07e37a4cc..107be16af16 100644 --- a/hlsl/ntsc.fx +++ b/hlsl/ntsc.fx @@ -108,7 +108,7 @@ static const int HalfSampleCount = SampleCount / 2; float4 GetCompositeYIQ(float2 TexCoord) { - float2 SourceTexelDims = 1.0f / SourceDims; + float2 SourceTexelDims = 1.0f / SourceDims; float2 SourceRes = SourceDims * SourceRect; float2 PValueSourceTexel = float2(PValue, 0.0f) * SourceTexelDims; @@ -131,12 +131,13 @@ float4 GetCompositeYIQ(float2 TexCoord) float4 I = float4(dot(Texel0, IDot), dot(Texel1, IDot), dot(Texel2, IDot), dot(Texel3, IDot)); float4 Q = float4(dot(Texel0, QDot), dot(Texel1, QDot), dot(Texel2, QDot), dot(Texel3, QDot)); - float4 W = PI2 * CCValue * ScanTime; + float W = PI2 * CCValue * ScanTime; + float WoPI = W / PI; - float4 T = HPosition - + (AValue / 360.0f * SourceRes.y) * VPosition - + (BValue / 360.0f) - + (SignalOffset / 360.0f); + float HOffset = (BValue + SignalOffset) / WoPI; + float VScale = (AValue * SourceRes.y) / WoPI; + + float4 T = HPosition + HOffset + VPosition * VScale; float4 TW = T * W; float4 CompositeYIQ = Y + I * cos(TW) + Q * sin(TW); @@ -171,7 +172,11 @@ float4 ps_main(PS_INPUT Input) : COLOR float PI2Length = PI2 / SampleCount; float W = PI2 * CCValue * ScanTime; - + float WoPI = W / PI; + + float HOffset = (BValue + SignalOffset) / WoPI; + float VScale = (AValue * SourceRes.y) / WoPI; + float4 YAccum = 0.0f; float4 IAccum = 0.0f; float4 QAccum = 0.0f; @@ -190,12 +195,8 @@ float4 ps_main(PS_INPUT Input) : COLOR float4 C = GetCompositeYIQ(float2(Cx.r, Cy.r)); - float4 T = HPosition - + (AValue / 360.0f * SourceRes.y) * VPosition - + (BValue / 360.0f) - + (SignalOffset / 360.0f); - float4 WT = W * T - + OValue; + float4 T = HPosition + HOffset + VPosition * VScale; + float4 WT = W * T + OValue; float4 SincKernel = 0.54f + 0.46f * cos(PI2Length * n4); diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 8a60eaa5190..712646f7a9a 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -990,7 +990,7 @@ int shaders::create_resources(bool reset) deconverge_effect->add_uniform("RadialConvergeY", uniform::UT_VEC3, uniform::CU_CONVERGE_RADIAL_Y); focus_effect->add_uniform("Defocus", uniform::UT_VEC2, uniform::CU_FOCUS_SIZE); - + phosphor_effect->add_uniform("Phosphor", uniform::UT_VEC3, uniform::CU_PHOSPHOR_LIFE); post_effect->add_uniform("VignettingAmount", uniform::UT_FLOAT, uniform::CU_POST_VIGNETTING); // backward compatibility @@ -1231,7 +1231,7 @@ int shaders::ntsc_pass(render_target *rt, int source_index, poly_info *poly, int { return next_index; } - + float signal_offset = curr_texture->get_cur_frame() == 0 ? 0.0f : options->yiq_jitter; @@ -1241,7 +1241,7 @@ int shaders::ntsc_pass(render_target *rt, int source_index, poly_info *poly, int curr_effect = ntsc_effect; curr_effect->update_uniforms(); curr_effect->set_float("SignalOffset", signal_offset); - + next_index = rt->next_index(next_index); blit(rt->native_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2); @@ -2778,7 +2778,7 @@ static INT32 slider_ntsc_enable(running_machine &machine, void *arg, std::string } // static INT32 slider_ntsc_phase_count(running_machine &machine, void *arg, std::string *str, INT32 newval) -// { +// { // hlsl_options *options = (hlsl_options*)arg; // if (newval != SLIDER_NOCHANGE) // { @@ -3066,7 +3066,7 @@ void uniform::update() break; } case CU_SOURCE_RECT: - { + { bool prepare_vector = d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; @@ -3076,7 +3076,7 @@ void uniform::update() m_shader->set_vector("SourceRect", 2, delta); break; } - + if (shadersys->curr_texture != NULL) { vec2f delta = shadersys->curr_texture->get_uvstop() - shadersys->curr_texture->get_uvstart();