summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/windows/d3dcomm.h13
-rw-r--r--src/osd/windows/d3dhlsl.c46
-rw-r--r--src/osd/windows/drawd3d.c38
3 files changed, 63 insertions, 34 deletions
diff --git a/src/osd/windows/d3dcomm.h b/src/osd/windows/d3dcomm.h
index 5c822e7e013..f2e8270099c 100644
--- a/src/osd/windows/d3dcomm.h
+++ b/src/osd/windows/d3dcomm.h
@@ -215,10 +215,12 @@ public:
poly_info() { }
void init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
- UINT32 flags, d3d::texture_info *texture, UINT32 modmode);
+ UINT32 flags, d3d::texture_info *texture, UINT32 modmode,
+ float prim_width, float prim_height);
void init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
UINT32 flags, d3d::texture_info *texture, UINT32 modmode,
- float line_time, float line_length);
+ float line_time, float line_length,
+ float prim_width, float prim_height);
D3DPRIMITIVETYPE get_type() { return m_type; }
UINT32 get_count() { return m_count; }
@@ -231,7 +233,11 @@ public:
float get_line_time() { return m_line_time; }
float get_line_length() { return m_line_length; }
+ float get_prim_width() { return m_prim_width; }
+ float get_prim_height() { return m_prim_height; }
+
private:
+
D3DPRIMITIVETYPE m_type; // type of primitive
UINT32 m_count; // total number of primitives
UINT32 m_numverts; // total number of vertices
@@ -242,6 +248,9 @@ private:
float m_line_time; // used by vectors
float m_line_length; // used by vectors
+
+ float m_prim_width; // used by quads
+ float m_prim_height; // used by quads
};
}; // d3d
diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c
index 1c584699f21..87522ec2808 100644
--- a/src/osd/windows/d3dhlsl.c
+++ b/src/osd/windows/d3dhlsl.c
@@ -2077,16 +2077,23 @@ void shaders::render_quad(poly_info *poly, int vertnum)
(*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->render_texture[2]);
(*d3dintf->effect.set_float)(curr_effect, "BloomRescale", options->raster_bloom_scale);
- int bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height();
+ float bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height();
int bloom_index = 0;
- int bloom_width = d3d->get_width();
- int bloom_height = d3d->get_height();
- for(; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
+ float bloom_width = rt->target_width;
+ float bloom_height = rt->target_height;
+ float prim_width = poly->get_prim_width();
+ float prim_height = poly->get_prim_height();
+ float prim_ratio[2] = { prim_width / bloom_width, prim_height / bloom_height };
+ float screen_size[2] = { d3d->get_width(), d3d->get_height() };
+ //float target_size[2] = { bloom_width * 0.5f, bloom_height * 0.5f };
+ (*d3dintf->effect.set_vector)(curr_effect, "ScreenSize", 2, screen_size);
+ for(; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
{
- float source_size[2] = { bloom_width, bloom_height };
- float target_size[2] = { bloom_width >> 1, bloom_height >> 1 };
+ float target_size[2] = { bloom_width, bloom_height };
+ float source_size[2] = { bloom_width * 0.5f, bloom_height * 0.5f };
(*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
(*d3dintf->effect.set_vector)(curr_effect, "SourceSize", 2, source_size);
+ (*d3dintf->effect.set_vector)(curr_effect, "PrimRatio", 2, prim_ratio);
(*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
@@ -2110,8 +2117,8 @@ void shaders::render_quad(poly_info *poly, int vertnum)
(*d3dintf->effect.end)(curr_effect);
bloom_index++;
- bloom_width >>= 1;
- bloom_height >>= 1;
+ bloom_width *= 0.5f;
+ bloom_height *= 0.5f;
}
// Bloom composite pass
@@ -2242,16 +2249,23 @@ void shaders::render_quad(poly_info *poly, int vertnum)
(*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->render_texture[0]);
(*d3dintf->effect.set_float)(curr_effect, "BloomRescale", options->vector_bloom_scale);
- int bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height();
+ float bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height();
int bloom_index = 0;
- int bloom_width = d3d->get_width();
- int bloom_height = d3d->get_height();
- for(; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
+ float bloom_width = rt->target_width;
+ float bloom_height = rt->target_height;
+ float prim_width = poly->get_prim_width();
+ float prim_height = poly->get_prim_height();
+ float prim_ratio[2] = { prim_width / bloom_width, prim_height / bloom_height };
+ float screen_size[2] = { d3d->get_width(), d3d->get_height() };
+ //float target_size[2] = { bloom_width * 0.5f, bloom_height * 0.5f };
+ (*d3dintf->effect.set_vector)(curr_effect, "ScreenSize", 2, screen_size);
+ for(; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
{
- float source_size[2] = { bloom_width, bloom_height };
- float target_size[2] = { bloom_width >> 1, bloom_height >> 1 };
+ float target_size[2] = { bloom_width, bloom_height };
+ float source_size[2] = { bloom_width * 0.5f, bloom_height * 0.5f };
(*d3dintf->effect.set_vector)(curr_effect, "TargetSize", 2, target_size);
(*d3dintf->effect.set_vector)(curr_effect, "SourceSize", 2, source_size);
+ (*d3dintf->effect.set_vector)(curr_effect, "PrimRatio", 2, prim_ratio);
(*d3dintf->effect.begin)(curr_effect, &num_passes, 0);
@@ -2274,8 +2288,8 @@ void shaders::render_quad(poly_info *poly, int vertnum)
(*d3dintf->effect.end)(curr_effect);
bloom_index++;
- bloom_width >>= 1;
- bloom_height >>= 1;
+ bloom_width *= 0.5f;
+ bloom_height *= 0.5f;
}
// Bloom composite pass
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c
index eaedf7ed904..8e58163f6a2 100644
--- a/src/osd/windows/drawd3d.c
+++ b/src/osd/windows/drawd3d.c
@@ -1577,7 +1577,7 @@ void renderer::batch_vectors()
// now add a polygon entry
m_poly[m_numpolys].init(D3DPT_TRIANGLELIST, m_line_count * (options.antialias() ? 8 : 2), vector_size * m_line_count, cached_flags,
- m_texture_manager->get_vector_texture(), D3DTOP_MODULATE, 0.0f, 1.0f);
+ m_texture_manager->get_vector_texture(), D3DTOP_MODULATE, 0.0f, 1.0f, 0.0f, 0.0f);
m_numpolys++;
start_index += (int)((float)line_index * period);
@@ -1740,7 +1740,7 @@ void renderer::draw_line(const render_primitive *prim)
// now add a polygon entry
m_poly[m_numpolys].init(D3DPT_TRIANGLESTRIP, 2, 4, prim->flags, get_vector_texture(),
- D3DTOP_MODULATE, 0.0f, 1.0f);
+ D3DTOP_MODULATE, 0.0f, 1.0f, 0.0f, 0.0f);
m_numpolys++;
}
}
@@ -1774,6 +1774,8 @@ void renderer::draw_quad(const render_primitive *prim)
vertex[2].y = prim->bounds.y1 - 0.5f;
vertex[3].x = prim->bounds.x1 - 0.5f;
vertex[3].y = prim->bounds.y1 - 0.5f;
+ float width = prim->bounds.x1 - prim->bounds.x0;
+ float height = prim->bounds.y1 - prim->bounds.y0;
// set the texture coordinates
if(texture != NULL)
@@ -1828,21 +1830,23 @@ void renderer::draw_quad(const render_primitive *prim)
}
// now add a polygon entry
- m_poly[m_numpolys].init(D3DPT_TRIANGLESTRIP, 2, 4, prim->flags, texture, modmode);
+ m_poly[m_numpolys].init(D3DPT_TRIANGLESTRIP, 2, 4, prim->flags, texture, modmode, width, height);
m_numpolys++;
}
void poly_info::init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
UINT32 flags, texture_info *texture, UINT32 modmode,
- float line_time, float line_length)
+ float line_time, float line_length,
+ float prim_width, float prim_height)
{
- init(type, count, numverts, flags, texture, modmode);
+ init(type, count, numverts, flags, texture, modmode, prim_width, prim_height);
m_line_time = line_time;
m_line_length = line_length;
}
void poly_info::init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
- UINT32 flags, texture_info *texture, UINT32 modmode)
+ UINT32 flags, texture_info *texture, UINT32 modmode,
+ float prim_width, float prim_height)
{
m_type = type;
m_count = count;
@@ -1850,6 +1854,8 @@ void poly_info::init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts,
m_flags = flags;
m_texture = texture;
m_modmode = modmode;
+ m_prim_width = prim_width;
+ m_prim_height = prim_height;
}
//============================================================
@@ -2851,10 +2857,10 @@ cache_target::~cache_target()
bool cache_target::init(renderer *d3d, base *d3dintf, int width, int height, int prescale_x, int prescale_y)
{
- int bloom_size = (width * prescale_x < height * prescale_y) ? width * prescale_x : height * prescale_y;
+ int bloom_size = (width < height) ? width : height;
int bloom_index = 0;
- int bloom_width = width * prescale_x;
- int bloom_height = height * prescale_y;
+ int bloom_width = width;
+ int bloom_height = height;
for (; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
{
bloom_width >>= 1;
@@ -2980,15 +2986,15 @@ bool render_target::init(renderer *d3d, base *d3dintf, int width, int height, in
return false;
(*d3dintf->texture.get_surface_level)(prescaletexture, 0, &prescaletarget);
- int bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height();
+ float bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height();
int bloom_index = 0;
- int bloom_width = d3d->get_width();
- int bloom_height = d3d->get_height();
- for (; bloom_size >= 2 && bloom_index < 11; bloom_size >>= 1)
+ float bloom_width = d3d->get_width();
+ float bloom_height = d3d->get_height();
+ for (; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f)
{
- bloom_width >>= 1;
- bloom_height >>= 1;
- result = (*d3dintf->device.create_texture)(d3d->get_device(), bloom_width, bloom_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &bloom_texture[bloom_index]);
+ bloom_width *= 0.5f;
+ bloom_height *= 0.5f;
+ 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]);