Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/OGLCombinerNV.h
2 views
/*1Copyright (C) 2003 Rice196423This program is free software; you can redistribute it and/or4modify it under the terms of the GNU General Public License5as published by the Free Software Foundation; either version 26of the License, or (at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program; if not, write to the Free Software15Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.16*/1718#ifndef _OGL_COMBINER_NV_H_19#define _OGL_COMBINER_NV_H_2021#include <vector>2223#include <SDL_opengl.h>2425#include "OGLExtCombiner.h"26#include "OGLDecodedMux.h"2728typedef struct {29uint8 a;30uint8 b;31uint8 c;32uint8 d;33} NVGeneralCombinerType;3435typedef struct {36uint8 a;37uint8 b;38uint8 c;39uint8 d;40uint8 e;41uint8 f;42uint8 g;43} NVFinalCombinerType;4445typedef struct {46GLenum variable;47GLenum input;48GLenum mapping;49GLenum componentUsage;50} NVCombinerInputType;5152typedef struct {53GLenum abOutput;54GLenum cdOutput;55GLenum sumOutput;56GLenum scale;57GLenum bias;58GLboolean abDotProduct;59GLboolean cdDotProduct;60GLboolean muxSum;61} NVCombinerOutputType;626364typedef struct {65union {66struct {67NVGeneralCombinerType s1rgb;68NVGeneralCombinerType s1alpha;69NVGeneralCombinerType s2rgb;70NVGeneralCombinerType s2alpha;71NVFinalCombinerType finalrgb;72NVFinalCombinerType finalalpha;73};74struct {75NVGeneralCombinerType generalCombiners[4];76NVFinalCombinerType finalCombiners[2];77};78};79int stagesUsed;80uint8 constant0;81uint8 constant1;82} NVRegisterCombinerParserType;8384typedef struct {85NVCombinerInputType stage1RGB[4];86NVCombinerInputType stage1Alpha[4];87NVCombinerOutputType stage1outputRGB;88NVCombinerOutputType stage1outputAlpha;8990NVCombinerInputType stage2RGB[4];91NVCombinerInputType stage2Alpha[4];92NVCombinerOutputType stage2outputRGB;93NVCombinerOutputType stage2outputAlpha;9495NVCombinerInputType finalStage[7];9697int numOfStages;9899uint32 dwMux0;100uint32 dwMux1;101102uint8 constant0;103uint8 constant1;104#ifdef DEBUGGER105NVRegisterCombinerParserType parseResult;106#endif107} NVRegisterCombinerSettingType;108109class COGLColorCombinerNvidia : public COGLColorCombiner4110{111public:112bool Initialize(void);113void InitCombinerBlenderForSimpleTextureDraw(uint32 tile=0);114protected:115friend class OGLDeviceBuilder;116117void InitCombinerCycle12(void);118void DisableCombiner(void);119void InitCombinerCycleCopy(void);120void InitCombinerCycleFill(void);121122123int FindCompiledMux(void);124void GenerateNVRegisterCombinerSetting(int);125void GenerateNVRegisterCombinerSettingConstants(int); // Compile the decodedMux into NV register combiner setting126void ApplyFogAtFinalStage();127128void ParseDecodedMux(NVRegisterCombinerParserType &result); // Compile the decodedMux into NV register combiner setting129void ParseDecodedMuxForConstant(NVRegisterCombinerParserType &result); // Compile the decodedMux into NV register combiner setting130int SaveParserResult(const NVRegisterCombinerParserType &result);131132int StagesNeedToUse(COGLDecodedMux &mux, N64StageNumberType stage);133int Parse1Mux(COGLDecodedMux &mux, N64StageNumberType stage, NVGeneralCombinerType &res); // Compile the decodedMux into NV register combiner setting134int Parse1Mux2Stages(COGLDecodedMux &mux, N64StageNumberType stage, NVGeneralCombinerType &res, NVGeneralCombinerType &res2);135int Parse1MuxForStage2AndFinalStage(COGLDecodedMux &mux, N64StageNumberType stage, NVGeneralCombinerType &res, NVFinalCombinerType &fres);136void Parse1MuxForFinalStage(COGLDecodedMux &mux, N64StageNumberType stage, NVFinalCombinerType &fres);137void ByPassFinalStage(NVFinalCombinerType &fres);138void ByPassGeneralStage(NVGeneralCombinerType &res);139140GLenum ConstMap(uint8 c);141142COGLColorCombinerNvidia(CRender *pRender);143~COGLColorCombinerNvidia();144145std::vector<NVRegisterCombinerSettingType> m_vCompiledSettings;146147bool m_bNVSupported; // Is this NV OGL extension combiner supported by the video card driver?148149#ifdef DEBUGGER150void DisplaySimpleMuxString(void);151void DisplayNVCombinerString(NVRegisterCombinerSettingType &record);152#endif153154};155156#endif157158159160