2009-07-28 15:32:10 -06:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
// 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, version 2.0.
|
|
|
|
|
|
|
|
// 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 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2009-07-26 03:52:35 -06:00
|
|
|
#ifndef GCOGL_PIXELSHADER_H
|
|
|
|
#define GCOGL_PIXELSHADER_H
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2010-06-14 08:36:01 -06:00
|
|
|
#include "VideoCommon.h"
|
2012-08-06 17:02:04 -06:00
|
|
|
#include "ShaderGenCommon.h"
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2009-07-26 03:52:35 -06:00
|
|
|
#define I_COLORS "color"
|
|
|
|
#define I_KCOLORS "k"
|
|
|
|
#define I_ALPHA "alphaRef"
|
|
|
|
#define I_TEXDIMS "texdim"
|
|
|
|
#define I_ZBIAS "czbias"
|
2008-12-07 21:46:09 -07:00
|
|
|
#define I_INDTEXSCALE "cindscale"
|
2009-07-26 03:52:35 -06:00
|
|
|
#define I_INDTEXMTX "cindmtx"
|
|
|
|
#define I_FOG "cfog"
|
2010-09-22 20:17:48 -06:00
|
|
|
#define I_PLIGHTS "cLights"
|
2012-03-23 21:47:28 -06:00
|
|
|
#define I_PMATERIALS "cmtrl"
|
2010-09-22 20:17:48 -06:00
|
|
|
|
2011-01-07 12:23:57 -07:00
|
|
|
#define C_COLORMATRIX 0 // 0
|
|
|
|
#define C_COLORS 0 // 0
|
|
|
|
#define C_KCOLORS (C_COLORS + 4) // 4
|
|
|
|
#define C_ALPHA (C_KCOLORS + 4) // 8
|
|
|
|
#define C_TEXDIMS (C_ALPHA + 1) // 9
|
2012-03-23 21:47:28 -06:00
|
|
|
#define C_ZBIAS (C_TEXDIMS + 8) //17
|
|
|
|
#define C_INDTEXSCALE (C_ZBIAS + 2) //19
|
|
|
|
#define C_INDTEXMTX (C_INDTEXSCALE + 2) //21
|
|
|
|
#define C_FOG (C_INDTEXMTX + 6) //27
|
|
|
|
|
|
|
|
#define C_PLIGHTS (C_FOG + 3)
|
|
|
|
#define C_PMATERIALS (C_PLIGHTS + 40)
|
|
|
|
#define C_PENVCONST_END (C_PMATERIALS + 4)
|
2008-12-26 03:43:18 -07:00
|
|
|
|
2012-08-10 10:57:37 -06:00
|
|
|
// Different ways to achieve rendering with destination alpha
|
|
|
|
enum DSTALPHA_MODE
|
2010-10-20 23:22:18 -06:00
|
|
|
{
|
2012-08-10 10:57:37 -06:00
|
|
|
DSTALPHA_NONE, // Render normally, without destination alpha
|
|
|
|
DSTALPHA_ALPHA_PASS, // Render normally first, then render again for alpha
|
|
|
|
DSTALPHA_DUAL_SOURCE_BLEND // Use dual-source blending
|
2010-10-20 23:22:18 -06:00
|
|
|
};
|
|
|
|
|
2012-08-06 17:02:04 -06:00
|
|
|
enum ALPHA_PRETEST_RESULT
|
|
|
|
{
|
|
|
|
ALPHAPT_UNDEFINED, // AlphaTest Result is not defined
|
|
|
|
ALPHAPT_ALWAYSFAIL, // Alpha test alway Fail
|
|
|
|
ALPHAPT_ALWAYSPASS // Alpha test alway Pass
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pixel_shader_uid_data
|
|
|
|
{
|
|
|
|
u32 components;
|
|
|
|
DSTALPHA_MODE dstAlphaMode; // TODO: as u32 :2
|
|
|
|
ALPHA_PRETEST_RESULT Pretest; // TODO: As :2
|
|
|
|
u32 nIndirectStagesUsed : 8;
|
|
|
|
struct {
|
|
|
|
u32 numtexgens : 4;
|
|
|
|
u32 numtevstages : 4;
|
|
|
|
u32 numindstages : 3;
|
|
|
|
} genMode;
|
|
|
|
u32 fogc_proj_fselfsel : 3;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 unknown : 1;
|
|
|
|
u32 projection : 1; // XF_TEXPROJ_X
|
|
|
|
u32 inputform : 2; // XF_TEXINPUT_X
|
|
|
|
u32 texgentype : 3; // XF_TEXGEN_X
|
|
|
|
u32 sourcerow : 5; // XF_SRCGEOM_X
|
|
|
|
u32 embosssourceshift : 3; // what generated texcoord to use
|
|
|
|
u32 embosslightshift : 3; // light index that is used
|
|
|
|
} texMtxInfo[8];
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 bi0 : 3; // indirect tex stage 0 ntexmap
|
|
|
|
u32 bc0 : 3; // indirect tex stage 0 ntexcoord
|
|
|
|
u32 bi1 : 3;
|
|
|
|
u32 bc1 : 3;
|
|
|
|
u32 bi2 : 3;
|
|
|
|
u32 bc3 : 3;
|
|
|
|
u32 bi4 : 3;
|
|
|
|
u32 bc4 : 3;
|
|
|
|
} tevindref;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef ShaderUid<pixel_shader_uid_data> PixelShaderUid;
|
|
|
|
typedef ShaderCode<pixel_shader_uid_data> PixelShaderCode;
|
2011-09-07 12:20:29 -06:00
|
|
|
|
2010-01-17 10:44:09 -07:00
|
|
|
|
2012-08-06 17:02:04 -06:00
|
|
|
void GeneratePixelShaderCode(PixelShaderCode& object, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components);
|
|
|
|
void GetPixelShaderId(PixelShaderUid& object, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components);
|
2011-09-08 16:32:04 -06:00
|
|
|
|
2009-07-26 03:52:35 -06:00
|
|
|
#endif // GCOGL_PIXELSHADER_H
|