mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
[powervr2.cpp] Naomi Rendering Fixes (#9745)
* Allow rendering non-textured sprites (filled boxes), causes spritetest to render properly. * Fix alpha blending for textures to key off of the right value. * Some code cleanup.
This commit is contained in:
parent
5052eb307a
commit
1911a43b49
@ -694,15 +694,10 @@ void powervr2_device::tex_get_info(texinfo *t)
|
||||
int miptype = 0;
|
||||
|
||||
t->textured = texture;
|
||||
|
||||
// not textured, abort.
|
||||
// if (!t->textured) return;
|
||||
|
||||
t->address = textureaddress;
|
||||
t->pf = pixelformat;
|
||||
t->palette = 0;
|
||||
|
||||
t->mode = (vqcompressed<<1);
|
||||
t->mode = (vqcompressed<<1);
|
||||
|
||||
// scanorder is ignored for palettized textures (palettized textures are ALWAYS twiddled)
|
||||
// (the same bits are used for palette select instead)
|
||||
@ -716,7 +711,7 @@ void powervr2_device::tex_get_info(texinfo *t)
|
||||
}
|
||||
|
||||
/* When scan order is 1 (non-twiddled) mipmap is ignored */
|
||||
t->mipmapped = t->mode & 1 ? 0 : mipmapped;
|
||||
t->mipmapped = t->mode & 1 ? 0 : mipmapped;
|
||||
|
||||
// Mipmapped textures are always square, ignore v size
|
||||
if (t->mipmapped)
|
||||
@ -745,7 +740,7 @@ void powervr2_device::tex_get_info(texinfo *t)
|
||||
t->cd = dilatechose[t->sizes];
|
||||
t->palbase = 0;
|
||||
t->vqbase = t->address;
|
||||
t->blend = use_alpha ? blend_functions[t->blend_mode] : bl10;
|
||||
t->blend = ignoretexalpha ? bl10 : blend_functions[t->blend_mode];
|
||||
|
||||
t->coltype = coltype;
|
||||
t->tsinstruction = tsinstruction;
|
||||
@ -1817,7 +1812,7 @@ void powervr2_device::process_ta_fifo()
|
||||
volume=(objcontrol >> 6) & 1;
|
||||
coltype=(objcontrol >> 4) & 3;
|
||||
texture=(objcontrol >> 3) & 1;
|
||||
offset_color_enable=(objcontrol >> 2) & 1;
|
||||
offset_color_enable=texture ? (objcontrol >> 2) & 1 : 0;
|
||||
gouraud=(objcontrol >> 1) & 1;
|
||||
uv16bit=(objcontrol >> 0) & 1;
|
||||
}
|
||||
@ -1993,6 +1988,13 @@ void powervr2_device::process_ta_fifo()
|
||||
|
||||
LOGTATILE(" Texture at %08x format %d\n", (tafifo_buff[3] & 0x1FFFFF) << 3, pixelformat);
|
||||
}
|
||||
if (use_alpha == 0)
|
||||
{
|
||||
// Alpha value in base/offset color is to be treated as 1.0/0xFF.
|
||||
poly_base_color[0] = 1.0;
|
||||
if (offset_color_enable)
|
||||
poly_offs_color[0] = 1.0;
|
||||
}
|
||||
if (paratype == 4)
|
||||
{
|
||||
LOGTATILE(" %s\n",
|
||||
@ -2033,24 +2035,24 @@ void powervr2_device::process_ta_fifo()
|
||||
u2f(tafifo_buff[10]), u2f(tafifo_buff[11])
|
||||
);
|
||||
|
||||
if (texture == 1)
|
||||
if (rd->verts_size <= (MAX_VERTS - 6) && grp->strips_size < MAX_STRIPS)
|
||||
{
|
||||
if (rd->verts_size <= (MAX_VERTS - 6) && grp->strips_size < MAX_STRIPS)
|
||||
vert * const tv = &rd->verts[rd->verts_size];
|
||||
tv[0].x = u2f(tafifo_buff[0x1]);
|
||||
tv[0].y = u2f(tafifo_buff[0x2]);
|
||||
tv[0].w = u2f(tafifo_buff[0x3]);
|
||||
tv[1].x = u2f(tafifo_buff[0x4]);
|
||||
tv[1].y = u2f(tafifo_buff[0x5]);
|
||||
tv[1].w = u2f(tafifo_buff[0x6]);
|
||||
tv[3].x = u2f(tafifo_buff[0x7]);
|
||||
tv[3].y = u2f(tafifo_buff[0x8]);
|
||||
tv[3].w = u2f(tafifo_buff[0x9]);
|
||||
tv[2].x = u2f(tafifo_buff[0xa]);
|
||||
tv[2].y = u2f(tafifo_buff[0xb]);
|
||||
tv[2].w = tv[0].w+tv[3].w-tv[1].w;
|
||||
|
||||
if (texture == 1)
|
||||
{
|
||||
strip *ts;
|
||||
vert *tv = &rd->verts[rd->verts_size];
|
||||
tv[0].x = u2f(tafifo_buff[0x1]);
|
||||
tv[0].y = u2f(tafifo_buff[0x2]);
|
||||
tv[0].w = u2f(tafifo_buff[0x3]);
|
||||
tv[1].x = u2f(tafifo_buff[0x4]);
|
||||
tv[1].y = u2f(tafifo_buff[0x5]);
|
||||
tv[1].w = u2f(tafifo_buff[0x6]);
|
||||
tv[3].x = u2f(tafifo_buff[0x7]);
|
||||
tv[3].y = u2f(tafifo_buff[0x8]);
|
||||
tv[3].w = u2f(tafifo_buff[0x9]);
|
||||
tv[2].x = u2f(tafifo_buff[0xa]);
|
||||
tv[2].y = u2f(tafifo_buff[0xb]);
|
||||
tv[2].w = tv[0].w+tv[3].w-tv[1].w;
|
||||
tv[0].u = u2f(tafifo_buff[0xd] & 0xffff0000);
|
||||
tv[0].v = u2f(tafifo_buff[0xd] << 16);
|
||||
tv[1].u = u2f(tafifo_buff[0xe] & 0xffff0000);
|
||||
@ -2059,22 +2061,20 @@ void powervr2_device::process_ta_fifo()
|
||||
tv[3].v = u2f(tafifo_buff[0xf] << 16);
|
||||
tv[2].u = tv[0].u+tv[3].u-tv[1].u;
|
||||
tv[2].v = tv[0].v+tv[3].v-tv[1].v;
|
||||
|
||||
int idx;
|
||||
for (idx = 0; idx < 4; idx++) {
|
||||
memcpy(tv[idx].b, poly_base_color,
|
||||
sizeof(tv[idx].b));
|
||||
memcpy(tv[idx].o, poly_offs_color,
|
||||
sizeof(tv[idx].o));
|
||||
}
|
||||
|
||||
ts = &grp->strips[grp->strips_size++];
|
||||
tex_get_info(&ts->ti);
|
||||
ts->svert = rd->verts_size;
|
||||
ts->evert = rd->verts_size + 3;
|
||||
|
||||
rd->verts_size += 4;
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < 4; idx++)
|
||||
{
|
||||
memcpy(tv[idx].b, poly_base_color, sizeof(tv[idx].b));
|
||||
memcpy(tv[idx].o, poly_offs_color, sizeof(tv[idx].o));
|
||||
}
|
||||
|
||||
strip * const ts = &grp->strips[grp->strips_size++];
|
||||
tex_get_info(&ts->ti);
|
||||
ts->svert = rd->verts_size;
|
||||
ts->evert = rd->verts_size + 3;
|
||||
|
||||
rd->verts_size += 4;
|
||||
}
|
||||
}
|
||||
else if (global_paratype == 4)
|
||||
|
Loading…
Reference in New Issue
Block a user