summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/osd/modules/render/d3d/d3dcomm.h3
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.c39
-rw-r--r--src/osd/modules/render/drawd3d.c14
3 files changed, 37 insertions, 19 deletions
diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h
index 399df12ad00..8b53d18d0f1 100644
--- a/src/osd/modules/render/d3d/d3dcomm.h
+++ b/src/osd/modules/render/d3d/d3dcomm.h
@@ -146,10 +146,11 @@ public:
vec2f & get_uvstop() { return m_stop; }
vec2f & get_rawdims() { return m_rawdims; }
+ static void compute_size_subroutine(texture_manager* texture_manager, int texwidth, int texheight, int* p_width, int* p_height);
+
private:
void prescale();
void compute_size(int texwidth, int texheight);
- void compute_size_subroutine(int texwidth, int texheight, int* p_width, int* p_height);
texture_manager * m_texture_manager; // texture manager pointer
diff --git a/src/osd/modules/render/d3d/d3dhlsl.c b/src/osd/modules/render/d3d/d3dhlsl.c
index ded675d2b1d..1813dcc111a 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.c
+++ b/src/osd/modules/render/d3d/d3dhlsl.c
@@ -1462,6 +1462,24 @@ int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int
curr_effect->set_bool("RotationSwapXY", rotation_swap_xy);
curr_effect->set_bool("PrepareBloom", prepare_bloom);
+ if (prepare_vector)
+ {
+ int source_width = d3d->get_width();
+ int source_height = d3d->get_height();
+ int target_width = 0;
+ int target_height = 0;
+
+ texture_info::compute_size_subroutine(d3d->get_texture_manager(), source_width, source_height, &target_width, &target_height);
+
+ // todo: fix fullscreen
+ float source_dims[2] = { (float)target_width, (float)source_height };
+ float source_rect[2] = { 1.0f, 1.0f };
+
+ curr_effect->set_bool("PrepareVector", prepare_vector);
+ curr_effect->set_vector("SourceDims", 2, source_dims);
+ curr_effect->set_vector("SourceRect", 2, source_rect);
+ }
+
d3d->set_wrap(D3DTADDRESS_MIRROR);
next_index = rt->next_index(next_index);
@@ -1696,21 +1714,20 @@ void shaders::render_quad(poly_info *poly, int vertnum)
next_index = rt->next_index(next_index);
blit(rt->prescale_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
-
- next_index = phosphor_pass(rt, ct, next_index, poly, vertnum);
-
- curr_effect = default_effect;
- curr_effect->update_uniforms();
- curr_effect->set_texture("Diffuse", rt->prescale_texture[next_index]);
- curr_effect->set_bool("PostPass", true);
- curr_effect->set_float("Brighten", 1.0f);
+ next_index = phosphor_pass(rt, ct, next_index, poly, vertnum);
- next_index = rt->next_index(next_index);
- blit(rt->native_target[next_index], true, poly->get_type(), vertnum, poly->get_count());
-
+ // create bloom textures
+ int phosphor_index = next_index;
+ next_index = post_pass(rt, next_index, poly, vertnum, true);
next_index = downsample_pass(rt, next_index, poly, vertnum);
+
+ // apply bloom textures
+ next_index = phosphor_index;
+ next_index = post_pass(rt, next_index, poly, vertnum, false);
next_index = bloom_pass(rt, next_index, poly, vertnum);
+
+ // render on screen
next_index = screen_pass(rt, next_index, poly, vertnum);
HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, backbuffer);
diff --git a/src/osd/modules/render/drawd3d.c b/src/osd/modules/render/drawd3d.c
index 33c0b1aff97..39fbac323eb 100644
--- a/src/osd/modules/render/drawd3d.c
+++ b/src/osd/modules/render/drawd3d.c
@@ -2074,13 +2074,13 @@ error:
// texture_info::compute_size_subroutine
//============================================================
-void texture_info::compute_size_subroutine(int texwidth, int texheight, int* p_width, int* p_height)
+void texture_info::compute_size_subroutine(texture_manager* texture_manager, int texwidth, int texheight, int* p_width, int* p_height)
{
int finalheight = texheight;
int finalwidth = texwidth;
// round width/height up to nearest power of 2 if we need to
- if (!(m_texture_manager->get_texture_caps() & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))
+ if (!(texture_manager->get_texture_caps() & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))
{
// first the width
if (finalwidth & (finalwidth - 1))
@@ -2104,7 +2104,7 @@ void texture_info::compute_size_subroutine(int texwidth, int texheight, int* p_w
}
// round up to square if we need to
- if (m_texture_manager->get_texture_caps() & D3DPTEXTURECAPS_SQUAREONLY)
+ if (texture_manager->get_texture_caps() & D3DPTEXTURECAPS_SQUAREONLY)
{
if (finalwidth < finalheight)
finalwidth = finalheight;
@@ -2113,11 +2113,11 @@ void texture_info::compute_size_subroutine(int texwidth, int texheight, int* p_w
}
// adjust the aspect ratio if we need to
- while (finalwidth < finalheight && finalheight / finalwidth > m_texture_manager->get_max_texture_aspect())
+ while (finalwidth < finalheight && finalheight / finalwidth > texture_manager->get_max_texture_aspect())
{
finalwidth *= 2;
}
- while (finalheight < finalwidth && finalwidth / finalheight > m_texture_manager->get_max_texture_aspect())
+ while (finalheight < finalwidth && finalwidth / finalheight > texture_manager->get_max_texture_aspect())
{
finalheight *= 2;
}
@@ -2151,7 +2151,7 @@ void texture_info::compute_size(int texwidth, int texheight)
finalwidth += 2 * m_xborderpix;
finalheight += 2 * m_yborderpix;
- compute_size_subroutine(finalwidth, finalheight, &finalwidth, &finalheight);
+ texture_info::compute_size_subroutine(m_texture_manager, finalwidth, finalheight, &finalwidth, &finalheight);
// if we added pixels for the border, and that just barely pushed us over, take it back
if (finalwidth > m_texture_manager->get_max_texture_width() || finalheight > m_texture_manager->get_max_texture_height())
@@ -2162,7 +2162,7 @@ void texture_info::compute_size(int texwidth, int texheight)
m_xborderpix = 0;
m_yborderpix = 0;
- compute_size_subroutine(finalwidth, finalheight, &finalwidth, &finalheight);
+ texture_info::compute_size_subroutine(m_texture_manager, finalwidth, finalheight, &finalwidth, &finalheight);
}
// if we're above the max width/height, do what?