|
|
|
@ -512,13 +512,19 @@ namespace NL3D
|
|
|
|
|
sp = shaderCache.findShader( desc );
|
|
|
|
|
|
|
|
|
|
if( !sp.empty() )
|
|
|
|
|
{
|
|
|
|
|
if( currentProgram.vp == NULL )
|
|
|
|
|
{
|
|
|
|
|
if( !activeVertexProgram( sp.vp ) )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( currentProgram.pp == NULL )
|
|
|
|
|
{
|
|
|
|
|
if( !activePixelProgram( sp.pp ) )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
std::string vs;
|
|
|
|
@ -565,6 +571,8 @@ namespace NL3D
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( currentProgram.vp == NULL )
|
|
|
|
|
{
|
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
@ -573,7 +581,10 @@ namespace NL3D
|
|
|
|
|
pp = NULL;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( currentProgram.pp == NULL )
|
|
|
|
|
{
|
|
|
|
|
if( !activePixelProgram( pp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
@ -582,6 +593,7 @@ namespace NL3D
|
|
|
|
|
pp = NULL;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sp.vp = vp;
|
|
|
|
|
sp.pp = pp;
|
|
|
|
@ -596,6 +608,9 @@ namespace NL3D
|
|
|
|
|
|
|
|
|
|
bool CDriverGL3::setupDynMatProgram( CMaterial& mat, uint pass )
|
|
|
|
|
{
|
|
|
|
|
if( ( currentProgram.vp != NULL ) && ( currentProgram.pp != NULL ) )
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
CDynMaterial *m = mat.getDynMat();
|
|
|
|
|
const SRenderPass *rp = m->getPass( pass );
|
|
|
|
|
std::string shaderRef;
|
|
|
|
@ -606,15 +621,16 @@ namespace NL3D
|
|
|
|
|
if( !usrShaderManager->getShader( shaderRef, &prg ) )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
CVertexProgram *vp = new CVertexProgram();
|
|
|
|
|
CPixelProgram *pp = new CPixelProgram();
|
|
|
|
|
|
|
|
|
|
std::string shaderSource;
|
|
|
|
|
std::string log;
|
|
|
|
|
std::string name;
|
|
|
|
|
|
|
|
|
|
if( currentProgram.vp == NULL )
|
|
|
|
|
{
|
|
|
|
|
prg.getVP( shaderSource );
|
|
|
|
|
prg.getName( name );
|
|
|
|
|
|
|
|
|
|
CVertexProgram *vp = new CVertexProgram();
|
|
|
|
|
{
|
|
|
|
|
IProgram::CSource *src = new IProgram::CSource();
|
|
|
|
|
src->Profile = IProgram::glsl330v;
|
|
|
|
@ -626,10 +642,26 @@ namespace NL3D
|
|
|
|
|
if( !compileVertexProgram( vp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
|
delete pp;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( currentProgram.dynmatVP != NULL )
|
|
|
|
|
delete currentProgram.dynmatVP;
|
|
|
|
|
currentProgram.dynmatVP = vp;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( currentProgram.pp == NULL )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
CPixelProgram *pp = new CPixelProgram();
|
|
|
|
|
|
|
|
|
|
prg.getFP( shaderSource );
|
|
|
|
|
{
|
|
|
|
|
IProgram::CSource *src = new IProgram::CSource();
|
|
|
|
@ -641,33 +673,22 @@ namespace NL3D
|
|
|
|
|
|
|
|
|
|
if( !compilePixelProgram( pp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
|
delete pp;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
|
delete pp;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( !activePixelProgram( pp ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
|
delete pp;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( currentProgram.dynmatVP != NULL )
|
|
|
|
|
delete currentProgram.dynmatVP;
|
|
|
|
|
currentProgram.dynmatVP = vp;
|
|
|
|
|
|
|
|
|
|
if( currentProgram.dynmatPP != NULL )
|
|
|
|
|
delete currentProgram.dynmatPP;
|
|
|
|
|
currentProgram.dynmatPP = pp;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|