2 Copyright (C) 2003 Rice1964
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef _OGL_COMBINER_NV_H_
20 #define _OGL_COMBINER_NV_H_
24 #include <SDL_opengl.h>
26 #include "OGLExtCombiner.h"
27 #include "OGLDecodedMux.h"
34 } NVGeneralCombinerType;
44 } NVFinalCombinerType;
50 GLenum componentUsage;
51 } NVCombinerInputType;
59 GLboolean abDotProduct;
60 GLboolean cdDotProduct;
62 } NVCombinerOutputType;
68 NVGeneralCombinerType s1rgb;
69 NVGeneralCombinerType s1alpha;
70 NVGeneralCombinerType s2rgb;
71 NVGeneralCombinerType s2alpha;
72 NVFinalCombinerType finalrgb;
73 NVFinalCombinerType finalalpha;
76 NVGeneralCombinerType generalCombiners[4];
77 NVFinalCombinerType finalCombiners[2];
83 } NVRegisterCombinerParserType;
86 NVCombinerInputType stage1RGB[4];
87 NVCombinerInputType stage1Alpha[4];
88 NVCombinerOutputType stage1outputRGB;
89 NVCombinerOutputType stage1outputAlpha;
91 NVCombinerInputType stage2RGB[4];
92 NVCombinerInputType stage2Alpha[4];
93 NVCombinerOutputType stage2outputRGB;
94 NVCombinerOutputType stage2outputAlpha;
96 NVCombinerInputType finalStage[7];
106 NVRegisterCombinerParserType parseResult;
108 } NVRegisterCombinerSettingType;
110 class COGLColorCombinerNvidia : public COGLColorCombiner4
113 bool Initialize(void);
114 void InitCombinerBlenderForSimpleTextureDraw(uint32 tile=0);
116 friend class OGLDeviceBuilder;
118 void InitCombinerCycle12(void);
119 void DisableCombiner(void);
120 void InitCombinerCycleCopy(void);
121 void InitCombinerCycleFill(void);
124 int FindCompiledMux(void);
125 void GenerateNVRegisterCombinerSetting(int);
126 void GenerateNVRegisterCombinerSettingConstants(int); // Compile the decodedMux into NV register combiner setting
127 void ApplyFogAtFinalStage();
129 void ParseDecodedMux(NVRegisterCombinerParserType &result); // Compile the decodedMux into NV register combiner setting
130 void ParseDecodedMuxForConstant(NVRegisterCombinerParserType &result); // Compile the decodedMux into NV register combiner setting
131 int SaveParserResult(const NVRegisterCombinerParserType &result);
133 int StagesNeedToUse(COGLDecodedMux &mux, N64StageNumberType stage);
134 int Parse1Mux(COGLDecodedMux &mux, N64StageNumberType stage, NVGeneralCombinerType &res); // Compile the decodedMux into NV register combiner setting
135 int Parse1Mux2Stages(COGLDecodedMux &mux, N64StageNumberType stage, NVGeneralCombinerType &res, NVGeneralCombinerType &res2);
136 int Parse1MuxForStage2AndFinalStage(COGLDecodedMux &mux, N64StageNumberType stage, NVGeneralCombinerType &res, NVFinalCombinerType &fres);
137 void Parse1MuxForFinalStage(COGLDecodedMux &mux, N64StageNumberType stage, NVFinalCombinerType &fres);
138 void ByPassFinalStage(NVFinalCombinerType &fres);
139 void ByPassGeneralStage(NVGeneralCombinerType &res);
141 GLenum ConstMap(uint8 c);
143 COGLColorCombinerNvidia(CRender *pRender);
144 ~COGLColorCombinerNvidia();
146 std::vector<NVRegisterCombinerSettingType> m_vCompiledSettings;
148 bool m_bNVSupported; // Is this NV OGL extension combiner supported by the video card driver?
151 void DisplaySimpleMuxString(void);
152 void DisplayNVCombinerString(NVRegisterCombinerSettingType &record);