X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=source%2Frice_gles%2Fsrc%2FOGLDecodedMux.cpp;fp=source%2Frice_gles%2Fsrc%2FOGLDecodedMux.cpp;h=ed98307734bd90f5af9c3e9e52c72c674ae74d38;hb=d07c171fa694cae985ad7045f9ce2b2f1a5699b4;hp=0000000000000000000000000000000000000000;hpb=ca22e7b76883b946060a6b40bb8709c1981e1cf6;p=mupen64plus-pandora.git diff --git a/source/rice_gles/src/OGLDecodedMux.cpp b/source/rice_gles/src/OGLDecodedMux.cpp new file mode 100644 index 0000000..ed98307 --- /dev/null +++ b/source/rice_gles/src/OGLDecodedMux.cpp @@ -0,0 +1,117 @@ +/* +Copyright (C) 2003 Rice1964 + +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; either version 2 +of the License, or (at your option) any later version. + +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 for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "OGLDecodedMux.h" + +//======================================================================== +void COGLDecodedMux::Simplify(void) +{ + DecodedMux::Simplify(); +} + +void COGLDecodedMux::Reformat(void) +{ + DecodedMux::Reformat(); + mType = max(max(max(splitType[0], splitType[1]),splitType[2]),splitType[3]); +} + +void COGLExtDecodedMux::Simplify(void) +//======================================================================== +{ + COGLDecodedMux::Simplify(); + FurtherFormatForOGL2(); + Reformat(); // Reformat again +} + +void COGLExtDecodedMux::FurtherFormatForOGL2(void) +{ + // This function is used by OGL 1.2, no need to call this function + // for Nvidia register combiner + + // And OGL 1.2 extension only supports 1 constant color, we can not use both PRIM and ENV + // constant color, and we can not use SPECULAR color as the 2nd color. + + // To futher format the mux. + // - For each stage, allow only 1 texel, change the 2nd texel in the same stage to MUX_SHADE + // - Only allow 1 constant color. Count PRIM and ENV, left the most used one, and change + // the 2nd one to MUX_SHADE + + if( Count(MUX_PRIM) >= Count(MUX_ENV) ) + { + ReplaceVal(MUX_ENV, MUX_PRIM); + //ReplaceVal(MUX_ENV, MUX_SHADE); + //ReplaceVal(MUX_ENV, MUX_1); + //ReplaceVal(MUX_PRIM, MUX_0); + } + else + { + //ReplaceVal(MUX_PRIM, MUX_ENV); + //ReplaceVal(MUX_PRIM, MUX_SHADE); + ReplaceVal(MUX_PRIM, MUX_0); + } + + /* + // Because OGL 1.2, we may use more than 1 texture unit, but for each texture unit, + // we can not use multitexture to do color combiner. Each combiner stage can only + // use 1 texture. + + if( isUsed(MUX_TEXEL0) && isUsed(MUX_TEXEL1) ) + { + if( Count(MUX_TEXEL0,0)+Count(MUX_TEXEL0,1) >= Count(MUX_TEXEL1,0)+Count(MUX_TEXEL1,1) ) + { + ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 0); + ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 1); + } + else + { + ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 0); + ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 1); + } + + if( Count(MUX_TEXEL0,2)+Count(MUX_TEXEL0,3) >= Count(MUX_TEXEL1,2)+Count(MUX_TEXEL1,3) ) + { + ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 2); + ReplaceVal(MUX_TEXEL1, MUX_TEXEL0, 3); + } + else + { + ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 2); + ReplaceVal(MUX_TEXEL0, MUX_TEXEL1, 3); + } + } + */ +} + + +void COGLExtDecodedMuxTNT2::FurtherFormatForOGL2(void) +{ + if( Count(MUX_PRIM) >= Count(MUX_ENV) ) + { + //ReplaceVal(MUX_ENV, MUX_PRIM); + //ReplaceVal(MUX_ENV, MUX_SHADE); + ReplaceVal(MUX_ENV, MUX_1); + //ReplaceVal(MUX_PRIM, MUX_0); + } + else + { + //ReplaceVal(MUX_PRIM, MUX_ENV); + //ReplaceVal(MUX_PRIM, MUX_SHADE); + ReplaceVal(MUX_PRIM, MUX_0); + } +} +