Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/OGLExtCombiner.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 _OGLEXT_COMBINER_H_19#define _OGLEXT_COMBINER_H_2021#include <vector>2223#include "osal_opengl.h"2425#include "OGLCombiner.h"26#include "GeneralCombiner.h"2728typedef union29{30struct {31uint8 arg0;32uint8 arg1;33uint8 arg2;34};35uint8 args[3];36} OGLExt1CombType;3738typedef struct {39union {40struct {41GLenum rgbOp;42GLenum alphaOp;43};44GLenum ops[2];45};4647union {48struct {49uint8 rgbArg0;50uint8 rgbArg1;51uint8 rgbArg2;52uint8 alphaArg0;53uint8 alphaArg1;54uint8 alphaArg2;55};56struct {57OGLExt1CombType rgbComb;58OGLExt1CombType alphaComb;59};60OGLExt1CombType Combs[2];61};6263union {64struct {65GLint rgbArg0gl;66GLint rgbArg1gl;67GLint rgbArg2gl;68};69GLint glRGBArgs[3];70};7172union {73struct {74GLint rgbFlag0gl;75GLint rgbFlag1gl;76GLint rgbFlag2gl;77};78GLint glRGBFlags[3];79};8081union {82struct {83GLint alphaArg0gl;84GLint alphaArg1gl;85GLint alphaArg2gl;86};87GLint glAlphaArgs[3];88};8990union {91struct {92GLint alphaFlag0gl;93GLint alphaFlag1gl;94GLint alphaFlag2gl;95};96GLint glAlphaFlags[3];97};9899int tex;100bool textureIsUsed;101//float scale; //Will not be used102} OGLExtCombinerType;103104typedef struct {105uint32 dwMux0;106uint32 dwMux1;107OGLExtCombinerType units[8];108int numOfUnits;109uint32 constantColor;110111// For 1.4 v2 combiner112bool primIsUsed;113bool envIsUsed;114bool lodFracIsUsed;115} OGLExtCombinerSaveType;116117118//========================================================================119// OpenGL 1.4 combiner which support Texture Crossbar feature120class COGLColorCombiner4 : public COGLColorCombiner121{122public:123bool Initialize(void);124protected:125friend class OGLDeviceBuilder;126void InitCombinerCycle12(void);127void InitCombinerCycleFill(void);128virtual void GenerateCombinerSetting(int index);129virtual void GenerateCombinerSettingConstants(int index);130virtual int ParseDecodedMux();131132COGLColorCombiner4(CRender *pRender);133~COGLColorCombiner4() {};134135bool m_bOGLExtCombinerSupported; // Is this OGL extension combiner supported by the video card driver?136bool m_bSupportModAdd_ATI;137bool m_bSupportModSub_ATI;138GLint m_maxTexUnits;139int m_lastIndex;140uint32 m_dwLastMux0;141uint32 m_dwLastMux1;142143#ifdef DEBUGGER144void DisplaySimpleMuxString(void);145#endif146147protected:148virtual int SaveParsedResult(OGLExtCombinerSaveType &result);149static GLint MapRGBArgFlags(uint8 arg);150static GLint MapAlphaArgFlags(uint8 arg);151std::vector<OGLExtCombinerSaveType> m_vCompiledSettings;152static GLint RGBArgsMap4[];153static const char* GetOpStr(GLenum op);154155private:156virtual int ParseDecodedMux2Units();157virtual int FindCompiledMux();158159virtual GLint MapRGBArgs(uint8 arg);160virtual GLint MapAlphaArgs(uint8 arg);161};162163164class COGLColorCombiner4v2 : public COGLColorCombiner4165{166/************************************************************************167* Version 2 of OGL 1.4 combiner168* Will support up to 4 texture units169* Texture unit 0 and 1 are for N64 texture T0 and T1170* Texture unit 2 and 3 will be used to map constant colors171* Constant color mapping:172* OGL constant factor: MUX_PRIM173* ARB_TEXTURE2: MUX_ENV174* ARB_TEXTURE3: MUX_LODFRAC175************************************************************************/176protected:177friend class OGLDeviceBuilder;178virtual void GenerateCombinerSettingConstants(int index);179virtual int SaveParsedResult(OGLExtCombinerSaveType &result);180181COGLColorCombiner4v2(CRender *pRender);182~COGLColorCombiner4v2() {};183184static GLint RGBArgsMap4v2[];185186private:187virtual GLint MapRGBArgs(uint8 arg);188virtual GLint MapAlphaArgs(uint8 arg);189};190191//////////////////////////////////////////////////////////////////////////192// OpenGL 1.2, 1.3 combiner which does not support Texture Crossbar feature193class COGLColorCombiner2 : public COGLColorCombiner4, CGeneralCombiner194{195public:196bool Initialize(void);197198#ifdef DEBUGGER199void DisplaySimpleMuxString(void);200#endif201202protected:203friend class OGLDeviceBuilder;204205COGLColorCombiner2(CRender *pRender);206~COGLColorCombiner2() {};207208private:209virtual int ParseDecodedMux();210virtual void GenerateCombinerSetting(int index);211virtual void GenerateCombinerSettingConstants(int index);212213virtual GLint MapRGBArgs(uint8 arg);214virtual GLint MapAlphaArgs(uint8 arg);215static GLint RGBArgsMap2[];216};217218219#endif220221222223