summaryrefslogtreecommitdiffstats
path: root/src/osd/windows/d3dhlsl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/windows/d3dhlsl.c')
-rw-r--r--src/osd/windows/d3dhlsl.c954
1 files changed, 477 insertions, 477 deletions
diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c
index 06f9894a026..373526dbdd8 100644
--- a/src/osd/windows/d3dhlsl.c
+++ b/src/osd/windows/d3dhlsl.c
@@ -914,17 +914,17 @@ void hlsl_info::init(d3d_base *d3dintf, win_window_info *window)
ini_file.gets(buf, 1024);
sscanf(buf, "yiq_phase_count %d\n", &options->yiq_phase_count);
- ini_file.gets(buf, 1024);
- sscanf(buf, "vector_time_scale %f\n", &options->vector_time_scale);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "vector_time_scale %f\n", &options->vector_time_scale);
- ini_file.gets(buf, 1024);
- sscanf(buf, "vector_time_period %f\n", &options->vector_time_period);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "vector_time_period %f\n", &options->vector_time_period);
- ini_file.gets(buf, 1024);
- sscanf(buf, "vector_length_scale %f\n", &options->vector_length_scale);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "vector_length_scale %f\n", &options->vector_length_scale);
- ini_file.gets(buf, 1024);
- sscanf(buf, "vector_length_ratio %f\n", &options->vector_length_ratio);
+ ini_file.gets(buf, 1024);
+ sscanf(buf, "vector_length_ratio %f\n", &options->vector_length_ratio);
}
}
}
@@ -979,10 +979,10 @@ void hlsl_info::init(d3d_base *d3dintf, win_window_info *window)
options->yiq_q = winoptions.screen_yiq_q();
options->yiq_scan_time = winoptions.screen_yiq_scan_time();
options->yiq_phase_count = winoptions.screen_yiq_phase_count();
- options->vector_time_scale = winoptions.screen_vector_time_scale();
- options->vector_time_period = winoptions.screen_vector_time_period();
- options->vector_length_scale = winoptions.screen_vector_length_scale();
- options->vector_length_ratio = winoptions.screen_vector_length_ratio();
+ options->vector_time_scale = winoptions.screen_vector_time_scale();
+ options->vector_time_period = winoptions.screen_vector_time_period();
+ options->vector_length_scale = winoptions.screen_vector_length_scale();
+ options->vector_length_ratio = winoptions.screen_vector_length_ratio();
}
options->params_dirty = true;
@@ -1001,58 +1001,58 @@ void hlsl_info::init(d3d_base *d3dintf, win_window_info *window)
void hlsl_info::init_fsfx_quad(void *vertbuf)
{
- // Called at the start of each frame by the D3D code in order to reserve two triangles
- // that are guaranteed to be at a fixed position so as to simply use D3DPT_TRIANGLELIST, 0, 2
- // instead of having to do bookkeeping about a specific screen quad
- if (!master_enable || !d3dintf->post_fx_available)
- return;
+ // Called at the start of each frame by the D3D code in order to reserve two triangles
+ // that are guaranteed to be at a fixed position so as to simply use D3DPT_TRIANGLELIST, 0, 2
+ // instead of having to do bookkeeping about a specific screen quad
+ if (!master_enable || !d3dintf->post_fx_available)
+ return;
- d3d_info *d3d = (d3d_info *)window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
- // get a pointer to the vertex buffer
- fsfx_vertices = (d3d_vertex *)vertbuf;
- if (fsfx_vertices == NULL)
- return;
+ // 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;
+ // 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[0].u0 = 0.0f;
+ fsfx_vertices[0].v0 = 0.0f;
- fsfx_vertices[1].u0 = 1.0f;
- fsfx_vertices[1].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[2].u0 = 0.0f;
+ fsfx_vertices[2].v0 = 1.0f;
- fsfx_vertices[3].u0 = 1.0f;
- fsfx_vertices[3].v0 = 0.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[4].u0 = 0.0f;
+ fsfx_vertices[4].v0 = 1.0f;
- fsfx_vertices[5].u0 = 1.0f;
- fsfx_vertices[5].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);
- }
+ // 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);
+ }
}
@@ -1068,22 +1068,22 @@ int hlsl_info::create_resources(bool reset)
d3d_info *d3d = (d3d_info *)window->drawdata;
- HRESULT result = (*d3dintf->device.get_render_target)(d3d->device, 0, &backbuffer);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result);
-
- result = (*d3dintf->device.create_texture)(d3d->device, 4, 4, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &black_texture);
- if (result != D3D_OK)
- {
- mame_printf_verbose("Direct3D: Unable to init video-memory target for black texture (%08x)\n", (UINT32)result);
- return 1;
- }
- (*d3dintf->texture.get_surface_level)(black_texture, 0, &black_surface);
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, black_surface);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ HRESULT result = (*d3dintf->device.get_render_target)(d3d->device, 0, &backbuffer);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result);
+
+ result = (*d3dintf->device.create_texture)(d3d->device, 4, 4, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &black_texture);
+ if (result != D3D_OK)
+ {
+ mame_printf_verbose("Direct3D: Unable to init video-memory target for black texture (%08x)\n", (UINT32)result);
+ return 1;
+ }
+ (*d3dintf->texture.get_surface_level)(black_texture, 0, &black_surface);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, black_surface);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
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)
@@ -1243,35 +1243,35 @@ int hlsl_info::create_resources(bool reset)
// create the vector shader
#if HLSL_VECTOR
- char bloom_cstr[1024];
- sprintf(bloom_cstr, "%s\\bloom.fx", fx_dir);
- TCHAR *bloom_name = tstring_from_utf8(bloom_cstr);
-
- result = (*d3dintf->device.create_effect)(d3d->device, bloom_name, &bloom_effect);
- if(result != D3D_OK)
- {
- mame_printf_verbose("Direct3D: Unable to load bloom.fx\n");
- return 1;
- }
- if (bloom_name)
- osd_free(bloom_name);
-
- char downsample_cstr[1024];
- sprintf(downsample_cstr, "%s\\downsample.fx", fx_dir);
- TCHAR *downsample_name = tstring_from_utf8(downsample_cstr);
-
- result = (*d3dintf->device.create_effect)(d3d->device, downsample_name, &downsample_effect);
- if(result != D3D_OK)
- {
- mame_printf_verbose("Direct3D: Unable to load downsample.fx\n");
- return 1;
- }
- if (downsample_name)
- osd_free(downsample_name);
-
- char vector_cstr[1024];
- sprintf(vector_cstr, "%s\\vector.fx", fx_dir);
- TCHAR *vector_name = tstring_from_utf8(vector_cstr);
+ char bloom_cstr[1024];
+ sprintf(bloom_cstr, "%s\\bloom.fx", fx_dir);
+ TCHAR *bloom_name = tstring_from_utf8(bloom_cstr);
+
+ result = (*d3dintf->device.create_effect)(d3d->device, bloom_name, &bloom_effect);
+ if(result != D3D_OK)
+ {
+ mame_printf_verbose("Direct3D: Unable to load bloom.fx\n");
+ return 1;
+ }
+ if (bloom_name)
+ osd_free(bloom_name);
+
+ char downsample_cstr[1024];
+ sprintf(downsample_cstr, "%s\\downsample.fx", fx_dir);
+ TCHAR *downsample_name = tstring_from_utf8(downsample_cstr);
+
+ result = (*d3dintf->device.create_effect)(d3d->device, downsample_name, &downsample_effect);
+ if(result != D3D_OK)
+ {
+ mame_printf_verbose("Direct3D: Unable to load downsample.fx\n");
+ return 1;
+ }
+ if (downsample_name)
+ osd_free(downsample_name);
+
+ char vector_cstr[1024];
+ sprintf(vector_cstr, "%s\\vector.fx", fx_dir);
+ TCHAR *vector_name = tstring_from_utf8(vector_cstr);
result = (*d3dintf->device.create_effect)(d3d->device, vector_name, &vector_effect);
if(result != D3D_OK)
@@ -1351,7 +1351,7 @@ void hlsl_info::begin_frame()
d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
if (rt == NULL)
{
- return;
+ return;
}
HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]);
@@ -1368,42 +1368,42 @@ void hlsl_info::begin_frame()
//============================================================
void hlsl_info::blit(d3d_surface *dst, d3d_texture *src, d3d_surface *new_dst, D3DPRIMITIVETYPE prim_type,
- UINT32 prim_index, UINT32 prim_count, int dstw, int dsth)
+ UINT32 prim_index, UINT32 prim_count, int dstw, int dsth)
{
- d3d_info *d3d = (d3d_info *)window->drawdata;
+ d3d_info *d3d = (d3d_info *)window->drawdata;
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, dst);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, dst);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- curr_effect = effect;
+ curr_effect = effect;
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", src);
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", src);
- (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)dstw);
- (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)dsth);
- (*d3dintf->effect.set_float)(curr_effect, "PostPass", 1.0f);
- (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion);
- (*d3dintf->effect.set_float)(curr_effect, "Brighten", 0.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)dstw);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)dsth);
+ (*d3dintf->effect.set_float)(curr_effect, "PostPass", 1.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion);
+ (*d3dintf->effect.set_float)(curr_effect, "Brighten", 0.0f);
- unsigned int num_passes = 0;
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+ unsigned int num_passes = 0;
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, prim_type, prim_index, prim_count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, prim_type, prim_index, prim_count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
- (*d3dintf->effect.end)(curr_effect);
+ (*d3dintf->effect.end)(curr_effect);
- if (new_dst)
- {
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, new_dst);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- }
+ if (new_dst)
+ {
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, new_dst);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ }
}
@@ -1413,7 +1413,7 @@ void hlsl_info::blit(d3d_surface *dst, d3d_texture *src, d3d_surface *new_dst, D
//============================================================
void hlsl_info::blit(d3d_surface *dst, d3d_texture *src, d3d_surface *new_dst, D3DPRIMITIVETYPE prim_type,
- UINT32 prim_index, UINT32 prim_count)
+ UINT32 prim_index, UINT32 prim_count)
{
d3d_info *d3d = (d3d_info *)window->drawdata;
@@ -1430,10 +1430,10 @@ void hlsl_info::blit(d3d_surface *dst, d3d_texture *src, d3d_surface *new_dst, D
(*d3dintf->effect.set_texture)(curr_effect, "Diffuse", src);
- (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
- (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
- (*d3dintf->effect.set_float)(curr_effect, "ScreenWidth", (float)d3d->width);
- (*d3dintf->effect.set_float)(curr_effect, "ScreenHeight", (float)d3d->height);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
+ (*d3dintf->effect.set_float)(curr_effect, "ScreenWidth", (float)d3d->width);
+ (*d3dintf->effect.set_float)(curr_effect, "ScreenHeight", (float)d3d->height);
(*d3dintf->effect.set_float)(curr_effect, "PostPass", 1.0f);
(*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion);
(*d3dintf->effect.set_float)(curr_effect, "Brighten", 1.0f);
@@ -1475,22 +1475,22 @@ void hlsl_info::end_frame()
render_snapshot(snap_target);
}
- if (!lines_pending)
- return;
+ if (!lines_pending)
+ return;
- lines_pending = false;
- /*d3d_info *d3d = (d3d_info *)window->drawdata;
+ lines_pending = false;
+ /*d3d_info *d3d = (d3d_info *)window->drawdata;
- d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
- if (!rt)
- return;
+ d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
+ if (!rt)
+ return;
- blit(backbuffer, rt->texture[0], NULL, vecbuf_type, vecbuf_index, vecbuf_count);*/
+ blit(backbuffer, rt->texture[0], NULL, vecbuf_type, vecbuf_index, vecbuf_count);*/
/*d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
if (rt == NULL)
{
- return;
+ return;
}
blit(backbuffer, rt->texture[1], NULL, vecbuf_type, vecbuf_index, vecbuf_count);
@@ -1973,9 +1973,9 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
(*d3dintf->effect.end)(curr_effect);
- curr_effect = post_effect;
- (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
- (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
+ curr_effect = post_effect;
+ (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
/* Scanlines and shadow mask, at high res for AVI logging*/
if(avi_output_file != NULL)
@@ -2022,156 +2022,156 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
snap_rendered = true;
}
- /* Scanlines and shadow mask */
- curr_effect = post_effect;
+ /* Scanlines and shadow mask */
+ curr_effect = post_effect;
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]);
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]);
- //(*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)rt->target_width);
- //(*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)rt->target_height);
+ //(*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)rt->target_width);
+ //(*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)rt->target_height);
#if HLSL_VECTOR
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]);
#else
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
#endif
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
- (*d3dintf->effect.end)(curr_effect);
+ (*d3dintf->effect.end)(curr_effect);
#if HLSL_VECTOR
- /* Bloom */
- curr_effect = downsample_effect;
-
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[1]);
-
- int bloom_size = (rt->target_width < rt->target_height) ? rt->target_width : rt->target_height;
- int bloom_index = 0;
- int bloom_width = rt->target_width;
- int bloom_height = rt->target_height;
- for(; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
- {
- float source_size[2] = { bloom_width, bloom_height };
- float target_size[2] = { bloom_width >> 1, bloom_height >> 1 };
- (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
- (*d3dintf->effect.set_vector)(curr_effect, "SourceSize", 2, source_size);
-
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
-
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", (bloom_index == 0) ? rt->texture[1] : ct->bloom_texture[bloom_index - 1]);
-
- if (ct->bloom_target[bloom_index] == NULL)
- {
- (*d3dintf->effect.end)(curr_effect);
- break;
- }
-
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, ct->bloom_target[bloom_index]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 7:%d\n", (int)result, bloom_size);
- //result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
- //if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
-
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
-
- (*d3dintf->effect.end)(curr_effect);
-
- bloom_index++;
- bloom_width >>= 1;
- bloom_height >>= 1;
- }
-
- /* Bloom composite pass*/
- curr_effect = bloom_effect;
-
- float target_size[2] = { rt->target_width, rt->target_height };
- (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
-
- (*d3dintf->effect.set_texture)(curr_effect, "DiffuseA", rt->texture[1]);
- (*d3dintf->effect.set_float)(curr_effect, "DiffuseScaleA", 1.0f);
-
- char name[9] = "Diffuse*";
- char scale[14] = "DiffuseScale*";
- for(int index = 1; index < bloom_index; index++)
- {
- name[7] = 'A' + index;
- scale[12] = 'A' + index;
- (*d3dintf->effect.set_texture)(curr_effect, name, ct->bloom_texture[index - 1]);
- (*d3dintf->effect.set_float)(curr_effect, scale, 1.0f);
- }
- for(int index = bloom_index; index < 11; index++)
- {
- name[7] = 'A' + index;
- scale[12] = 'A' + index;
- (*d3dintf->effect.set_texture)(curr_effect, name, black_texture);
- (*d3dintf->effect.set_float)(curr_effect, scale, 0.0f);
- }
-
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
-
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[2]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 8\n", (int)result);
-
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
-
- (*d3dintf->effect.end)(curr_effect);
-
- curr_effect = effect;
-
- //(*d3dintf->effect.set_float)(curr_effect, "PostPass", 1.0f);
-
- //blit(backbuffer, ct->last_texture, NULL, poly->type, vertnum, poly->count, d3d->width, d3d->height);
-
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 9\n", (int)result);
-
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[2]);
-
- (*d3dintf->effect.set_float)(curr_effect, "RawWidth", poly->texture != NULL ? (float)poly->texture->rawwidth : 8.0f);
- (*d3dintf->effect.set_float)(curr_effect, "RawHeight", poly->texture != NULL ? (float)poly->texture->rawheight : 8.0f);
- (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", poly->texture != NULL ? (1.0f / (poly->texture->ustop - poly->texture->ustart)) : 0.0f);
- (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", poly->texture != NULL ? (1.0f / (poly->texture->vstop - poly->texture->vstart)) : 0.0f);
- (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
- (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
- (*d3dintf->effect.set_float)(curr_effect, "PostPass", 0.0f);
- (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion);
-
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
-
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
-
- (*d3dintf->effect.end)(curr_effect);
+ /* Bloom */
+ curr_effect = downsample_effect;
+
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[1]);
+
+ int bloom_size = (rt->target_width < rt->target_height) ? rt->target_width : rt->target_height;
+ int bloom_index = 0;
+ int bloom_width = rt->target_width;
+ int bloom_height = rt->target_height;
+ for(; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
+ {
+ float source_size[2] = { bloom_width, bloom_height };
+ float target_size[2] = { bloom_width >> 1, bloom_height >> 1 };
+ (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
+ (*d3dintf->effect.set_vector)(curr_effect, "SourceSize", 2, source_size);
+
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", (bloom_index == 0) ? rt->texture[1] : ct->bloom_texture[bloom_index - 1]);
+
+ if (ct->bloom_target[bloom_index] == NULL)
+ {
+ (*d3dintf->effect.end)(curr_effect);
+ break;
+ }
+
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, ct->bloom_target[bloom_index]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 7:%d\n", (int)result, bloom_size);
+ //result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
+ //if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
+
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
+
+ (*d3dintf->effect.end)(curr_effect);
+
+ bloom_index++;
+ bloom_width >>= 1;
+ bloom_height >>= 1;
+ }
+
+ /* Bloom composite pass*/
+ curr_effect = bloom_effect;
+
+ float target_size[2] = { rt->target_width, rt->target_height };
+ (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
+
+ (*d3dintf->effect.set_texture)(curr_effect, "DiffuseA", rt->texture[1]);
+ (*d3dintf->effect.set_float)(curr_effect, "DiffuseScaleA", 1.0f);
+
+ char name[9] = "Diffuse*";
+ char scale[14] = "DiffuseScale*";
+ for(int index = 1; index < bloom_index; index++)
+ {
+ name[7] = 'A' + index;
+ scale[12] = 'A' + index;
+ (*d3dintf->effect.set_texture)(curr_effect, name, ct->bloom_texture[index - 1]);
+ (*d3dintf->effect.set_float)(curr_effect, scale, 1.0f);
+ }
+ for(int index = bloom_index; index < 11; index++)
+ {
+ name[7] = 'A' + index;
+ scale[12] = 'A' + index;
+ (*d3dintf->effect.set_texture)(curr_effect, name, black_texture);
+ (*d3dintf->effect.set_float)(curr_effect, scale, 0.0f);
+ }
+
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[2]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 8\n", (int)result);
+
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ result = (*d3dintf->device.draw_primitive)(d3d->device, D3DPT_TRIANGLELIST, 0, 2);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
+
+ (*d3dintf->effect.end)(curr_effect);
+
+ curr_effect = effect;
+
+ //(*d3dintf->effect.set_float)(curr_effect, "PostPass", 1.0f);
+
+ //blit(backbuffer, ct->last_texture, NULL, poly->type, vertnum, poly->count, d3d->width, d3d->height);
+
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 9\n", (int)result);
+
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[2]);
+
+ (*d3dintf->effect.set_float)(curr_effect, "RawWidth", poly->texture != NULL ? (float)poly->texture->rawwidth : 8.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "RawHeight", poly->texture != NULL ? (float)poly->texture->rawheight : 8.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "WidthRatio", poly->texture != NULL ? (1.0f / (poly->texture->ustop - poly->texture->ustart)) : 0.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", poly->texture != NULL ? (1.0f / (poly->texture->vstop - poly->texture->vstart)) : 0.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
+ (*d3dintf->effect.set_float)(curr_effect, "PostPass", 0.0f);
+ (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->pincushion);
+
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
+
+ (*d3dintf->effect.end)(curr_effect);
#endif
poly->texture->cur_frame++;
@@ -2180,150 +2180,150 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
options->params_dirty = false;
}
#if HLSL_VECTOR
- else if(PRIMFLAG_GET_VECTOR(poly->flags) && vector_enable)
- {
- d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
- if (rt == NULL)
- {
- return;
- }
-
- lines_pending = true;
-
- curr_effect = vector_effect;
- //curr_effect = effect;
-
- if(options->params_dirty)
- {
- (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
- (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
- }
-
- float time_params[2] = { poly->line_time, options->vector_time_scale };
- float length_params[3] = { poly->line_length, options->vector_length_scale, options->vector_length_ratio };
- (*d3dintf->effect.set_vector)(curr_effect, "TimeParams", 2, time_params);
- (*d3dintf->effect.set_vector)(curr_effect, "LengthParams", 3, length_params);
-
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
-
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
-
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
-
- (*d3dintf->effect.end)(curr_effect);
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
-
- curr_effect = effect;
-
- (*d3dintf->effect.set_float)(curr_effect, "FixedAlpha", 1.0f);
- }
- else if (PRIMFLAG_GET_VECTORBUF(poly->flags) && vector_enable)
- {
- //if (!lines_pending)
- //return;
- //lines_pending = false;
-
- d3d_info *d3d = (d3d_info *)window->drawdata;
-
- d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
- if (rt == NULL)
- {
- return;
- }
-
- /* Bloom */
- curr_effect = downsample_effect;
-
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]);
-
- int bloom_size = (d3d->width < d3d->height) ? d3d->width : d3d->height;
- int bloom_index = 0;
- int bloom_width = d3d->width;
- int bloom_height = d3d->height;
- for(; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
- {
- float source_size[2] = { bloom_width, bloom_height };
- float target_size[2] = { bloom_width >> 1, bloom_height >> 1 };
- (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
- (*d3dintf->effect.set_vector)(curr_effect, "SourceSize", 2, source_size);
-
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
-
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", (bloom_index == 0) ? rt->texture[0] : rt->bloom_texture[bloom_index - 1]);
-
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->bloom_target[bloom_index]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 6\n", (int)result);
- //result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
- //if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
-
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
-
- (*d3dintf->effect.end)(curr_effect);
-
- bloom_index++;
- bloom_width >>= 1;
- bloom_height >>= 1;
- }
-
- /* Bloom composite pass*/
- curr_effect = bloom_effect;
-
- float target_size[2] = { d3d->width, d3d->height };
- (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
-
- (*d3dintf->effect.set_texture)(curr_effect, "DiffuseA", rt->texture[0]);
- (*d3dintf->effect.set_float)(curr_effect, "DiffuseScaleA", 1.0f);
-
- char name[9] = "Diffuse*";
- char scale[14] = "DiffuseScale*";
- for(int index = 1; index < bloom_index; index++)
- {
- name[7] = 'A' + index;
- scale[12] = 'A' + index;
- (*d3dintf->effect.set_texture)(curr_effect, name, rt->bloom_texture[index - 1]);
- (*d3dintf->effect.set_float)(curr_effect, scale, 1.0f);
- }
- for(int index = bloom_index; index < 11; index++)
- {
- name[7] = 'A' + index;
- scale[12] = 'A' + index;
- (*d3dintf->effect.set_texture)(curr_effect, name, black_texture);
- (*d3dintf->effect.set_float)(curr_effect, scale, 0.0f);
- }
-
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
-
- HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 6\n", (int)result);
- //result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
- //if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
-
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
-
- (*d3dintf->effect.end)(curr_effect);
+ else if(PRIMFLAG_GET_VECTOR(poly->flags) && vector_enable)
+ {
+ d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
+ if (rt == NULL)
+ {
+ return;
+ }
+
+ lines_pending = true;
+
+ curr_effect = vector_effect;
+ //curr_effect = effect;
+
+ if(options->params_dirty)
+ {
+ (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
+ }
+
+ float time_params[2] = { poly->line_time, options->vector_time_scale };
+ float length_params[3] = { poly->line_length, options->vector_length_scale, options->vector_length_ratio };
+ (*d3dintf->effect.set_vector)(curr_effect, "TimeParams", 2, time_params);
+ (*d3dintf->effect.set_vector)(curr_effect, "LengthParams", 3, length_params);
+
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
+
+ (*d3dintf->effect.end)(curr_effect);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+
+ curr_effect = effect;
+
+ (*d3dintf->effect.set_float)(curr_effect, "FixedAlpha", 1.0f);
+ }
+ else if (PRIMFLAG_GET_VECTORBUF(poly->flags) && vector_enable)
+ {
+ //if (!lines_pending)
+ //return;
+ //lines_pending = false;
+
+ d3d_info *d3d = (d3d_info *)window->drawdata;
+
+ d3d_render_target *rt = find_render_target(d3d->width, d3d->height, 0, 0);
+ if (rt == NULL)
+ {
+ return;
+ }
+
+ /* Bloom */
+ curr_effect = downsample_effect;
+
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]);
+
+ int bloom_size = (d3d->width < d3d->height) ? d3d->width : d3d->height;
+ int bloom_index = 0;
+ int bloom_width = d3d->width;
+ int bloom_height = d3d->height;
+ for(; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
+ {
+ float source_size[2] = { bloom_width, bloom_height };
+ float target_size[2] = { bloom_width >> 1, bloom_height >> 1 };
+ (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
+ (*d3dintf->effect.set_vector)(curr_effect, "SourceSize", 2, source_size);
+
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", (bloom_index == 0) ? rt->texture[0] : rt->bloom_texture[bloom_index - 1]);
+
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->bloom_target[bloom_index]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 6\n", (int)result);
+ //result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
+ //if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
+
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
+
+ (*d3dintf->effect.end)(curr_effect);
+
+ bloom_index++;
+ bloom_width >>= 1;
+ bloom_height >>= 1;
+ }
+
+ /* Bloom composite pass*/
+ curr_effect = bloom_effect;
+
+ float target_size[2] = { d3d->width, d3d->height };
+ (*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
+
+ (*d3dintf->effect.set_texture)(curr_effect, "DiffuseA", rt->texture[0]);
+ (*d3dintf->effect.set_float)(curr_effect, "DiffuseScaleA", 1.0f);
+
+ char name[9] = "Diffuse*";
+ char scale[14] = "DiffuseScale*";
+ for(int index = 1; index < bloom_index; index++)
+ {
+ name[7] = 'A' + index;
+ scale[12] = 'A' + index;
+ (*d3dintf->effect.set_texture)(curr_effect, name, rt->bloom_texture[index - 1]);
+ (*d3dintf->effect.set_float)(curr_effect, scale, 1.0f);
+ }
+ for(int index = bloom_index; index < 11; index++)
+ {
+ name[7] = 'A' + index;
+ scale[12] = 'A' + index;
+ (*d3dintf->effect.set_texture)(curr_effect, name, black_texture);
+ (*d3dintf->effect.set_float)(curr_effect, scale, 0.0f);
+ }
+
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+
+ HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 6\n", (int)result);
+ //result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
+ //if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
+
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
+
+ (*d3dintf->effect.end)(curr_effect);
/* Phosphor */
curr_effect = phosphor_effect;
@@ -2359,51 +2359,51 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
(*d3dintf->effect.end)(curr_effect);
- //curr_effect = effect;
+ //curr_effect = effect;
- //blit(backbuffer, rt->bloom_texture[5], NULL, poly->type, vertnum, poly->count);
- //blit(rt->target[2], rt->texture[0], NULL, poly->type, vertnum, poly->count);
- blit(backbuffer, rt->texture[0], NULL, poly->type, vertnum, poly->count);
- //blit(backbuffer, rt->texture[0], NULL, poly->type, vertnum, poly->count);
+ //blit(backbuffer, rt->bloom_texture[5], NULL, poly->type, vertnum, poly->count);
+ //blit(rt->target[2], rt->texture[0], NULL, poly->type, vertnum, poly->count);
+ blit(backbuffer, rt->texture[0], NULL, poly->type, vertnum, poly->count);
+ //blit(backbuffer, rt->texture[0], NULL, poly->type, vertnum, poly->count);
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- /*curr_effect = post_effect;
+ /*curr_effect = post_effect;
- (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]);
+ (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]);
- (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
- (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width);
+ (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height);
(*d3dintf->effect.set_float)(curr_effect, "RawWidth", (float)poly->texture->rawwidth);
(*d3dintf->effect.set_float)(curr_effect, "RawHeight", (float)poly->texture->rawheight);
(*d3dintf->effect.set_float)(curr_effect, "WidthRatio", 1.0f / (poly->texture->ustop - poly->texture->ustart));
(*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart));
- result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
+ result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
- (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
+ (*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
- for (UINT pass = 0; pass < num_passes; pass++)
- {
- (*d3dintf->effect.begin_pass)(curr_effect, pass);
- // add the primitives
- result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
- if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
- (*d3dintf->effect.end_pass)(curr_effect);
- }
+ for (UINT pass = 0; pass < num_passes; pass++)
+ {
+ (*d3dintf->effect.begin_pass)(curr_effect, pass);
+ // add the primitives
+ result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
+ if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
+ (*d3dintf->effect.end_pass)(curr_effect);
+ }
- (*d3dintf->effect.end)(curr_effect);*/
+ (*d3dintf->effect.end)(curr_effect);*/
- vecbuf_type = poly->type;
- vecbuf_index = vertnum;
- vecbuf_count = poly->count;
- }
+ vecbuf_type = poly->type;
+ vecbuf_index = vertnum;
+ vecbuf_count = poly->count;
+ }
#endif
else
{
@@ -2733,10 +2733,10 @@ void hlsl_info::delete_resources(bool reset)
file.printf("yiq_q %f\n", options->yiq_q);
file.printf("yiq_scan_time %f\n", options->yiq_scan_time);
file.printf("yiq_phase_count %d\n", options->yiq_phase_count);
- file.printf("vector_time_scale %f\n", options->vector_time_scale);
- file.printf("vector_time_period %f\n", options->vector_time_period);
- file.printf("vector_length_scale %f\n", options->vector_length_scale);
- file.printf("vector_length_ratio %f\n", options->vector_length_ratio);
+ file.printf("vector_time_scale %f\n", options->vector_time_scale);
+ file.printf("vector_time_period %f\n", options->vector_time_period);
+ file.printf("vector_length_scale %f\n", options->vector_length_scale);
+ file.printf("vector_length_ratio %f\n", options->vector_length_ratio);
}
while (targethead != NULL)
@@ -2745,16 +2745,16 @@ void hlsl_info::delete_resources(bool reset)
}
#if HLSL_VECTOR
- if (downsample_effect != NULL)
- {
- (*d3dintf->effect.release)(downsample_effect);
- downsample_effect = NULL;
- }
- if (bloom_effect != NULL)
- {
- (*d3dintf->effect.release)(bloom_effect);
- bloom_effect = NULL;
- }
+ if (downsample_effect != NULL)
+ {
+ (*d3dintf->effect.release)(downsample_effect);
+ downsample_effect = NULL;
+ }
+ if (bloom_effect != NULL)
+ {
+ (*d3dintf->effect.release)(bloom_effect);
+ bloom_effect = NULL;
+ }
#endif
if (effect != NULL)
{
@@ -2807,11 +2807,11 @@ void hlsl_info::delete_resources(bool reset)
yiq_decode_effect = NULL;
}
- if (black_texture != NULL)
- {
- (*d3dintf->texture.release)(black_texture);
- black_texture = NULL;
- }
+ if (black_texture != NULL)
+ {
+ (*d3dintf->texture.release)(black_texture);
+ black_texture = NULL;
+ }
if (avi_copy_texture != NULL)
{