2013-09-07 16:33:18 +00:00
|
|
|
/**
|
2013-09-13 22:46:10 +00:00
|
|
|
* \file program.cpp
|
|
|
|
* \brief IProgram
|
2013-09-07 16:33:18 +00:00
|
|
|
* \date 2013-09-07 15:00GMT
|
|
|
|
* \author Jan Boon (Kaetemi)
|
2013-09-13 22:46:10 +00:00
|
|
|
* IProgram
|
2013-09-07 16:33:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 by authors
|
|
|
|
*
|
|
|
|
* This file is part of NL3D.
|
|
|
|
* NL3D is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* NL3D 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 Affero General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with NL3D. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-19 19:37:03 +00:00
|
|
|
#include "std3d.h"
|
|
|
|
|
|
|
|
#include "nel/misc/types_nl.h"
|
|
|
|
#include "nel/3d/program.h"
|
2013-09-07 16:33:18 +00:00
|
|
|
|
|
|
|
// STL includes
|
|
|
|
|
|
|
|
// NeL includes
|
|
|
|
// #include <nel/misc/debug.h>
|
2016-01-19 19:37:03 +00:00
|
|
|
#include "nel/misc/string_mapper.h"
|
2013-09-07 16:33:18 +00:00
|
|
|
|
|
|
|
// Project includes
|
2016-01-19 19:37:03 +00:00
|
|
|
#include "nel/3d/driver.h"
|
2013-09-07 16:33:18 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
// using namespace NLMISC;
|
|
|
|
|
|
|
|
namespace NL3D {
|
|
|
|
|
2013-09-07 18:41:07 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
IProgramDrvInfos::IProgramDrvInfos(IDriver *drv, ItGPUPrgDrvInfoPtrList it)
|
2013-09-07 16:33:18 +00:00
|
|
|
{
|
2013-09-07 18:41:07 +00:00
|
|
|
_Driver = drv;
|
|
|
|
_DriverIterator = it;
|
2013-09-07 16:33:18 +00:00
|
|
|
}
|
|
|
|
|
2013-09-07 18:41:07 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
IProgramDrvInfos::~IProgramDrvInfos ()
|
2013-09-07 16:33:18 +00:00
|
|
|
{
|
2013-09-07 18:41:07 +00:00
|
|
|
_Driver->removeGPUPrgDrvInfoPtr(_DriverIterator);
|
2013-09-07 16:33:18 +00:00
|
|
|
}
|
|
|
|
|
2013-09-07 18:41:07 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
IProgram::IProgram()
|
2013-09-07 16:33:18 +00:00
|
|
|
{
|
2013-09-07 18:41:07 +00:00
|
|
|
|
2013-09-07 16:33:18 +00:00
|
|
|
}
|
|
|
|
|
2013-09-07 18:41:07 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
IProgram::~IProgram()
|
2013-09-07 16:33:18 +00:00
|
|
|
{
|
2013-09-09 16:33:38 +00:00
|
|
|
// Must kill the drv mirror of this program.
|
|
|
|
m_DrvInfo.kill();
|
2013-09-07 16:33:18 +00:00
|
|
|
}
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
const char *CProgramIndex::Names[NUM_UNIFORMS] =
|
2013-09-10 13:42:42 +00:00
|
|
|
{
|
|
|
|
"modelView",
|
|
|
|
"modelViewInverse",
|
|
|
|
"modelViewTranspose",
|
|
|
|
"modelViewInverseTranspose",
|
|
|
|
|
|
|
|
"projection",
|
|
|
|
"projectionInverse",
|
|
|
|
"projectionTranspose",
|
|
|
|
"projectionInverseTranspose",
|
|
|
|
|
|
|
|
"modelViewProjection",
|
|
|
|
"modelViewProjectionInverse",
|
|
|
|
"modelViewProjectionTranspose",
|
|
|
|
"modelViewProjectionInverseTranspose",
|
|
|
|
|
|
|
|
"fog",
|
|
|
|
};
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
void IProgram::buildInfo(CSource *source)
|
2013-09-07 16:33:18 +00:00
|
|
|
{
|
2014-07-29 12:39:07 +00:00
|
|
|
// nlassert(!m_Source); // VALID: When deleting driver and creating new one.
|
2013-09-09 16:33:38 +00:00
|
|
|
|
|
|
|
m_Source = source;
|
|
|
|
|
|
|
|
// Fill index cache
|
2013-09-13 22:46:10 +00:00
|
|
|
for (int i = 0; i < CProgramIndex::NUM_UNIFORMS; ++i)
|
2013-09-09 16:33:38 +00:00
|
|
|
{
|
2013-09-10 13:42:42 +00:00
|
|
|
m_Index.Indices[i] = getUniformIndex(m_Index.Names[i]);
|
2013-09-09 16:33:38 +00:00
|
|
|
}
|
2013-09-09 18:49:59 +00:00
|
|
|
|
|
|
|
buildInfo();
|
|
|
|
}
|
|
|
|
|
2013-09-13 22:46:10 +00:00
|
|
|
void IProgram::buildInfo()
|
2013-09-09 18:49:59 +00:00
|
|
|
{
|
|
|
|
|
2013-09-07 16:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace NL3D */
|
|
|
|
|
|
|
|
/* end of file */
|