diff options
author | 2016-03-28 20:19:01 +0200 | |
---|---|---|
committer | 2016-03-28 20:19:01 +0200 | |
commit | fe9dfdbf991ead01d9ff63042532cc82440de7a5 (patch) | |
tree | 89a842c4573bf96a17965100daf5537b8cc9d073 /src | |
parent | 839718373d2269d7f0e258d170595cd5c3740195 (diff) |
Refactored Bloom
- reduced raster bloom level to 8
- extended vector bloom level to 15
- changed vector bloom to be less blocky
- removed bloom_lvl9_weight and bloom_lvl10_weight options
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/modules/render/d3d/d3dcomm.h | 12 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.cpp | 61 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.h | 2 | ||||
-rw-r--r-- | src/osd/modules/render/drawd3d.cpp | 8 | ||||
-rw-r--r-- | src/osd/windows/winmain.cpp | 8 | ||||
-rw-r--r-- | src/osd/windows/winmain.h | 4 |
6 files changed, 30 insertions, 65 deletions
diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index 51758bb70b6..3d84ea567a3 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -10,6 +10,12 @@ #define __WIN_D3DCOMM__ //============================================================ +// CONSTANTS +//============================================================ + +#define MAX_BLOOM_COUNT 15 // shader model 3.0 support up to 16 samplers, but we need the last for the original texture + +//============================================================ // FORWARD DECLARATIONS //============================================================ @@ -292,10 +298,10 @@ public: d3d_render_target *next; d3d_render_target *prev; - surface *bloom_surface[11]; - texture *bloom_texture[11]; + surface *bloom_surface[MAX_BLOOM_COUNT]; + texture *bloom_texture[MAX_BLOOM_COUNT]; - float bloom_dims[11][2]; + float bloom_dims[MAX_BLOOM_COUNT][2]; int bloom_count; }; diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 9d22e045b91..ca2c29078da 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -739,8 +739,6 @@ void shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r options->bloom_level6_weight = winoptions.screen_bloom_lvl6_weight(); options->bloom_level7_weight = winoptions.screen_bloom_lvl7_weight(); options->bloom_level8_weight = winoptions.screen_bloom_lvl8_weight(); - options->bloom_level9_weight = winoptions.screen_bloom_lvl9_weight(); - options->bloom_level10_weight = winoptions.screen_bloom_lvl10_weight(); options->params_init = true; } @@ -1460,59 +1458,34 @@ int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly return next_index; } - float weight12[2] = { - options->bloom_level1_weight, - options->bloom_level2_weight - }; - float weight34[2] = { - options->bloom_level3_weight, - options->bloom_level4_weight - }; - float weight56[2] = { - options->bloom_level5_weight, - options->bloom_level6_weight, - }; - float weight78[2] = { - options->bloom_level7_weight, - options->bloom_level8_weight - }; - float weight9A[2] = { - options->bloom_level9_weight, - options->bloom_level10_weight - }; - curr_effect = bloom_effect; curr_effect->update_uniforms(); - curr_effect->set_float ("Level0Weight", options->bloom_level0_weight); - curr_effect->set_vector("Level12Weight", 2, weight12); - curr_effect->set_vector("Level34Weight", 2, weight34); - curr_effect->set_vector("Level56Weight", 2, weight56); - curr_effect->set_vector("Level78Weight", 2, weight78); - curr_effect->set_vector("Level9AWeight", 2, weight9A); - - curr_effect->set_vector("Level0Size", 2, rt->bloom_dims[0]); - curr_effect->set_vector("Level12Size", 4, rt->bloom_dims[1]); - curr_effect->set_vector("Level34Size", 4, rt->bloom_dims[3]); - curr_effect->set_vector("Level56Size", 4, rt->bloom_dims[5]); - curr_effect->set_vector("Level78Size", 4, rt->bloom_dims[7]); - curr_effect->set_vector("Level9ASize", 4, rt->bloom_dims[9]); + curr_effect->set_float("Level0Weight", options->bloom_level0_weight); + curr_effect->set_float("Level1Weight", options->bloom_level1_weight); + curr_effect->set_float("Level2Weight", options->bloom_level2_weight); + curr_effect->set_float("Level3Weight", options->bloom_level3_weight); + curr_effect->set_float("Level4Weight", options->bloom_level4_weight); + curr_effect->set_float("Level5Weight", options->bloom_level5_weight); + curr_effect->set_float("Level6Weight", options->bloom_level6_weight); + curr_effect->set_float("Level7Weight", options->bloom_level7_weight); + curr_effect->set_float("Level8Weight", options->bloom_level8_weight); curr_effect->set_int("BloomBlendMode", options->bloom_blend_mode); curr_effect->set_float("BloomScale", options->bloom_scale); curr_effect->set_vector("BloomOverdrive", 3, options->bloom_overdrive); - curr_effect->set_texture("DiffuseA", rt->target_texture[next_index]); + curr_effect->set_texture("DiffuseTexture", rt->target_texture[next_index]); - char name[9] = "Diffuse*"; + char name[14] = "BloomTexture*"; for (int index = 1; index < rt->bloom_count; index++) { - name[7] = 'A' + index; + name[12] = 'A' + index - 1; curr_effect->set_texture(name, rt->bloom_texture[index - 1]); } - for (int index = rt->bloom_count; index < 11; index++) + for (int index = rt->bloom_count; index < MAX_BLOOM_COUNT; index++) { - name[7] = 'A' + index; + name[12] = 'A' + index - 1; curr_effect->set_texture(name, black_texture); } @@ -2315,8 +2288,6 @@ enum slider_option SLIDER_BLOOM_LVL6_SCALE, SLIDER_BLOOM_LVL7_SCALE, SLIDER_BLOOM_LVL8_SCALE, - SLIDER_BLOOM_LVL9_SCALE, - SLIDER_BLOOM_LVL10_SCALE, SLIDER_NTSC_ENABLE, SLIDER_NTSC_JITTER, SLIDER_NTSC_A_VALUE, @@ -2392,8 +2363,6 @@ slider_desc shaders::s_sliders[] = { "Bloom Level 6 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL6_SCALE, 0.01f, "%1.2f", {} }, { "Bloom Level 7 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL7_SCALE, 0.01f, "%1.2f", {} }, { "Bloom Level 8 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL8_SCALE, 0.01f, "%1.2f", {} }, - { "Bloom Level 9 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL9_SCALE, 0.01f, "%1.2f", {} }, - { "Bloom Level 10 Scale", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_BLOOM_LVL10_SCALE, 0.01f, "%1.2f", {} }, { "NTSC processing", 0, 0, 1, 1, SLIDER_INT_ENUM, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_NTSC_ENABLE, 0, "%s", { "Off", "On" } }, { "Signal Jitter", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_NTSC_JITTER, 0.01f, "%1.2f", {} }, { "A Value", -100, 50, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_NTSC_A_VALUE, 0.01f, "%1.2f", {} }, @@ -2467,8 +2436,6 @@ void *shaders::get_slider_option(int id, int index) case SLIDER_BLOOM_LVL6_SCALE: return &(options->bloom_level6_weight); case SLIDER_BLOOM_LVL7_SCALE: return &(options->bloom_level7_weight); case SLIDER_BLOOM_LVL8_SCALE: return &(options->bloom_level8_weight); - case SLIDER_BLOOM_LVL9_SCALE: return &(options->bloom_level9_weight); - case SLIDER_BLOOM_LVL10_SCALE: return &(options->bloom_level10_weight); case SLIDER_NTSC_ENABLE: return &(options->yiq_enable); case SLIDER_NTSC_JITTER: return &(options->yiq_jitter); case SLIDER_NTSC_A_VALUE: return &(options->yiq_a); diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h index a4c9f13b9ed..af5db351efe 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.h +++ b/src/osd/modules/render/d3d/d3dhlsl.h @@ -260,8 +260,6 @@ struct hlsl_options float bloom_level6_weight; float bloom_level7_weight; float bloom_level8_weight; - float bloom_level9_weight; - float bloom_level10_weight; }; struct slider_desc diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index 4b8cc430640..708ed01cd6c 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -2795,7 +2795,7 @@ bool cache_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_width, d3d_render_target::~d3d_render_target() { - for (int index = 0; index < 11; index++) + for (int index = 0; index < MAX_BLOOM_COUNT; index++) { if (bloom_texture[index] != nullptr) { @@ -2869,13 +2869,13 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_w bool vector_screen = d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; - // larger blur width for vector screens than raster screens - float scale_factor = vector_screen ? 0.5f : 0.75f; + float scale_factor = 0.75f; + int scale_count = vector_screen ? MAX_BLOOM_COUNT : MAX_BLOOM_COUNT / 2; float bloom_width = (float)source_width; float bloom_height = (float)source_height; float bloom_size = bloom_width < bloom_height ? bloom_width : bloom_height; - for (int bloom_index = 0; bloom_index < 11 && bloom_size >= 2.0f; bloom_size *= scale_factor) + for (int bloom_index = 0; bloom_index < scale_count && bloom_size >= 2.0f; bloom_size *= scale_factor) { this->bloom_dims[bloom_index][0] = (int)bloom_width; this->bloom_dims[bloom_index][1] = (int)bloom_height; diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 0efb762a079..50c671ef24d 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -350,13 +350,11 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_BLOOM_LEVEL2_WEIGHT, "0.32", OPTION_FLOAT, "Bloom level 2 (1/4-size target) weight" }, { WINOPTION_BLOOM_LEVEL3_WEIGHT, "0.16", OPTION_FLOAT, "Bloom level 3 (1/8-size target) weight" }, { WINOPTION_BLOOM_LEVEL4_WEIGHT, "0.08", OPTION_FLOAT, "Bloom level 4 (1/16-size target) weight" }, - { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.04", OPTION_FLOAT, "Bloom level 5 (1/32-size target) weight" }, + { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.06", OPTION_FLOAT, "Bloom level 5 (1/32-size target) weight" }, { WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.04", OPTION_FLOAT, "Bloom level 6 (1/64-size target) weight" }, { WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.02", OPTION_FLOAT, "Bloom level 7 (1/128-size target) weight" }, - { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.02", OPTION_FLOAT, "Bloom level 8 (1/256-size target) weight" }, - { WINOPTION_BLOOM_LEVEL9_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 9 (1/512-size target) weight" }, - { WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 10 (1/1024-size target) weight" }, - + { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 8 (1/256-size target) weight" }, + // full screen options { nullptr, nullptr, OPTION_HEADER, "FULL SCREEN OPTIONS" }, { WINOPTION_TRIPLEBUFFER ";tb", "0", OPTION_BOOLEAN, "enables triple buffering" }, diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index dd348ee4491..fec09444446 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -96,8 +96,6 @@ #define WINOPTION_BLOOM_LEVEL6_WEIGHT "bloom_lvl6_weight" #define WINOPTION_BLOOM_LEVEL7_WEIGHT "bloom_lvl7_weight" #define WINOPTION_BLOOM_LEVEL8_WEIGHT "bloom_lvl8_weight" -#define WINOPTION_BLOOM_LEVEL9_WEIGHT "bloom_lvl9_weight" -#define WINOPTION_BLOOM_LEVEL10_WEIGHT "bloom_lvl10_weight" // full screen options #define WINOPTION_TRIPLEBUFFER "triplebuffer" @@ -191,8 +189,6 @@ public: float screen_bloom_lvl6_weight() const { return float_value(WINOPTION_BLOOM_LEVEL6_WEIGHT); } float screen_bloom_lvl7_weight() const { return float_value(WINOPTION_BLOOM_LEVEL7_WEIGHT); } float screen_bloom_lvl8_weight() const { return float_value(WINOPTION_BLOOM_LEVEL8_WEIGHT); } - float screen_bloom_lvl9_weight() const { return float_value(WINOPTION_BLOOM_LEVEL9_WEIGHT); } - float screen_bloom_lvl10_weight() const { return float_value(WINOPTION_BLOOM_LEVEL10_WEIGHT); } 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); } |