mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 02:20:54 +00:00
Cleanup more unneeded code
This commit is contained in:
parent
72035e936a
commit
0c1bfe0f63
2 changed files with 1 additions and 191 deletions
|
@ -81,12 +81,7 @@ bool CDriverD3D::activePixelProgram(CPixelProgram *program)
|
||||||
// Create a driver info structure
|
// Create a driver info structure
|
||||||
program->_DrvInfo = *itPix;
|
program->_DrvInfo = *itPix;
|
||||||
|
|
||||||
std::string dest;
|
const std::string &dest = program->getProgram();
|
||||||
/* TODO_REMOVE
|
|
||||||
if(program->isEffectProgram())
|
|
||||||
{
|
|
||||||
dest = program->getProgram();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
LPD3DXBUFFER pShader;
|
LPD3DXBUFFER pShader;
|
||||||
LPD3DXBUFFER pErrorMsgs;
|
LPD3DXBUFFER pErrorMsgs;
|
||||||
|
|
|
@ -311,189 +311,4 @@ void CDriverGL::setPixelProgramConstantMatrix (uint index, IDriver::TMatrix matr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO_REMOVE_PARSER
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************** CPixelProgramConversionARB *****************************
|
|
||||||
// ***************************************************************************
|
|
||||||
|
|
||||||
const char * CPixelProgramConversionARB::ARBPixelProgramInputRegisterToName[CPPOperand::InputRegisterCount] =
|
|
||||||
{
|
|
||||||
"color.primary",
|
|
||||||
"color.secondary",
|
|
||||||
"texcoord[0]",
|
|
||||||
"texcoord[1]",
|
|
||||||
"texcoord[2]",
|
|
||||||
"texcoord[3]",
|
|
||||||
"texcoord[4]",
|
|
||||||
"texcoord[5]",
|
|
||||||
"texcoord[6]",
|
|
||||||
"texcoord[7]",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
const char * CPixelProgramConversionARB::ARBPixelProgramOutputRegisterToName[CPPOperand::OutputRegisterCount] =
|
|
||||||
{
|
|
||||||
"color",
|
|
||||||
"depth"
|
|
||||||
};
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
bool CPixelProgramConversionARB::convert(const CPixelProgramParser::CPProgram &inParsedProgram, std::string & code)
|
|
||||||
{
|
|
||||||
CPixelProgramParser::TPProgram parsedProgram = inParsedProgram._Program;
|
|
||||||
//
|
|
||||||
code = "!!ARBfp1.0\n";
|
|
||||||
// declare temporary registers
|
|
||||||
GLint glMaxTempVar;
|
|
||||||
nglGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB, &glMaxTempVar);
|
|
||||||
uint usedTempVar = inParsedProgram.getUsedVariablesNb();
|
|
||||||
if(usedTempVar>glMaxTempVar)
|
|
||||||
{
|
|
||||||
nlwarning(" Used temporary registers number is superior to maximum ARB_FRAGMENT_PROGRAM temporaries registers.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ARBProgramTemporaryRegisters(code, usedTempVar);
|
|
||||||
// declare constant register
|
|
||||||
if(!CProgramConversionARB::constantRegisters(inParsedProgram._Constants, code)) return false;
|
|
||||||
|
|
||||||
for(uint k = 0; k < parsedProgram.size(); ++k)
|
|
||||||
{
|
|
||||||
std::string instr;
|
|
||||||
ARBPixelProgramDumpInstr(parsedProgram[k], instr);
|
|
||||||
code += instr + "\r\n";
|
|
||||||
}
|
|
||||||
code += "END\n";
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
// Dump an instruction in a string
|
|
||||||
void CPixelProgramConversionARB::ARBPixelProgramDumpInstr(const CPPInstruction &instr, std::string &out)
|
|
||||||
{
|
|
||||||
nlassert(instr.Opcode.PPOp < CPPInstruction::OpcodeCount);
|
|
||||||
// Special case for EXP with a scalar output argument (y component) -> translate to FRC
|
|
||||||
|
|
||||||
out = std::string();
|
|
||||||
switch(instr.Opcode.PPOp)
|
|
||||||
{
|
|
||||||
case CPPInstruction::ADD:
|
|
||||||
out = "ADD";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::DP3:
|
|
||||||
out = "DP3";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::DP4:
|
|
||||||
out = "DP4";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::EXP:
|
|
||||||
out = "EXP";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::FRC:
|
|
||||||
out = "FRC";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::LOG:
|
|
||||||
out = "LOG";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::MAD:
|
|
||||||
out = "MAD";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::MAX:
|
|
||||||
out = "MAX";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::MIN:
|
|
||||||
out = "MIN";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::MOV:
|
|
||||||
out = "MOV";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::MUL:
|
|
||||||
out = "MUL";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::RCP:
|
|
||||||
out = "RCP";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::RSQ:
|
|
||||||
out = "RSQ";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::SUB:
|
|
||||||
out = "SUB";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::ABS:
|
|
||||||
out = "ABS";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::CMP:
|
|
||||||
out = "CMP";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::CRS:
|
|
||||||
out = "XPD";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::LRP:
|
|
||||||
out = "LRP";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::POW:
|
|
||||||
out = "POW";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::TEX:
|
|
||||||
out = "TEX";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::TEXB:
|
|
||||||
out = "TXB";
|
|
||||||
break;
|
|
||||||
case CPPInstruction::TEXP:
|
|
||||||
out = "TXP";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
nlwarning("no match with a ARB Pixel Program Operator");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(instr.Sat) out += "_SAT";
|
|
||||||
out += " ";
|
|
||||||
uint nbOp = instr.getNumUsedSrc();
|
|
||||||
std::string destOperand;
|
|
||||||
ARBPixelProgramDumpOperand(instr.Dest, true, destOperand);
|
|
||||||
out += destOperand;
|
|
||||||
for(uint k = 0; k < nbOp; ++k)
|
|
||||||
{
|
|
||||||
out += ", ";
|
|
||||||
std::string srcOperand;
|
|
||||||
ARBPixelProgramDumpOperand(instr.getSrc(k), false, srcOperand);
|
|
||||||
out += srcOperand;
|
|
||||||
}
|
|
||||||
out +="; \n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CPixelProgramConversionARB::ARBPixelProgramDumpOperand(const CPPOperand &op, bool destOperand, std::string &out)
|
|
||||||
{
|
|
||||||
out = op.Negate ? " -" : " ";
|
|
||||||
switch(op.Type)
|
|
||||||
{
|
|
||||||
case CPPOperand::Variable: out += "R" + NLMISC::toString(op.Value.VariableValue); break;
|
|
||||||
case CPPOperand::Constant:
|
|
||||||
out += "c[";
|
|
||||||
out += NLMISC::toString(op.Value.ConstantValue) + "]";
|
|
||||||
break;
|
|
||||||
case CPPOperand::InputRegister: out += string("fragment.") + ARBPixelProgramInputRegisterToName[(uint) op.Value.InputRegisterValue]; break;
|
|
||||||
case CPPOperand::OutputRegister:
|
|
||||||
nlassert(op.Value.OutputRegisterValue < CVPOperand::OutputRegisterCount);
|
|
||||||
out += "result." + std::string(ARBPixelProgramOutputRegisterToName[op.Value.OutputRegisterValue]);
|
|
||||||
break;
|
|
||||||
case CPPOperand::Sampler2DRegister:
|
|
||||||
out += string("texture[") + op.Value.SamplerValue + "], 2D";
|
|
||||||
break;
|
|
||||||
case CPPOperand::Sampler3DRegister:
|
|
||||||
out += string("texture[") + op.Value.SamplerValue + "], 3D";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ARBProgramSuffix(op, destOperand, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // NL3D
|
} // NL3D
|
||||||
|
|
Loading…
Reference in a new issue