Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/OGLDecodedMux.cpp
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#include "OGLDecodedMux.h"1920//========================================================================21void COGLDecodedMux::Simplify(void)22{23DecodedMux::Simplify();24}2526void COGLDecodedMux::Reformat(void)27{28DecodedMux::Reformat();29mType = max(max(max(splitType[0], splitType[1]),splitType[2]),splitType[3]);30}3132void COGLExtDecodedMux::Simplify(void)33//========================================================================34{35COGLDecodedMux::Simplify();36FurtherFormatForOGL2();37Reformat(); // Reformat again38}3940void COGLExtDecodedMux::FurtherFormatForOGL2(void)41{42// This function is used by OGL 1.2, no need to call this function43// for Nvidia register combiner4445// And OGL 1.2 extension only supports 1 constant color, we can not use both PRIM and ENV46// constant color, and we can not use SPECULAR color as the 2nd color.4748// To futher format the mux.49// - For each stage, allow only 1 texel, change the 2nd texel in the same stage to MUX_SHADE50// - Only allow 1 constant color. Count PRIM and ENV, left the most used one, and change51// the 2nd one to MUX_SHADE5253if( Count(MUX_PRIM) >= Count(MUX_ENV) )54{55ReplaceVal(MUX_ENV, MUX_PRIM);56//ReplaceVal(MUX_ENV, MUX_SHADE);57//ReplaceVal(MUX_ENV, MUX_1);58//ReplaceVal(MUX_PRIM, MUX_0);59}60else61{62//ReplaceVal(MUX_PRIM, MUX_ENV);63//ReplaceVal(MUX_PRIM, MUX_SHADE);64ReplaceVal(MUX_PRIM, MUX_0);65}6667/*68// Because OGL 1.2, we may use more than 1 texture unit, but for each texture unit,69// we can not use multitexture to do color combiner. Each combiner stage can only70// use 1 texture.7172if( isUsed(MUX_TEXEL0) && isUsed(MUX_TEXEL1) )73{74if( Count(MUX_TEXEL0,0)+Count(MUX_TEXEL0,1) >= Count(MUX_TEXEL1,0)+Count(MUX_TEXEL1,1) )75{76ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 0);77ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 1);78}79else80{81ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 0);82ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 1);83}8485if( Count(MUX_TEXEL0,2)+Count(MUX_TEXEL0,3) >= Count(MUX_TEXEL1,2)+Count(MUX_TEXEL1,3) )86{87ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 2);88ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 3);89}90else91{92ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 2);93ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 3);94}95}96*/97}9899100void COGLExtDecodedMuxTNT2::FurtherFormatForOGL2(void)101{102if( Count(MUX_PRIM) >= Count(MUX_ENV) )103{104//ReplaceVal(MUX_ENV, MUX_PRIM);105//ReplaceVal(MUX_ENV, MUX_SHADE);106ReplaceVal(MUX_ENV, MUX_1);107//ReplaceVal(MUX_PRIM, MUX_0);108}109else110{111//ReplaceVal(MUX_PRIM, MUX_ENV);112//ReplaceVal(MUX_PRIM, MUX_SHADE);113ReplaceVal(MUX_PRIM, MUX_0);114}115}116117118119