diff options
Diffstat (limited to 'src/osd/modules/render')
-rw-r--r-- | src/osd/modules/render/d3d/d3dcomm.h | 6 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.cpp | 41 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.h | 2 | ||||
-rw-r--r-- | src/osd/modules/render/drawd3d.cpp | 30 |
4 files changed, 39 insertions, 40 deletions
diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index 947dbba2362..9c444fd9cf0 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -292,8 +292,12 @@ public: d3d_render_target *next; d3d_render_target *prev; - surface *bloom_target[11]; + surface *bloom_surface[11]; texture *bloom_texture[11]; + + float bloom_dims[11][2]; + + int bloom_count; }; #endif diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index d862fdcb6a8..5fc5e9a4899 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), bloom_count(0), + d3dintf(NULL), machine(NULL), d3d(NULL), num_screens(0), curr_screen(0), curr_frame(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), @@ -1444,32 +1444,19 @@ int shaders::downsample_pass(d3d_render_target *rt, int source_index, poly_info curr_effect = downsample_effect; curr_effect->update_uniforms(); - int bloom_index = 0; - 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) + for (int bloom_index = 0; bloom_index < rt->bloom_count; bloom_index++) { - bloom_dims[bloom_index][0] = (float)(int)bloom_width; - bloom_dims[bloom_index][1] = (float)(int)bloom_height; - - curr_effect->set_vector("TargetDims", 2, bloom_dims[bloom_index]); + curr_effect->set_vector("TargetDims", 2, rt->bloom_dims[bloom_index]); + curr_effect->set_int("BloomLevel", bloom_index + 1); curr_effect->set_texture("DiffuseTexture", bloom_index == 0 ? 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; - bloom_height *= 0.5f; - - bloom_index++; + // blit(rt->bloom_surface[bloom_index], true, D3DPT_TRIANGLELIST, 0, 2); + blit(rt->bloom_surface[bloom_index], true, poly->get_type(), vertnum, poly->get_count()); } - bloom_count = bloom_index; - return next_index; } @@ -1514,12 +1501,12 @@ int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly curr_effect->set_vector("Level78Weight", 2, weight78); curr_effect->set_vector("Level9AWeight", 2, weight9A); - curr_effect->set_vector("Level0Size", 2, bloom_dims[0]); - curr_effect->set_vector("Level12Size", 4, bloom_dims[1]); - curr_effect->set_vector("Level34Size", 4, bloom_dims[3]); - curr_effect->set_vector("Level56Size", 4, bloom_dims[5]); - curr_effect->set_vector("Level78Size", 4, bloom_dims[7]); - curr_effect->set_vector("Level9ASize", 4, bloom_dims[9]); + curr_effect->set_vector("Level0Size", 2, rt->bloom_dims[0]); + curr_effect->set_vector("Level12Size", 4, rt->bloom_dims[1]); + curr_effect->set_vector("Level34Size", 4, rt->bloom_dims[3]); + curr_effect->set_vector("Level56Size", 4, rt->bloom_dims[5]); + curr_effect->set_vector("Level78Size", 4, rt->bloom_dims[7]); + curr_effect->set_vector("Level9ASize", 4, rt->bloom_dims[9]); curr_effect->set_int("BloomBlendMode", options->bloom_blend_mode); curr_effect->set_float("BloomScale", options->bloom_scale); @@ -1528,12 +1515,12 @@ int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly curr_effect->set_texture("DiffuseA", rt->target_texture[next_index]); char name[9] = "Diffuse*"; - for (int index = 1; index < bloom_count; index++) + for (int index = 1; index < rt->bloom_count; index++) { name[7] = 'A' + index; curr_effect->set_texture(name, rt->bloom_texture[index - 1]); } - for (int index = bloom_count; index < 11; index++) + for (int index = rt->bloom_count; index < 11; index++) { name[7] = 'A' + index; curr_effect->set_texture(name, black_texture); diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h index 4f3a072cf41..5d59aabc6e2 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.h +++ b/src/osd/modules/render/d3d/d3dhlsl.h @@ -380,8 +380,6 @@ private: int curr_screen; // current screen for render target operations int curr_frame; // current frame (0/1) of a screen for render target operations int lastidx; // index of the last-encountered target - float bloom_dims[11][2]; // bloom texture dimensions - int bloom_count; // count of used bloom textures bitmap_argb32 shadow_bitmap; // shadow mask bitmap for post-processing shader texture_info * shadow_texture; // shadow mask texture for post-processing shader hlsl_options * options; // current options diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index 144de46dfd6..edce723c475 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -2770,10 +2770,10 @@ d3d_render_target::~d3d_render_target() (*d3dintf->texture.release)(bloom_texture[index]); bloom_texture[index] = nullptr; } - if (bloom_target[index] != nullptr) + if (bloom_surface[index] != nullptr) { - (*d3dintf->surface.release)(bloom_target[index]); - bloom_target[index] = nullptr; + (*d3dintf->surface.release)(bloom_surface[index]); + bloom_surface[index] = nullptr; } } @@ -2836,23 +2836,33 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int width, i (*d3dintf->texture.get_surface_level)(target_texture[index], 0, &target_surface[index]); } - int bloom_index = 0; - float bloom_width = target_width; - float bloom_height = target_height; + bool vector_screen = + d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; + + // larger blur width for vector screens than raster screens + float scale_factor = vector_screen ? 0.5f : 0.75f; + + float bloom_width = (float)width; + float bloom_height = (float)height; float bloom_size = bloom_width < bloom_height ? bloom_width : bloom_height; - for (; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f) + for (int bloom_index = 0; bloom_index < 11 && bloom_size >= 2.0f; bloom_size *= scale_factor) { - bloom_width *= 0.5f; - bloom_height *= 0.5f; + this->bloom_dims[bloom_index][0] = (int)bloom_width; + this->bloom_dims[bloom_index][1] = (int)bloom_height; result = (*d3dintf->device.create_texture)(d3d->get_device(), (int)bloom_width, (int)bloom_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &bloom_texture[bloom_index]); if (result != D3D_OK) { return false; } - (*d3dintf->texture.get_surface_level)(bloom_texture[bloom_index], 0, &bloom_target[bloom_index]); + (*d3dintf->texture.get_surface_level)(bloom_texture[bloom_index], 0, &bloom_surface[bloom_index]); + + bloom_width *= scale_factor; + bloom_height *= scale_factor; bloom_index++; + + this->bloom_count = bloom_index; } return true; |