2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2010-04-24 21:37:39 +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
|
|
|
*
|
2010-04-24 21:37:39 +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
|
|
|
*
|
2010-04-24 21:37:39 +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
|
2010-04-25 00:31:27 +00:00
|
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-04-24 21:37:39 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GSDrawingContext.h"
|
|
|
|
#include "GSVertex.h"
|
|
|
|
#include "GSVertexSW.h"
|
|
|
|
#include "GSVertexHW.h"
|
|
|
|
#include "GSFunctionMap.h"
|
|
|
|
|
|
|
|
class GSState;
|
|
|
|
|
2012-01-05 02:40:24 +00:00
|
|
|
__aligned(class, 32) GSVertexTrace : public GSAlignedClass<32>
|
2010-04-24 21:37:39 +00:00
|
|
|
{
|
2011-03-09 11:52:53 +00:00
|
|
|
public:
|
2011-03-12 22:10:58 +00:00
|
|
|
struct Vertex {GSVector4i c; GSVector4 p, t;}; // t.xy * 0x10000
|
2010-04-24 21:37:39 +00:00
|
|
|
struct VertexAlpha {int min, max; bool valid;};
|
|
|
|
|
2012-01-05 02:40:24 +00:00
|
|
|
protected:
|
2011-03-12 22:10:58 +00:00
|
|
|
const GSState* m_state;
|
|
|
|
|
2010-04-24 21:37:39 +00:00
|
|
|
uint32 Hash(GS_PRIM_CLASS primclass);
|
|
|
|
|
2012-01-05 02:40:24 +00:00
|
|
|
typedef void (*VertexTracePtr)(int count, const void* vertex, const uint32* index, Vertex& min, Vertex& max);
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2011-02-28 11:08:52 +00:00
|
|
|
static const GSVector4 s_minmax;
|
|
|
|
|
2010-04-24 21:37:39 +00:00
|
|
|
public:
|
|
|
|
GS_PRIM_CLASS m_primclass;
|
2011-03-12 22:10:58 +00:00
|
|
|
|
|
|
|
Vertex m_min;
|
|
|
|
Vertex m_max;
|
2012-01-05 02:40:24 +00:00
|
|
|
VertexAlpha m_alpha; // source alpha range after tfx, GSRenderer::GetAlphaMinMax() updates it
|
2010-04-24 21:37:39 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
2010-04-25 00:31:27 +00:00
|
|
|
uint32 value;
|
2010-04-24 21:37:39 +00:00
|
|
|
struct {uint32 r:4, g:4, b:4, a:4, x:1, y:1, z:1, f:1, s:1, t:1, q:1, _pad:1;};
|
|
|
|
struct {uint32 rgba:16, xyzf:4, stq:4;};
|
|
|
|
} m_eq;
|
|
|
|
|
2011-03-12 22:10:58 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct {uint32 mmag:1, mmin:1, linear:1;};
|
|
|
|
} m_filter;
|
|
|
|
|
|
|
|
GSVector2 m_lod; // x = min, y = max
|
|
|
|
|
2012-01-05 02:40:24 +00:00
|
|
|
public:
|
2010-04-24 21:37:39 +00:00
|
|
|
GSVertexTrace(const GSState* state);
|
2012-01-05 02:40:24 +00:00
|
|
|
virtual ~GSVertexTrace() {}
|
2010-04-24 21:37:39 +00:00
|
|
|
|
2012-01-05 02:40:24 +00:00
|
|
|
virtual void Update(const void* vertex, const uint32* index, int count, GS_PRIM_CLASS primclass);
|
2011-03-12 22:10:58 +00:00
|
|
|
|
|
|
|
bool IsLinear() const {return m_filter.linear;}
|
2010-04-24 21:37:39 +00:00
|
|
|
};
|
2012-01-05 02:40:24 +00:00
|
|
|
|
|
|
|
__aligned(class, 32) GSVertexTraceSW : public GSVertexTrace
|
|
|
|
{
|
|
|
|
class CG : public GSCodeGenerator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CG(const void* param, uint32 key, void* code, size_t maxsize);
|
|
|
|
};
|
|
|
|
|
|
|
|
GSCodeGeneratorFunctionMap<CG, uint32, VertexTracePtr> m_map;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GSVertexTraceSW(const GSState* state);
|
|
|
|
|
|
|
|
void Update(const void* vertex, const uint32* index, int count, GS_PRIM_CLASS primclass);
|
|
|
|
};
|
|
|
|
|
|
|
|
__aligned(class, 32) GSVertexTraceDX9 : public GSVertexTrace
|
|
|
|
{
|
|
|
|
class CG : public GSCodeGenerator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CG(const void* param, uint32 key, void* code, size_t maxsize);
|
|
|
|
};
|
|
|
|
|
|
|
|
GSCodeGeneratorFunctionMap<CG, uint32, VertexTracePtr> m_map;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GSVertexTraceDX9(const GSState* state);
|
|
|
|
|
|
|
|
void Update(const void* vertex, const uint32* index, int count, GS_PRIM_CLASS primclass);
|
|
|
|
};
|
|
|
|
|
|
|
|
__aligned(class, 32) GSVertexTraceDX11 : public GSVertexTrace
|
|
|
|
{
|
|
|
|
class CG : public GSCodeGenerator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CG(const void* param, uint32 key, void* code, size_t maxsize);
|
|
|
|
};
|
|
|
|
|
|
|
|
GSCodeGeneratorFunctionMap<CG, uint32, VertexTracePtr> m_map;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GSVertexTraceDX11(const GSState* state);
|
|
|
|
|
|
|
|
void Update(const void* vertex, const uint32* index, int count, GS_PRIM_CLASS primclass);
|
|
|
|
};
|