summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2013-01-13 15:07:11 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2013-01-13 15:07:11 +0000
commit4825263ebf648573e3945c7a4f77e8ccf0db81cc (patch)
tree49731bffe7be6f71464c3649d0b663ae8e8bba7c /src/osd
parent2838333f3333820b95fba463ddd254d0ae273230 (diff)
- d3dhlsl.c: Made HLSL switchable at runtime, Ctrl+Alt+F12. [MooglyGuy]
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/windows/d3dhlsl.c509
-rw-r--r--src/osd/windows/d3dhlsl.h3
-rw-r--r--src/osd/windows/drawd3d.c33
-rw-r--r--src/osd/windows/drawd3d.h2
-rw-r--r--src/osd/windows/drawdd.c1
-rw-r--r--src/osd/windows/drawgdi.c1
-rw-r--r--src/osd/windows/drawnone.c1
-rw-r--r--src/osd/windows/input.c8
-rw-r--r--src/osd/windows/video.c4
-rw-r--r--src/osd/windows/window.c23
-rw-r--r--src/osd/windows/window.h2
11 files changed, 336 insertions, 251 deletions
diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c
index f21312217f4..0afca50623e 100644
--- a/src/osd/windows/d3dhlsl.c
+++ b/src/osd/windows/d3dhlsl.c
@@ -203,6 +203,7 @@ hlsl_info::hlsl_info()
lastidx = -1;
targethead = NULL;
cachehead = NULL;
+ initialized = false;
}
@@ -498,6 +499,30 @@ void hlsl_info::end_avi_recording()
//============================================================
+// hlsl_info::set_texture
+//============================================================
+
+void hlsl_info::toggle()
+{
+ if (master_enable)
+ {
+ if (initialized)
+ {
+ delete_resources(false);
+ }
+ }
+ else
+ {
+ if (!initialized)
+ {
+ create_resources(false);
+ }
+ }
+
+ master_enable = !master_enable;
+}
+
+//============================================================
// hlsl_info::begin_avi_recording
//============================================================
@@ -655,6 +680,7 @@ void hlsl_info::remove_render_target(d3d_render_target *rt)
}
}
+
//============================================================
// hlsl_info::set_texture
//============================================================
@@ -698,6 +724,8 @@ void hlsl_info::init(d3d_base *d3dintf, win_window_info *window)
if (!d3dintf->post_fx_available)
return;
+ g_slider_list = init_slider_list();
+
this->d3dintf = d3dintf;
this->window = window;
@@ -712,305 +740,192 @@ void hlsl_info::init(d3d_base *d3dintf, win_window_info *window)
snap_width = downcast<windows_options &>(window->machine().options()).d3d_snap_width();
snap_height = downcast<windows_options &>(window->machine().options()).d3d_snap_height();
-}
-
-
-//============================================================
-// hlsl_info::init_fsfx_quad
-//============================================================
-
-void hlsl_info::init_fsfx_quad(void *vertbuf)
-{
- if (!master_enable || !d3dintf->post_fx_available)
- return;
-
- d3d_info *d3d = (d3d_info *)window->drawdata;
-
- // get a pointer to the vertex buffer
- fsfx_vertices = (d3d_vertex *)vertbuf;
- if (fsfx_vertices == NULL)
- return;
-
- // fill in the vertexes clockwise
- fsfx_vertices[0].x = 0.0f;
- fsfx_vertices[0].y = 0.0f;
- fsfx_vertices[1].x = d3d->width;
- fsfx_vertices[1].y = 0.0f;
- fsfx_vertices[2].x = 0.0f;
- fsfx_vertices[2].y = d3d->height;
- fsfx_vertices[3].x = d3d->width;
- fsfx_vertices[3].y = 0.0f;
- fsfx_vertices[4].x = 0.0f;
- fsfx_vertices[4].y = d3d->height;
- fsfx_vertices[5].x = d3d->width;
- fsfx_vertices[5].y = d3d->height;
-
- fsfx_vertices[0].u0 = 0.0f;
- fsfx_vertices[0].v0 = 0.0f;
-
- fsfx_vertices[1].u0 = 1.0f;
- 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 = 0.0f;
- fsfx_vertices[4].u0 = 0.0f;
- fsfx_vertices[4].v0 = 1.0f;
-
- fsfx_vertices[5].u0 = 1.0f;
- fsfx_vertices[5].v0 = 1.0f;
-
- // set the color, Z parameters to standard values
- for (int i = 0; i < 6; i++)
- {
- fsfx_vertices[i].z = 0.0f;
- fsfx_vertices[i].rhw = 1.0f;
- fsfx_vertices[i].color = D3DCOLOR_ARGB(255, 255, 255, 255);
- }
-}
-
-
-//============================================================
-// hlsl_info::create_resources
-//============================================================
+ prescale_force_x = 0;
+ prescale_force_y = 0;
-int hlsl_info::create_resources(bool reset)
-{
- if (!master_enable || !d3dintf->post_fx_available)
- return 0;
+ windows_options &winoptions = downcast<windows_options &>(window->machine().options());
- d3d_info *d3d = (d3d_info *)window->drawdata;
+ options = (hlsl_options*)global_alloc_clear(hlsl_options);
- HRESULT result = (*d3dintf->device.create_texture)(d3d->device, (int)snap_width, (int)snap_height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &avi_copy_texture);
- if (result != D3D_OK)
- {
- mame_printf_verbose("Direct3D: Unable to init system-memory target for HLSL AVI dumping (%08x)\n", (UINT32)result);
- return 1;
- }
- (*d3dintf->texture.get_surface_level)(avi_copy_texture, 0, &avi_copy_surface);
-
- result = (*d3dintf->device.create_texture)(d3d->device, (int)snap_width, (int)snap_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &avi_final_texture);
- if (result != D3D_OK)
- {
- mame_printf_verbose("Direct3D: Unable to init video-memory target for HLSL AVI dumping (%08x)\n", (UINT32)result);
- return 1;
- }
- (*d3dintf->texture.get_surface_level)(avi_final_texture, 0, &avi_final_target);
+ options->params_dirty = true;
+ strcpy(options->shadow_mask_texture, downcast<windows_options &>(window->machine().options()).screen_shadow_mask_texture()); // unsafe
- windows_options &winoptions = downcast<windows_options &>(window->machine().options());
+ write_ini = downcast<windows_options &>(window->machine().options()).hlsl_write_ini();
+ read_ini = downcast<windows_options &>(window->machine().options()).hlsl_read_ini();
- if (!reset)
+ if(read_ini)
{
- options = (hlsl_options*)global_alloc_clear(hlsl_options);
+ emu_file ini_file(downcast<windows_options &>(window->machine().options()).screen_post_fx_dir(), OPEN_FLAG_READ | OPEN_FLAG_CREATE_PATHS);
+ file_error filerr = open_next((d3d_info*)window->drawdata, ini_file, downcast<windows_options &>(window->machine().options()).hlsl_ini_name(), "ini", 0);
- options->params_dirty = true;
- strcpy(options->shadow_mask_texture, downcast<windows_options &>(window->machine().options()).screen_shadow_mask_texture()); // unsafe
-
- write_ini = downcast<windows_options &>(window->machine().options()).hlsl_write_ini();
- read_ini = downcast<windows_options &>(window->machine().options()).hlsl_read_ini();
-
- if(read_ini)
+ read_ini = false;
+ if (filerr == FILERR_NONE)
{
- emu_file ini_file(downcast<windows_options &>(window->machine().options()).screen_post_fx_dir(), OPEN_FLAG_READ | OPEN_FLAG_CREATE_PATHS);
- file_error filerr = open_next((d3d_info*)window->drawdata, ini_file, downcast<windows_options &>(window->machine().options()).hlsl_ini_name(), "ini", 0);
-
- read_ini = false;
- if (filerr == FILERR_NONE)
+ ini_file.seek(0, SEEK_END);
+ if (ini_file.tell() >= 1000)
{
- ini_file.seek(0, SEEK_END);
- if (ini_file.tell() >= 1000)
- {
- read_ini = true;
- ini_file.seek(0, SEEK_SET);
+ read_ini = true;
+ ini_file.seek(0, SEEK_SET);
- int en = 0;
- char buf[1024];
- ini_file.gets(buf, 1024);
- sscanf(buf, "hlsl_enable %d\n", &en);
- master_enable = en == 1;
+ int en = 0;
+ char buf[1024];
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "hlsl_enable %d\n", &en);
+ master_enable = en == 1;
- ini_file.gets(buf, 1024);
- sscanf(buf, "hlsl_prescale_x %d\n", &prescale_force_x);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "hlsl_prescale_x %d\n", &prescale_force_x);
- ini_file.gets(buf, 1024);
- sscanf(buf, "hlsl_prescale_y %d\n", &prescale_force_y);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "hlsl_prescale_y %d\n", &prescale_force_y);
- ini_file.gets(buf, 1024);
- sscanf(buf, "hlsl_preset %d\n", &preset);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "hlsl_preset %d\n", &preset);
- ini_file.gets(buf, 1024);
- sscanf(buf, "hlsl_snap_width %d\n", &snap_width);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "hlsl_snap_width %d\n", &snap_width);
- ini_file.gets(buf, 1024);
- sscanf(buf, "hlsl_snap_height %d\n", &snap_height);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "hlsl_snap_height %d\n", &snap_height);
- ini_file.gets(buf, 1024);
- sscanf(buf, "shadow_mask_alpha %f\n", &options->shadow_mask_alpha);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "shadow_mask_alpha %f\n", &options->shadow_mask_alpha);
- ini_file.gets(buf, 1024);
- sscanf(buf, "shadow_mask_texture %s\n", options->shadow_mask_texture);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "shadow_mask_texture %s\n", options->shadow_mask_texture);
- ini_file.gets(buf, 1024);
- sscanf(buf, "shadow_mask_x_count %d\n", &options->shadow_mask_count_x);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "shadow_mask_x_count %d\n", &options->shadow_mask_count_x);
- ini_file.gets(buf, 1024);
- sscanf(buf, "shadow_mask_y_count %d\n", &options->shadow_mask_count_y);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "shadow_mask_y_count %d\n", &options->shadow_mask_count_y);
- ini_file.gets(buf, 1024);
- sscanf(buf, "shadow_mask_usize %f\n", &options->shadow_mask_u_size);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "shadow_mask_usize %f\n", &options->shadow_mask_u_size);
- ini_file.gets(buf, 1024);
- sscanf(buf, "shadow_mask_vsize %f\n", &options->shadow_mask_v_size);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "shadow_mask_vsize %f\n", &options->shadow_mask_v_size);
- ini_file.gets(buf, 1024);
- sscanf(buf, "curvature %f\n", &options->curvature);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "curvature %f\n", &options->curvature);
- ini_file.gets(buf, 1024);
- sscanf(buf, "pincushion %f\n", &options->pincushion);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "pincushion %f\n", &options->pincushion);
- ini_file.gets(buf, 1024);
- sscanf(buf, "scanline_alpha %f\n", &options->scanline_alpha);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "scanline_alpha %f\n", &options->scanline_alpha);
- ini_file.gets(buf, 1024);
- sscanf(buf, "scanline_size %f\n", &options->scanline_scale);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "scanline_size %f\n", &options->scanline_scale);
- ini_file.gets(buf, 1024);
- sscanf(buf, "scanline_height %f\n", &options->scanline_height);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "scanline_height %f\n", &options->scanline_height);
- ini_file.gets(buf, 1024);
- sscanf(buf, "scanline_bright_scale %f\n", &options->scanline_bright_scale);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "scanline_bright_scale %f\n", &options->scanline_bright_scale);
- ini_file.gets(buf, 1024);
- sscanf(buf, "scanline_bright_offset %f\n", &options->scanline_bright_offset);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "scanline_bright_offset %f\n", &options->scanline_bright_offset);
- ini_file.gets(buf, 1024);
- sscanf(buf, "scanline_jitter %f\n", &options->scanline_offset);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "scanline_jitter %f\n", &options->scanline_offset);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "defocus %f %f\n", &options->defocus[0], &options->defocus[1]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "defocus %f %f\n", &options->defocus[0], &options->defocus[1]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "converge_x %f %f %f\n", &options->converge_x[0], &options->converge_x[1], &options->converge_x[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "converge_x %f %f %f\n", &options->converge_x[0], &options->converge_x[1], &options->converge_x[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "converge_y %f %f %f\n", &options->converge_y[0], &options->converge_y[1], &options->converge_y[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "converge_y %f %f %f\n", &options->converge_y[0], &options->converge_y[1], &options->converge_y[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "radial_converge_x %f %f %f\n", &options->radial_converge_x[0], &options->radial_converge_x[1], &options->radial_converge_x[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "radial_converge_x %f %f %f\n", &options->radial_converge_x[0], &options->radial_converge_x[1], &options->radial_converge_x[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "radial_converge_y %f %f %f\n", &options->radial_converge_y[0], &options->radial_converge_y[1], &options->radial_converge_y[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "radial_converge_y %f %f %f\n", &options->radial_converge_y[0], &options->radial_converge_y[1], &options->radial_converge_y[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "red_ratio %f %f %f\n", &options->red_ratio[0], &options->red_ratio[1], &options->red_ratio[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "red_ratio %f %f %f\n", &options->red_ratio[0], &options->red_ratio[1], &options->red_ratio[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "grn_ratio %f %f %f\n", &options->grn_ratio[0], &options->grn_ratio[1], &options->grn_ratio[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "grn_ratio %f %f %f\n", &options->grn_ratio[0], &options->grn_ratio[1], &options->grn_ratio[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "blu_ratio %f %f %f\n", &options->blu_ratio[0], &options->blu_ratio[1], &options->blu_ratio[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "blu_ratio %f %f %f\n", &options->blu_ratio[0], &options->blu_ratio[1], &options->blu_ratio[2]);
- ini_file.gets(buf, 1024);
- sscanf(buf, "saturation %f\n", &options->saturation);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "saturation %f\n", &options->saturation);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "offset %f %f %f\n", &options->offset[0], &options->offset[1], &options->offset[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "offset %f %f %f\n", &options->offset[0], &options->offset[1], &options->offset[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "scale %f %f %f\n", &options->scale[0], &options->scale[1], &options->scale[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "scale %f %f %f\n", &options->scale[0], &options->scale[1], &options->scale[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "power %f %f %f\n", &options->power[0], &options->power[1], &options->power[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "power %f %f %f\n", &options->power[0], &options->power[1], &options->power[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "floor %f %f %f\n", &options->floor[0], &options->floor[1], &options->floor[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "floor %f %f %f\n", &options->floor[0], &options->floor[1], &options->floor[2]);
- ini_file.gets(buf, 1024);
- for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
- sscanf(buf, "phosphor_life %f %f %f\n", &options->phosphor[0], &options->phosphor[1], &options->phosphor[2]);
+ ini_file.gets(buf, 1024);
+ for(int idx = 0; idx < strlen(buf); idx++) if(buf[idx] == ',') buf[idx] = ' ';
+ sscanf(buf, "phosphor_life %f %f %f\n", &options->phosphor[0], &options->phosphor[1], &options->phosphor[2]);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_enable %d\n", &en);
- options->yiq_enable = en == 1;
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_enable %d\n", &en);
+ options->yiq_enable = en == 1;
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_cc %f\n", &options->yiq_cc);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_cc %f\n", &options->yiq_cc);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_a %f\n", &options->yiq_a);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_a %f\n", &options->yiq_a);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_b %f\n", &options->yiq_b);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_b %f\n", &options->yiq_b);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_o %f\n", &options->yiq_o);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_o %f\n", &options->yiq_o);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_p %f\n", &options->yiq_p);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_p %f\n", &options->yiq_p);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_n %f\n", &options->yiq_n);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_n %f\n", &options->yiq_n);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_y %f\n", &options->yiq_y);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_y %f\n", &options->yiq_y);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_i %f\n", &options->yiq_i);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_i %f\n", &options->yiq_i);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_q %f\n", &options->yiq_q);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_q %f\n", &options->yiq_q);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_scan_time %f\n", &options->yiq_scan_time);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_scan_time %f\n", &options->yiq_scan_time);
- ini_file.gets(buf, 1024);
- sscanf(buf, "yiq_phase_count %d\n", &options->yiq_phase_count);
- }
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "yiq_phase_count %d\n", &options->yiq_phase_count);
}
}
}
-
- // experimental: load a PNG to use for vector rendering; it is treated
- // as a brightness map
- emu_file file(window->machine().options().art_path(), OPEN_FLAG_READ);
-
- // experimental: if we have a shadow bitmap, create a texture for it
- render_load_png(shadow_bitmap, file, NULL, options->shadow_mask_texture);
- if (shadow_bitmap.valid())
- {
- render_texinfo texture;
-
- // fake in the basic data so it looks like it came from render.c
- texture.base = shadow_bitmap.raw_pixptr(0);
- texture.rowpixels = shadow_bitmap.rowpixels();
- texture.width = shadow_bitmap.width();
- texture.height = shadow_bitmap.height();
- texture.palette = NULL;
- texture.seqid = 0;
-
- // now create it
- shadow_texture = texture_create(d3d, &texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32));
- }
-
- prescale_force_x = 0;
- prescale_force_y = 0;
-
- if(!read_ini)
+ else
{
prescale_force_x = winoptions.d3d_hlsl_prescale_x();
prescale_force_y = winoptions.d3d_hlsl_prescale_y();
@@ -1063,7 +978,115 @@ int hlsl_info::create_resources(bool reset)
options->yiq_phase_count = winoptions.screen_yiq_phase_count();
}
- g_slider_list = init_slider_list();
+ options->params_dirty = true;
+ // experimental: load a PNG to use for vector rendering; it is treated
+ // as a brightness map
+ emu_file file(window->machine().options().art_path(), OPEN_FLAG_READ);
+
+ render_load_png(shadow_bitmap, file, NULL, options->shadow_mask_texture);
+}
+
+
+//============================================================
+// hlsl_info::init_fsfx_quad
+//============================================================
+
+void hlsl_info::init_fsfx_quad(void *vertbuf)
+{
+ if (!master_enable || !d3dintf->post_fx_available)
+ return;
+
+ d3d_info *d3d = (d3d_info *)window->drawdata;
+
+ // get a pointer to the vertex buffer
+ fsfx_vertices = (d3d_vertex *)vertbuf;
+ if (fsfx_vertices == NULL)
+ return;
+
+ // fill in the vertexes clockwise
+ fsfx_vertices[0].x = 0.0f;
+ fsfx_vertices[0].y = 0.0f;
+ fsfx_vertices[1].x = d3d->width;
+ fsfx_vertices[1].y = 0.0f;
+ fsfx_vertices[2].x = 0.0f;
+ fsfx_vertices[2].y = d3d->height;
+ fsfx_vertices[3].x = d3d->width;
+ fsfx_vertices[3].y = 0.0f;
+ fsfx_vertices[4].x = 0.0f;
+ fsfx_vertices[4].y = d3d->height;
+ fsfx_vertices[5].x = d3d->width;
+ fsfx_vertices[5].y = d3d->height;
+
+ fsfx_vertices[0].u0 = 0.0f;
+ fsfx_vertices[0].v0 = 0.0f;
+
+ fsfx_vertices[1].u0 = 1.0f;
+ 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 = 0.0f;
+
+ fsfx_vertices[4].u0 = 0.0f;
+ fsfx_vertices[4].v0 = 1.0f;
+
+ fsfx_vertices[5].u0 = 1.0f;
+ fsfx_vertices[5].v0 = 1.0f;
+
+ // set the color, Z parameters to standard values
+ for (int i = 0; i < 6; i++)
+ {
+ fsfx_vertices[i].z = 0.0f;
+ fsfx_vertices[i].rhw = 1.0f;
+ fsfx_vertices[i].color = D3DCOLOR_ARGB(255, 255, 255, 255);
+ }
+}
+
+
+//============================================================
+// hlsl_info::create_resources
+//============================================================
+
+int hlsl_info::create_resources(bool reset)
+{
+ initialized = true;
+
+ d3d_info *d3d = (d3d_info *)window->drawdata;
+
+ HRESULT result = (*d3dintf->device.create_texture)(d3d->device, (int)snap_width, (int)snap_height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &avi_copy_texture);
+ if (result != D3D_OK)
+ {
+ mame_printf_verbose("Direct3D: Unable to init system-memory target for HLSL AVI dumping (%08x)\n", (UINT32)result);
+ return 1;
+ }
+ (*d3dintf->texture.get_surface_level)(avi_copy_texture, 0, &avi_copy_surface);
+
+ result = (*d3dintf->device.create_texture)(d3d->device, (int)snap_width, (int)snap_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &avi_final_texture);
+ if (result != D3D_OK)
+ {
+ mame_printf_verbose("Direct3D: Unable to init video-memory target for HLSL AVI dumping (%08x)\n", (UINT32)result);
+ return 1;
+ }
+ (*d3dintf->texture.get_surface_level)(avi_final_texture, 0, &avi_final_target);
+
+ // experimental: if we have a shadow bitmap, create a texture for it
+ if (shadow_bitmap.valid())
+ {
+ render_texinfo texture;
+
+ // fake in the basic data so it looks like it came from render.c
+ texture.base = shadow_bitmap.raw_pixptr(0);
+ texture.rowpixels = shadow_bitmap.rowpixels();
+ texture.width = shadow_bitmap.width();
+ texture.height = shadow_bitmap.height();
+ texture.palette = NULL;
+ texture.seqid = 0;
+
+ // now create it
+ shadow_texture = texture_create(d3d, &texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32));
+ }
const char *fx_dir = downcast<windows_options &>(window->machine().options()).screen_post_fx_dir();
@@ -2063,6 +2086,8 @@ void hlsl_info::delete_resources(bool reset)
if (!master_enable || !d3dintf->post_fx_available)
return;
+ initialized = false;
+
if(write_ini && !reset)
{
emu_file file(downcast<windows_options &>(window->machine().options()).screen_post_fx_dir(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
@@ -2199,8 +2224,6 @@ void hlsl_info::delete_resources(bool reset)
avi_final_target = NULL;
}
- global_free(options);
-
shadow_bitmap.reset();
}
diff --git a/src/osd/windows/d3dhlsl.h b/src/osd/windows/d3dhlsl.h
index 32786776ad7..52bad0062ad 100644
--- a/src/osd/windows/d3dhlsl.h
+++ b/src/osd/windows/d3dhlsl.h
@@ -116,6 +116,7 @@ public:
void init_fsfx_quad(void *vertbuf);
bool enabled() { return master_enable; }
+ void toggle();
bool vector_enabled() { return vector_enable && (bool)HLSL_VECTOR; }
d3d_render_target* get_vector_target(d3d_info *d3d);
@@ -206,6 +207,8 @@ private:
int snap_height; // snapshot height
bool lines_pending; // whether or not we have lines to flush on the next quad
+ bool initialized; // whether or not we're initialize
+
// HLSL effects
d3d_surface * backbuffer; // pointer to our device's backbuffer
d3d_effect * curr_effect; // pointer to the currently active effect object
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c
index 481ca37f3fa..6d9572685a0 100644
--- a/src/osd/windows/drawd3d.c
+++ b/src/osd/windows/drawd3d.c
@@ -217,8 +217,7 @@ INLINE void set_texture(d3d_info *d3d, d3d_texture_info *texture)
d3d->last_texture = texture;
d3d->last_texture_flags = (texture == NULL ? 0 : texture->flags);
result = (*d3dintf->device.set_texture)(d3d->device, 0, (texture == NULL) ? d3d->default_texture->d3dfinaltex : texture->d3dfinaltex);
- if (d3d->hlsl != NULL)
- d3d->hlsl->set_texture(texture);
+ d3d->hlsl->set_texture(texture);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_texture call\n", (int)result);
}
}
@@ -348,6 +347,7 @@ static void drawd3d_window_destroy(win_window_info *window);
static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window);
static void drawd3d_window_save(win_window_info *window);
static void drawd3d_window_record(win_window_info *window);
+static void drawd3d_window_toggle_fsfx(win_window_info *window);
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update);
// devices
@@ -412,6 +412,7 @@ int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks)
callbacks->window_draw = drawd3d_window_draw;
callbacks->window_save = drawd3d_window_save;
callbacks->window_record = drawd3d_window_record;
+ callbacks->window_toggle_fsfx = drawd3d_window_toggle_fsfx;
callbacks->window_destroy = drawd3d_window_destroy;
return 0;
}
@@ -440,6 +441,7 @@ static int drawd3d_window_init(win_window_info *window)
// allocate memory for our structures
d3d = global_alloc_clear(d3d_info);
+ d3d->restarting = false;
window->drawdata = d3d;
d3d->window = window;
d3d->hlsl = NULL;
@@ -475,20 +477,25 @@ error:
+static void drawd3d_window_toggle_fsfx(win_window_info *window)
+{
+ d3d_info *d3d = (d3d_info *)window->drawdata;
+
+ d3d->restarting = true;
+}
+
static void drawd3d_window_record(win_window_info *window)
{
d3d_info *d3d = (d3d_info *)window->drawdata;
- if (d3d->hlsl != NULL)
- d3d->hlsl->window_record();
+ d3d->hlsl->window_record();
}
static void drawd3d_window_save(win_window_info *window)
{
d3d_info *d3d = (d3d_info *)window->drawdata;
- if (d3d->hlsl != NULL)
- d3d->hlsl->window_save();
+ d3d->hlsl->window_save();
}
@@ -551,6 +558,18 @@ static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
if (window->resize_state == RESIZE_STATE_RESIZING)
return 0;
+ // if we're restarting the renderer, leave things alone
+ if (d3d->restarting)
+ {
+ d3d->hlsl->toggle();
+
+ // free all existing resources and re-create
+ device_delete_resources(d3d);
+ device_create_resources(d3d);
+
+ d3d->restarting = false;
+ }
+
// if we haven't been created, just punt
if (d3d == NULL)
return 1;
@@ -811,7 +830,7 @@ static int device_create_resources(d3d_info *d3d)
VERTEX_BASE_FORMAT | ((d3d->hlsl->enabled() && d3dintf->post_fx_available) ? D3DFVF_XYZW : D3DFVF_XYZRHW), D3DPOOL_DEFAULT, &d3d->vertexbuf);
if (result != D3D_OK)
{
- mame_printf_error("Error creating vertex buffer (%08X)", (UINT32)result);
+ printf("Error creating vertex buffer (%08X)", (UINT32)result);
return 1;
}
diff --git a/src/osd/windows/drawd3d.h b/src/osd/windows/drawd3d.h
index a0feed411d5..0d1adff5f57 100644
--- a/src/osd/windows/drawd3d.h
+++ b/src/osd/windows/drawd3d.h
@@ -134,6 +134,8 @@ struct d3d_info
d3d_poly_info poly[VERTEX_BUFFER_SIZE/3]; // array to hold polygons as they are created
int numpolys; // number of accumulated polygons
+ bool restarting; // if we're restarting
+
d3d_texture_info * texlist; // list of active textures
int dynamic_supported; // are dynamic textures supported?
int stretch_supported; // is StretchRect with point filtering supported?
diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c
index 896255004cf..5157fe271d5 100644
--- a/src/osd/windows/drawdd.c
+++ b/src/osd/windows/drawdd.c
@@ -223,6 +223,7 @@ int drawdd_init(running_machine &machine, win_draw_callbacks *callbacks)
callbacks->window_draw = drawdd_window_draw;
callbacks->window_save = NULL;
callbacks->window_record = NULL;
+ callbacks->window_toggle_fsfx = NULL;
callbacks->window_destroy = drawdd_window_destroy;
mame_printf_verbose("DirectDraw: Using DirectDraw 7\n");
diff --git a/src/osd/windows/drawgdi.c b/src/osd/windows/drawgdi.c
index 52d3b629f81..0a8d3c54fd5 100644
--- a/src/osd/windows/drawgdi.c
+++ b/src/osd/windows/drawgdi.c
@@ -93,6 +93,7 @@ int drawgdi_init(running_machine &machine, win_draw_callbacks *callbacks)
callbacks->window_draw = drawgdi_window_draw;
callbacks->window_save = NULL;
callbacks->window_record = NULL;
+ callbacks->window_toggle_fsfx = NULL;
callbacks->window_destroy = drawgdi_window_destroy;
return 0;
}
diff --git a/src/osd/windows/drawnone.c b/src/osd/windows/drawnone.c
index c82740f84ac..a87ef14f823 100644
--- a/src/osd/windows/drawnone.c
+++ b/src/osd/windows/drawnone.c
@@ -77,6 +77,7 @@ int drawnone_init(running_machine &machine, win_draw_callbacks *callbacks)
callbacks->window_draw = drawnone_window_draw;
callbacks->window_save = NULL;
callbacks->window_record = NULL;
+ callbacks->window_toggle_fsfx = NULL;
callbacks->window_destroy = drawnone_window_destroy;
return 0;
}
diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c
index 8e28447efaa..88529bb663f 100644
--- a/src/osd/windows/input.c
+++ b/src/osd/windows/input.c
@@ -779,7 +779,7 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
// alt-F12 for fullscreen snap
case IPT_OSD_2:
entry->configure_osd("RENDER_SNAP", "Take Rendered Snapshot");
- entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_LALT, KEYCODE_F12);
+ entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_LALT, KEYCODE_F12, input_seq::not_code, KEYCODE_LCONTROL);
break;
// alt-F11 for fullscreen video
@@ -788,6 +788,12 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_LALT, KEYCODE_F11);
break;
+ // ctrl-alt-F12 to toggle post-processing
+ case IPT_OSD_4:
+ entry->configure_osd("POST_PROCESS", "Toggle Post-Processing");
+ entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_LALT, KEYCODE_LCONTROL, KEYCODE_F12);
+ break;
+
// leave everything else alone
default:
break;
diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c
index c53f07b7597..0723b31880d 100644
--- a/src/osd/windows/video.c
+++ b/src/osd/windows/video.c
@@ -374,6 +374,10 @@ static void check_osd_inputs(running_machine &machine)
// check for taking fullscreen video
if (ui_input_pressed(machine, IPT_OSD_3))
winwindow_take_video();
+
+ // check for taking fullscreen video
+ if (ui_input_pressed(machine, IPT_OSD_4))
+ winwindow_toggle_fsfx();
}
diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c
index 52366a704f8..9d75c0b58e3 100644
--- a/src/osd/windows/window.c
+++ b/src/osd/windows/window.c
@@ -522,6 +522,29 @@ void winwindow_take_snap(void)
//============================================================
+// winwindow_toggle_fsfx
+// (main thread)
+//============================================================
+
+void winwindow_toggle_fsfx(void)
+{
+ if (draw.window_toggle_fsfx == NULL)
+ return;
+
+ win_window_info *window;
+
+ assert(GetCurrentThreadId() == main_threadid);
+
+ // iterate over windows and request a snap
+ for (window = win_window_list; window != NULL; window = window->next)
+ {
+ (*draw.window_toggle_fsfx)(window);
+ }
+}
+
+
+
+//============================================================
// winwindow_take_video
// (main thread)
//============================================================
diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h
index cd1ebc80842..9633ed3990c 100644
--- a/src/osd/windows/window.h
+++ b/src/osd/windows/window.h
@@ -123,6 +123,7 @@ struct win_draw_callbacks
int (*window_draw)(win_window_info *window, HDC dc, int update);
void (*window_save)(win_window_info *window);
void (*window_record)(win_window_info *window);
+ void (*window_toggle_fsfx)(win_window_info *window);
void (*window_destroy)(win_window_info *window);
};
@@ -158,6 +159,7 @@ extern LRESULT CALLBACK winwindow_video_window_proc_ui(HWND wnd, UINT message, W
void winwindow_toggle_full_screen(void);
void winwindow_take_snap(void);
void winwindow_take_video(void);
+void winwindow_toggle_fsfx(void);
void winwindow_process_events_periodic(running_machine &machine);
void winwindow_process_events(running_machine &machine, int ingame);