summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Jezze <jezze@gmx.net>2016-09-28 15:22:38 +0200
committer Jezze <jezze@gmx.net>2016-09-28 15:30:43 +0200
commitecf1e166fc6342ecf0664fe1d3af7aecb621c650 (patch)
treef75605582b1bc87ea3b6a2989d9867ea4ea93096 /src/emu
parent4727ff5e6a1e0aaa1d2b146b819250a6a83e8448 (diff)
Fixed several small issues in HLSL/BGFX
* fixed target texture dimension when -intoverscan is used (this fixes the appereance of scanline and shadow mask) * added target_scale and screen_count uniforms * rounded corners now remain aligned with screen bounds when -intoverscan is used (single screen only)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/render.cpp26
-rw-r--r--src/emu/render.h13
2 files changed, 25 insertions, 14 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 7e2ad4c2ca1..0e28f3c0494 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -1402,6 +1402,7 @@ render_primitive_list &render_target::get_primitives()
{
render_primitive *prim = list.alloc(render_primitive::QUAD);
set_render_bounds_xy(&prim->bounds, 0.0f, 0.0f, (float)m_width, (float)m_height);
+ prim->full_bounds = prim->bounds;
set_render_color(&prim->color, 1.0f, 1.0f, 1.0f, 1.0f);
prim->texture.base = nullptr;
prim->flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
@@ -1411,6 +1412,7 @@ render_primitive_list &render_target::get_primitives()
{
prim = list.alloc(render_primitive::QUAD);
set_render_bounds_xy(&prim->bounds, 1.0f, 1.0f, (float)(m_width - 1), (float)(m_height - 1));
+ prim->full_bounds = prim->bounds;
set_render_color(&prim->color, 1.0f, 0.0f, 0.0f, 0.0f);
prim->texture.base = nullptr;
prim->flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
@@ -1855,6 +1857,9 @@ void render_target::add_container_primitives(render_primitive_list &list, const
prim->color.b = container_xform.color.b * curitem.color().b;
prim->color.a = container_xform.color.a * curitem.color().a;
+ // copy unclipped bounds
+ prim->full_bounds = prim->bounds;
+
// now switch off the type
bool clipped = true;
switch (curitem.type())
@@ -1917,7 +1922,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const
clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
// apply the final orientation from the quad flags and then build up the final flags
- prim->flags = (curitem.flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK))
+ prim->flags |= (curitem.flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK))
| PRIMFLAG_TEXORIENT(finalorient)
| PRIMFLAG_TEXFORMAT(curitem.texture()->format());
prim->flags |= blendmode != -1
@@ -1977,7 +1982,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const
clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
// apply the final orientation from the quad flags and then build up the final flags
- prim->flags = (curitem.flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK))
+ prim->flags |= (curitem.flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK))
| PRIMFLAG_TEXORIENT(finalorient);
prim->flags |= blendmode != -1
? PRIMFLAG_BLENDMODE(blendmode)
@@ -1986,7 +1991,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const
else
{
// set the basic flags
- prim->flags = (curitem.flags() & ~PRIMFLAG_BLENDMODE_MASK)
+ prim->flags |= (curitem.flags() & ~PRIMFLAG_BLENDMODE_MASK)
| PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
// apply clipping
@@ -2008,22 +2013,23 @@ void render_target::add_container_primitives(render_primitive_list &list, const
// allocate a primitive
render_primitive *prim = list.alloc(render_primitive::QUAD);
set_render_bounds_wh(&prim->bounds, xform.xoffs, xform.yoffs, xform.xscale, xform.yscale);
+ prim->full_bounds = prim->bounds;
prim->color = container_xform.color;
width = render_round_nearest(prim->bounds.x1) - render_round_nearest(prim->bounds.x0);
height = render_round_nearest(prim->bounds.y1) - render_round_nearest(prim->bounds.y0);
container.overlay()->get_scaled(
- (container_xform.orientation & ORIENTATION_SWAP_XY) ? height : width,
- (container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list);
+ (container_xform.orientation & ORIENTATION_SWAP_XY) ? height : width,
+ (container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list);
// determine UV coordinates
prim->texcoords = oriented_texcoords[container_xform.orientation];
// set the flags and add it to the list
- prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
- PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
- PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
- PRIMFLAG_TEXSHADE(1);
+ prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation)
+ | PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY)
+ | PRIMFLAG_TEXFORMAT(container.overlay()->format())
+ | PRIMFLAG_TEXSHADE(1);
list.append_or_return(*prim, false);
}
@@ -2057,6 +2063,7 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob
INT32 width = render_round_nearest(xform.xscale);
INT32 height = render_round_nearest(xform.yscale);
set_render_bounds_wh(&prim->bounds, render_round_nearest(xform.xoffs), render_round_nearest(xform.yoffs), (float) width, (float) height);
+ prim->full_bounds = prim->bounds;
if (xform.orientation & ORIENTATION_SWAP_XY)
std::swap(width, height);
width = std::min(width, m_maxtexwidth);
@@ -2511,6 +2518,7 @@ void render_target::add_clear_extents(render_primitive_list &list)
{
render_primitive *prim = list.alloc(render_primitive::QUAD);
set_render_bounds_xy(&prim->bounds, (float)x0, (float)y0, (float)x1, (float)y1);
+ prim->full_bounds = prim->bounds;
set_render_color(&prim->color, 1.0f, 0.0f, 0.0f, 0.0f);
prim->texture.base = nullptr;
prim->flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
diff --git a/src/emu/render.h b/src/emu/render.h
index 069ae534a32..d0f8a29b0c4 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -203,7 +203,7 @@ struct render_color
// render_texuv - floating point set of UV texture coordinates
struct render_texuv
{
- float u; // U coodinate (0.0-1.0)
+ float u; // U coordinate (0.0-1.0)
float v; // V coordinate (0.0-1.0)
};
@@ -345,8 +345,10 @@ public:
// getters
render_primitive *next() const { return m_next; }
bool packable(const INT32 pack_size) const { return (flags & PRIMFLAG_PACKABLE) && texture.base != nullptr && texture.width <= pack_size && texture.height <= pack_size; }
- float get_quad_width() const { return bounds.x1 - bounds.x0; }
- float get_quad_height() const { return bounds.y1 - bounds.y0; }
+ float get_quad_width() const { return abs(bounds.x1 - bounds.x0); }
+ float get_quad_height() const { return abs(bounds.y1 - bounds.y0); }
+ float get_full_quad_width() const { return abs(full_bounds.x1 - full_bounds.x0); }
+ float get_full_quad_height() const { return abs(full_bounds.y1 - full_bounds.y0); }
// reset to prepare for re-use
void reset();
@@ -354,6 +356,7 @@ public:
// public state
primitive_type type; // type of primitive
render_bounds bounds; // bounds or positions
+ render_bounds full_bounds; // bounds or positions (unclipped)
render_color color; // RGBA values
UINT32 flags; // flags
float width; // width (for line primitives)
@@ -602,8 +605,8 @@ private:
user_settings m_user; // user settings
bitmap_argb32 * m_overlaybitmap; // overlay bitmap
render_texture * m_overlaytexture; // overlay texture
- std::unique_ptr<palette_client> m_palclient; // client to the screen palette
- std::vector<rgb_t> m_bcglookup; // copy of screen palette with bcg adjustment
+ std::unique_ptr<palette_client> m_palclient; // client to the screen palette
+ std::vector<rgb_t> m_bcglookup; // copy of screen palette with bcg adjustment
rgb_t m_bcglookup256[0x400]; // lookup table for brightness/contrast/gamma
};