diff options
author | Ryan Holtz <rholtz@batcountryentertainment.com> | 2011-06-11 23:46:24 +0000 |
---|---|---|
committer | Ryan Holtz <rholtz@batcountryentertainment.com> | 2011-06-11 23:46:24 +0000 |
commit | 80d66bb1d6dee4f6e0d91ddf415d123b0aace1e2 (patch) | |
tree | 257920a2a6ab9e564982ab2e06b83d7f77ec976e | |
parent | 5d2798215c21b68ac84dee11a6f6c7de53cc0ddc (diff) |
HLSL Cleanup, no whatsnew:
- Fixed set_vector functionality and simplified shaders as a result
- Fixed HLSL presets, 0 to 3, in increasing level of terribleness
- Reduced options footprint from RGB triplets
Next plan: Separate INI writing.
-rw-r--r-- | hlsl/color.fx | 39 | ||||
-rw-r--r-- | hlsl/deconverge.fx | 56 | ||||
-rw-r--r-- | hlsl/focus.fx | 20 | ||||
-rw-r--r-- | hlsl/post.fx | 20 | ||||
-rw-r--r-- | src/osd/windows/d3d8intf.c | 2 | ||||
-rw-r--r-- | src/osd/windows/d3d9intf.c | 13 | ||||
-rw-r--r-- | src/osd/windows/d3dhlsl.c | 437 | ||||
-rw-r--r-- | src/osd/windows/d3dhlsl.h | 51 | ||||
-rw-r--r-- | src/osd/windows/d3dintf.h | 2 | ||||
-rw-r--r-- | src/osd/windows/drawd3d.c | 4 | ||||
-rw-r--r-- | src/osd/windows/winmain.c | 61 | ||||
-rw-r--r-- | src/osd/windows/winmain.h | 106 |
12 files changed, 325 insertions, 486 deletions
diff --git a/hlsl/color.fx b/hlsl/color.fx index e7ceeb57978..5e62dbd6d9f 100644 --- a/hlsl/color.fx +++ b/hlsl/color.fx @@ -76,28 +76,11 @@ VS_OUTPUT vs_main(VS_INPUT Input) // Post-Processing Pixel Shader //----------------------------------------------------------------------------- -uniform float RedFromRed = 1.0f; -uniform float RedFromGrn = 0.0f; -uniform float RedFromBlu = 0.0f; -uniform float GrnFromRed = 0.0f; -uniform float GrnFromGrn = 1.0f; -uniform float GrnFromBlu = 0.0f; -uniform float BluFromRed = 0.0f; -uniform float BluFromGrn = 0.0f; -uniform float BluFromBlu = 1.0f; - -uniform float RedOffset = 0.0f; -uniform float GrnOffset = 0.0f; -uniform float BluOffset = 0.0f; - -uniform float RedScale = 1.0f; -uniform float GrnScale = 1.0f; -uniform float BluScale = 1.0f; - -uniform float RedFloor = 0.0f; -uniform float GrnFloor = 0.0f; -uniform float BluFloor = 0.0f; - +uniform float3 RedRatios = float3(1.0f, 0.0f, 0.0f); +uniform float3 GrnRatios = float3(0.0f, 1.0f, 0.0f); +uniform float3 BluRatios = float3(0.0f, 0.0f, 1.0f); +uniform float3 Offset = float3(0.0f, 0.0f, 0.0f); +uniform float3 Scale = float3(1.0f, 1.0f, 1.0f); uniform float Saturation = 1.0f; float4 ps_main(PS_INPUT Input) : COLOR @@ -107,14 +90,12 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 OutRGB = BaseTexel.rgb; // -- RGB Tint & Shift -- - float ShiftedRed = dot(OutRGB, float3(RedFromRed, RedFromGrn, RedFromBlu)); - float ShiftedGrn = dot(OutRGB, float3(GrnFromRed, GrnFromGrn, GrnFromBlu)); - float ShiftedBlu = dot(OutRGB, float3(BluFromRed, BluFromGrn, BluFromBlu)); + float ShiftedRed = dot(OutRGB, RedRatios); + float ShiftedGrn = dot(OutRGB, GrnRatios); + float ShiftedBlu = dot(OutRGB, BluRatios); // -- RGB Offset & Scale -- - float3 RGBScale = float3(RedScale, GrnScale, BluScale); - float3 RGBShift = float3(RedOffset, GrnOffset, BluOffset); - float3 OutTexel = float3(ShiftedRed, ShiftedGrn, ShiftedBlu) * RGBScale + RGBShift; + float3 OutTexel = float3(ShiftedRed, ShiftedGrn, ShiftedBlu) * Scale + Offset; // -- Saturation -- float3 Gray = float3(0.3f, 0.59f, 0.11f); @@ -122,7 +103,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 OutChroma = OutTexel - OutLuma; float3 Saturated = OutLuma + OutChroma * Saturation; - return float4(OutRGB, BaseTexel.a); + return float4(Saturated, BaseTexel.a); } //----------------------------------------------------------------------------- diff --git a/hlsl/deconverge.fx b/hlsl/deconverge.fx index 38651a060d4..7121fe07b46 100644 --- a/hlsl/deconverge.fx +++ b/hlsl/deconverge.fx @@ -23,10 +23,9 @@ struct VS_OUTPUT { float4 Position : POSITION; float4 Color : COLOR0; - float2 RedCoord : TEXCOORD0; - float2 GrnCoord : TEXCOORD1; - float2 BluCoord : TEXCOORD2; - float2 TexCoord : TEXCOORD3; + float3 CoordX : TEXCOORD0; + float3 CoordY : TEXCOORD1; + float2 TexCoord : TEXCOORD2; }; struct VS_INPUT @@ -39,22 +38,17 @@ struct VS_INPUT struct PS_INPUT { float4 Color : COLOR0; - float2 RedCoord : TEXCOORD0; - float2 GrnCoord : TEXCOORD1; - float2 BluCoord : TEXCOORD2; - float2 TexCoord : TEXCOORD3; + float3 CoordX : TEXCOORD0; + float3 CoordY : TEXCOORD1; + float2 TexCoord : TEXCOORD2; }; //----------------------------------------------------------------------------- // Deconvergence Vertex Shader //----------------------------------------------------------------------------- -uniform float RedConvergeX; -uniform float RedConvergeY; -uniform float GrnConvergeX; -uniform float GrnConvergeY; -uniform float BluConvergeX; -uniform float BluConvergeY; +uniform float3 ConvergeX = float3(0.0f, 0.0f, 0.0f); +uniform float3 ConvergeY = float3(0.0f, 0.0f, 0.0f); uniform float TargetWidth; uniform float TargetHeight; @@ -65,12 +59,8 @@ uniform float RawHeight; uniform float WidthRatio; uniform float HeightRatio; -uniform float RedRadialConvergeX; -uniform float RedRadialConvergeY; -uniform float GrnRadialConvergeX; -uniform float GrnRadialConvergeY; -uniform float BluRadialConvergeX; -uniform float BluRadialConvergeY; +uniform float3 RadialConvergeX = float3(0.0f, 0.0f, 0.0f); +uniform float3 RadialConvergeY = float3(0.0f, 0.0f, 0.0f); uniform float Prescale; @@ -91,14 +81,8 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Color = Input.Color; float2 TexCoord = Input.TexCoord; - Output.RedCoord.x = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RedRadialConvergeX / RawWidth) + 0.5f) * Ratios.x + RedConvergeX * invDims.x; - Output.GrnCoord.x = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + GrnRadialConvergeX / RawWidth) + 0.5f) * Ratios.x + GrnConvergeX * invDims.x; - Output.BluCoord.x = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + BluRadialConvergeX / RawWidth) + 0.5f) * Ratios.x + BluConvergeX * invDims.x; - - Output.RedCoord.y = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RedRadialConvergeY / RawHeight) + 0.5f) * Ratios.y + RedConvergeY * invDims.y; - Output.GrnCoord.y = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + GrnRadialConvergeY / RawHeight) + 0.5f) * Ratios.y + GrnConvergeY * invDims.y; - Output.BluCoord.y = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + BluRadialConvergeY / RawHeight) + 0.5f) * Ratios.y + BluConvergeY * invDims.y; - + Output.CoordX = ((((TexCoord.x / Ratios.x) - 0.5f)) * (1.0f + RadialConvergeX / RawWidth) + 0.5f) * Ratios.x + ConvergeX * invDims.x; + Output.CoordY = ((((TexCoord.y / Ratios.y) - 0.5f)) * (1.0f + RadialConvergeY / RawHeight) + 0.5f) * Ratios.y + ConvergeY * invDims.y; Output.TexCoord = TexCoord; return Output; @@ -120,17 +104,15 @@ float4 ps_main(PS_INPUT Input) : COLOR float2 TargetDims = float2(RawWidth, RawHeight); float2 DimOffset = 0.0f / TargetDims; float2 TexCoord = Input.TexCoord; - float2 RedCoord = Input.RedCoord; - float2 GrnCoord = Input.GrnCoord; - float2 BluCoord = Input.BluCoord; + float3 CoordX = Input.CoordX; + float3 CoordY = Input.CoordY; - RedCoord = lerp(TexCoord, RedCoord, Deconverge); - GrnCoord = lerp(TexCoord, GrnCoord, Deconverge); - BluCoord = lerp(TexCoord, BluCoord, Deconverge); + CoordX = lerp(TexCoord.x, CoordX, Deconverge); + CoordY = lerp(TexCoord.y, CoordY, Deconverge); - float RedTexel = tex2D(DiffuseSampler, RedCoord - DimOffset).r; - float GrnTexel = tex2D(DiffuseSampler, GrnCoord - DimOffset).g; - float BluTexel = tex2D(DiffuseSampler, BluCoord - DimOffset).b; + float RedTexel = tex2D(DiffuseSampler, float2(CoordX.x, CoordY.x) - DimOffset).r; + float GrnTexel = tex2D(DiffuseSampler, float2(CoordX.y, CoordY.y) - DimOffset).g; + float BluTexel = tex2D(DiffuseSampler, float2(CoordX.z, CoordY.z) - DimOffset).b; //RedTexel *= Input.RedCoord.x < (WidthRatio / RawWidth) ? 0.0f : 1.0f; //RedTexel *= Input.RedCoord.y < (HeightRatio / RawHeight) ? 0.0f : 1.0f; diff --git a/hlsl/focus.fx b/hlsl/focus.fx index c5e95baf6e8..de660af7d24 100644 --- a/hlsl/focus.fx +++ b/hlsl/focus.fx @@ -63,8 +63,7 @@ uniform float TargetHeight; uniform float WidthRatio; uniform float HeightRatio; -uniform float DefocusX; -uniform float DefocusY; +uniform float2 Defocus = float2(0.0f, 0.0f); uniform float FocusEnable; float2 Coord0Offset = float2( 0.0f, 0.0f); @@ -92,15 +91,14 @@ VS_OUTPUT vs_main(VS_INPUT Input) float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight); float2 TexCoord = Input.TexCoord; TexCoord = TexCoord + 0.5f * InvTexSize; - float2 DefocusVal = float2(DefocusX, DefocusY); - Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * DefocusVal; - Output.TexCoord1 = TexCoord + Coord1Offset * InvTexSize * DefocusVal; - Output.TexCoord2 = TexCoord + Coord2Offset * InvTexSize * DefocusVal; - Output.TexCoord3 = TexCoord + Coord3Offset * InvTexSize * DefocusVal; - Output.TexCoord4 = TexCoord + Coord4Offset * InvTexSize * DefocusVal; - Output.TexCoord5 = TexCoord + Coord5Offset * InvTexSize * DefocusVal; - Output.TexCoord6 = TexCoord + Coord6Offset * InvTexSize * DefocusVal; - Output.TexCoord7 = TexCoord + Coord7Offset * InvTexSize * DefocusVal; + Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * Defocus; + Output.TexCoord1 = TexCoord + Coord1Offset * InvTexSize * Defocus; + Output.TexCoord2 = TexCoord + Coord2Offset * InvTexSize * Defocus; + Output.TexCoord3 = TexCoord + Coord3Offset * InvTexSize * Defocus; + Output.TexCoord4 = TexCoord + Coord4Offset * InvTexSize * Defocus; + Output.TexCoord5 = TexCoord + Coord5Offset * InvTexSize * Defocus; + Output.TexCoord6 = TexCoord + Coord6Offset * InvTexSize * Defocus; + Output.TexCoord7 = TexCoord + Coord7Offset * InvTexSize * Defocus; return Output; } diff --git a/hlsl/post.fx b/hlsl/post.fx index eee6aaa4798..94c039219e6 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -112,16 +112,8 @@ uniform float ShadowV = 0.375f; uniform float ShadowWidth = 8.0f; uniform float ShadowHeight = 8.0f; -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; - -uniform float RedPower = 2.2f; -uniform float GrnPower = 2.2f; -uniform float BluPower = 2.2f; +uniform float3 Power = float3(1.0f, 1.0f, 1.0f); +uniform float3 Floor = float3(0.0f, 0.0f, 0.0f); float4 ps_main(PS_INPUT Input) : COLOR { @@ -173,7 +165,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 Scanned = BaseTexel.rgb * ScanBrightness; // -- Color Compression (increasing the floor of the signal without affecting the ceiling) -- - Scanned = float3(RedFloor + (1.0f - RedFloor) * Scanned.r, GrnFloor + (1.0f - GrnFloor) * Scanned.g, BluFloor + (1.0f - BluFloor) * Scanned.b); + Scanned = Floor + (1.0f - Floor) * Scanned; float2 ShadowDims = float2(ShadowWidth, ShadowHeight); float2 ShadowUV = float2(ShadowU, ShadowV); @@ -185,9 +177,9 @@ float4 ps_main(PS_INPUT Input) : COLOR // -- Final Pixel -- float4 Output = float4(Scanned * lerp(1.0f, ShadowTexel, ShadowBrightness), BaseTexel.a) * Input.Color; - Output.r = pow(Output.r, RedPower); - Output.g = pow(Output.g, GrnPower); - Output.b = pow(Output.b, BluPower); + Output.r = pow(Output.r, Power.r); + Output.g = pow(Output.g, Power.g); + Output.b = pow(Output.b, Power.b); return Output; } diff --git a/src/osd/windows/d3d8intf.c b/src/osd/windows/d3d8intf.c index 0218309b193..71994489bd1 100644 --- a/src/osd/windows/d3d8intf.c +++ b/src/osd/windows/d3d8intf.c @@ -638,7 +638,7 @@ static void d3d_effect_set_technique(d3d_effect *effect, const char *name) } -static void d3d_effect_set_vector(d3d_effect *effect, const char *name, d3d_vector *vector) +static void d3d_effect_set_vector(d3d_effect *effect, const char *name, int count, float *vector) { assert(FALSE); } diff --git a/src/osd/windows/d3d9intf.c b/src/osd/windows/d3d9intf.c index dccf68cde75..45bc2947ed5 100644 --- a/src/osd/windows/d3d9intf.c +++ b/src/osd/windows/d3d9intf.c @@ -717,10 +717,19 @@ static void d3d_effect_set_technique(d3d_effect *effect, const char *name) } -static void d3d_effect_set_vector(d3d_effect *effect, const char *name, d3d_vector *vector) +static void d3d_effect_set_vector(d3d_effect *effect, const char *name, int count, float *vector) { + static D3DXVECTOR4 out_vector; ID3DXEffect *d3dfx = (ID3DXEffect*)effect; - d3dfx->SetVector(name, (D3DXVECTOR4*)vector); + if (count > 0) + out_vector.x = vector[0]; + if (count > 1) + out_vector.y = vector[1]; + if (count > 2) + out_vector.z = vector[2]; + if (count > 3) + out_vector.w = vector[3]; + d3dfx->SetVector(name, &out_vector); } diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c index 0182852ee8d..cba28af541a 100644 --- a/src/osd/windows/d3dhlsl.c +++ b/src/osd/windows/d3dhlsl.c @@ -82,86 +82,84 @@ // GLOBALS //============================================================ -static hlsl_options g_hlsl_presets[6] = -{ - { 0.00f, 1, 1, 0.1875f, 0.1875f, - 0.03f, 0.03f, - 0.25f, 1.0f, 1.0f, 0.6f, 0.0f, - 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, - 1.1f, 1.1f, 1.1f, - 0.9f, 0.9f, 0.9f, - 0.05f, 0.05f, 0.05f, - 0.45f, 0.45f, 0.45f, - 1.4f }, - { 0.15f, 512, 384, 0.1875f, 0.1875f, - 0.03f, 0.03f, - 0.25f, 1.0f, 1.0f, 0.6f, 0.0f, - 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, - 1.1f, 1.1f, 1.1f, - 0.9f, 0.9f, 0.9f, - 0.05f, 0.05f, 0.05f, - 0.45f, 0.45f, 0.45f, - 1.4f }, - { 0.15f, 512, 384, 0.1875f, 0.1875f, - 0.03f, 0.03f, - 0.25f, 1.0f, 1.0f, 0.6f, 0.0f, - 0.0f, 0.0f, - 0.4f, 0.1f, 0.0, 0.0f,-0.25f,-0.3f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, - 1.1f, 1.1f, 1.1f, - 0.9f, 0.9f, 0.9f, - 0.05f, 0.05f, 0.05f, - 0.45f, 0.45f, 0.45f, - 1.4f }, - { 0.15f, 512, 384, 0.1875f, 0.1875f, - 0.03f, 0.03f, - 0.25f, 1.0f, 1.0f, 0.6f, 0.0f, - 0.0f, 0.0f, - 0.4f, 0.1f, 0.0, 0.0f,-0.25f,-0.3f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, - 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 0.05f, 0.05f, 0.05f, - 0.45f, 0.45f, 0.45f, - 1.0f }, - { 0.15f, 512, 384, 0.1875f, 0.1875f, - 0.03f, 0.03f, - 0.25f, 1.0f, 1.0f, 0.6f, 0.0f, - 0.0f, 0.0f, - 0.4f, 0.1f, 0.0, 0.0f,-0.25f,-0.3f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, - 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 0.05f, 0.05f, 0.05f, - 0.45f, 0.45f, 0.45f, - 0.8f }, - { 0.15f, 512, 384, 0.1875f, 0.1875f, - 0.03f, 0.03f, - 0.25f, 1.0f, 1.0f, 0.6f, 0.0f, - 0.0f, 0.0f, - 0.4f, 0.1f, 0.0, 0.0f,-0.25f,-0.3f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.7f, 0.3f, 0.0f, 0.0f, 0.7f, 0.3f, 0.3f, 0.0f, 0.7f, - 0.0f, 0.0f, 0.0f, - 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 0.05f, 0.05f, 0.05f, - 0.45f, 0.45f, 0.45f, - 0.8f } +static hlsl_options g_hlsl_presets[4] = +{ + { // 25% Shadow mask, 50% Scanlines, 3% Pincushion, 0 defocus, No Tint, 0.9 Exponent, 5% Floor, 25% Phosphor Return, 120% Saturation + 0.25f, 320, 240, 0.09375f, 0.109375f, + 0.03f, 0.03f, + 0.5f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, + { 0.0f, 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, + { 0.0f, 0.0f, 1.0f }, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 1.0f, 1.0f }, + { 0.9f, 0.9f, 0.9f }, + { 0.05f,0.05f,0.05f}, + { 0.25f,0.25f,0.25f}, + 1.2f, + }, + { // 25% Shadow mask, 0% Scanlines, 3% Pincushion, 0 defocus, No Tint, 0.9 Exponent, 5% Floor, 25% Phosphor Return, 120% Saturation + 0.25f, 320, 240, 0.09375f, 0.109375f, + 0.03f, 0.03f, + 0.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, + { 0.0f, 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, + { 0.0f, 0.0f, 1.0f }, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 1.0f, 1.0f }, + { 0.9f, 0.9f, 0.9f }, + { 0.05f,0.05f,0.05f}, + { 0.25f,0.25f,0.25f}, + 1.2f, + }, + { // 25% Shadow mask, 0% Scanlines, 0% Pincushion, 0 defocus, No Tint, 0.9 Exponent, 5% Floor, 25% Phosphor Return, 120% Saturation + 0.25f, 320, 240, 0.09375f, 0.109375f, + 0.0f, 0.0f, + 0.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, + { 0.0f, 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, + { 0.0f, 0.0f, 1.0f }, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 1.0f, 1.0f }, + { 0.9f, 0.9f, 0.9f }, + { 0.05f,0.05f,0.05f}, + { 0.25f,0.25f,0.25f}, + 1.2f, + }, + { // 25% Shadow mask, 100% Scanlines, 15% Pincushion, 3 defocus, 24-degree Tint Out, 1.5 Exponent, 5% Floor, 70% Phosphor Return, 80% Saturation, Bad Convergence + 0.25f, 320, 240, 0.09375f, 0.109375f, + 0.15f, 0.15f, + 1.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.5f, + { 3.0f, 3.0f, 3.0f, 3.0f }, + { 0.5f,-0.33f,0.7f }, + { 0.0f,-1.0f, 0.5f }, + { 0.0f, 0.2f, 0.3f }, + { 0.0f, 0.2f, 0.0f }, + { 0.8f, 0.2f, 0.0f }, + { 0.0f, 0.8f, 0.2f}, + { 0.2f, 0.0f, 0.8f}, + { 0.0f, 0.0f, 0.0f }, + { 1.0f, 1.0f, 1.0f }, + { 1.5f, 1.5f, 1.5f }, + { 0.05f,0.05f,0.05f}, + { 0.7f, 0.7f, 0.7f}, + 0.8f, + }, }; static slider_state *g_slider_list; @@ -172,6 +170,7 @@ static slider_state *g_slider_list; // PROTOTYPES //============================================================ +static void get_vector(const char *data, int count, float *out, int report_error); static file_error open_next(d3d_info *d3d, emu_file &file, const char *extension, int idx); @@ -618,6 +617,7 @@ void hlsl_info::init(d3d *d3dintf, win_window_info *window) prescale_size_x = 1; prescale_size_y = 1; preset = downcast<windows_options &>(window->machine().options()).d3d_hlsl_preset(); + printf("%d\n", preset); snap_width = downcast<windows_options &>(window->machine().options()).d3d_snap_width(); snap_height = downcast<windows_options &>(window->machine().options()).d3d_snap_height(); @@ -641,18 +641,18 @@ void hlsl_info::init_fsfx_quad(void *vertbuf) return; // fill in the vertexes clockwise - windows_options &options = downcast<windows_options &>(window->machine().options()); - float scale_top = options.screen_scale_top(); - float scale_bottom = options.screen_scale_bottom(); - - fsfx_vertices[0].x = (d3d->width * (scale_top * 0.5f - 0.5f)); + fsfx_vertices[0].x = 0.0f; fsfx_vertices[0].y = 0.0f; - fsfx_vertices[1].x = d3d->width - (d3d->width * (scale_top * 0.5f - 0.5f)); + fsfx_vertices[1].x = d3d->width; fsfx_vertices[1].y = 0.0f; - fsfx_vertices[2].x = (d3d->width * (scale_bottom * 0.5f - 0.5f)); + fsfx_vertices[2].x = 0.0f; fsfx_vertices[2].y = d3d->height; - fsfx_vertices[3].x = d3d->width - (d3d->width * (scale_bottom * 0.5f - 0.5f)); - fsfx_vertices[3].y = d3d->height; + fsfx_vertices[3].x = d3d->width;// - 1.5f; + fsfx_vertices[3].y = 0.0f;// - 1.5f; + fsfx_vertices[4].x = 0.0f;// - 1.5f; + fsfx_vertices[4].y = d3d->height;// - 1.5f; + fsfx_vertices[5].x = d3d->width;// - 1.5f; + fsfx_vertices[5].y = d3d->height;// - 1.5f; fsfx_vertices[0].u0 = 0.0f; fsfx_vertices[0].v0 = 0.0f; @@ -660,11 +660,15 @@ void hlsl_info::init_fsfx_quad(void *vertbuf) fsfx_vertices[1].v0 = 0.0f; fsfx_vertices[2].u0 = 0.0f; fsfx_vertices[2].v0 = 1.0f; - fsfx_vertices[3].u0 = 1.0f; - fsfx_vertices[3].v0 = 1.0f; + fsfx_vertices[3].u0 = 1.0f;// + 0.5f / d3d->width; + fsfx_vertices[3].v0 = 0.0f;// + 0.5f / d3d->height; + fsfx_vertices[4].u0 = 0.0f;// + 0.5f / d3d->width; + fsfx_vertices[4].v0 = 1.0f;// + 0.5f / d3d->height; + fsfx_vertices[5].u0 = 1.0f;// + 0.5f / d3d->width; + fsfx_vertices[5].v0 = 1.0f;// + 0.5f / d3d->height; // set the color, Z parameters to standard values - for (int i = 0; i < 4; i++) + for (int i = 0; i < 6; i++) { fsfx_vertices[i].z = 0.0f; fsfx_vertices[i].rhw = 1.0f; @@ -741,44 +745,18 @@ int hlsl_info::create_resources() options->scanline_bright_scale = winoptions.screen_scanline_bright_scale(); options->scanline_bright_offset = winoptions.screen_scanline_bright_offset(); options->scanline_offset = winoptions.screen_scanline_offset(); - options->defocus_x = winoptions.screen_defocus_x(); - options->defocus_y = winoptions.screen_defocus_y(); - options->red_converge_x = winoptions.screen_red_converge_x(); - options->red_converge_y = winoptions.screen_red_converge_y(); - options->green_converge_x = winoptions.screen_green_converge_x(); - options->green_converge_y = winoptions.screen_green_converge_y(); - options->blue_converge_x = winoptions.screen_blue_converge_x(); - options->blue_converge_y = winoptions.screen_blue_converge_y(); - options->red_radial_converge_x = winoptions.screen_red_radial_converge_x(); - options->red_radial_converge_y = winoptions.screen_red_radial_converge_y(); - options->green_radial_converge_x = winoptions.screen_green_radial_converge_x(); - options->green_radial_converge_y = winoptions.screen_green_radial_converge_y(); - options->blue_radial_converge_x = winoptions.screen_blue_radial_converge_x(); - options->blue_radial_converge_y = winoptions.screen_blue_radial_converge_y(); - options->red_from_red = winoptions.screen_red_from_red(); - options->red_from_green = winoptions.screen_red_from_green(); - options->red_from_blue = winoptions.screen_red_from_blue(); - options->green_from_red = winoptions.screen_green_from_red(); - options->green_from_green = winoptions.screen_green_from_green(); - options->green_from_blue = winoptions.screen_green_from_blue(); - options->blue_from_red = winoptions.screen_blue_from_red(); - options->blue_from_green = winoptions.screen_blue_from_green(); - options->blue_from_blue = winoptions.screen_blue_from_blue(); - options->red_offset = winoptions.screen_red_offset(); - options->green_offset = winoptions.screen_green_offset(); - options->blue_offset = winoptions.screen_blue_offset(); - options->red_scale = winoptions.screen_red_scale(); - options->green_scale = winoptions.screen_green_scale(); - options->blue_scale = winoptions.screen_blue_scale(); - options->red_power = winoptions.screen_red_power(); - options->green_power = winoptions.screen_green_power(); - options->blue_power = winoptions.screen_blue_power(); - options->red_floor = winoptions.screen_red_floor(); - options->green_floor = winoptions.screen_green_floor(); - options->blue_floor = winoptions.screen_blue_floor(); - options->red_phosphor_life = winoptions.screen_red_phosphor(); - options->green_phosphor_life = winoptions.screen_green_phosphor(); - options->blue_phosphor_life = winoptions.screen_blue_phosphor(); + get_vector(winoptions.screen_defocus(), 2, options->defocus, TRUE); + get_vector(winoptions.screen_converge_x(), 3, options->converge_x, TRUE); + get_vector(winoptions.screen_converge_y(), 3, options->converge_y, TRUE); + get_vector(winoptions.screen_radial_converge_x(), 3, options->radial_converge_x, TRUE); + get_vector(winoptions.screen_radial_converge_y(), 3, options->radial_converge_y, TRUE); + get_vector(winoptions.screen_grn_ratio(), 3, options->grn_ratio, TRUE); + get_vector(winoptions.screen_blu_ratio(), 3, options->blu_ratio, TRUE); + get_vector(winoptions.screen_offset(), 3, options->offset, TRUE); + get_vector(winoptions.screen_scale(), 3, options->scale, TRUE); + get_vector(winoptions.screen_power(), 3, options->power, TRUE); + get_vector(winoptions.screen_floor(), 3, options->floor, TRUE); + get_vector(winoptions.screen_phosphor(), 3, options->phosphor, TRUE); options->saturation = winoptions.screen_saturation(); } else @@ -994,9 +972,7 @@ void hlsl_info::init_effect_info(d3d_poly_info *poly) (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); - (*d3dintf->effect.set_float)(curr_effect, "RedFloor", options->red_floor); - (*d3dintf->effect.set_float)(curr_effect, "GrnFloor", options->green_floor); - (*d3dintf->effect.set_float)(curr_effect, "BluFloor", options->blue_floor); + (*d3dintf->effect.set_vector)(curr_effect, "Floor", 3, options->floor); (*d3dintf->effect.set_float)(curr_effect, "SnapX", snap_width); (*d3dintf->effect.set_float)(curr_effect, "SnapY", snap_height); (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion); @@ -1016,9 +992,7 @@ void hlsl_info::init_effect_info(d3d_poly_info *poly) (*d3dintf->effect.set_float)(curr_effect, "ScanlineBrightScale", options->scanline_bright_scale); (*d3dintf->effect.set_float)(curr_effect, "ScanlineBrightOffset", options->scanline_bright_offset); (*d3dintf->effect.set_float)(curr_effect, "ScanlineOffset", (poly->texture->cur_frame == 0) ? 0.0f : options->scanline_offset); - (*d3dintf->effect.set_float)(curr_effect, "RedPower", options->red_power); - (*d3dintf->effect.set_float)(curr_effect, "GrnPower", options->green_power); - (*d3dintf->effect.set_float)(curr_effect, "BluPower", options->blue_power); + (*d3dintf->effect.set_vector)(curr_effect, "Power", 3, options->power); } else { @@ -1083,7 +1057,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1124,7 +1098,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1146,21 +1120,11 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); (*d3dintf->effect.set_float)(curr_effect, "YIQEnable", yiq_enable ? 1.0f : 0.0f); - (*d3dintf->effect.set_float)(curr_effect, "RedFromRed", options->red_from_red); - (*d3dintf->effect.set_float)(curr_effect, "RedFromGrn", options->red_from_green); - (*d3dintf->effect.set_float)(curr_effect, "RedFromBlu", options->red_from_blue); - (*d3dintf->effect.set_float)(curr_effect, "GrnFromRed", options->green_from_red); - (*d3dintf->effect.set_float)(curr_effect, "GrnFromGrn", options->green_from_green); - (*d3dintf->effect.set_float)(curr_effect, "GrnFromBlu", options->green_from_blue); - (*d3dintf->effect.set_float)(curr_effect, "BluFromRed", options->blue_from_red); - (*d3dintf->effect.set_float)(curr_effect, "BluFromGrn", options->blue_from_green); - (*d3dintf->effect.set_float)(curr_effect, "BluFromBlu", options->blue_from_blue); - (*d3dintf->effect.set_float)(curr_effect, "RedOffset", options->red_offset); - (*d3dintf->effect.set_float)(curr_effect, "GrnOffset", options->green_offset); - (*d3dintf->effect.set_float)(curr_effect, "BluOffset", options->blue_offset); - (*d3dintf->effect.set_float)(curr_effect, "RedScale", options->red_scale); - (*d3dintf->effect.set_float)(curr_effect, "GrnScale", options->green_scale); - (*d3dintf->effect.set_float)(curr_effect, "BluScale", options->blue_scale); + (*d3dintf->effect.set_vector)(curr_effect, "RedRatios", 3, options->red_ratio); + (*d3dintf->effect.set_vector)(curr_effect, "GrnRatios", 3, options->grn_ratio); + (*d3dintf->effect.set_vector)(curr_effect, "BluRatios", 3, options->blu_ratio); + (*d3dintf->effect.set_vector)(curr_effect, "Offset", 3, options->offset); + (*d3dintf->effect.set_vector)(curr_effect, "Scale", 3, options->scale); (*d3dintf->effect.set_float)(curr_effect, "Saturation", options->saturation); HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, smalltarget0[poly->texture->target_index]); @@ -1175,7 +1139,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1204,7 +1168,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1222,18 +1186,10 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart)); (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); - (*d3dintf->effect.set_float)(curr_effect, "RedConvergeX", options->red_converge_x); - (*d3dintf->effect.set_float)(curr_effect, "RedConvergeY", options->red_converge_y); - (*d3dintf->effect.set_float)(curr_effect, "GrnConvergeX", options->green_converge_x); - (*d3dintf->effect.set_float)(curr_effect, "GrnConvergeY", options->green_converge_y); - (*d3dintf->effect.set_float)(curr_effect, "BluConvergeX", options->blue_converge_x); - (*d3dintf->effect.set_float)(curr_effect, "BluConvergeY", options->blue_converge_y); - (*d3dintf->effect.set_float)(curr_effect, "RedRadialConvergeX", options->red_radial_converge_x); - (*d3dintf->effect.set_float)(curr_effect, "RedRadialConvergeY", options->red_radial_converge_y); - (*d3dintf->effect.set_float)(curr_effect, "GrnRadialConvergeX", options->green_radial_converge_x); - (*d3dintf->effect.set_float)(curr_effect, "GrnRadialConvergeY", options->green_radial_converge_y); - (*d3dintf->effect.set_float)(curr_effect, "BluRadialConvergeX", options->blue_radial_converge_x); - (*d3dintf->effect.set_float)(curr_effect, "BluRadialConvergeY", options->blue_radial_converge_y); + (*d3dintf->effect.set_vector)(curr_effect, "ConvergeX", 3, options->converge_x); + (*d3dintf->effect.set_vector)(curr_effect, "ConvergeY", 3, options->converge_y); + (*d3dintf->effect.set_vector)(curr_effect, "RadialConvergeX", 3, options->radial_converge_x); + (*d3dintf->effect.set_vector)(curr_effect, "RadialConvergeY", 3, options->radial_converge_y); (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); @@ -1246,15 +1202,15 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } (*d3dintf->effect.end)(curr_effect); - float defocus_x = options->defocus_x; - float defocus_y = options->defocus_y; + float defocus_x = options->defocus[0]; + float defocus_y = options->defocus[1]; bool focus_enable = defocus_x != 0.0f || defocus_y != 0.0f; if(focus_enable) { @@ -1269,8 +1225,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", poly->texture != NULL ? (1.0f / (poly->texture->ustop - poly->texture->ustart)) : 0.0f); (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", poly->texture != NULL ? (1.0f / (poly->texture->vstop - poly->texture->vstart)) : 0.0f); - (*d3dintf->effect.set_float)(curr_effect, "DefocusX", defocus_x); - (*d3dintf->effect.set_float)(curr_effect, "DefocusY", defocus_y); + (*d3dintf->effect.set_vector)(curr_effect, "Defocus", 2, &options->defocus[0]); (*d3dintf->effect.set_float)(curr_effect, "FocusEnable", (defocus_x == 0.0f && defocus_y == 0.0f) ? 0.0f : 1.0f); (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); @@ -1284,7 +1239,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1301,8 +1256,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f); (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f); - (*d3dintf->effect.set_float)(curr_effect, "DefocusX", defocus_x); - (*d3dintf->effect.set_float)(curr_effect, "DefocusY", defocus_y); + (*d3dintf->effect.set_vector)(curr_effect, "Defocus", 2, &options->defocus[0]); (*d3dintf->effect.set_float)(curr_effect, "FocusEnable", (defocus_x == 0.0f && defocus_y == 0.0f) ? 0.0f : 1.0f); (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); @@ -1314,7 +1268,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1331,9 +1285,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); (*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth); (*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight); - (*d3dintf->effect.set_float)(curr_effect, "RedPhosphor", options->red_phosphor_life); - (*d3dintf->effect.set_float)(curr_effect, "GreenPhosphor", options->green_phosphor_life); - (*d3dintf->effect.set_float)(curr_effect, "BluePhosphor", options->blue_phosphor_life); + (*d3dintf->effect.set_vector)(curr_effect, "Phosphor", 3, options->phosphor); (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", focus_enable ? texture1[poly->texture->target_index] : texture2[poly->texture->target_index]); (*d3dintf->effect.set_texture)(curr_effect, "LastPass", last_texture[poly->texture->target_index]); @@ -1349,7 +1301,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1375,7 +1327,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) { (*d3dintf->effect.begin_pass)(curr_effect, pass); // add the primitives - result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, 0, poly->count); + result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); (*d3dintf->effect.end_pass)(curr_effect); } @@ -1433,9 +1385,6 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) 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 = post_effect; @@ -1469,8 +1418,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum) (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); (*d3dintf->effect.set_float)(curr_effect, "PostPass", 0.0f); - (*d3dintf->effect.set_float)(curr_effect, "PincushionAmountX", options->pincushion); - (*d3dintf->effect.set_float)(curr_effect, "PincushionAmountY", options->pincushion); + (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion); (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); @@ -1966,6 +1914,35 @@ void hlsl_info::delete_resources() } +//============================================================ +// get_vector +//============================================================ + +static void get_vector(const char *data, int count, float *out, int report_error) +{ + if (count > 3) + { + if (sscanf(data, "%f,%f,%f,%f", &out[0], &out[1], &out[2], &out[3]) < 4 && report_error) + mame_printf_error("Illegal quad vector value = %s\n", data); + } + else if(count > 2) + { + if (sscanf(data, "%f,%f,%f", &out[0], &out[1], &out[2]) < 3 && report_error) + mame_printf_error("Illegal triple vector value = %s\n", data); + } + else if(count > 1) + { + if (sscanf(data, "%f,%f", &out[0], &out[1]) < 2 && report_error) + mame_printf_error("Illegal double vector value = %s\n", data); + } + else if(count > 0) + { + if (sscanf(data, "%f", &out[0]) < 1 && report_error) + mame_printf_error("Illegal single vector value = %s\n", data); + } +} + + /*------------------------------------------------- slider_alloc - allocate a new slider entry currently duplicated from ui.c, this could @@ -2073,192 +2050,202 @@ static INT32 slider_scanline_offset(running_machine &machine, void *arg, astring static INT32 slider_defocus_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->defocus_x), 0.5f, "%2.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->defocus[0]), 0.5f, "%2.1f", string, newval); } static INT32 slider_defocus_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->defocus_y), 0.5f, "%2.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->defocus[1]), 0.5f, "%2.1f", string, newval); +} + +static INT32 slider_post_defocus_x(running_machine &machine, void *arg, astring *string, INT32 newval) +{ + return slider_set(&(((hlsl_options*)arg)->defocus[2]), 0.5f, "%2.1f", string, newval); +} + +static INT32 slider_post_defocus_y(running_machine &machine, void *arg, astring *string, INT32 newval) +{ + return slider_set(&(((hlsl_options*)arg)->defocus[3]), 0.5f, "%2.1f", string, newval); } static INT32 slider_red_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_converge_x), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->converge_x[0]), 0.1f, "%3.1f", string, newval); } static INT32 slider_red_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_converge_y), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->converge_y[0]), 0.1f, "%3.1f", string, newval); } static INT32 slider_green_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_converge_x), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->converge_x[1]), 0.1f, "%3.1f", string, newval); } static INT32 slider_green_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_converge_y), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->converge_y[1]), 0.1f, "%3.1f", string, newval); } static INT32 slider_blue_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_converge_x), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->converge_x[2]), 0.1f, "%3.1f", string, newval); } static INT32 slider_blue_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_converge_y), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->converge_y[2]), 0.1f, "%3.1f", string, newval); } static INT32 slider_red_radial_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_radial_converge_x), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->radial_converge_x[0]), 0.1f, "%3.1f", string, newval); } static INT32 slider_red_radial_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_radial_converge_y), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->radial_converge_y[0]), 0.1f, "%3.1f", string, newval); } static INT32 slider_green_radial_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_radial_converge_x), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->radial_converge_x[1]), 0.1f, "%3.1f", string, newval); } static INT32 slider_green_radial_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_radial_converge_y), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->radial_converge_y[1]), 0.1f, "%3.1f", string, newval); } static INT32 slider_blue_radial_converge_x(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_radial_converge_x), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->radial_converge_x[2]), 0.1f, "%3.1f", string, newval); } static INT32 slider_blue_radial_converge_y(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_radial_converge_y), 0.1f, "%3.1f", string, newval); + return slider_set(&(((hlsl_options*)arg)->radial_converge_y[2]), 0.1f, "%3.1f", string, newval); } static INT32 slider_red_from_r(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_from_red), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->red_ratio[0]), 0.005f, "%2.3f", string, newval); } static INT32 slider_red_from_g(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_from_green), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->red_ratio[1]), 0.005f, "%2.3f", string, newval); } static INT32 slider_red_from_b(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_from_blue), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->red_ratio[2]), 0.005f, "%2.3f", string, newval); } static INT32 slider_green_from_r(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_from_red), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->grn_ratio[0]), 0.005f, "%2.3f", string, newval); } static INT32 slider_green_from_g(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_from_green), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->grn_ratio[1]), 0.005f, "%2.3f", string, newval); } static INT32 slider_green_from_b(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_from_blue), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->grn_ratio[2]), 0.005f, "%2.3f", string, newval); } static INT32 slider_blue_from_r(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_from_red), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->blu_ratio[0]), 0.005f, "%2.3f", string, newval); } static INT32 slider_blue_from_g(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_from_green), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->blu_ratio[1]), 0.005f, "%2.3f", string, newval); } static INT32 slider_blue_from_b(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_from_blue), 0.005f, "%2.3f", string, newval); + return slider_set(&(((hlsl_options*)arg)->blu_ratio[2]), 0.005f, "%2.3f", string, newval); } static INT32 slider_red_offset(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_offset), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->offset[0]), 0.01f, "%2.2f", string, newval); } static INT32 slider_green_offset(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_offset), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->offset[1]), 0.01f, "%2.2f", string, newval); } static INT32 slider_blue_offset(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_offset), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->offset[2]), 0.01f, "%2.2f", string, newval); } static INT32 slider_red_scale(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_scale), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->scale[0]), 0.01f, "%2.2f", string, newval); } static INT32 slider_green_scale(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_scale), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->scale[1]), 0.01f, "%2.2f", string, newval); } static INT32 slider_blue_scale(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_scale), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->scale[2]), 0.01f, "%2.2f", string, newval); } static INT32 slider_red_power(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_power), 0.05f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->power[0]), 0.05f, "%2.2f", string, newval); } static INT32 slider_green_power(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_power), 0.05f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->power[1]), 0.05f, "%2.2f", string, newval); } static INT32 slider_blue_power(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_power), 0.05f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->power[2]), 0.05f, "%2.2f", string, newval); } static INT32 slider_red_floor(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_floor), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->floor[0]), 0.01f, "%2.2f", string, newval); } static INT32 slider_green_floor(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_floor), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->floor[1]), 0.01f, "%2.2f", string, newval); } static INT32 slider_blue_floor(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_floor), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->floor[2]), 0.01f, "%2.2f", string, newval); } static INT32 slider_red_phosphor_life(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->red_phosphor_life), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->phosphor[0]), 0.01f, "%2.2f", string, newval); } static INT32 slider_green_phosphor_life(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->green_phosphor_life), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->phosphor[1]), 0.01f, "%2.2f", string, newval); } static INT32 slider_blue_phosphor_life(running_machine &machine, void *arg, astring *string, INT32 newval) { - return slider_set(&(((hlsl_options*)arg)->blue_phosphor_life), 0.01f, "%2.2f", string, newval); + return slider_set(&(((hlsl_options*)arg)->phosphor[2]), 0.01f, "%2.2f", string, newval); } static INT32 slider_saturation(running_machine &machine, void *arg, astring *string, INT32 newval) @@ -2297,6 +2284,8 @@ slider_state *hlsl_info::init_slider_list() *tailptr = slider_alloc(window->machine(), "Scanline Jitter", 0, 0, 40, 1, slider_scanline_offset, (void*)options); tailptr = &(*tailptr)->next; *tailptr = slider_alloc(window->machine(), "Defocus X", 0, 0, 64, 1, slider_defocus_x, (void*)options); tailptr = &(*tailptr)->next; *tailptr = slider_alloc(window->machine(), "Defocus Y", 0, 0, 64, 1, slider_defocus_y, (void*)options); tailptr = &(*tailptr)->next; + *tailptr = slider_alloc(window->machine(), "Phosphor Defocus X", 0, 0, 64, 1, slider_post_defocus_x, (void*)options); tailptr = &(*tailptr)->next; + *tailptr = slider_alloc(window->machine(), "Phosphor Defocus Y", 0, 0, 64, 1, slider_post_defocus_y, (void*)options); tailptr = &(*tailptr)->next; *tailptr = slider_alloc(window->machine(), "Red Position Offset X", -1500, 0, 1500, 1, slider_red_converge_x, (void*)options); tailptr = &(*tailptr)->next; *tailptr = slider_alloc(window->machine(), "Red Position Offset Y", -1500, 0, 1500, 1, slider_red_converge_y, (void*)options); tailptr = &(*tailptr)->next; *tailptr = slider_alloc(window->machine(), "Green Position Offset X", -1500, 0, 1500, 1, slider_green_converge_x, (void*)options); tailptr = &(*tailptr)->next; diff --git a/src/osd/windows/d3dhlsl.h b/src/osd/windows/d3dhlsl.h index cc4a84346e3..daaa075b190 100644 --- a/src/osd/windows/d3dhlsl.h +++ b/src/osd/windows/d3dhlsl.h @@ -68,44 +68,19 @@ struct _hlsl_options float scanline_bright_scale; float scanline_bright_offset; float scanline_offset; - float defocus_x; - float defocus_y; - float red_converge_x; - float red_converge_y; - float green_converge_x; - float green_converge_y; - float blue_converge_x; - float blue_converge_y; - float red_radial_converge_x; - float red_radial_converge_y; - float green_radial_converge_x; - float green_radial_converge_y; - float blue_radial_converge_x; - float blue_radial_converge_y; - float red_from_red; - float red_from_green; - float red_from_blue; - float green_from_red; - float green_from_green; - float green_from_blue; - float blue_from_red; - float blue_from_green; - float blue_from_blue; - float red_offset; - float green_offset; - float blue_offset; - float red_scale; - float green_scale; - float blue_scale; - float red_power; - float green_power; - float blue_power; - float red_floor; - float green_floor; - float blue_floor; - float red_phosphor_life; - float green_phosphor_life; - float blue_phosphor_life; + float defocus[4]; + float converge_x[3]; + float converge_y[3]; + float radial_converge_x[3]; + float radial_converge_y[3]; + float red_ratio[3]; + float grn_ratio[3]; + float blu_ratio[3]; + float offset[3]; + float scale[3]; + float power[3]; + float floor[3]; + float phosphor[3]; float saturation; }; diff --git a/src/osd/windows/d3dintf.h b/src/osd/windows/d3dintf.h index 4819281339e..2e5125670d8 100644 --- a/src/osd/windows/d3dintf.h +++ b/src/osd/windows/d3dintf.h @@ -258,7 +258,7 @@ struct _d3d_effect_interface void (*begin_pass)(d3d_effect *effect, UINT pass); void (*end_pass)(d3d_effect *effect); void (*set_technique)(d3d_effect *effect, const char *name); - void (*set_vector)(d3d_effect *effect, const char *name, d3d_vector *vector); + void (*set_vector)(d3d_effect *effect, const char *name, int count, float *vector); void (*set_float)(d3d_effect *effect, const char *name, float value); void (*set_int)(d3d_effect *effect, const char *name, int value); void (*set_matrix)(d3d_effect *effect, const char *name, d3d_matrix *matrix); diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 6f4a06d508f..d75c8f275ca 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -604,7 +604,7 @@ mtlog_add("drawd3d_window_draw: begin_scene"); // loop over primitives if(d3d->hlsl->enabled()) { - d3d->hlsl_buf = (void*)primitive_alloc(d3d, 4); + d3d->hlsl_buf = (void*)primitive_alloc(d3d, 6); d3d->hlsl->init_fsfx_quad(d3d->hlsl_buf); } @@ -1655,7 +1655,7 @@ static void primitive_flush_pending(d3d_info *d3d) // first remember the original render target in case we need to set a new one if(d3d->hlsl->enabled() && d3dintf->post_fx_available) { - vertnum = 4; + vertnum = 6; } else { diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 8a16363b398..525f620b9ec 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -331,7 +331,7 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_HLSL_ENABLE";hlsl", "0", OPTION_BOOLEAN, "enable HLSL post-processing (PS3.0 required)" }, { WINOPTION_HLSLPATH, "hlsl", OPTION_STRING, "path to hlsl files" }, { WINOPTION_HLSL_PRESCALE_SIZE, "3", OPTION_INTEGER, "HLSL scaling pre-pass factor (usually 2 or 3)" }, - { WINOPTION_HLSL_PRESET";(-1-5)", "-1", OPTION_INTEGER, "HLSL preset to use (0-5)" }, + { WINOPTION_HLSL_PRESET";(-1-3)", "-1", OPTION_INTEGER, "HLSL preset to use (0-3)" }, { WINOPTION_HLSL_WRITE, NULL, OPTION_STRING, "enable HLSL AVI writing (huge disk bandwidth suggested)" }, { WINOPTION_HLSL_SNAP_WIDTH, "2048", OPTION_STRING, "HLSL upscaled-snapshot width" }, { WINOPTION_HLSL_SNAP_HEIGHT, "1536", OPTION_STRING, "HLSL upscaled-snapshot height" }, @@ -342,8 +342,6 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_SHADOW_MASK_USIZE";fs_shadwu(0.0-1.0)", "0.09375", OPTION_FLOAT, "shadow mask texture size in U direction" }, { WINOPTION_SHADOW_MASK_VSIZE";fs_shadwv(0.0-1.0)", "0.109375", OPTION_FLOAT, "shadow mask texture size in V direction" }, { WINOPTION_CURVATURE";fs_curv(0.0-4.0)", "0.0", OPTION_FLOAT, "screen curvature amount" }, - { WINOPTION_SCREEN_SCALE_TOP";fs_scalex(0.0-2.0)", "1.0", OPTION_FLOAT, "screen scale, top" }, - { WINOPTION_SCREEN_SCALE_BOTTOM";fs_scaley(0.0-2.0)", "1.0", OPTION_FLOAT, "screen scale, bottom" }, /* Beam-related values below this line*/ { WINOPTION_PINCUSHION";fs_pin(0.0-4.0)", "0.0", OPTION_FLOAT, "pincushion amount" }, { WINOPTION_SCANLINE_AMOUNT";fs_scanam(0.0-4.0)", "0.0", OPTION_FLOAT, "overall alpha scaling value for scanlines" }, @@ -352,52 +350,21 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_SCANLINE_BRIGHT_SCALE";fs_scanbs(0.0-2.0)", "1.0", OPTION_FLOAT, "overall brightness scaling value for scanlines (multiplicative)" }, { WINOPTION_SCANLINE_BRIGHT_OFFSET";fs_scanbo(0.0-1.0)", "0.0", OPTION_FLOAT, "overall brightness offset value for scanlines (additive)" }, { WINOPTION_SCANLINE_OFFSET";fs_scanjt(0.0-4.0)", "0.0", OPTION_FLOAT, "overall interlace jitter scaling value for scanlines" }, - { WINOPTION_DEFOCUS_X";fs_focusx(0.0-16.0)", "0.0", OPTION_FLOAT, "overall defocus scaling value in screen-relative X direction" }, - { WINOPTION_DEFOCUS_Y";fs_focusy(0.0-16.0)", "0.0", OPTION_FLOAT, "overall defocus scaling value in screen-relative Y direction" }, - { WINOPTION_RED_CONVERGE_X";fs_redcvx(-1.0-1.0)", "0.0", OPTION_FLOAT, "red convergence in screen-relative X direction" }, - { WINOPTION_RED_CONVERGE_Y";fs_redcvy(-1.0-1.0)", "0.0", OPTION_FLOAT, "red convergence in screen-relative Y direction" }, - { WINOPTION_GREEN_CONVERGE_X";fs_grncvx(-1.0-1.0)", "0.0", OPTION_FLOAT, "green convergence in screen-relative X direction" }, - { WINOPTION_GREEN_CONVERGE_Y";fs_grncvy(-1.0-1.0)", "0.0", OPTION_FLOAT, "green convergence in screen-relative Y direction" }, - { WINOPTION_BLUE_CONVERGE_X";fs_blucvx(-1.0-1.0)", "0.0", OPTION_FLOAT, "blue convergence in screen-relative X direction" }, - { WINOPTION_BLUE_CONVERGE_Y";fs_blucvy(-1.0-1.0)", "0.0", OPTION_FLOAT, "blue convergence in screen-relative Y direction" }, - { WINOPTION_RED_RADIAL_CONVERGE_X";fs_redrcvx(-16 - 16)", "0.0", OPTION_FLOAT, "red radial convergence in screen-relative X direction" }, - { WINOPTION_RED_RADIAL_CONVERGE_Y";fs_redrcvy(-16 - 16)", "0.0", OPTION_FLOAT, "red radial convergence in screen-relative Y direction" }, - { WINOPTION_GREEN_RADIAL_CONVERGE_X";fs_grnrcvx(-16 - 16)", "0.0", OPTION_FLOAT, "green radial convergence in screen-relative X direction" }, - { WINOPTION_GREEN_RADIAL_CONVERGE_Y";fs_grnrcvy(-16 - 16)", "0.0", OPTION_FLOAT, "green radial convergence in screen-relative Y direction" }, - { WINOPTION_BLUE_RADIAL_CONVERGE_X";fs_blurcvx(-16 - 16)", "0.0", OPTION_FLOAT, "blue radial convergence in screen-relative X direction" }, - { WINOPTION_BLUE_RADIAL_CONVERGE_Y";fs_blurcvy(-16 - 16)", "0.0", OPTION_FLOAT, "blue radial convergence in screen-relative Y direction" }, + { WINOPTION_DEFOCUS";fs_focus", "0.0,0.0", OPTION_STRING, "overall defocus value in screen-relative coords" }, + { WINOPTION_CONVERGE_X";fs_convx", "0.0,0.0,0.0",OPTION_STRING, "convergence in screen-relative X direction" }, + { WINOPTION_CONVERGE_Y";fs_convy", "0.0,0.0,0.0",OPTION_STRING, "convergence in screen-relative Y direction" }, + { WINOPTION_RADIAL_CONVERGE_X";fs_rconvx", "0.0,0.0,0.0",OPTION_STRING, "radial convergence in screen-relative X direction" }, + { WINOPTION_RADIAL_CONVERGE_Y";fs_rconvy", "0.0,0.0,0.0",OPTION_STRING, "radial convergence in screen-relative Y direction" }, /* RGB colorspace convolution below this line */ - { WINOPTION_RED_MATRIX_R";fs_matrr(-2.0-2.0)", "1.0", OPTION_FLOAT, "red output signal generated by red input signal" }, - { WINOPTION_RED_MATRIX_G";fs_matrg(-2.0-2.0)", "0.0", OPTION_FLOAT, "red output signal generated by green input signal" }, - { WINOPTION_RED_MATRIX_B";fs_matrb(-2.0-2.0)", "0.0", OPTION_FLOAT, "red output signal generated by blue input signal" }, - { WINOPTION_GREEN_MATRIX_R";fs_matgr(-2.0-2.0)", "0.0", OPTION_FLOAT, "green output signal generated by red input signal" }, - { WINOPTION_GREEN_MATRIX_G";fs_matgg(-2.0-2.0)", "1.0", OPTION_FLOAT, "green output signal generated by green input signal" }, - { WINOPTION_GREEN_MATRIX_B";fs_matgb(-2.0-2.0)", "0.0", OPTION_FLOAT, "green output signal generated by blue input signal" }, - { WINOPTION_BLUE_MATRIX_R";fs_matbr(-2.0-2.0)", "0.0", OPTION_FLOAT, "blue output signal generated by red input signal" }, - { WINOPTION_BLUE_MATRIX_G";fs_matbg(-2.0-2.0)", "0.0", OPTION_FLOAT, "blue output signal generated by green input signal" }, - { WINOPTION_BLUE_MATRIX_B";fs_matbb(-2.0-2.0)", "1.0", OPTION_FLOAT, "blue output signal generated by blue input signal" }, - { WINOPTION_GREEN_MATRIX_R";fs_matgr(-2.0-2.0)", "0.0", OPTION_FLOAT, "green output signal generated by red input signal" }, - { WINOPTION_GREEN_MATRIX_G";fs_matgg(-2.0-2.0)", "1.0", OPTION_FLOAT, "green output signal generated by green input signal" }, - { WINOPTION_GREEN_MATRIX_B";fs_matgb(-2.0-2.0)", "0.0", OPTION_FLOAT, "green output signal generated by blue input signal" }, - { WINOPTION_BLUE_MATRIX_R";fs_matbr(-2.0-2.0)", "0.0", OPTION_FLOAT, "blue output signal generated by red input signal" }, - { WINOPTION_BLUE_MATRIX_G";fs_matbg(-2.0-2.0)", "0.0", OPTION_FLOAT, "blue output signal generated by green input signal" }, - { WINOPTION_BLUE_MATRIX_B";fs_matbb(-2.0-2.0)", "1.0", OPTION_FLOAT, "blue output signal generated by blue input signal" }, + { WINOPTION_RED_RATIO";fs_redratio", "1.0,0.0,0.0",OPTION_STRING, "red output signal generated by input signal" }, + { WINOPTION_GRN_RATIO";fs_grnratio", "0.0,1.0,0.0",OPTION_STRING, "green output signal generated by input signal" }, + { WINOPTION_BLU_RATIO";fs_bluratio", "0.0,0.0,1.0",OPTION_STRING, "blue output signal generated by input signal" }, { WINOPTION_SATURATION";fs_sat(0.0-4.0)", "1.0", OPTION_FLOAT, "saturation scaling value" }, - { WINOPTION_RED_OFFSET";fs_redoff(-1.0-1.0)", "0.0", OPTION_FLOAT, "red signal offset value (additive)" }, - { WINOPTION_GREEN_OFFSET";fs_grnoff(-1.0-1.0)", "0.0", OPTION_FLOAT, "green signal offset value (additive)" }, - { WINOPTION_BLUE_OFFSET";fs_bluoff(-1.0-1.0)", "0.0", OPTION_FLOAT, "blue signal offset value (additive)" }, - { WINOPTION_RED_SCALE";fs_redmul(0.0-2.0)", "1.0", OPTION_FLOAT, "red signal scaling value (multiplicative)" }, - { WINOPTION_GREEN_SCALE";fs_grnmul(0.0-2.0)", "1.0", OPTION_FLOAT, "green signal scaling value (multiplicative)" }, - { WINOPTION_BLUE_SCALE";fs_blumul(0.0-2.0)", "1.0", OPTION_FLOAT, "blue signal scaling value (multiplicative)" }, - { WINOPTION_RED_POWER";fs_redpow(0.01-4.0)", "1.0", OPTION_FLOAT, "red signal power value (exponential)" }, - { WINOPTION_GREEN_POWER";fs_grnpow(0.01-4.0)", "1.0", OPTION_FLOAT, "green signal power value (exponential)" }, - { WINOPTION_BLUE_POWER";fs_blupow(0.01-4.0)", "1.0", OPTION_FLOAT, "blue signal power value (exponential)" }, - { WINOPTION_RED_FLOOR";fs_redfl(0.0-1.0)", "0.0", OPTION_FLOAT, "red signal floor level" }, - { WINOPTION_GREEN_FLOOR";fs_grnfl(0.0-1.0)", "0.0", OPTION_FLOAT, "green signal floor level" }, - { WINOPTION_BLUE_FLOOR";fs_blufl(0.0-1.0)", "0.0", OPTION_FLOAT, "blue signal floor level" }, - { WINOPTION_RED_PHOSPHOR";fs_redpho(0.0-1.0)", "0.0", OPTION_FLOAT, "red phosphorescence decay rate (0.0 is instant, 1.0 is forever)" }, - { WINOPTION_GREEN_PHOSPHOR";fs_grnpho(0.0-1.0)", "0.0", OPTION_FLOAT, "green phosphorescence decay rate (0.0 is instant, 1.0 is forever)" }, - { WINOPTION_BLUE_PHOSPHOR";fs_grnpho(0.0-1.0)", "0.0", OPTION_FLOAT, "blue phosphorescence decay rate (0.0 is instant, 1.0 is forever)" }, + { WINOPTION_OFFSET";fs_offset", "0.0,0.0,0.0",OPTION_STRING, "signal offset value (additive)" }, + { WINOPTION_SCALE";fs_scale", "1.0,1.0,1.0",OPTION_STRING, "signal scaling value (multiplicative)" }, + { WINOPTION_POWER";fs_power", "1.0,1.0,1.0",OPTION_STRING, "signal power value (exponential)" }, + { WINOPTION_FLOOR";fs_floor", "0.0,0.0,0.0",OPTION_STRING, "signal floor level" }, + { WINOPTION_PHOSPHOR";fs_phosphor", "0.0,0.0,0.0",OPTION_STRING, "phosphorescence decay rate (0.0 is instant, 1.0 is forever)" }, /* NTSC simulation below this line */ { WINOPTION_YIQ_ENABLE";yiq", "0", OPTION_BOOLEAN, "enable YIQ-space HLSL post-processing" }, { WINOPTION_YIQ_CCVALUE";yiqcc", "3.59754545",OPTION_FLOAT, "Color Carrier frequency for NTSC signal processing" }, diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 99717cb17ca..7ae57d53add 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -93,8 +93,6 @@ #define WINOPTION_SHADOW_MASK_USIZE "shadow_mask_usize" #define WINOPTION_SHADOW_MASK_VSIZE "shadow_mask_vsize" #define WINOPTION_PINCUSHION "pincushion" -#define WINOPTION_SCREEN_SCALE_TOP "screen_scale_top" -#define WINOPTION_SCREEN_SCALE_BOTTOM "screen_scale_bottom" #define WINOPTION_CURVATURE "curvature" #define WINOPTION_SCANLINE_AMOUNT "scanline_alpha" #define WINOPTION_SCANLINE_SCALE "scanline_size" @@ -102,44 +100,19 @@ #define WINOPTION_SCANLINE_BRIGHT_SCALE "scanline_bright_scale" #define WINOPTION_SCANLINE_BRIGHT_OFFSET "scanline_bright_offset" #define WINOPTION_SCANLINE_OFFSET "scanline_jitter" -#define WINOPTION_DEFOCUS_X "defocus_x" -#define WINOPTION_DEFOCUS_Y "defocus_y" -#define WINOPTION_RED_CONVERGE_X "red_converge_x" -#define WINOPTION_RED_CONVERGE_Y "red_converge_y" -#define WINOPTION_GREEN_CONVERGE_X "green_converge_x" -#define WINOPTION_GREEN_CONVERGE_Y "green_converge_y" -#define WINOPTION_BLUE_CONVERGE_X "blue_converge_x" -#define WINOPTION_BLUE_CONVERGE_Y "blue_converge_y" -#define WINOPTION_RED_RADIAL_CONVERGE_X "red_radial_converge_x" -#define WINOPTION_RED_RADIAL_CONVERGE_Y "red_radial_converge_y" -#define WINOPTION_GREEN_RADIAL_CONVERGE_X "green_radial_converge_x" -#define WINOPTION_GREEN_RADIAL_CONVERGE_Y "green_radial_converge_y" -#define WINOPTION_BLUE_RADIAL_CONVERGE_X "blue_radial_converge_x" -#define WINOPTION_BLUE_RADIAL_CONVERGE_Y "blue_radial_converge_y" -#define WINOPTION_RED_MATRIX_R "red_from_r" -#define WINOPTION_RED_MATRIX_G "red_from_g" -#define WINOPTION_RED_MATRIX_B "red_from_b" -#define WINOPTION_GREEN_MATRIX_R "green_from_r" -#define WINOPTION_GREEN_MATRIX_G "green_from_g" -#define WINOPTION_GREEN_MATRIX_B "green_from_b" -#define WINOPTION_BLUE_MATRIX_R "blue_from_r" -#define WINOPTION_BLUE_MATRIX_G "blue_from_g" -#define WINOPTION_BLUE_MATRIX_B "blue_from_b" -#define WINOPTION_RED_OFFSET "red_offset" -#define WINOPTION_GREEN_OFFSET "green_offset" -#define WINOPTION_BLUE_OFFSET "blue_offset" -#define WINOPTION_RED_SCALE "red_scale" -#define WINOPTION_GREEN_SCALE "green_scale" -#define WINOPTION_BLUE_SCALE "blue_scale" -#define WINOPTION_RED_POWER "red_power" -#define WINOPTION_GREEN_POWER "green_power" -#define WINOPTION_BLUE_POWER "blue_power" -#define WINOPTION_RED_FLOOR "red_floor" -#define WINOPTION_GREEN_FLOOR "green_floor" -#define WINOPTION_BLUE_FLOOR "blue_floor" -#define WINOPTION_RED_PHOSPHOR "red_phosphor_life" -#define WINOPTION_GREEN_PHOSPHOR "green_phosphor_life" -#define WINOPTION_BLUE_PHOSPHOR "blue_phosphor_life" +#define WINOPTION_DEFOCUS "defocus" +#define WINOPTION_CONVERGE_X "converge_x" +#define WINOPTION_CONVERGE_Y "converge_y" +#define WINOPTION_RADIAL_CONVERGE_X "radial_converge_x" +#define WINOPTION_RADIAL_CONVERGE_Y "radial_converge_y" +#define WINOPTION_RED_RATIO "red_ratio" +#define WINOPTION_GRN_RATIO "grn_ratio" +#define WINOPTION_BLU_RATIO "blu_ratio" +#define WINOPTION_OFFSET "offset" +#define WINOPTION_SCALE "scale" +#define WINOPTION_POWER "power" +#define WINOPTION_FLOOR "floor" +#define WINOPTION_PHOSPHOR "phosphor_life" #define WINOPTION_SATURATION "saturation" #define WINOPTION_YIQ_ENABLE "yiq_enable" #define WINOPTION_YIQ_CCVALUE "yiq_cc" @@ -237,32 +210,15 @@ public: float screen_scanline_bright_offset() const { return float_value(WINOPTION_SCANLINE_BRIGHT_OFFSET); } float screen_scanline_offset() const { return float_value(WINOPTION_SCANLINE_OFFSET); } float screen_pincushion() const { return float_value(WINOPTION_PINCUSHION); } - float screen_scale_top() const { return float_value(WINOPTION_SCREEN_SCALE_TOP); } - float screen_scale_bottom() const { return float_value(WINOPTION_SCREEN_SCALE_BOTTOM); } float screen_curvature() const { return float_value(WINOPTION_CURVATURE); } - float screen_defocus_x() const { return float_value(WINOPTION_DEFOCUS_X); } - float screen_defocus_y() const { return float_value(WINOPTION_DEFOCUS_Y); } - float screen_red_converge_x() const { return float_value(WINOPTION_RED_CONVERGE_X); } - float screen_red_converge_y() const { return float_value(WINOPTION_RED_CONVERGE_Y); } - float screen_green_converge_x() const { return float_value(WINOPTION_GREEN_CONVERGE_X); } - float screen_green_converge_y() const { return float_value(WINOPTION_GREEN_CONVERGE_Y); } - float screen_blue_converge_x() const { return float_value(WINOPTION_BLUE_CONVERGE_X); } - float screen_blue_converge_y() const { return float_value(WINOPTION_BLUE_CONVERGE_Y); } - float screen_red_radial_converge_x() const { return float_value(WINOPTION_RED_RADIAL_CONVERGE_X); } - float screen_red_radial_converge_y() const { return float_value(WINOPTION_RED_RADIAL_CONVERGE_Y); } - float screen_green_radial_converge_x() const { return float_value(WINOPTION_GREEN_RADIAL_CONVERGE_X); } - float screen_green_radial_converge_y() const { return float_value(WINOPTION_GREEN_RADIAL_CONVERGE_Y); } - float screen_blue_radial_converge_x() const { return float_value(WINOPTION_BLUE_RADIAL_CONVERGE_X); } - float screen_blue_radial_converge_y() const { return float_value(WINOPTION_BLUE_RADIAL_CONVERGE_Y); } - float screen_red_from_red() const { return float_value(WINOPTION_RED_MATRIX_R); } - float screen_red_from_green() const { return float_value(WINOPTION_RED_MATRIX_G); } - float screen_red_from_blue() const { return float_value(WINOPTION_RED_MATRIX_B); } - float screen_green_from_red() const { return float_value(WINOPTION_GREEN_MATRIX_R); } - float screen_green_from_green() const { return float_value(WINOPTION_GREEN_MATRIX_G); } - float screen_green_from_blue() const { return float_value(WINOPTION_GREEN_MATRIX_B); } - float screen_blue_from_red() const { return float_value(WINOPTION_BLUE_MATRIX_R); } - float screen_blue_from_green() const { return float_value(WINOPTION_BLUE_MATRIX_G); } - float screen_blue_from_blue() const { return float_value(WINOPTION_BLUE_MATRIX_B); } + const char *screen_defocus() const { return value(WINOPTION_DEFOCUS); } + const char *screen_converge_x() const { return value(WINOPTION_CONVERGE_X); } + const char *screen_converge_y() const { return value(WINOPTION_CONVERGE_Y); } + const char *screen_radial_converge_x() const { return value(WINOPTION_RADIAL_CONVERGE_X); } + const char *screen_radial_converge_y() const { return value(WINOPTION_RADIAL_CONVERGE_Y); } + const char *screen_red_ratio() const { return value(WINOPTION_RED_RATIO); } + const char *screen_grn_ratio() const { return value(WINOPTION_GRN_RATIO); } + const char *screen_blu_ratio() const { return value(WINOPTION_BLU_RATIO); } bool screen_yiq_enable() const { return bool_value(WINOPTION_YIQ_ENABLE); } float screen_yiq_cc() const { return float_value(WINOPTION_YIQ_CCVALUE); } float screen_yiq_a() const { return float_value(WINOPTION_YIQ_AVALUE); } @@ -275,22 +231,12 @@ public: float screen_yiq_q() const { return float_value(WINOPTION_YIQ_QVALUE); } float screen_yiq_scan_time() const { return float_value(WINOPTION_YIQ_SCAN_TIME); } 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); } - float screen_blue_offset() const { return float_value(WINOPTION_BLUE_OFFSET); } - float screen_red_scale() const { return float_value(WINOPTION_RED_SCALE); } - float screen_green_scale() const { return float_value(WINOPTION_GREEN_SCALE); } - float screen_blue_scale() const { return float_value(WINOPTION_BLUE_SCALE); } - float screen_red_power() const { return float_value(WINOPTION_RED_POWER); } - float screen_green_power() const { return float_value(WINOPTION_GREEN_POWER); } - float screen_blue_power() const { return float_value(WINOPTION_BLUE_POWER); } - float screen_red_floor() const { return float_value(WINOPTION_RED_FLOOR); } - float screen_green_floor() const { return float_value(WINOPTION_GREEN_FLOOR); } - float screen_blue_floor() const { return float_value(WINOPTION_BLUE_FLOOR); } + const char *screen_offset() const { return value(WINOPTION_OFFSET); } + const char *screen_scale() const { return value(WINOPTION_SCALE); } + const char *screen_power() const { return value(WINOPTION_POWER); } + const char *screen_floor() const { return value(WINOPTION_FLOOR); } + const char *screen_phosphor() const { return value(WINOPTION_PHOSPHOR); } float screen_saturation() const { return float_value(WINOPTION_SATURATION); } - float screen_red_phosphor() const { return float_value(WINOPTION_RED_PHOSPHOR); } - float screen_green_phosphor() const { return float_value(WINOPTION_GREEN_PHOSPHOR); } - float screen_blue_phosphor() const { return float_value(WINOPTION_BLUE_PHOSPHOR); } // per-window options const char *screen() const { return value(WINOPTION_SCREEN); } |