summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/d3d/d3dhlsl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render/d3d/d3dhlsl.cpp')
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp222
1 files changed, 99 insertions, 123 deletions
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index 776820b801f..d862fdcb6a8 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -60,7 +60,7 @@ static direct3dx9_loadeffect_ptr g_load_effect = NULL;
//============================================================
shaders::shaders() :
- d3dintf(NULL), machine(NULL), d3d(NULL), num_screens(0), curr_screen(0), curr_frame(0), write_ini(false), read_ini(false), hlsl_prescale_x(0), hlsl_prescale_y(0), bloom_count(0),
+ d3dintf(NULL), machine(NULL), d3d(NULL), num_screens(0), curr_screen(0), curr_frame(0), bloom_count(0),
vecbuf_type(), vecbuf_index(0), vecbuf_count(0), avi_output_file(NULL), avi_frame(0), avi_copy_surface(NULL), avi_copy_texture(NULL), avi_final_target(NULL), avi_final_texture(NULL),
black_surface(NULL), black_texture(NULL), render_snap(false), snap_rendered(false), snap_copy_target(NULL), snap_copy_texture(NULL), snap_target(NULL), snap_texture(NULL),
snap_width(0), snap_height(0), lines_pending(false), backbuffer(NULL), curr_effect(NULL), default_effect(NULL), prescale_effect(NULL), post_effect(NULL), distortion_effect(NULL),
@@ -69,9 +69,6 @@ shaders::shaders() :
{
master_enable = false;
vector_enable = true;
- hlsl_prescale_x = 1;
- hlsl_prescale_x = 1;
- preset = -1;
shadow_texture = NULL;
options = NULL;
paused = true;
@@ -663,8 +660,6 @@ void shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
windows_options &winoptions = downcast<windows_options &>(machine->options());
master_enable = winoptions.d3d_hlsl_enable();
- hlsl_prescale_x = winoptions.d3d_hlsl_prescale_x();
- hlsl_prescale_y = winoptions.d3d_hlsl_prescale_y();
snap_width = winoptions.d3d_snap_width();
snap_height = winoptions.d3d_snap_height();
@@ -952,6 +947,7 @@ int shaders::create_resources(bool reset)
effects[i]->add_uniform("ScreenDims", uniform::UT_VEC2, uniform::CU_SCREEN_DIMS);
effects[i]->add_uniform("QuadDims", uniform::UT_VEC2, uniform::CU_QUAD_DIMS);
effects[i]->add_uniform("SwapXY", uniform::UT_BOOL, uniform::CU_SWAP_XY);
+ effects[i]->add_uniform("VectorScreen", uniform::UT_BOOL, uniform::CU_VECTOR_SCREEN);
}
ntsc_effect->add_uniform("CCValue", uniform::UT_FLOAT, uniform::CU_NTSC_CCFREQ);
@@ -1231,9 +1227,9 @@ int shaders::ntsc_pass(d3d_render_target *rt, int source_index, poly_info *poly,
curr_effect->set_float("SignalOffset", signal_offset);
next_index = rt->next_index(next_index);
- blit(rt->native_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->source_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
- color_effect->set_texture("Diffuse", rt->native_texture[next_index]);
+ color_effect->set_texture("Diffuse", rt->source_texture[next_index]);
return next_index;
}
@@ -1288,7 +1284,7 @@ int shaders::color_convolution_pass(d3d_render_target *rt, int source_index, pol
// initial "Diffuse" texture is set in shaders::set_texture() or the result of shaders::ntsc_pass()
next_index = rt->next_index(next_index);
- blit(rt->native_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->source_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
return next_index;
}
@@ -1299,10 +1295,11 @@ int shaders::prescale_pass(d3d_render_target *rt, int source_index, poly_info *p
curr_effect = prescale_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->native_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->source_texture[next_index]);
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1322,10 +1319,11 @@ int shaders::deconverge_pass(d3d_render_target *rt, int source_index, poly_info
curr_effect = deconverge_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1342,10 +1340,11 @@ int shaders::defocus_pass(d3d_render_target *rt, int source_index, poly_info *po
curr_effect = focus_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1362,21 +1361,23 @@ int shaders::phosphor_pass(d3d_render_target *rt, cache_target *ct, int source_i
curr_effect = phosphor_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
curr_effect->set_texture("LastPass", ct->last_texture);
curr_effect->set_bool("Passthrough", false);
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
// Pass along our phosphor'd screen
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
- curr_effect->set_texture("LastPass", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
+ curr_effect->set_texture("LastPass", rt->target_texture[next_index]);
curr_effect->set_bool("Passthrough", true);
// Avoid changing targets due to page flipping
- blit(ct->last_target, true, D3DPT_TRIANGLELIST, 0, 2);
+ // blit(ct->last_target, true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(ct->last_target, true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1385,9 +1386,6 @@ int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly,
{
int next_index = source_index;
- bool prepare_vector =
- machine->first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
-
screen_device_iterator screen_iterator(machine->root_device());
screen_device *screen = screen_iterator.first();
for (int i = 0; i < curr_screen; i++)
@@ -1404,15 +1402,20 @@ int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly,
float screen_scale[2] = { xscale, yscale };
float screen_offset[2] = { xoffset, yoffset };
- rgb_t back_color_rgb = !machine->first_screen()->has_palette() ? rgb_t(0, 0, 0) : machine->first_screen()->palette().palette()->entry_color(0);
+ rgb_t back_color_rgb = !machine->first_screen()->has_palette()
+ ? 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 };
+ 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("ShadowTileMode", options->shadow_mask_tile_mode);
- curr_effect->set_texture("DiffuseTexture", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("DiffuseTexture", rt->target_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);
@@ -1420,10 +1423,10 @@ int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly,
curr_effect->set_float("TimeMilliseconds", (float)machine->time().as_double() * 1000.0f);
curr_effect->set_float("HumBarAlpha", options->hum_bar_alpha);
curr_effect->set_bool("PrepareBloom", prepare_bloom);
- curr_effect->set_bool("PrepareVector", prepare_vector);
next_index = rt->next_index(next_index);
- blit(prepare_bloom ? rt->native_target[next_index] : rt->prescale_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
+ // blit(prepare_bloom ? rt->source_surface[next_index] : rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(prepare_bloom ? rt->source_surface[next_index] : rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1438,17 +1441,13 @@ int shaders::downsample_pass(d3d_render_target *rt, int source_index, poly_info
return next_index;
}
- bool prepare_vector =
- machine->first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
-
curr_effect = downsample_effect;
curr_effect->update_uniforms();
- curr_effect->set_bool("PrepareVector", prepare_vector);
int bloom_index = 0;
- float bloom_width = prepare_vector ? rt->target_width : rt->target_width / hlsl_prescale_x;
- float bloom_height = prepare_vector ? rt->target_height : rt->target_height / hlsl_prescale_y;
- float bloom_size = (bloom_width < bloom_height) ? bloom_width : bloom_height;
+ float bloom_width = rt->target_width;
+ float bloom_height = rt->target_height;
+ float bloom_size = bloom_width < bloom_height ? bloom_width : bloom_height;
for (; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
{
bloom_dims[bloom_index][0] = (float)(int)bloom_width;
@@ -1457,9 +1456,10 @@ int shaders::downsample_pass(d3d_render_target *rt, int source_index, poly_info
curr_effect->set_vector("TargetDims", 2, bloom_dims[bloom_index]);
curr_effect->set_texture("DiffuseTexture",
bloom_index == 0
- ? rt->native_texture[next_index]
+ ? rt->source_texture[next_index]
: rt->bloom_texture[bloom_index - 1]);
+ // blit(rt->bloom_target[bloom_index], true, D3DPT_TRIANGLELIST, 0, 2);
blit(rt->bloom_target[bloom_index], true, poly->get_type(), vertnum, poly->get_count());
bloom_width *= 0.5f;
@@ -1525,7 +1525,7 @@ int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly
curr_effect->set_float("BloomScale", options->bloom_scale);
curr_effect->set_vector("BloomOverdrive", 3, options->bloom_overdrive);
- curr_effect->set_texture("DiffuseA", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("DiffuseA", rt->target_texture[next_index]);
char name[9] = "Diffuse*";
for (int index = 1; index < bloom_count; index++)
@@ -1540,7 +1540,8 @@ int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly
}
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1561,7 +1562,7 @@ int shaders::distortion_pass(d3d_render_target *rt, int source_index, poly_info
int screen_count = d3d->window().target()->current_view()->screens().count();
- // only one screen is supported
+ // todo: only one screen is supported
if (screen_count > 1)
{
return next_index;
@@ -1569,22 +1570,26 @@ int shaders::distortion_pass(d3d_render_target *rt, int source_index, poly_info
render_bounds bounds = d3d->window().target()->current_view()->bounds();
render_bounds screen_bounds = d3d->window().target()->current_view()->screen_bounds();
-
- // artworks are not supported
- if (bounds.x0 != screen_bounds.x0 ||
+ bool screen_bounds_zoomed = d3d->window().target()->zoom_to_screen();
+ bool screen_bounds_differ =
+ bounds.x0 != screen_bounds.x0 ||
bounds.y0 != screen_bounds.y0 ||
bounds.x1 != screen_bounds.x1 ||
- bounds.y1 != screen_bounds.y1)
+ bounds.y1 != screen_bounds.y1;
+
+ // todo: full artworks are not supported
+ if (screen_bounds_differ && !screen_bounds_zoomed)
{
return next_index;
}
curr_effect = distortion_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("DiffuseTexture", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("DiffuseTexture", rt->target_texture[next_index]);
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1601,7 +1606,8 @@ int shaders::vector_pass(d3d_render_target *rt, int source_index, poly_info *pol
curr_effect->set_vector("TimeParams", 2, time_params);
curr_effect->set_vector("LengthParams", 3, length_params);
- blit(rt->prescale_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1613,12 +1619,12 @@ int shaders::vector_buffer_pass(d3d_render_target *rt, int source_index, poly_in
curr_effect = default_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
curr_effect->set_bool("PostPass", true);
- curr_effect->set_float("Brighten", 1.0f);
next_index = rt->next_index(next_index);
- blit(rt->prescale_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
+ // blit(rt->target_surface[next_index], true, D3DPT_TRIANGLELIST, 0, 2);
+ blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
return next_index;
}
@@ -1627,15 +1633,11 @@ int shaders::screen_pass(d3d_render_target *rt, int source_index, poly_info *pol
{
int next_index = source_index;
- bool prepare_vector =
- machine->first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
-
curr_effect = default_effect;
curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
+ curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
curr_effect->set_bool("PostPass", true);
- curr_effect->set_float("Brighten", prepare_vector ? 1.0f : 0.0f);
// we do not clear the backbuffe here because multiple screens might rendered into
blit(backbuffer, false, poly->get_type(), vertnum, poly->get_count());
@@ -1660,7 +1662,6 @@ void shaders::menu_pass(poly_info *poly, int vertnum)
curr_effect = default_effect;
curr_effect->update_uniforms();
curr_effect->set_bool("PostPass", false);
- curr_effect->set_float("Brighten", 0.0f);
blit(NULL, false, poly->get_type(), vertnum, poly->get_count());
}
@@ -1689,6 +1690,7 @@ void shaders::render_quad(poly_info *poly, int vertnum)
d3d_render_target *rt = curr_render_target;
if (rt == NULL)
{
+ osd_printf_verbose("Direct3D: No raster render target\n");
return;
}
@@ -1735,6 +1737,7 @@ void shaders::render_quad(poly_info *poly, int vertnum)
d3d_render_target *rt = curr_render_target;
if (rt == NULL)
{
+ osd_printf_verbose("Direct3D: No vector render target\n");
return;
}
@@ -1757,6 +1760,7 @@ void shaders::render_quad(poly_info *poly, int vertnum)
d3d_render_target *rt = curr_render_target;
if (rt == NULL)
{
+ osd_printf_verbose("Direct3D: No vector buffer render target\n");
return;
}
@@ -1820,23 +1824,13 @@ void shaders::end_draw()
//============================================================
-// shaders::register_prescaled_texture
-//============================================================
-
-bool shaders::register_prescaled_texture(texture_info *texture)
-{
- return register_texture(texture);
-}
-
-
-//============================================================
// shaders::add_cache_target - register a cache target
//============================================================
-bool shaders::add_cache_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int xprescale, int yprescale, int screen_index)
+bool shaders::add_cache_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int screen_index)
{
cache_target* target = (cache_target*)global_alloc_clear<cache_target>();
- if (!target->init(d3d, d3dintf, width, height, xprescale, yprescale))
+ if (!target->init(d3d, d3dintf, width, height))
{
global_free(target);
return false;
@@ -1879,7 +1873,10 @@ d3d_render_target* shaders::get_vector_target()
void shaders::create_vector_target(render_primitive *prim)
{
- if (!add_render_target(d3d, NULL, d3d->get_width(), d3d->get_height(), 1, 1))
+ int width = d3d->get_width();
+ int height = d3d->get_height();
+
+ if (!add_render_target(d3d, NULL, width, height, width, height))
{
vector_enable = false;
}
@@ -1890,7 +1887,7 @@ void shaders::create_vector_target(render_primitive *prim)
// shaders::add_render_target - register a render target
//============================================================
-bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int xprescale, int yprescale)
+bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int target_width, int target_height)
{
UINT32 screen_index = 0;
UINT32 page_index = 0;
@@ -1917,7 +1914,7 @@ bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* info, int widt
d3d_render_target* target = (d3d_render_target*)global_alloc_clear<d3d_render_target>();
- if (!target->init(d3d, d3dintf, width, height, xprescale, yprescale))
+ if (!target->init(d3d, d3dintf, width, height, target_width, target_height))
{
global_free(target);
return false;
@@ -1934,7 +1931,7 @@ bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* info, int widt
target->height = d3d->get_height();
}
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, target->prescale_target[0]);
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, target->target_surface[0]);
if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
result = (*d3dintf->device.clear)(d3d->get_device(), 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
@@ -1947,7 +1944,7 @@ bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* info, int widt
cache_target* cache = find_cache_target(target->screen_index, target->width, target->height);
if (cache == NULL)
{
- if (!add_cache_target(d3d, info, width, height, xprescale, yprescale, target->screen_index))
+ if (!add_cache_target(d3d, info, target_width, target_height, target->screen_index))
{
global_free(target);
return false;
@@ -1983,11 +1980,6 @@ void shaders::enumerate_screens()
bool shaders::register_texture(texture_info *texture)
{
- int width = texture->get_width();
- int height = texture->get_height();
- int xscale = texture->get_xscale();
- int yscale = texture->get_yscale();
-
if (!master_enable || !d3dintf->post_fx_available)
{
return false;
@@ -1995,31 +1987,7 @@ bool shaders::register_texture(texture_info *texture)
enumerate_screens();
- // Find the nearest prescale factor that is over our screen size
- if (hlsl_prescale_x == 0)
- {
- hlsl_prescale_x = 1;
- while (width * xscale * hlsl_prescale_x <= d3d->get_width())
- {
- hlsl_prescale_x++;
- }
- hlsl_prescale_x--;
- }
-
- if (hlsl_prescale_y == 0)
- {
- hlsl_prescale_y = 1;
- while (height * yscale * hlsl_prescale_y <= d3d->get_height())
- {
- hlsl_prescale_y++;
- }
- hlsl_prescale_y--;
- }
-
- hlsl_prescale_x = ((hlsl_prescale_x == 0) ? 1 : hlsl_prescale_x);
- hlsl_prescale_y = ((hlsl_prescale_y == 0) ? 1 : hlsl_prescale_y);
-
- if (!add_render_target(d3d, texture, width, height, xscale * hlsl_prescale_x, yscale * hlsl_prescale_y))
+ if (!add_render_target(d3d, texture, texture->get_width(), texture->get_height(), d3d->get_width(), d3d->get_height()))
{
return false;
}
@@ -2360,25 +2328,25 @@ static INT32 slider_scanline_alpha(running_machine &machine, void *arg, std::str
static INT32 slider_scanline_scale(running_machine &machine, void *arg, std::string *str, INT32 newval)
{
((hlsl_options*)arg)->params_dirty = true;
- return slider_set(&(((hlsl_options*)arg)->scanline_scale), 0.05f, "%2.2f", str, newval);
+ return slider_set(&(((hlsl_options*)arg)->scanline_scale), 0.01f, "%2.2f", str, newval);
}
static INT32 slider_scanline_height(running_machine &machine, void *arg, std::string *str, INT32 newval)
{
((hlsl_options*)arg)->params_dirty = true;
- return slider_set(&(((hlsl_options*)arg)->scanline_height), 0.05f, "%2.2f", str, newval);
+ return slider_set(&(((hlsl_options*)arg)->scanline_height), 0.01f, "%2.2f", str, newval);
}
static INT32 slider_scanline_bright_scale(running_machine &machine, void *arg, std::string *str, INT32 newval)
{
((hlsl_options*)arg)->params_dirty = true;
- return slider_set(&(((hlsl_options*)arg)->scanline_bright_scale), 0.05f, "%2.2f", str, newval);
+ return slider_set(&(((hlsl_options*)arg)->scanline_bright_scale), 0.01f, "%2.2f", str, newval);
}
static INT32 slider_scanline_bright_offset(running_machine &machine, void *arg, std::string *str, INT32 newval)
{
((hlsl_options*)arg)->params_dirty = true;
- return slider_set(&(((hlsl_options*)arg)->scanline_bright_offset), 0.05f, "%2.2f", str, newval);
+ return slider_set(&(((hlsl_options*)arg)->scanline_bright_offset), 0.01f, "%2.2f", str, newval);
}
static INT32 slider_scanline_jitter(running_machine &machine, void *arg, std::string *str, INT32 newval)
@@ -2957,10 +2925,10 @@ shaders::slider_desc shaders::s_sliders[] =
{ "Screen Reflection", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_reflection, SLIDER_REFLECTION },
{ "Image Vignetting", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_vignetting, SLIDER_VIGNETTING },
{ "Scanline Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_alpha, SLIDER_SCANLINE_ALPHA },
- { "Scanline Screen Height", 1, 20, 80, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_scale, SLIDER_SCANLINE_SCALE },
- { "Scanline Indiv. Height", 1, 20, 80, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_height, SLIDER_SCANLINE_HEIGHT },
- { "Scanline Brightness", 0, 20, 40, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_scale, SLIDER_SCANLINE_BRIGHT_SCALE },
- { "Scanline Brightness Overdrive", 0, 0, 20, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_offset, SLIDER_SCANLINE_BRIGHT_OFFSET },
+ { "Scanline Screen Scale", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_scale, SLIDER_SCANLINE_SCALE },
+ { "Scanline Height", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_height, SLIDER_SCANLINE_HEIGHT },
+ { "Scanline Brightness", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_scale, SLIDER_SCANLINE_BRIGHT_SCALE },
+ { "Scanline Brightness Overdrive", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_offset, SLIDER_SCANLINE_BRIGHT_OFFSET },
{ "Scanline Jitter", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_jitter, SLIDER_SCANLINE_JITTER },
{ "Hum Bar Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_hum_bar_alpha, SLIDER_HUM_BAR_ALPHA },
{ "Defocus X", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_defocus_x, SLIDER_DEFOCUS_X },
@@ -3139,28 +3107,25 @@ void uniform::update()
vec2f sourcedims = shadersys->curr_texture->get_rawdims();
m_shader->set_vector("SourceDims", 2, &sourcedims.c.x);
}
-
+ else
+ {
+ vec2f sourcedims = d3d->get_dims();
+ m_shader->set_vector("SourceDims", 2, &sourcedims.c.x);
+ }
break;
}
case CU_SOURCE_RECT:
{
- bool prepare_vector =
- d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
-
- if (prepare_vector)
- {
- float delta[2] = { 1.0f, 1.0f };
- m_shader->set_vector("SourceRect", 2, delta);
- break;
- }
-
if (shadersys->curr_texture != NULL)
{
vec2f delta = shadersys->curr_texture->get_uvstop() - shadersys->curr_texture->get_uvstart();
m_shader->set_vector("SourceRect", 2, &delta.c.x);
- break;
}
-
+ else
+ {
+ float delta[2] = { 1.0f, 1.0f };
+ m_shader->set_vector("SourceRect", 2, delta);
+ }
break;
}
case CU_TARGET_DIMS:
@@ -3194,12 +3159,14 @@ void uniform::update()
(d3d->window().target()->orientation() & ROT90) == ROT90 ||
(d3d->window().target()->orientation() & ROT270) == ROT270;
m_shader->set_bool("SwapXY", orientation_swap_xy ^ rotation_swap_xy);
+ break;
}
case CU_ORIENTATION_SWAP:
{
bool orientation_swap_xy =
(d3d->window().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
m_shader->set_bool("OrientationSwapXY", orientation_swap_xy);
+ break;
}
case CU_ROTATION_SWAP:
@@ -3208,6 +3175,7 @@ void uniform::update()
(d3d->window().target()->orientation() & ROT90) == ROT90 ||
(d3d->window().target()->orientation() & ROT270) == ROT270;
m_shader->set_bool("RotationSwapXY", rotation_swap_xy);
+ break;
}
case CU_ROTATION_TYPE:
{
@@ -3220,6 +3188,14 @@ void uniform::update()
? 3
: 0;
m_shader->set_int("RotationType", rotation_type);
+ break;
+ }
+ case CU_VECTOR_SCREEN:
+ {
+ bool vector_screen =
+ d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
+ m_shader->set_bool("VectorScreen", vector_screen);
+ break;
}
case CU_NTSC_CCFREQ: