2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2009-02-09 21:15:56 +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.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* 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.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GSState.h"
|
|
|
|
#include "GSRasterizer.h"
|
2009-02-11 07:05:44 +00:00
|
|
|
#include "GSScanlineEnvironment.h"
|
2009-02-13 09:28:51 +00:00
|
|
|
#include "GSSetupPrimCodeGenerator.h"
|
2009-02-11 07:05:44 +00:00
|
|
|
#include "GSDrawScanlineCodeGenerator.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-07-05 00:18:33 +00:00
|
|
|
class GSDrawScanline : public IDrawScanline
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2012-01-08 17:10:00 +00:00
|
|
|
public:
|
|
|
|
class SharedData : public GSRasterizerData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GSScanlineGlobalData global;
|
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
2011-02-17 18:22:47 +00:00
|
|
|
GSScanlineGlobalData m_global;
|
2011-02-17 03:24:37 +00:00
|
|
|
GSScanlineLocalData m_local;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2011-02-16 03:19:36 +00:00
|
|
|
GSCodeGeneratorFunctionMap<GSSetupPrimCodeGenerator, uint64, SetupPrimPtr> m_sp_map;
|
|
|
|
GSCodeGeneratorFunctionMap<GSDrawScanlineCodeGenerator, uint64, DrawScanlinePtr> m_ds_map;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
template<class T, bool masked>
|
2011-02-16 03:19:36 +00:00
|
|
|
void DrawRectT(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, uint32 c, uint32 m);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
template<class T, bool masked>
|
2009-07-06 16:35:06 +00:00
|
|
|
__forceinline void FillRect(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, uint32 c, uint32 m);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2013-06-10 15:56:11 +00:00
|
|
|
#if _M_SSE >= 0x501
|
|
|
|
|
|
|
|
template<class T, bool masked>
|
|
|
|
__forceinline void FillBlock(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, const GSVector8i& c, const GSVector8i& m);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
template<class T, bool masked>
|
2009-07-06 16:35:06 +00:00
|
|
|
__forceinline void FillBlock(const int* RESTRICT row, const int* RESTRICT col, const GSVector4i& r, const GSVector4i& c, const GSVector4i& m);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2013-06-10 15:56:11 +00:00
|
|
|
#endif
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
public:
|
2011-02-17 18:22:47 +00:00
|
|
|
GSDrawScanline();
|
2017-05-06 09:59:43 +00:00
|
|
|
virtual ~GSDrawScanline() = default;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// IDrawScanline
|
|
|
|
|
2012-01-08 17:10:00 +00:00
|
|
|
void BeginDraw(const GSRasterizerData* data);
|
2013-06-23 10:46:24 +00:00
|
|
|
void EndDraw(uint64 frame, uint64 ticks, int actual, int total);
|
2011-11-25 23:48:59 +00:00
|
|
|
|
|
|
|
void DrawRect(const GSVector4i& r, const GSVertexSW& v);
|
|
|
|
|
2011-12-16 19:13:58 +00:00
|
|
|
#ifndef ENABLE_JIT_RASTERIZER
|
2011-11-25 23:48:59 +00:00
|
|
|
|
2012-01-09 08:41:33 +00:00
|
|
|
void SetupPrim(const GSVertexSW* vertex, const uint32* index, const GSVertexSW& dscan);
|
2011-11-25 23:48:59 +00:00
|
|
|
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);
|
|
|
|
void DrawEdge(int pixels, int left, int top, const GSVertexSW& scan);
|
|
|
|
|
|
|
|
bool IsEdge() const {return m_global.sel.aa1;}
|
|
|
|
bool IsRect() const {return m_global.sel.IsSolidRect();}
|
|
|
|
|
2013-06-20 05:07:52 +00:00
|
|
|
template<class T> bool TestAlpha(T& test, T& fm, T& zm, const T& ga);
|
|
|
|
template<class T> void WritePixel(const T& src, int addr, int i, uint32 psm);
|
2011-11-25 23:48:59 +00:00
|
|
|
|
|
|
|
#endif
|
2013-06-17 04:11:10 +00:00
|
|
|
|
|
|
|
void PrintStats() {m_ds_map.PrintStats();}
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|