mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
Extended Shadow Mask and Bloom functionality
- added shadow mask type option to choose between "Screen" and "Source" tile mode ("Screen" is the default as before) - added bloom type option to choose between "Addition" and "Darken" blend mode ("Addition" is the default as before) - the alpha channel of a shadow mask is now filled with the background color of the screen by the amount of the inverted alpha value - added monochrome-matrix.png which can be used in combination with "Source" tile mode and "Darken" blend mode to simulate a STN LCD, for example
This commit is contained in:
parent
099f547d05
commit
1b373eb812
BIN
artwork/monochrome-matrix.png
Normal file
BIN
artwork/monochrome-matrix.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
@ -19,6 +19,7 @@ Surface/Color Processing Parameters
|
||||
-----------------------------------
|
||||
|
||||
Name Values Description
|
||||
shadow_mask_type 0 or 1 0 for screen tile mode or 1 for source tile mode.
|
||||
shadow_mask_alpha 0.0 to 1.0 The ovearll darkness of each shadow mask pixel.
|
||||
shadow_mask_texture [filename] A PNG that defines the shadow mask for each pixel.
|
||||
shadow_mask_x_count 1+ The number of pixels one shadow mask tile uses on screen.
|
||||
@ -101,6 +102,7 @@ vector_length_ratio 500.0 Vector fade length (4.0 - vectors fade t
|
||||
Bloom Post-Processing Options
|
||||
-----------------------------
|
||||
Name Default Values Description
|
||||
bloom_type 0 or 1 0 for addition blend mode or 1 for darken blend mode.
|
||||
bloom_scale 0.500 Bloom intensity factor. (0.000-2.000)
|
||||
bloom_overdrive 0.00,0.00,0.00 Bloom overdrive factor to bright full saturated colors. (0.000-2.000)
|
||||
bloom_lvl0_weight 1.00 Bloom level 0 (full-size target) weight. (0.00-1.00)
|
||||
|
105
hlsl/bloom.fx
105
hlsl/bloom.fx
@ -240,7 +240,9 @@ uniform float4 Level0123Weight;
|
||||
uniform float4 Level4567Weight;
|
||||
uniform float3 Level89AWeight;
|
||||
|
||||
uniform float3 OverdriveWeight;
|
||||
uniform int BloomType = 1; // blend mode: 0 addition, 1 darken
|
||||
uniform float BloomScale;
|
||||
uniform float3 BloomOverdrive;
|
||||
|
||||
float3 GetNoiseFactor(float3 n, float random)
|
||||
{
|
||||
@ -262,43 +264,78 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord89.zw).rgb;
|
||||
float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoordA).rgb;
|
||||
|
||||
texel0 = texel0 * Level0123Weight.x;
|
||||
texel1 = texel1 * Level0123Weight.y;
|
||||
texel2 = texel2 * Level0123Weight.z;
|
||||
texel3 = texel3 * Level0123Weight.w;
|
||||
texel4 = texel4 * Level4567Weight.x;
|
||||
texel5 = texel5 * Level4567Weight.y;
|
||||
texel6 = texel6 * Level4567Weight.z;
|
||||
texel7 = texel7 * Level4567Weight.w;
|
||||
texel8 = texel8 * Level89AWeight.x;
|
||||
texel9 = texel9 * Level89AWeight.y;
|
||||
texelA = texelA * Level89AWeight.z;
|
||||
float3 blend;
|
||||
|
||||
float3 bloom = float3(
|
||||
texel1 +
|
||||
texel2 +
|
||||
texel3 +
|
||||
texel4 +
|
||||
texel5 +
|
||||
texel6 +
|
||||
texel7 +
|
||||
texel8 +
|
||||
texel9 +
|
||||
texelA);
|
||||
// addition
|
||||
if (BloomType == 0)
|
||||
{
|
||||
texel0 *= Level0123Weight.x;
|
||||
texel1 *= Level0123Weight.y;
|
||||
texel2 *= Level0123Weight.z;
|
||||
texel3 *= Level0123Weight.w;
|
||||
texel4 *= Level4567Weight.x;
|
||||
texel5 *= Level4567Weight.y;
|
||||
texel6 *= Level4567Weight.z;
|
||||
texel7 *= Level4567Weight.w;
|
||||
texel8 *= Level89AWeight.x;
|
||||
texel9 *= Level89AWeight.y;
|
||||
texelA *= Level89AWeight.z;
|
||||
|
||||
float3 bloomOverdrive = max(0.0f, texel0 + bloom - 1.0f) * OverdriveWeight;
|
||||
float3 bloom = float3(
|
||||
texel1 +
|
||||
texel2 +
|
||||
texel3 +
|
||||
texel4 +
|
||||
texel5 +
|
||||
texel6 +
|
||||
texel7 +
|
||||
texel8 +
|
||||
texel9 +
|
||||
texelA) * BloomScale;
|
||||
|
||||
bloom.r += bloomOverdrive.g * 0.5f;
|
||||
bloom.r += bloomOverdrive.b * 0.5f;
|
||||
bloom.g += bloomOverdrive.r * 0.5f;
|
||||
bloom.g += bloomOverdrive.b * 0.5f;
|
||||
bloom.b += bloomOverdrive.r * 0.5f;
|
||||
bloom.b += bloomOverdrive.g * 0.5f;
|
||||
float3 bloomOverdrive = max(0.0f, texel0 + bloom - 1.0f) * BloomOverdrive;
|
||||
|
||||
float2 NoiseCoord = Input.TexCoord01.xy;
|
||||
float3 NoiseFactor = GetNoiseFactor(bloom, random(NoiseCoord));
|
||||
|
||||
return float4(texel0 + bloom * NoiseFactor, 1.0f);
|
||||
bloom.r += bloomOverdrive.g * 0.5f;
|
||||
bloom.r += bloomOverdrive.b * 0.5f;
|
||||
bloom.g += bloomOverdrive.r * 0.5f;
|
||||
bloom.g += bloomOverdrive.b * 0.5f;
|
||||
bloom.b += bloomOverdrive.r * 0.5f;
|
||||
bloom.b += bloomOverdrive.g * 0.5f;
|
||||
|
||||
float2 NoiseCoord = Input.TexCoord01.xy;
|
||||
float3 NoiseFactor = GetNoiseFactor(bloom, random(NoiseCoord));
|
||||
|
||||
blend = texel0 + bloom * NoiseFactor;
|
||||
}
|
||||
|
||||
// darken
|
||||
else
|
||||
{
|
||||
texel1 = min(texel0, texel1);
|
||||
texel2 = min(texel0, texel2);
|
||||
texel3 = min(texel0, texel3);
|
||||
texel4 = min(texel0, texel4);
|
||||
texel5 = min(texel0, texel5);
|
||||
texel6 = min(texel0, texel6);
|
||||
texel7 = min(texel0, texel7);
|
||||
texel8 = min(texel0, texel8);
|
||||
texel9 = min(texel0, texel9);
|
||||
texelA = min(texel0, texelA);
|
||||
|
||||
blend = texel0 * Level0123Weight.x;
|
||||
blend = lerp(blend, texel1, Level0123Weight.y * BloomScale);
|
||||
blend = lerp(blend, texel2, Level0123Weight.z * BloomScale);
|
||||
blend = lerp(blend, texel3, Level0123Weight.w * BloomScale);
|
||||
blend = lerp(blend, texel4, Level4567Weight.x * BloomScale);
|
||||
blend = lerp(blend, texel5, Level4567Weight.y * BloomScale);
|
||||
blend = lerp(blend, texel6, Level4567Weight.z * BloomScale);
|
||||
blend = lerp(blend, texel7, Level4567Weight.w * BloomScale);
|
||||
blend = lerp(blend, texel8, Level89AWeight.x * BloomScale);
|
||||
blend = lerp(blend, texel9, Level89AWeight.y * BloomScale);
|
||||
blend = lerp(blend, texelA, Level89AWeight.z * BloomScale);
|
||||
}
|
||||
|
||||
return float4(blend, 1.0f);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -49,20 +49,20 @@ struct PS_INPUT
|
||||
uniform float2 ScreenDims;
|
||||
uniform float2 SourceDims;
|
||||
|
||||
uniform float YIQEnable;
|
||||
|
||||
VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
{
|
||||
VS_OUTPUT Output = (VS_OUTPUT)0;
|
||||
|
||||
float2 invDims = 1.0f / SourceDims;
|
||||
|
||||
Output.Position = float4(Input.Position.xyz, 1.0f);
|
||||
Output.Position.xy /= ScreenDims;
|
||||
Output.Position.y = 1.0f - Output.Position.y;
|
||||
Output.Position.xy -= 0.5f;
|
||||
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
|
||||
Output.Position.y = 1.0f - Output.Position.y; // flip y
|
||||
Output.Position.xy -= 0.5f; // center
|
||||
Output.Position.xy *= 2.0f; // zoom
|
||||
|
||||
Output.TexCoord = Input.TexCoord;
|
||||
Output.TexCoord += 0.5f / SourceDims; // half texel offset correction (DX9)
|
||||
|
||||
Output.Color = Input.Color;
|
||||
Output.TexCoord = Input.TexCoord + 0.5f * invDims;
|
||||
|
||||
return Output;
|
||||
}
|
||||
@ -84,17 +84,17 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
|
||||
float3 OutRGB = BaseTexel.rgb;
|
||||
|
||||
// -- RGB Tint & Shift --
|
||||
// RGB Tint & Shift
|
||||
float ShiftedRed = dot(OutRGB, RedRatios);
|
||||
float ShiftedGrn = dot(OutRGB, GrnRatios);
|
||||
float ShiftedBlu = dot(OutRGB, BluRatios);
|
||||
|
||||
// -- RGB Offset & Scale --
|
||||
// RGB Scale & Offset
|
||||
float3 OutTexel = float3(ShiftedRed, ShiftedGrn, ShiftedBlu) * Scale + Offset;
|
||||
|
||||
// -- Saturation --
|
||||
float3 Gray = float3(0.3f, 0.59f, 0.11f);
|
||||
float OutLuma = dot(OutTexel, Gray);
|
||||
// Saturation
|
||||
float3 Grayscale = float3(0.299f, 0.587f, 0.114f);
|
||||
float OutLuma = dot(OutTexel, Grayscale);
|
||||
float3 OutChroma = OutTexel - OutLuma;
|
||||
float3 Saturated = OutLuma + OutChroma * Saturation;
|
||||
|
||||
|
20
hlsl/post.fx
20
hlsl/post.fx
@ -127,13 +127,16 @@ VS_OUTPUT vs_main(VS_INPUT Input)
|
||||
uniform float2 ScreenScale = float2(1.0f, 1.0f);
|
||||
uniform float2 ScreenOffset = float2(0.0f, 0.0f);
|
||||
|
||||
uniform float ScanlineAlpha = 1.0f;
|
||||
uniform float ScanlineAlpha = 0.0f;
|
||||
uniform float ScanlineScale = 1.0f;
|
||||
uniform float ScanlineBrightScale = 1.0f;
|
||||
uniform float ScanlineBrightOffset = 1.0f;
|
||||
uniform float ScanlineOffset = 1.0f;
|
||||
uniform float ScanlineHeight = 1.0f;
|
||||
|
||||
uniform float3 BackColor = float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
uniform int ShadowType = 0; // tile mode: 0 based on screen dimension, 1 based on source dimension
|
||||
uniform float ShadowAlpha = 0.0f;
|
||||
uniform float2 ShadowCount = float2(6.0f, 6.0f);
|
||||
uniform float2 ShadowUV = float2(0.25f, 0.25f);
|
||||
@ -161,6 +164,7 @@ float2 GetAdjustedCoords(float2 coord, float2 centerOffset)
|
||||
float4 ps_main(PS_INPUT Input) : COLOR
|
||||
{
|
||||
float2 ScreenTexelDims = 1.0f / ScreenDims;
|
||||
float2 SourceTexelDims = 1.0f / SourceDims;
|
||||
|
||||
float2 HalfSourceRect = PrepareVector
|
||||
? float2(0.5f, 0.5f)
|
||||
@ -191,7 +195,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
// ? shadowUV.yx
|
||||
// : shadowUV.xy;
|
||||
|
||||
float2 screenCoord = ScreenCoord;
|
||||
float2 screenCoord = ShadowType == 0 ? ScreenCoord : BaseCoord;
|
||||
screenCoord = xor(OrientationSwapXY, RotationSwapXY)
|
||||
? screenCoord.yx
|
||||
: screenCoord.xy;
|
||||
@ -201,7 +205,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
? shadowCount.yx
|
||||
: shadowCount.xy;
|
||||
|
||||
float2 shadowTile = (ScreenTexelDims * shadowCount);
|
||||
float2 shadowTile = ((ShadowType == 0 ? ScreenTexelDims : SourceTexelDims) * shadowCount);
|
||||
shadowTile = xor(OrientationSwapXY, RotationSwapXY)
|
||||
? shadowTile.yx
|
||||
: shadowTile.xy;
|
||||
@ -213,10 +217,14 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
||||
// ? ShadowCoord.yx
|
||||
// : ShadowCoord.xy;
|
||||
|
||||
float3 ShadowColor = tex2D(ShadowSampler, ShadowCoord).rgb;
|
||||
ShadowColor = lerp(1.0f, ShadowColor, ShadowAlpha);
|
||||
float4 ShadowColor = tex2D(ShadowSampler, ShadowCoord);
|
||||
float3 ShadowMaskColor = lerp(1.0f, ShadowColor.rgb, ShadowAlpha);
|
||||
float ShadowMaskClear = (1.0f - ShadowColor.a) * ShadowAlpha;
|
||||
|
||||
BaseColor.rgb *= ShadowColor;
|
||||
// apply shadow mask color
|
||||
BaseColor.rgb *= ShadowMaskColor;
|
||||
// clear shadow mask by background color
|
||||
BaseColor.rgb = lerp(BaseColor.rgb, BackColor, ShadowMaskClear);
|
||||
}
|
||||
|
||||
// Color Compression (may not affect bloom)
|
||||
|
@ -688,6 +688,7 @@ void shaders::init(base *d3dintf, running_machine *machine, d3d::renderer *rende
|
||||
if (!options->params_init)
|
||||
{
|
||||
strncpy(options->shadow_mask_texture, winoptions.screen_shadow_mask_texture(), sizeof(options->shadow_mask_texture));
|
||||
options->shadow_mask_type = winoptions.screen_shadow_mask_type();
|
||||
options->shadow_mask_alpha = winoptions.screen_shadow_mask_alpha();
|
||||
options->shadow_mask_count_x = winoptions.screen_shadow_mask_count_x();
|
||||
options->shadow_mask_count_y = winoptions.screen_shadow_mask_count_y();
|
||||
@ -734,6 +735,7 @@ void shaders::init(base *d3dintf, running_machine *machine, d3d::renderer *rende
|
||||
options->yiq_phase_count = winoptions.screen_yiq_phase_count();
|
||||
options->vector_length_scale = winoptions.screen_vector_length_scale();
|
||||
options->vector_length_ratio = winoptions.screen_vector_length_ratio();
|
||||
options->bloom_type = winoptions.screen_bloom_type();
|
||||
options->bloom_scale = winoptions.screen_bloom_scale();
|
||||
get_vector(winoptions.screen_bloom_overdrive(), 3, options->bloom_overdrive, TRUE);
|
||||
options->bloom_level0_weight = winoptions.screen_bloom_lvl0_weight();
|
||||
@ -968,7 +970,6 @@ int shaders::create_resources(bool reset)
|
||||
color_effect->add_uniform("ScreenDims", uniform::UT_VEC2, uniform::CU_SCREEN_DIMS);
|
||||
color_effect->add_uniform("SourceDims", uniform::UT_VEC2, uniform::CU_SOURCE_DIMS);
|
||||
|
||||
color_effect->add_uniform("YIQEnable", uniform::UT_FLOAT, uniform::CU_NTSC_ENABLE);
|
||||
color_effect->add_uniform("RedRatios", uniform::UT_VEC3, uniform::CU_COLOR_RED_RATIOS);
|
||||
color_effect->add_uniform("GrnRatios", uniform::UT_VEC3, uniform::CU_COLOR_GRN_RATIOS);
|
||||
color_effect->add_uniform("BluRatios", uniform::UT_VEC3, uniform::CU_COLOR_BLU_RATIOS);
|
||||
@ -1280,6 +1281,46 @@ int shaders::ntsc_pass(render_target *rt, int source_index, poly_info *poly, int
|
||||
return next_index;
|
||||
}
|
||||
|
||||
rgb_t shaders::apply_color_convolution(rgb_t color)
|
||||
{
|
||||
// this function uses the same algorithm as the color convolution shader pass
|
||||
|
||||
float r = static_cast<float>(color.r()) / 255.0f;
|
||||
float g = static_cast<float>(color.g()) / 255.0f;
|
||||
float b = static_cast<float>(color.b()) / 255.0f;
|
||||
|
||||
float *rRatio = options->red_ratio;
|
||||
float *gRatio = options->grn_ratio;
|
||||
float *bRatio = options->blu_ratio;
|
||||
float *offset = options->offset;
|
||||
float *scale = options->scale;
|
||||
float saturation = options->saturation;
|
||||
|
||||
// RGB Tint & Shift
|
||||
float rShifted = r * rRatio[0] + g * rRatio[1] + b * rRatio[2];
|
||||
float gShifted = r * gRatio[0] + g * gRatio[1] + b * gRatio[2];
|
||||
float bShifted = r * bRatio[0] + g * bRatio[1] + b * bRatio[2];
|
||||
|
||||
// RGB Scale & Offset
|
||||
r = rShifted * scale[0] + offset[0];
|
||||
g = gShifted * scale[1] + offset[1];
|
||||
b = bShifted * scale[2] + offset[2];
|
||||
|
||||
// Saturation
|
||||
float grayscale[3] = { 0.299f, 0.587f, 0.114f };
|
||||
float luma = r * grayscale[0] + g * grayscale[1] + b * grayscale[2];
|
||||
float chroma[3] = { r - luma, g - luma, b - luma };
|
||||
|
||||
r = chroma[0] * saturation + luma;
|
||||
g = chroma[1] * saturation + luma;
|
||||
b = chroma[2] * saturation + luma;
|
||||
|
||||
return rgb_t(
|
||||
MAX(0, MIN(255, static_cast<int>(r * 255.0f))),
|
||||
MAX(0, MIN(255, static_cast<int>(g * 255.0f))),
|
||||
MAX(0, MIN(255, static_cast<int>(b * 255.0f))));
|
||||
}
|
||||
|
||||
int shaders::color_convolution_pass(render_target *rt, int source_index, poly_info *poly, int vertnum)
|
||||
{
|
||||
int next_index = source_index;
|
||||
@ -1396,10 +1437,21 @@ int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int
|
||||
float screen_scale[2] = { xscale, yscale };
|
||||
float screen_offset[2] = { xoffset, yoffset };
|
||||
|
||||
rgb_t back_color_rgb = machine->first_screen()->palette() == NULL
|
||||
? rgb_t(0, 0, 0)
|
||||
: machine->first_screen()->palette()->palette()->entry_color(0);
|
||||
back_color_rgb = apply_color_convolution(back_color_rgb);
|
||||
float back_color[3] = {
|
||||
static_cast<float>(back_color_rgb.r()) / 255.0f,
|
||||
static_cast<float>(back_color_rgb.g()) / 255.0f,
|
||||
static_cast<float>(back_color_rgb.b()) / 255.0f };
|
||||
|
||||
curr_effect = post_effect;
|
||||
curr_effect->update_uniforms();
|
||||
curr_effect->set_texture("ShadowTexture", shadow_texture == NULL ? NULL : shadow_texture->get_finaltex());
|
||||
curr_effect->set_int("ShadowType", options->shadow_mask_type);
|
||||
curr_effect->set_texture("DiffuseTexture", rt->prescale_texture[next_index]);
|
||||
curr_effect->set_vector("BackColor", 3, back_color);
|
||||
curr_effect->set_vector("ScreenScale", 2, screen_scale);
|
||||
curr_effect->set_vector("ScreenOffset", 2, screen_offset);
|
||||
curr_effect->set_float("ScanlineOffset", texture->get_cur_frame() == 0 ? 0.0f : options->scanline_offset);
|
||||
@ -1475,20 +1527,20 @@ int shaders::bloom_pass(render_target *rt, int source_index, poly_info *poly, in
|
||||
|
||||
float weight0123[4] = {
|
||||
options->bloom_level0_weight,
|
||||
options->bloom_level1_weight * bloom_rescale,
|
||||
options->bloom_level2_weight * bloom_rescale,
|
||||
options->bloom_level3_weight * bloom_rescale
|
||||
options->bloom_level1_weight,
|
||||
options->bloom_level2_weight,
|
||||
options->bloom_level3_weight
|
||||
};
|
||||
float weight4567[4] = {
|
||||
options->bloom_level4_weight * bloom_rescale,
|
||||
options->bloom_level5_weight * bloom_rescale,
|
||||
options->bloom_level6_weight * bloom_rescale,
|
||||
options->bloom_level7_weight * bloom_rescale
|
||||
options->bloom_level4_weight,
|
||||
options->bloom_level5_weight,
|
||||
options->bloom_level6_weight,
|
||||
options->bloom_level7_weight
|
||||
};
|
||||
float weight89A[3] = {
|
||||
options->bloom_level8_weight * bloom_rescale,
|
||||
options->bloom_level9_weight * bloom_rescale,
|
||||
options->bloom_level10_weight * bloom_rescale
|
||||
options->bloom_level8_weight,
|
||||
options->bloom_level9_weight,
|
||||
options->bloom_level10_weight
|
||||
};
|
||||
curr_effect->set_vector("Level0123Weight", 4, weight0123);
|
||||
curr_effect->set_vector("Level4567Weight", 4, weight4567);
|
||||
@ -1500,7 +1552,9 @@ int shaders::bloom_pass(render_target *rt, int source_index, poly_info *poly, in
|
||||
curr_effect->set_vector("Level89Size", 4, bloom_dims[8]);
|
||||
curr_effect->set_vector("LevelASize", 2, bloom_dims[10]);
|
||||
|
||||
curr_effect->set_vector("OverdriveWeight", 3, options->bloom_overdrive);
|
||||
curr_effect->set_int("BloomType", options->bloom_type);
|
||||
curr_effect->set_float("BloomScale", bloom_rescale);
|
||||
curr_effect->set_vector("BloomOverdrive", 3, options->bloom_overdrive);
|
||||
|
||||
curr_effect->set_texture("DiffuseA", rt->prescale_texture[next_index]);
|
||||
|
||||
@ -2222,8 +2276,25 @@ static INT32 slider_set(float *option, float scale, const char *fmt, std::string
|
||||
return floor(*option / scale + 0.5f);
|
||||
}
|
||||
|
||||
static INT32 slider_shadow_mask_type(running_machine &machine, void *arg, std::string *str, INT32 newval)
|
||||
{
|
||||
hlsl_options *options = (hlsl_options*)arg;
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
options->shadow_mask_type = newval;
|
||||
}
|
||||
if (str != NULL)
|
||||
{
|
||||
strprintf(*str, "%s", options->shadow_mask_type == 0 ? "Screen" : "Source");
|
||||
}
|
||||
options->params_dirty = true;
|
||||
|
||||
return options->shadow_mask_type;
|
||||
}
|
||||
|
||||
static INT32 slider_shadow_mask_alpha(running_machine &machine, void *arg, std::string *str, INT32 newval)
|
||||
{
|
||||
((hlsl_options*)arg)->params_dirty = true;
|
||||
return slider_set(&(((hlsl_options*)arg)->shadow_mask_alpha), 0.01f, "%2.2f", str, newval);
|
||||
}
|
||||
|
||||
@ -2595,6 +2666,22 @@ static INT32 slider_vector_length_max(running_machine &machine, void *arg, std::
|
||||
return slider_set(&(((hlsl_options*)arg)->vector_length_ratio), 1.0f, "%4f", str, newval);
|
||||
}
|
||||
|
||||
static INT32 slider_bloom_type(running_machine &machine, void *arg, std::string *str, INT32 newval)
|
||||
{
|
||||
hlsl_options *options = (hlsl_options*)arg;
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
options->bloom_type = newval;
|
||||
}
|
||||
if (str != NULL)
|
||||
{
|
||||
strprintf(*str, "%s", options->bloom_type == 0 ? "Addition" : "Darken");
|
||||
}
|
||||
options->params_dirty = true;
|
||||
|
||||
return options->bloom_type;
|
||||
}
|
||||
|
||||
static INT32 slider_bloom_scale(running_machine &machine, void *arg, std::string *str, INT32 newval)
|
||||
{
|
||||
((hlsl_options*)arg)->params_dirty = true;
|
||||
@ -2691,6 +2778,7 @@ shaders::slider_desc shaders::s_sliders[] =
|
||||
{
|
||||
{ "Vector Length Attenuation", 0, 50, 100, 1, 2, slider_vector_attenuation },
|
||||
{ "Vector Attenuation Length Limit", 1, 500, 1000, 1, 2, slider_vector_length_max },
|
||||
{ "Shadow Mask Type", 0, 0, 1, 1, 7, slider_shadow_mask_type },
|
||||
{ "Shadow Mask Darkness", 0, 0, 100, 1, 7, slider_shadow_mask_alpha },
|
||||
{ "Shadow Mask X Count", 1, 1, 1024, 1, 7, slider_shadow_mask_x_count },
|
||||
{ "Shadow Mask Y Count", 1, 1, 1024, 1, 7, slider_shadow_mask_y_count },
|
||||
@ -2748,6 +2836,7 @@ shaders::slider_desc shaders::s_sliders[] =
|
||||
{ "Red Phosphor Life", 0, 0, 100, 1, 7, slider_red_phosphor_life },
|
||||
{ "Green Phosphor Life", 0, 0, 100, 1, 7, slider_green_phosphor_life },
|
||||
{ "Blue Phosphor Life", 0, 0, 100, 1, 7, slider_blue_phosphor_life },
|
||||
{ "Bloom Type", 0, 0, 1, 1, 7, slider_bloom_type },
|
||||
{ "Bloom Scale", 0, 0, 2000, 5, 7, slider_bloom_scale },
|
||||
{ "Bloom Red Overdrive", 0, 0, 2000, 5, 7, slider_bloom_red_overdrive },
|
||||
{ "Bloom Green Overdrive", 0, 0, 2000, 5, 7, slider_bloom_green_overdrive },
|
||||
|
@ -195,6 +195,7 @@ struct hlsl_options
|
||||
{
|
||||
bool params_init;
|
||||
bool params_dirty;
|
||||
int shadow_mask_type;
|
||||
float shadow_mask_alpha;
|
||||
char shadow_mask_texture[1024];
|
||||
int shadow_mask_count_x;
|
||||
@ -248,6 +249,7 @@ struct hlsl_options
|
||||
float vector_length_ratio;
|
||||
|
||||
// Bloom
|
||||
int bloom_type;
|
||||
float bloom_scale;
|
||||
float bloom_overdrive[3];
|
||||
float bloom_level0_weight;
|
||||
@ -349,6 +351,8 @@ private:
|
||||
cache_target * find_cache_target(UINT32 screen_index, int width, int height);
|
||||
void remove_cache_target(cache_target *cache);
|
||||
|
||||
rgb_t apply_color_convolution(rgb_t color);
|
||||
|
||||
// Shader passes
|
||||
int ntsc_pass(render_target *rt, int source_index, poly_info *poly, int vertnum);
|
||||
int color_convolution_pass(render_target *rt, int source_index, poly_info *poly, int vertnum);
|
||||
|
@ -288,6 +288,7 @@ const options_entry windows_options::s_option_entries[] =
|
||||
{ WINOPTION_HLSL_WRITE, NULL, OPTION_STRING, "enables 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" },
|
||||
{ WINOPTION_SHADOW_MASK_TYPE";fs_shadwt", "0", OPTION_INTEGER, "shadow mask tile mode (0 for screen based, 1 for source based)" },
|
||||
{ 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)", "shadow-mask.png", OPTION_STRING, "shadow mask texture name" },
|
||||
{ WINOPTION_SHADOW_MASK_COUNT_X";fs_shadww", "6", OPTION_INTEGER, "shadow mask tile width, in screen dimensions" },
|
||||
@ -345,6 +346,7 @@ const options_entry windows_options::s_option_entries[] =
|
||||
{ WINOPTION_VECTOR_LENGTH_RATIO";vecsize", "500.0", OPTION_FLOAT, "Vector fade length (4.0 - vectors fade the most at and above 4 pixels, etc.)" },
|
||||
/* Bloom below this line */
|
||||
{ NULL, NULL, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" },
|
||||
{ WINOPTION_BLOOM_TYPE, "0", OPTION_INTEGER, "bloom blend mode (0 for addition, 1 for darken)" },
|
||||
{ WINOPTION_BLOOM_SCALE, "0.25", OPTION_FLOAT, "Intensity factor for bloom" },
|
||||
{ WINOPTION_BLOOM_OVERDRIVE, "1.0,1.0,1.0", OPTION_STRING, "Overdrive factor for bloom" },
|
||||
{ WINOPTION_BLOOM_LEVEL0_WEIGHT, "1.0", OPTION_FLOAT, "Bloom level 0 (full-size target) weight" },
|
||||
|
@ -36,6 +36,7 @@
|
||||
#define WINOPTION_HLSL_WRITE "hlsl_write"
|
||||
#define WINOPTION_HLSL_SNAP_WIDTH "hlsl_snap_width"
|
||||
#define WINOPTION_HLSL_SNAP_HEIGHT "hlsl_snap_height"
|
||||
#define WINOPTION_SHADOW_MASK_TYPE "shadow_mask_type"
|
||||
#define WINOPTION_SHADOW_MASK_ALPHA "shadow_mask_alpha"
|
||||
#define WINOPTION_SHADOW_MASK_TEXTURE "shadow_mask_texture"
|
||||
#define WINOPTION_SHADOW_MASK_COUNT_X "shadow_mask_x_count"
|
||||
@ -84,6 +85,7 @@
|
||||
#define WINOPTION_VECTOR_LENGTH_SCALE "vector_length_scale"
|
||||
#define WINOPTION_VECTOR_LENGTH_RATIO "vector_length_ratio"
|
||||
#define WINOPTION_VECTOR_TIME_PERIOD "vector_time_period"
|
||||
#define WINOPTION_BLOOM_TYPE "bloom_type"
|
||||
#define WINOPTION_BLOOM_SCALE "bloom_scale"
|
||||
#define WINOPTION_BLOOM_OVERDRIVE "bloom_overdrive"
|
||||
#define WINOPTION_BLOOM_LEVEL0_WEIGHT "bloom_lvl0_weight"
|
||||
@ -138,6 +140,7 @@ public:
|
||||
int d3d_hlsl_prescale_y() const { return int_value(WINOPTION_HLSL_PRESCALE_Y); }
|
||||
int d3d_snap_width() const { return int_value(WINOPTION_HLSL_SNAP_WIDTH); }
|
||||
int d3d_snap_height() const { return int_value(WINOPTION_HLSL_SNAP_HEIGHT); }
|
||||
int screen_shadow_mask_type() const { return int_value(WINOPTION_SHADOW_MASK_TYPE); }
|
||||
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); }
|
||||
int screen_shadow_mask_count_x() const { return int_value(WINOPTION_SHADOW_MASK_COUNT_X); }
|
||||
@ -180,6 +183,7 @@ public:
|
||||
float screen_vector_length_scale() const { return float_value(WINOPTION_VECTOR_LENGTH_SCALE); }
|
||||
float screen_vector_length_ratio() const { return float_value(WINOPTION_VECTOR_LENGTH_RATIO); }
|
||||
float screen_vector_time_period() const { return float_value(WINOPTION_VECTOR_TIME_PERIOD); }
|
||||
int screen_bloom_type() const { return int_value(WINOPTION_BLOOM_TYPE); }
|
||||
float screen_bloom_scale() const { return float_value(WINOPTION_BLOOM_SCALE); }
|
||||
const char *screen_bloom_overdrive() const { return value(WINOPTION_BLOOM_OVERDRIVE); }
|
||||
float screen_bloom_lvl0_weight() const { return float_value(WINOPTION_BLOOM_LEVEL0_WEIGHT); }
|
||||
|
Loading…
Reference in New Issue
Block a user