|
|
@ -224,13 +224,13 @@ bool CDriverGL3::activeVertexProgram(CVertexProgram *program, bool driver)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IProgramDrvInfos *di = program->m_DrvInfo;
|
|
|
|
IProgramDrvInfos *di = program->m_DrvInfo;
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = dynamic_cast< CProgramDrvInfosGL3* >(di);
|
|
|
|
if (di == NULL)
|
|
|
|
if (drvInfo == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_UserVertexProgram = NULL;
|
|
|
|
m_UserVertexProgram = NULL;
|
|
|
|
m_DriverVertexProgram = NULL;
|
|
|
|
m_DriverVertexProgram = NULL;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = static_cast<CProgramDrvInfosGL3 *>(di);
|
|
|
|
|
|
|
|
|
|
|
|
nglUseProgramStages(ppoId, GL_VERTEX_SHADER_BIT, drvInfo->getProgramId());
|
|
|
|
nglUseProgramStages(ppoId, GL_VERTEX_SHADER_BIT, drvInfo->getProgramId());
|
|
|
|
|
|
|
|
|
|
|
@ -337,13 +337,13 @@ bool CDriverGL3::activePixelProgram(CPixelProgram *program, bool driver)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IProgramDrvInfos *di = program->m_DrvInfo;
|
|
|
|
IProgramDrvInfos *di = program->m_DrvInfo;
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = dynamic_cast< CProgramDrvInfosGL3* >(di);
|
|
|
|
if (di == NULL)
|
|
|
|
if (drvInfo == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_UserPixelProgram = NULL;
|
|
|
|
m_UserPixelProgram = NULL;
|
|
|
|
m_DriverPixelProgram = NULL;
|
|
|
|
m_DriverPixelProgram = NULL;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = static_cast<CProgramDrvInfosGL3 *>(di);
|
|
|
|
|
|
|
|
|
|
|
|
nglUseProgramStages(ppoId, GL_FRAGMENT_SHADER_BIT, drvInfo->getProgramId());
|
|
|
|
nglUseProgramStages(ppoId, GL_FRAGMENT_SHADER_BIT, drvInfo->getProgramId());
|
|
|
|
|
|
|
|
|
|
|
@ -355,35 +355,31 @@ bool CDriverGL3::activePixelProgram(CPixelProgram *program, bool driver)
|
|
|
|
|
|
|
|
|
|
|
|
uint32 CDriverGL3::getProgramId(TProgram program) const
|
|
|
|
uint32 CDriverGL3::getProgramId(TProgram program) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 id = 0;
|
|
|
|
IProgramDrvInfos *di;
|
|
|
|
|
|
|
|
|
|
|
|
switch(program)
|
|
|
|
switch(program)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case IDriver::VertexProgram:
|
|
|
|
case IDriver::VertexProgram:
|
|
|
|
if (m_DriverVertexProgram)
|
|
|
|
if (m_DriverVertexProgram)
|
|
|
|
{
|
|
|
|
di = m_DriverVertexProgram->m_DrvInfo;
|
|
|
|
IProgramDrvInfos *di = m_DriverVertexProgram->m_DrvInfo;
|
|
|
|
else
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = dynamic_cast< CProgramDrvInfosGL3* >(di);
|
|
|
|
di = NULL;
|
|
|
|
if (drvInfo != NULL)
|
|
|
|
|
|
|
|
id = drvInfo->getProgramId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case IDriver::PixelProgram:
|
|
|
|
case IDriver::PixelProgram:
|
|
|
|
if (m_DriverPixelProgram)
|
|
|
|
if (m_DriverPixelProgram)
|
|
|
|
{
|
|
|
|
di = m_DriverPixelProgram->m_DrvInfo;
|
|
|
|
IProgramDrvInfos *di = m_DriverPixelProgram->m_DrvInfo;
|
|
|
|
else
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = dynamic_cast< CProgramDrvInfosGL3* >(di);
|
|
|
|
di = NULL;
|
|
|
|
if (drvInfo != NULL)
|
|
|
|
|
|
|
|
id = drvInfo->getProgramId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
case IDriver::GeometryProgram:
|
|
|
|
di = NULL;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return id;
|
|
|
|
if (di == NULL)
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = static_cast<CProgramDrvInfosGL3 *>(di);
|
|
|
|
|
|
|
|
return drvInfo->getProgramId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IProgram* CDriverGL3::getProgram(TProgram program) const
|
|
|
|
IProgram* CDriverGL3::getProgram(TProgram program) const
|
|
|
@ -752,8 +748,11 @@ void CDriverGL3::setupUniforms(TProgram program)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterial &mat = *_CurrentMaterial;
|
|
|
|
CMaterial &mat = *_CurrentMaterial;
|
|
|
|
IProgram *p = getProgram(program);
|
|
|
|
IProgram *p = getProgram(program);
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = dynamic_cast<CProgramDrvInfosGL3 *>(&*p->m_DrvInfo);
|
|
|
|
if (p == NULL) return;
|
|
|
|
if (drvInfo == NULL) return;
|
|
|
|
IProgramDrvInfos *di = p->m_DrvInfo;
|
|
|
|
|
|
|
|
if (di == NULL) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = static_cast<CProgramDrvInfosGL3 *>(di);
|
|
|
|
GLuint progId = drvInfo->getProgramId();
|
|
|
|
GLuint progId = drvInfo->getProgramId();
|
|
|
|
|
|
|
|
|
|
|
|
uint mvpIndex = p->getUniformIndex(CProgramIndex::ModelViewProjection);
|
|
|
|
uint mvpIndex = p->getUniformIndex(CProgramIndex::ModelViewProjection);
|
|
|
@ -907,9 +906,9 @@ void CDriverGL3::setupUniforms(TProgram program)
|
|
|
|
void CDriverGL3::setupInitialUniforms(IProgram *program)
|
|
|
|
void CDriverGL3::setupInitialUniforms(IProgram *program)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IProgramDrvInfos *di = program->m_DrvInfo;
|
|
|
|
IProgramDrvInfos *di = program->m_DrvInfo;
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = dynamic_cast<CProgramDrvInfosGL3 *>(di);
|
|
|
|
if (di != NULL)
|
|
|
|
if (drvInfo != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
CProgramDrvInfosGL3 *drvInfo = static_cast<CProgramDrvInfosGL3 *>(di);
|
|
|
|
GLuint id = drvInfo->getProgramId();
|
|
|
|
GLuint id = drvInfo->getProgramId();
|
|
|
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < std::min(_Extensions.MaxFragmentTextureImageUnits, (GLint)IDRV_PROGRAM_MAXSAMPLERS); ++i)
|
|
|
|
for (uint i = 0; i < std::min(_Extensions.MaxFragmentTextureImageUnits, (GLint)IDRV_PROGRAM_MAXSAMPLERS); ++i)
|
|
|
|