From 99dffc122e45c592bc10731755594e0ccbc0da1e Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Sun, 22 May 2011 01:30:55 +0000 Subject: [PATCH] HLSL: Added adjustable color carrier in YIQ processing mode. [Ryan Holtz, Bat Country Entertainment] HLSL: Fixed resolution-change crash and likely D3D performance regression with -nohlsl on low-spec cards [Ryan Holtz, Bat Country Entertainment] --- hlsl/post.fx | 4 +- hlsl/yiq_decode.fx | 80 ++++++++++++----------- hlsl/yiq_encode.fx | 19 +++--- src/osd/windows/drawd3d.c | 130 ++++++++++++++++++++------------------ src/osd/windows/winmain.c | 10 +-- src/osd/windows/winmain.h | 8 +-- 6 files changed, 132 insertions(+), 119 deletions(-) diff --git a/hlsl/post.fx b/hlsl/post.fx index 617ba5f71d6..78fe988c26d 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -84,7 +84,7 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.ExtraInfo = Input.ExtraInfo; //Output.TexCoord /= 16.0f; - //Output.TexCoord += 0.4875f; + //Output.TexCoord += float2(0.3f, 0.25f); return Output; } @@ -164,7 +164,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float2 ShadowUV = float2(ShadowU, ShadowV); float2 ShadowMaskSize = float2(ShadowMaskSizeX, ShadowMaskSizeY); float2 ShadowFrac = frac(ScreenCurveCoord * ShadowMaskSize * Ratios * 0.5f); - float2 ShadowCoord = ShadowFrac * ShadowUV + 2.5f / ShadowDims; + float2 ShadowCoord = ShadowFrac * ShadowUV + 1.5f / ShadowDims; float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord), UseShadow); // -- Final Pixel -- diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx index 786e9c549c6..a446698884a 100644 --- a/hlsl/yiq_decode.fx +++ b/hlsl/yiq_decode.fx @@ -4,7 +4,7 @@ texture Diffuse; -sampler DiffuseSampler = sampler_state +sampler CompositeSampler = sampler_state { Texture = ; MipFilter = POINT; @@ -29,6 +29,8 @@ struct VS_OUTPUT float4 Coord3 : TEXCOORD3; float4 Coord4 : TEXCOORD4; float4 Coord5 : TEXCOORD5; + float4 Coord6 : TEXCOORD6; + float4 Coord7 : TEXCOORD7; }; struct VS_INPUT @@ -48,6 +50,8 @@ struct PS_INPUT float4 Coord3 : TEXCOORD3; float4 Coord4 : TEXCOORD4; float4 Coord5 : TEXCOORD5; + float4 Coord6 : TEXCOORD6; + float4 Coord7 : TEXCOORD7; }; //----------------------------------------------------------------------------- @@ -63,6 +67,8 @@ uniform float RawHeight; uniform float WidthRatio; uniform float HeightRatio; +uniform float FscValue; + VS_OUTPUT vs_main(VS_INPUT Input) { VS_OUTPUT Output = (VS_OUTPUT)0; @@ -83,12 +89,8 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Coord3.xy = Input.TexCoord + float2(0.75f / RawWidth, 0.0f); Output.Coord4.xy = Input.TexCoord + float2(1.00f / RawWidth, 0.0f); Output.Coord5.xy = Input.TexCoord + float2(1.25f / RawWidth, 0.0f); - Output.Coord0.zw = Input.TexCoord + float2(-0.25f / RawWidth, 0.0f); - Output.Coord1.zw = Input.TexCoord + float2(-0.50f / RawWidth, 0.0f); - Output.Coord2.zw = Input.TexCoord + float2(-0.75f / RawWidth, 0.0f); - Output.Coord3.zw = Input.TexCoord + float2(-1.00f / RawWidth, 0.0f); - Output.Coord4.zw = Input.TexCoord + float2(-1.25f / RawWidth, 0.0f); - Output.Coord5.zw = Input.TexCoord + float2(-1.55f / RawWidth, 0.0f); + Output.Coord6.xy = Input.TexCoord + float2(1.50f / RawWidth, 0.0f); + Output.Coord7.xy = Input.TexCoord + float2(1.75f / RawWidth, 0.0f); return Output; } @@ -108,12 +110,10 @@ uniform float BValue; float4 ps_main(PS_INPUT Input) : COLOR { float2 RawDims = float2(RawWidth, RawHeight); - float4 OrigC = tex2D(DiffuseSampler, Input.Coord0.xy); - float4 OrigC2 = tex2D(DiffuseSampler, Input.Coord4.xy); - float4 OrigC3 = tex2D(DiffuseSampler, Input.Coord2.zw); + float4 OrigC = tex2D(CompositeSampler, Input.Coord0.xy); + float4 OrigC2 = tex2D(CompositeSampler, Input.Coord4.xy); float4 C = OrigC; float4 C2 = OrigC2; - float4 C3 = OrigC3; float MaxC = 2.1183f; float MinC = -1.1183f; @@ -121,7 +121,6 @@ float4 ps_main(PS_INPUT Input) : COLOR C = C * CRange + MinC; C2 = C2 * CRange + MinC; - C3 = C3 * CRange + MinC; float2 Coord0 = Input.Coord0.xy * RawDims; float2 Coord1 = Input.Coord1.xy * RawDims; @@ -129,13 +128,8 @@ float4 ps_main(PS_INPUT Input) : COLOR float2 Coord3 = Input.Coord3.xy * RawDims; float2 Coord4 = Input.Coord4.xy * RawDims; float2 Coord5 = Input.Coord5.xy * RawDims; - - float2 Coord6 = Input.Coord0.zw * RawDims; - float2 Coord7 = Input.Coord1.zw * RawDims; - float2 Coord8 = Input.Coord2.zw * RawDims; - float2 Coord9 = Input.Coord3.zw * RawDims; - float2 CoordA = Input.Coord4.zw * RawDims; - float2 CoordB = Input.Coord5.zw * RawDims; + float2 Coord6 = Input.Coord6.xy * RawDims; + float2 Coord7 = Input.Coord7.xy * RawDims; float W = WValue; float T0 = Coord0.x + AValue * Coord0.y + BValue; @@ -146,29 +140,39 @@ float4 ps_main(PS_INPUT Input) : COLOR float T5 = Coord5.x + AValue * Coord5.y + BValue; float T6 = Coord6.x + AValue * Coord6.y + BValue; float T7 = Coord7.x + AValue * Coord7.y + BValue; - float T8 = Coord8.x + AValue * Coord8.y + BValue; - float T9 = Coord9.x + AValue * Coord9.y + BValue; - float TA = CoordA.x + AValue * CoordA.y + BValue; - float TB = CoordB.x + AValue * CoordB.y + BValue; float4 Tc = float4(T0, T1, T2, T3); float4 Tc2 = float4(T4, T5, T6, T7); - float4 Tc3 = float4(T8, T9, TA, TB); - float Y = (C.r + C.g + C.b + C.a + C2.r + C2.g) / 6.0f;// + C2.a + C3.r + C3.g + C3.b + C3.a) / 12.0f; - - float4 I = (C - Y) * sin(W * Tc); - float4 Q = (C - Y) * cos(W * Tc); - float4 I2 = (C2 - Y) * sin(W * Tc2); - float4 Q2 = (C2 - Y) * cos(W * Tc2); - float4 I3 = (C3 - Y) * sin(W * Tc3); - float4 Q3 = (C3 - Y) * cos(W * Tc3); - - float Iavg = (I.r + I.g + I.b + I.a + I2.r + I2.g) / 3.0f; - float Qavg = (Q.r + Q.g + Q.b + Q.a + Q2.r + Q2.g) / 3.0f; - float Iavg2 = (I2.b + I2.a + I3.r + I3.g + I3.b + I3.a) / 3.0f; - float Qavg2 = (Q2.b + Q2.a + Q3.r + Q3.g + Q3.b + Q3.a) / 3.0f; + float Yvals[8]; + Yvals[0] = C.r; Yvals[1] = C.g; Yvals[2] = C.b; Yvals[3] = C.a; Yvals[4] = C2.r; Yvals[5] = C2.g; Yvals[6] = C2.b; Yvals[7] = C2.a; + float Ytotal = 0.0f; + for(uint idx = 0; idx < FscValue * 4.0f; idx++ ) + { + Ytotal = Ytotal + Yvals[idx]; + } + float Yavg = Ytotal / (FscValue * 4.0f); - float3 YIQ = float3(Y, Iavg, Qavg); + float4 I = (C - Yavg) * sin(W * Tc); + float4 Q = (C - Yavg) * cos(W * Tc); + float4 I2 = (C2 - Yavg) * sin(W * Tc2); + float4 Q2 = (C2 - Yavg) * cos(W * Tc2); + + float Itotal = 0.0f; + float Qtotal = 0.0f; + + float Ivals[8]; + float Qvals[8]; + Ivals[0] = I.r; Ivals[1] = I.g; Ivals[2] = I.b; Ivals[3] = I.a; Ivals[4] = I2.r; Ivals[5] = I2.g; Ivals[6] = I2.b; Ivals[7] = I2.a; + Qvals[0] = Q.r; Qvals[1] = Q.g; Qvals[2] = Q.b; Qvals[3] = Q.a; Qvals[4] = Q2.r; Qvals[5] = Q2.g; Qvals[6] = Q2.b; Qvals[7] = Q2.a; + for(uint idx = 0; idx < FscValue * 4.0f; idx++ ) + { + Itotal = Itotal + Ivals[idx]; + Qtotal = Qtotal + Qvals[idx]; + } + float Iavg = Itotal / (FscValue * 4.0f); + float Qavg = Qtotal / (FscValue * 4.0f); + + float3 YIQ = float3(Yavg, Iavg, Qavg); float3 OutRGB = float3(dot(YIQ, float3(1.0f, 0.9563f, 0.6210f)), dot(YIQ, float3(1.0f, -0.2721f, -0.6474f)), dot(YIQ, float3(1.0f, -1.1070f, 1.7046f))); diff --git a/hlsl/yiq_encode.fx b/hlsl/yiq_encode.fx index 98c1d3a17fe..e15e7ccb7d7 100644 --- a/hlsl/yiq_encode.fx +++ b/hlsl/yiq_encode.fx @@ -91,14 +91,15 @@ uniform float WValue; uniform float AValue; uniform float BValue; +uniform float FscScale; + float4 ps_main(PS_INPUT Input) : COLOR { float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio); - float2 Offset = float2(0.5f / RawWidth, 0.5f / RawHeight); - float3 Texel0 = tex2D(DiffuseSampler, Input.Coord0 - Offset).rgb; - float3 Texel1 = tex2D(DiffuseSampler, Input.Coord1 - Offset).rgb; - float3 Texel2 = tex2D(DiffuseSampler, Input.Coord2 - Offset).rgb; - float3 Texel3 = tex2D(DiffuseSampler, Input.Coord3 - Offset).rgb; + float3 Texel0 = tex2D(DiffuseSampler, Input.Coord0 - float2(0.0f, 0.5f / RawHeight)).rgb; + float3 Texel1 = tex2D(DiffuseSampler, Input.Coord1 - float2(0.0f, 0.5f / RawHeight)).rgb; + float3 Texel2 = tex2D(DiffuseSampler, Input.Coord2 - float2(0.0f, 0.5f / RawHeight)).rgb; + float3 Texel3 = tex2D(DiffuseSampler, Input.Coord3 - float2(0.0f, 0.5f / RawHeight)).rgb; float2 Scaler = float2(RawWidth, RawHeight); float2 Coord0 = Input.Coord0.xy * Scaler; @@ -107,10 +108,10 @@ float4 ps_main(PS_INPUT Input) : COLOR float2 Coord3 = Input.Coord3.xy * Scaler; float W = WValue; - float T0 = Coord0.x + AValue * Coord0.y + BValue;// - 1.1f; - float T1 = Coord1.x + AValue * Coord1.y + BValue;// - 1.1f; - float T2 = Coord2.x + AValue * Coord2.y + BValue;// - 1.1f; - float T3 = Coord3.x + AValue * Coord3.y + BValue;// - 1.1f; + float T0 = Coord0.x + AValue * Coord0.y + BValue; + float T1 = Coord1.x + AValue * Coord1.y + BValue; + float T2 = Coord2.x + AValue * Coord2.y + BValue; + float T3 = Coord3.x + AValue * Coord3.y + BValue; float Y0 = dot(Texel0, float3(0.299f, 0.587f, 0.114f)); float I0 = dot(Texel0, float3(0.595716f, -0.274453f, -0.321263f)); diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index c8236b678a8..d18dcc712d4 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -2163,8 +2163,6 @@ static void primitive_flush_pending(d3d_info *d3d) (*d3dintf->effect.set_float)(curr_effect, "UseShadow", d3d->shadow_texture == NULL ? 0.0f : 1.0f); (*d3dintf->effect.set_texture)(curr_effect, "Shadow", d3d->shadow_texture == NULL ? NULL : d3d->shadow_texture->d3dfinaltex); (*d3dintf->effect.set_float)(curr_effect, "ShadowBrightness", (float)options.screen_shadow_mask_alpha()); - (*d3dintf->effect.set_float)(curr_effect, "ShadowPixelSizeX", (float)options.screen_shadow_mask_ratio_x()); - (*d3dintf->effect.set_float)(curr_effect, "ShadowPixelSizeY", (float)options.screen_shadow_mask_ratio_y()); (*d3dintf->effect.set_float)(curr_effect, "ShadowMaskSizeX", (float)options.screen_shadow_mask_count_x()); (*d3dintf->effect.set_float)(curr_effect, "ShadowMaskSizeY", (float)options.screen_shadow_mask_count_y()); (*d3dintf->effect.set_float)(curr_effect, "ShadowU", (float)options.screen_shadow_mask_u_size()); @@ -2212,6 +2210,8 @@ static void primitive_flush_pending(d3d_info *d3d) (*d3dintf->effect.set_float)(curr_effect, "WValue", options.screen_yiq_w()); (*d3dintf->effect.set_float)(curr_effect, "AValue", options.screen_yiq_a()); (*d3dintf->effect.set_float)(curr_effect, "BValue", (float)poly->texture->cur_frame * options.screen_yiq_b()); + (*d3dintf->effect.set_float)(curr_effect, "FscScale", options.screen_yiq_fsc_scale()); + (*d3dintf->effect.set_float)(curr_effect, "FscValue", options.screen_yiq_fsc()); result = (*d3dintf->device.set_render_target)(d3d->device, 0, poly->texture->d3dtarget4); @@ -2245,6 +2245,7 @@ static void primitive_flush_pending(d3d_info *d3d) (*d3dintf->effect.set_float)(curr_effect, "WValue", options.screen_yiq_w()); (*d3dintf->effect.set_float)(curr_effect, "AValue", options.screen_yiq_a()); (*d3dintf->effect.set_float)(curr_effect, "BValue", (float)poly->texture->cur_frame * options.screen_yiq_b()); + (*d3dintf->effect.set_float)(curr_effect, "FscValue", options.screen_yiq_fsc()); result = (*d3dintf->device.set_render_target)(d3d->device, 0, poly->texture->d3dtarget3); @@ -2648,42 +2649,46 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour { texture->d3dfinaltex = texture->d3dtex; texture->type = d3d->dynamic_supported ? TEXTURE_TYPE_DYNAMIC : TEXTURE_TYPE_PLAIN; - result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture0); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture0, 0, &texture->d3dtarget0); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d3d->last_d3dtexture[d3d->registered_targets]); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(d3d->last_d3dtexture[d3d->registered_targets], 0, &d3d->last_d3dtarget[d3d->registered_targets]); + if(d3d->hlsl_enable && d3dintf->post_fx_available) + { + result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture0); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture0, 0, &texture->d3dtarget0); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture1); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture1, 0, &texture->d3dtarget1); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d3d->last_d3dtexture[d3d->registered_targets]); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(d3d->last_d3dtexture[d3d->registered_targets], 0, &d3d->last_d3dtarget[d3d->registered_targets]); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture2); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture2, 0, &texture->d3dtarget2); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture1); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture1, 0, &texture->d3dtarget1); - result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture3); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture3, 0, &texture->d3dtarget3); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(d3d->width * d3d->oversample_x), (int)(d3d->height * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture2); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture2, 0, &texture->d3dtarget2); - result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture4); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture4, 0, &texture->d3dtarget4); + result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture3); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture3, 0, &texture->d3dtarget3); - result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dsmalltexture0); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dsmalltexture0, 0, &texture->d3dsmalltarget0); + result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture4); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture4, 0, &texture->d3dtarget4); - d3d->registered_targets++; + result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dsmalltexture0); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dsmalltexture0, 0, &texture->d3dsmalltarget0); + + d3d->registered_targets++; + } break; } @@ -2723,42 +2728,44 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour result = (*d3dintf->device.create_texture)(d3d->device, scwidth, scheight, 1, D3DUSAGE_RENDERTARGET, finalfmt, D3DPOOL_DEFAULT, &texture->d3dfinaltex); if (result == D3D_OK) { - result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture0); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture0, 0, &texture->d3dtarget0); + if(d3d->hlsl_enable && d3dintf->post_fx_available) + { + result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture0); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture0, 0, &texture->d3dtarget0); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d3d->last_d3dtexture[d3d->registered_targets]); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(d3d->last_d3dtexture[d3d->registered_targets], 0, &d3d->last_d3dtarget[d3d->registered_targets]); - d3d->registered_targets++; + result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d3d->last_d3dtexture[d3d->registered_targets]); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(d3d->last_d3dtexture[d3d->registered_targets], 0, &d3d->last_d3dtarget[d3d->registered_targets]); + d3d->registered_targets++; - result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture1); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture1, 0, &texture->d3dtarget1); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture1); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture1, 0, &texture->d3dtarget1); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture2); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture2, 0, &texture->d3dtarget2); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture2); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture2, 0, &texture->d3dtarget2); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture3); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture3, 0, &texture->d3dtarget3); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture3); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture3, 0, &texture->d3dtarget3); - result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture4); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dtexture4, 0, &texture->d3dtarget4); - - result = (*d3dintf->device.create_texture)(d3d->device, scwidth, scheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dsmalltexture0); - if (result != D3D_OK) - goto error; - (*d3dintf->texture.get_surface_level)(texture->d3dsmalltexture0, 0, &texture->d3dsmalltarget0); + result = (*d3dintf->device.create_texture)(d3d->device, (int)(scwidth * d3d->oversample_x), (int)(scheight * d3d->oversample_y), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dtexture4); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dtexture4, 0, &texture->d3dtarget4); + result = (*d3dintf->device.create_texture)(d3d->device, scwidth, scheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture->d3dsmalltexture0); + if (result != D3D_OK) + goto error; + (*d3dintf->texture.get_surface_level)(texture->d3dsmalltexture0, 0, &texture->d3dsmalltarget0); + } break; } (*d3dintf->texture.release)(texture->d3dtex); @@ -2776,6 +2783,7 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour return texture; error: + d3dintf->post_fx_available = false; if (texture->d3dsurface != NULL) (*d3dintf->surface.release)(texture->d3dsurface); if (texture->d3dtex != NULL) diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 3e98b91e1ac..6b687c289c3 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -332,8 +332,6 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_HLSLPATH, "hlsl", OPTION_STRING, "path to hlsl files" }, { WINOPTION_SHADOW_MASK_ALPHA";fs_shadwa(0.0-1.0)", "0.0", OPTION_FLOAT, "shadow mask alpha-blend value (1.0 is fully blended, 0.0 is no mask)" }, { WINOPTION_SHADOW_MASK_TEXTURE";fs_shadwt(0.0-1.0)", "aperture.png", OPTION_STRING, "shadow mask texture name" }, - { WINOPTION_SHADOW_MASK_RATIO_X";fs_shadwx", "3.0", OPTION_FLOAT, "shadow mask texels per dot mask pixel in screen-relative X direction" }, - { WINOPTION_SHADOW_MASK_RATIO_Y";fs_shadwy", "3.0", OPTION_FLOAT, "shadow mask texels per dot mask pixel in screen-relative Y direction" }, { WINOPTION_SHADOW_MASK_COUNT_X";fs_shadww", "640", OPTION_INTEGER, "shadow mask width, in phosphor dots" }, { WINOPTION_SHADOW_MASK_COUNT_Y";fs_shadwh", "480", OPTION_INTEGER, "shadow mask height, in phosphor dots" }, { WINOPTION_SHADOW_MASK_USIZE";fs_shadwu(0.0-1.0)", "0.1875", OPTION_FLOAT, "shadow mask texture size in U direction" }, @@ -399,9 +397,11 @@ const options_entry windows_options::s_option_entries[] = /* NTSC simulation below this line */ { WINOPTION_YIQ_ENABLE";yiq", "0", OPTION_BOOLEAN, "enable YIQ-space HLSL post-processing" }, { WINOPTION_YIQ_WVALUE";yiqw", "4.1187867", OPTION_FLOAT, "W value for YIQ signal processing" }, - { WINOPTION_YIQ_AVALUE";yiqa", "0.5", OPTION_FLOAT, "A value for YIQ signal processing (usually 0.5)" }, - { WINOPTION_YIQ_BVALUE";yiqb", "0.5", OPTION_FLOAT, "B value for YIQ signal processing (usually 0.5)" }, - { WINOPTION_YIQ_PHASE_COUNT";yiqp", "3", OPTION_INTEGER, "Phase Count value for YIQ signal processing (usually 2)" }, + { WINOPTION_YIQ_AVALUE";yiqa", "0.5", OPTION_FLOAT, "A value for YIQ signal processing" }, + { WINOPTION_YIQ_BVALUE";yiqb", "0.5", OPTION_FLOAT, "B value for YIQ signal processing" }, + { WINOPTION_YIQ_FSCVALUE";yiqfsc", "1.5", OPTION_FLOAT, "Fsc value for YIQ signal processing" }, + { WINOPTION_YIQ_FSCSCALE";yiqfscs", "1.0", OPTION_FLOAT, "Incoming Fsc scaling value for YIQ signal processing" }, + { WINOPTION_YIQ_PHASE_COUNT";yiqp", "2", OPTION_INTEGER, "Phase Count value for YIQ signal processing" }, // per-window options { NULL, NULL, OPTION_HEADER, "PER-WINDOW VIDEO OPTIONS" }, diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index c9e1e438966..f7ec9cb7f59 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -83,8 +83,6 @@ #define WINOPTION_HLSLPATH "hlslpath" #define WINOPTION_SHADOW_MASK_ALPHA "shadow_mask_alpha" #define WINOPTION_SHADOW_MASK_TEXTURE "shadow_mask_texture" -#define WINOPTION_SHADOW_MASK_RATIO_X "shadow_mask_pix_width" -#define WINOPTION_SHADOW_MASK_RATIO_Y "shadow_mask_pix_height" #define WINOPTION_SHADOW_MASK_COUNT_X "shadow_mask_x_count" #define WINOPTION_SHADOW_MASK_COUNT_Y "shadow_mask_y_count" #define WINOPTION_SHADOW_MASK_USIZE "shadow_mask_usize" @@ -143,6 +141,8 @@ #define WINOPTION_YIQ_WVALUE "yiq_w" #define WINOPTION_YIQ_AVALUE "yiq_a" #define WINOPTION_YIQ_BVALUE "yiq_b" +#define WINOPTION_YIQ_FSCVALUE "yiq_fsc" +#define WINOPTION_YIQ_FSCSCALE "yiq_fsc_scale" #define WINOPTION_YIQ_PHASE_COUNT "yiq_phase_count" // per-window options @@ -212,8 +212,6 @@ public: bool d3d_hlsl_enable() const { return bool_value(WINOPTION_HLSL_ENABLE); } float screen_shadow_mask_alpha() const { return float_value(WINOPTION_SHADOW_MASK_ALPHA); } const char *screen_shadow_mask_texture() const { return value(WINOPTION_SHADOW_MASK_TEXTURE); } - float screen_shadow_mask_ratio_x() const { return float_value(WINOPTION_SHADOW_MASK_RATIO_X); } - float screen_shadow_mask_ratio_y() const { return float_value(WINOPTION_SHADOW_MASK_RATIO_Y); } float screen_shadow_mask_count_x() const { return float_value(WINOPTION_SHADOW_MASK_COUNT_X); } float screen_shadow_mask_count_y() const { return float_value(WINOPTION_SHADOW_MASK_COUNT_Y); } float screen_shadow_mask_u_size() const { return float_value(WINOPTION_SHADOW_MASK_USIZE); } @@ -256,6 +254,8 @@ public: float screen_yiq_w() const { return float_value(WINOPTION_YIQ_WVALUE); } float screen_yiq_a() const { return float_value(WINOPTION_YIQ_AVALUE); } float screen_yiq_b() const { return float_value(WINOPTION_YIQ_BVALUE); } + float screen_yiq_fsc() const { return float_value(WINOPTION_YIQ_FSCVALUE); } + float screen_yiq_fsc_scale() const { return float_value(WINOPTION_YIQ_FSCSCALE); } int screen_yiq_phase_count() const { return int_value(WINOPTION_YIQ_PHASE_COUNT); } float screen_red_offset() const { return float_value(WINOPTION_RED_OFFSET); } float screen_green_offset() const { return float_value(WINOPTION_GREEN_OFFSET); }