2011-02-12 21:45:16 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "StdAfx.h"
|
|
|
|
#include "GPUDrawScanline.h"
|
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
GPUDrawScanline::GPUDrawScanline()
|
2011-02-17 03:24:37 +00:00
|
|
|
: m_sp_map("GPUSetupPrim", &m_local)
|
|
|
|
, m_ds_map("GPUDrawScanline", &m_local)
|
2011-02-12 21:45:16 +00:00
|
|
|
{
|
2011-02-17 03:24:37 +00:00
|
|
|
memset(&m_local, 0, sizeof(m_local));
|
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
m_local.gd = &m_global;
|
2011-02-12 21:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GPUDrawScanline::~GPUDrawScanline()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
void GPUDrawScanline::BeginDraw(const void* param)
|
2011-02-12 21:45:16 +00:00
|
|
|
{
|
2011-02-17 18:22:47 +00:00
|
|
|
memcpy(&m_global, param, sizeof(m_global));
|
|
|
|
|
|
|
|
if(m_global.sel.tme && m_global.sel.twin)
|
2011-02-12 21:45:16 +00:00
|
|
|
{
|
2011-02-17 03:24:37 +00:00
|
|
|
uint32 u, v;
|
2011-02-12 21:45:16 +00:00
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
u = ~(m_global.twin.x << 3) & 0xff; // TWW
|
|
|
|
v = ~(m_global.twin.y << 3) & 0xff; // TWH
|
2011-02-12 21:45:16 +00:00
|
|
|
|
2011-02-17 03:24:37 +00:00
|
|
|
m_local.twin[0].u = GSVector4i((u << 16) | u);
|
|
|
|
m_local.twin[0].v = GSVector4i((v << 16) | v);
|
2011-02-12 21:45:16 +00:00
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
u = m_global.twin.z << 3; // TWX
|
|
|
|
v = m_global.twin.w << 3; // TWY
|
2011-02-12 21:45:16 +00:00
|
|
|
|
2011-02-17 03:24:37 +00:00
|
|
|
m_local.twin[1].u = GSVector4i((u << 16) | u) & ~m_local.twin[0].u;
|
|
|
|
m_local.twin[1].v = GSVector4i((v << 16) | v) & ~m_local.twin[0].v;
|
2011-02-12 21:45:16 +00:00
|
|
|
}
|
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
m_ds = m_ds_map[m_global.sel];
|
2011-02-12 21:45:16 +00:00
|
|
|
|
2011-02-16 03:19:36 +00:00
|
|
|
m_de = NULL;
|
|
|
|
|
|
|
|
m_dr = NULL; // TODO
|
2011-02-12 21:45:16 +00:00
|
|
|
|
|
|
|
// doesn't need all bits => less functions generated
|
|
|
|
|
|
|
|
GPUScanlineSelector sel;
|
|
|
|
|
|
|
|
sel.key = 0;
|
|
|
|
|
2011-02-17 18:22:47 +00:00
|
|
|
sel.iip = m_global.sel.iip;
|
|
|
|
sel.tfx = m_global.sel.tfx;
|
|
|
|
sel.twin = m_global.sel.twin;
|
|
|
|
sel.sprite = m_global.sel.sprite;
|
2011-02-12 21:45:16 +00:00
|
|
|
|
2011-02-16 03:19:36 +00:00
|
|
|
m_sp = m_sp_map[sel];
|
2011-02-12 21:45:16 +00:00
|
|
|
}
|
|
|
|
|
2011-02-17 03:24:37 +00:00
|
|
|
void GPUDrawScanline::EndDraw(const GSRasterizerStats& stats, uint64 frame)
|
2011-02-12 21:45:16 +00:00
|
|
|
{
|
2011-02-17 03:24:37 +00:00
|
|
|
m_ds_map.UpdateStats(stats, frame);
|
2011-02-12 21:45:16 +00:00
|
|
|
}
|