This commit is contained in:
kaetemi 2013-09-14 00:46:10 +02:00
parent 08f37643b7
commit 0386673d13
27 changed files with 143 additions and 143 deletions

View file

@ -1455,8 +1455,8 @@ protected:
friend class CTextureDrvShare;
friend class ITextureDrvInfos;
friend class IMaterialDrvInfos;
friend class IGPUProgramDrvInfos;
friend class IGPUProgramParamsDrvInfos;
friend class IProgramDrvInfos;
friend class IProgramParamsDrvInfos;
/// remove ptr from the lists in the driver.
void removeVBDrvInfoPtr(ItVBDrvInfoPtrList vbDrvInfoIt);

View file

@ -26,13 +26,13 @@
#include <nel/misc/types_nl.h>
#include <nel/misc/smart_ptr.h>
#include <nel/3d/gpu_program.h>
#include <nel/3d/program.h>
#include <list>
namespace NL3D {
class CGeometryProgram : public IGPUProgram
class CGeometryProgram : public IProgram
{
public:
/// Constructor

View file

@ -26,13 +26,13 @@
#include <nel/misc/types_nl.h>
#include <nel/misc/smart_ptr.h>
#include <nel/3d/gpu_program.h>
#include <nel/3d/program.h>
#include <list>
namespace NL3D {
class CPixelProgram : public IGPUProgram
class CPixelProgram : public IProgram
{
public:
/// Constructor

View file

@ -1,9 +1,9 @@
/**
* \file gpu_program.h
* \brief IGPUProgram
* \file program.h
* \brief IProgram
* \date 2013-09-07 15:00GMT
* \author Jan Boon (Kaetemi)
* IGPUProgram
* IProgram
*/
/*
@ -25,8 +25,8 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_GPU_PROGRAM_H
#define NL3D_GPU_PROGRAM_H
#ifndef NL3D_PROGRAM_H
#define NL3D_PROGRAM_H
#include <nel/misc/types_nl.h>
// STL includes
@ -40,22 +40,22 @@ namespace NL3D {
// List typedef.
class IDriver;
class IGPUProgramDrvInfos;
typedef std::list<IGPUProgramDrvInfos*> TGPUPrgDrvInfoPtrList;
class IProgramDrvInfos;
typedef std::list<IProgramDrvInfos*> TGPUPrgDrvInfoPtrList;
typedef TGPUPrgDrvInfoPtrList::iterator ItGPUPrgDrvInfoPtrList;
// Class for interaction of vertex program with Driver.
// IGPUProgramDrvInfos represent the real data of the GPU program, stored into the driver (eg: just a GLint for opengl).
class IGPUProgramDrvInfos : public NLMISC::CRefCount
// IProgramDrvInfos represent the real data of the GPU program, stored into the driver (eg: just a GLint for opengl).
class IProgramDrvInfos : public NLMISC::CRefCount
{
private:
IDriver *_Driver;
ItGPUPrgDrvInfoPtrList _DriverIterator;
public:
IGPUProgramDrvInfos (IDriver *drv, ItGPUPrgDrvInfoPtrList it);
IProgramDrvInfos (IDriver *drv, ItGPUPrgDrvInfoPtrList it);
// The virtual dtor is important.
virtual ~IGPUProgramDrvInfos(void);
virtual ~IProgramDrvInfos(void);
virtual uint getUniformIndex(const char *name) const = 0;
};
@ -73,9 +73,9 @@ public:
// This does not work extremely efficient, but it's the most practical option
// for passing builtin parameters onto user provided shaders.
// Note: May need additional flags related to scene sorting, etcetera.
struct CGPUProgramFeatures
struct CProgramFeatures
{
CGPUProgramFeatures() : DriverFlags(0), MaterialFlags(0) { }
CProgramFeatures() : DriverFlags(0), MaterialFlags(0) { }
// Driver builtin parameters
enum TDriverFlags
@ -100,7 +100,7 @@ struct CGPUProgramFeatures
// Stucture used to cache the indices of builtin parameters which are used by the drivers
// Not used for parameters of specific nl3d programs
struct CGPUProgramIndex
struct CProgramIndex
{
enum TName
{
@ -128,12 +128,12 @@ struct CGPUProgramIndex
};
/**
* \brief IGPUProgram
* \brief IProgram
* \date 2013-09-07 15:00GMT
* \author Jan Boon (Kaetemi)
* A generic GPU program
*/
class IGPUProgram : public NLMISC::CRefCount
class IProgram : public NLMISC::CRefCount
{
public:
enum TProfile
@ -195,7 +195,7 @@ public:
std::string DisplayName;
/// Minimal required profile for this GPU program
IGPUProgram::TProfile Profile;
IProgram::TProfile Profile;
const char *SourcePtr;
size_t SourceLen;
@ -207,7 +207,7 @@ public:
inline void setSourcePtr(const char *sourcePtr) { SourceCopy.clear(); SourcePtr = sourcePtr; SourceLen = strlen(sourcePtr); }
/// CVertexProgramInfo/CPixelProgramInfo/... NeL features
CGPUProgramFeatures Features;
CProgramFeatures Features;
/// Map with known parameter indices, used for assembly programs
std::map<std::string, uint> ParamIndices;
@ -217,8 +217,8 @@ public:
};
public:
IGPUProgram();
virtual ~IGPUProgram();
IProgram();
virtual ~IProgram();
// Manage the sources, not allowed after compilation.
// Add multiple sources using different profiles, the driver will use the first one it supports.
@ -230,11 +230,11 @@ public:
// Get the idx of a parameter (ogl: uniform, d3d: constant, etcetera) by name. Invalid name returns ~0
inline uint getUniformIndex(const char *name) const { return m_DrvInfo->getUniformIndex(name); };
inline uint getUniformIndex(const std::string &name) const { return m_DrvInfo->getUniformIndex(name.c_str()); };
inline uint getUniformIndex(CGPUProgramIndex::TName name) const { return m_Index.Indices[name]; }
inline uint getUniformIndex(CProgramIndex::TName name) const { return m_Index.Indices[name]; }
// Get feature information of the current program
inline CSource *source() const { return m_Source; };
inline const CGPUProgramFeatures &features() const { return m_Source->Features; };
inline const CProgramFeatures &features() const { return m_Source->Features; };
inline TProfile profile() const { return m_Source->Profile; }
// Build feature info, called automatically by the driver after compile succeeds
@ -249,16 +249,16 @@ protected:
/// The source used for compilation
NLMISC::CSmartPtr<CSource> m_Source;
CGPUProgramIndex m_Index;
CProgramIndex m_Index;
public:
/// The driver information. For the driver implementation only.
NLMISC::CRefPtr<IGPUProgramDrvInfos> m_DrvInfo;
NLMISC::CRefPtr<IProgramDrvInfos> m_DrvInfo;
}; /* class IGPUProgram */
}; /* class IProgram */
} /* namespace NL3D */
#endif /* #ifndef NL3D_GPU_PROGRAM_H */
#endif /* #ifndef NL3D_PROGRAM_H */
/* end of file */

View file

@ -19,13 +19,13 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/gpu_program.h"
#include "nel/3d/program.h"
#include <list>
namespace NL3D {
class CVertexProgram : public IGPUProgram
class CVertexProgram : public IProgram
{
public:
/// Constructor

View file

@ -167,8 +167,8 @@ SOURCE_GROUP(Driver FILES
../../include/nel/3d/pixel_program.h
geometry_program.cpp
../../include/nel/3d/geometry_program.h
gpu_program.cpp
../../include/nel/3d/gpu_program.h
program.cpp
../../include/nel/3d/program.h
gpu_program_params.cpp
../../include/nel/3d/gpu_program_params.h)

View file

@ -299,7 +299,7 @@ public:
// ***************************************************************************
class CVertexProgamDrvInfosD3D : public IGPUProgramDrvInfos
class CVertexProgamDrvInfosD3D : public IProgramDrvInfos
{
public:
@ -321,7 +321,7 @@ public:
// ***************************************************************************
class CPixelProgramDrvInfosD3D : public IGPUProgramDrvInfos
class CPixelProgramDrvInfosD3D : public IProgramDrvInfos
{
public:
@ -2111,7 +2111,7 @@ public:
{
H_AUTO_D3D(CDriverD3D_getPixelProgramD3D);
CPixelProgramDrvInfosD3D* d3dPixelProgram;
d3dPixelProgram = (CPixelProgramDrvInfosD3D*)(IGPUProgramDrvInfos*)(pixelProgram.m_DrvInfo);
d3dPixelProgram = (CPixelProgramDrvInfosD3D*)(IProgramDrvInfos*)(pixelProgram.m_DrvInfo);
return d3dPixelProgram;
}
@ -2120,7 +2120,7 @@ public:
{
H_AUTO_D3D(CDriverD3D_getVertexProgramD3D);
CVertexProgamDrvInfosD3D* d3dVertexProgram;
d3dVertexProgram = (CVertexProgamDrvInfosD3D*)(IGPUProgramDrvInfos*)(vertexProgram.m_DrvInfo);
d3dVertexProgram = (CVertexProgamDrvInfosD3D*)(IProgramDrvInfos*)(vertexProgram.m_DrvInfo);
return d3dVertexProgram;
}

View file

@ -649,7 +649,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
// because setupTexture() may disable all stage.
if (matShader == CMaterial::Normal
|| ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CGPUProgramFeatures::TextureStages))
|| ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
uint stage;
@ -671,7 +671,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
{
H_AUTO_D3D(CDriverD3D_setupMaterial_normalShaderActivateTextures)
if (matShader == CMaterial::Normal
|| ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CGPUProgramFeatures::TextureStages))
|| ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
uint stage;

View file

@ -37,7 +37,7 @@ namespace NL3D
// ***************************************************************************
CPixelProgramDrvInfosD3D::CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IGPUProgramDrvInfos (drv, it)
CPixelProgramDrvInfosD3D::CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_D3D(CPixelProgramDrvInfosD3D_CPixelProgamDrvInfosD3D)
Shader = NULL;
@ -69,7 +69,7 @@ bool CDriverD3D::compilePixelProgram(CPixelProgram *program)
if (program->m_DrvInfo==NULL)
{
// Find a supported pixel program profile
IGPUProgram::CSource *source = NULL;
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (supportPixelProgram(program->getSource(i)->Profile))
@ -128,7 +128,7 @@ bool CDriverD3D::activePixelProgram(CPixelProgram *program)
{
if (!CDriverD3D::compilePixelProgram(program)) return false;
CPixelProgramDrvInfosD3D *info = static_cast<CPixelProgramDrvInfosD3D *>((IGPUProgramDrvInfos*)program->m_DrvInfo);
CPixelProgramDrvInfosD3D *info = static_cast<CPixelProgramDrvInfosD3D *>((IProgramDrvInfos*)program->m_DrvInfo);
_PixelProgramUser = program;
setPixelShader(info->Shader);
}

View file

@ -26,7 +26,7 @@ namespace NL3D
// ***************************************************************************
CVertexProgamDrvInfosD3D::CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IGPUProgramDrvInfos (drv, it)
CVertexProgamDrvInfosD3D::CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_D3D(CVertexProgamDrvInfosD3D_CVertexProgamDrvInfosD3D)
Shader = NULL;
@ -268,7 +268,7 @@ bool CDriverD3D::compileVertexProgram(NL3D::CVertexProgram *program)
if (program->m_DrvInfo == NULL)
{
// Find nelvp
IGPUProgram::CSource *source = NULL;
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (program->getSource(i)->Profile == CVertexProgram::nelvp)
@ -378,7 +378,7 @@ bool CDriverD3D::activeVertexProgram (CVertexProgram *program)
{
if (!CDriverD3D::compileVertexProgram(program)) return false;
CVertexProgamDrvInfosD3D *info = NLMISC::safe_cast<CVertexProgamDrvInfosD3D *>((IGPUProgramDrvInfos*)program->m_DrvInfo);
CVertexProgamDrvInfosD3D *info = NLMISC::safe_cast<CVertexProgamDrvInfosD3D *>((IProgramDrvInfos*)program->m_DrvInfo);
_VertexProgramUser = program;
setVertexProgram (info->Shader, program);

View file

@ -1627,7 +1627,7 @@ private:
};
// ***************************************************************************
class CVertexProgamDrvInfosGL : public IGPUProgramDrvInfos
class CVertexProgamDrvInfosGL : public IProgramDrvInfos
{
public:
// The GL Id.
@ -1661,7 +1661,7 @@ public:
};
// ***************************************************************************
class CPixelProgamDrvInfosGL : public IGPUProgramDrvInfos
class CPixelProgamDrvInfosGL : public IProgramDrvInfos
{
public:
// The GL Id.

View file

@ -404,7 +404,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
// Must separate texture setup and texture activation in 2 "for"...
// because setupTexture() may disable all stage.
if (matShader != CMaterial::Water
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CGPUProgramFeatures::TextureStages))
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
for (uint stage = 0; stage < inlGetNumTextStages(); ++stage)
@ -441,7 +441,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
&& matShader != CMaterial::Cloud
&& matShader != CMaterial::Water
&& matShader != CMaterial::Specular
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CGPUProgramFeatures::TextureStages))
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
for(uint stage=0 ; stage<inlGetNumTextStages() ; stage++)
@ -573,7 +573,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
// Textures user matrix
if (matShader == CMaterial::Normal
|| ((matShader == CMaterial::Program) && (_LastSetuppedPP->features().MaterialFlags & CGPUProgramFeatures::TextureMatrices))
|| ((matShader == CMaterial::Program) && (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureMatrices))
)
{
setupUserTextureMatrix(inlGetNumTextStages(), mat);

View file

@ -51,7 +51,7 @@ namespace NLDRIVERGL {
// ***************************************************************************
CPixelProgamDrvInfosGL::CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IGPUProgramDrvInfos (drv, it)
CPixelProgamDrvInfosGL::CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_OGL(CPixelProgamDrvInfosGL_CPixelProgamDrvInfosGL)
// Extension must exist
@ -103,7 +103,7 @@ bool CDriverGL::compilePixelProgram(NL3D::CPixelProgram *program)
_PixelProgramEnabled = false;
// Insert into driver list. (so it is deleted when driver is deleted).
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IGPUProgramDrvInfos*)NULL);
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL);
// Create a driver info
CPixelProgamDrvInfosGL *drvInfo;
@ -136,7 +136,7 @@ bool CDriverGL::activeARBPixelProgram(CPixelProgram *program)
if (!CDriverGL::compilePixelProgram(program)) return false;
// Cast the driver info pointer
CPixelProgamDrvInfosGL *drvInfo = safe_cast<CPixelProgamDrvInfosGL*>((IGPUProgramDrvInfos*)program->m_DrvInfo);
CPixelProgamDrvInfosGL *drvInfo = safe_cast<CPixelProgamDrvInfosGL*>((IProgramDrvInfos*)program->m_DrvInfo);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
_PixelProgramEnabled = true;
@ -159,10 +159,10 @@ bool CDriverGL::setupPixelProgram(CPixelProgram *program, GLuint id/*, bool &spe
{
H_AUTO_OGL(CDriverGL_setupARBPixelProgram)
CPixelProgamDrvInfosGL *drvInfo = static_cast<CPixelProgamDrvInfosGL *>((IGPUProgramDrvInfos *)program->m_DrvInfo);
CPixelProgamDrvInfosGL *drvInfo = static_cast<CPixelProgamDrvInfosGL *>((IProgramDrvInfos *)program->m_DrvInfo);
// Find a supported pixel program profile
IGPUProgram::CSource *source = NULL;
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (supportPixelProgram(program->getSource(i)->Profile))

View file

@ -310,7 +310,7 @@ void CDriverGL::setUniformFog(NL3D::IDriver::TProgram program, uint index)
bool CDriverGL::setUniformDriver(TProgram program)
{
IGPUProgram *prog = NULL;
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
@ -322,66 +322,66 @@ bool CDriverGL::setUniformDriver(TProgram program)
}
if (!prog) return false;
const CGPUProgramFeatures &features = prog->features();
const CProgramFeatures &features = prog->features();
if (features.DriverFlags)
{
if (features.DriverFlags & CGPUProgramFeatures::Matrices)
if (features.DriverFlags & CProgramFeatures::Matrices)
{
if (prog->getUniformIndex(CGPUProgramIndex::ModelView) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelView) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelView), ModelView, Identity);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelView), ModelView, Identity);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewInverse) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewInverse), ModelView, Inverse);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverse), ModelView, Inverse);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewTranspose), ModelView, Transpose);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewTranspose), ModelView, Transpose);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewInverseTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose);
}
if (prog->getUniformIndex(CGPUProgramIndex::Projection) != ~0)
if (prog->getUniformIndex(CProgramIndex::Projection) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::Projection), Projection, Identity);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::Projection), Projection, Identity);
}
if (prog->getUniformIndex(CGPUProgramIndex::ProjectionInverse) != ~0)
if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ProjectionInverse), Projection, Inverse);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverse), Projection, Inverse);
}
if (prog->getUniformIndex(CGPUProgramIndex::ProjectionTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ProjectionTranspose), Projection, Transpose);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionTranspose), Projection, Transpose);
}
if (prog->getUniformIndex(CGPUProgramIndex::ProjectionInverseTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewProjection) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewProjection), ModelViewProjection, Identity);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjection), ModelViewProjection, Identity);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewProjectionInverse) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewProjectionTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose);
}
if (prog->getUniformIndex(CGPUProgramIndex::ModelViewProjectionInverseTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CGPUProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose);
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose);
}
}
if (features.DriverFlags & CGPUProgramFeatures::Fog)
if (features.DriverFlags & CProgramFeatures::Fog)
{
if (prog->getUniformIndex(CGPUProgramIndex::Fog) != ~0)
if (prog->getUniformIndex(CProgramIndex::Fog) != ~0)
{
setUniformFog(program, prog->getUniformIndex(CGPUProgramIndex::Fog));
setUniformFog(program, prog->getUniformIndex(CProgramIndex::Fog));
}
}
}
@ -391,7 +391,7 @@ bool CDriverGL::setUniformDriver(TProgram program)
bool CDriverGL::setUniformMaterial(TProgram program, CMaterial &material)
{
IGPUProgram *prog = NULL;
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
@ -403,12 +403,12 @@ bool CDriverGL::setUniformMaterial(TProgram program, CMaterial &material)
}
if (!prog) return false;
const CGPUProgramFeatures &features = prog->features();
const CProgramFeatures &features = prog->features();
// These are also already set by setupMaterial, so setupMaterial uses setUniformMaterialInternal instead
if (features.MaterialFlags & (CGPUProgramFeatures::TextureStages | CGPUProgramFeatures::TextureMatrices))
if (features.MaterialFlags & (CProgramFeatures::TextureStages | CProgramFeatures::TextureMatrices))
{
if (features.MaterialFlags & CGPUProgramFeatures::TextureStages)
if (features.MaterialFlags & CProgramFeatures::TextureStages)
{
for (uint stage = 0; stage < inlGetNumTextStages(); ++stage)
{
@ -427,7 +427,7 @@ bool CDriverGL::setUniformMaterial(TProgram program, CMaterial &material)
}
if (features.MaterialFlags & CGPUProgramFeatures::TextureMatrices)
if (features.MaterialFlags & CProgramFeatures::TextureMatrices)
{
// Textures user matrix
setupUserTextureMatrix(inlGetNumTextStages(), material);
@ -439,7 +439,7 @@ bool CDriverGL::setUniformMaterial(TProgram program, CMaterial &material)
bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material)
{
IGPUProgram *prog = NULL;
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
@ -451,9 +451,9 @@ bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material
}
if (!prog) return false;
const CGPUProgramFeatures &features = prog->features();
const CProgramFeatures &features = prog->features();
if (features.MaterialFlags & ~(CGPUProgramFeatures::TextureStages | CGPUProgramFeatures::TextureMatrices))
if (features.MaterialFlags & ~(CProgramFeatures::TextureStages | CProgramFeatures::TextureMatrices))
{
// none
}
@ -463,7 +463,7 @@ bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material
void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
{
IGPUProgram *prog = NULL;
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:

View file

@ -1151,7 +1151,7 @@ void CDriverGL::toggleGlArraysForEXTVertexShader()
CVertexProgram *vp = _LastSetuppedVP;
if (vp)
{
CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast<CVertexProgamDrvInfosGL *>((IGPUProgramDrvInfos *) vp->m_DrvInfo);
CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast<CVertexProgamDrvInfosGL *>((IProgramDrvInfos *) vp->m_DrvInfo);
if (drvInfo)
{
// Disable all VertexAttribs.
@ -1396,7 +1396,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
CVertexProgram *vp = _LastSetuppedVP;
if (!vp) return;
CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast<CVertexProgamDrvInfosGL *>((IGPUProgramDrvInfos *) vp->m_DrvInfo);
CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast<CVertexProgamDrvInfosGL *>((IProgramDrvInfos *) vp->m_DrvInfo);
if (!drvInfo) return;
uint32 flags= vb.VertexFormat;

View file

@ -41,7 +41,7 @@ namespace NLDRIVERGL {
#endif
// ***************************************************************************
CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL(CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IGPUProgramDrvInfos (drv, it)
CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL(CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_OGL(CVertexProgamDrvInfosGL_CVertexProgamDrvInfosGL);
@ -98,7 +98,7 @@ bool CDriverGL::compileNVVertexProgram(CVertexProgram *program)
_VertexProgramEnabled = false;
// Find nelvp
IGPUProgram::CSource *source = NULL;
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (program->getSource(i)->Profile == CVertexProgram::nelvp)
@ -130,7 +130,7 @@ bool CDriverGL::compileNVVertexProgram(CVertexProgram *program)
}
// Insert into driver list. (so it is deleted when driver is deleted).
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IGPUProgramDrvInfos*)NULL);
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL);
// Create a driver info
*it = drvInfo = new CVertexProgamDrvInfosGL(this, it);
@ -208,7 +208,7 @@ bool CDriverGL::activeNVVertexProgram(CVertexProgram *program)
if (program)
{
// Driver info
CVertexProgamDrvInfosGL *drvInfo = safe_cast<CVertexProgamDrvInfosGL*>((IGPUProgramDrvInfos*)program->m_DrvInfo);
CVertexProgamDrvInfosGL *drvInfo = safe_cast<CVertexProgamDrvInfosGL*>((IProgramDrvInfos*)program->m_DrvInfo);
nlassert(drvInfo);
// Enable vertex program
@ -1529,7 +1529,7 @@ bool CDriverGL::compileARBVertexProgram(NL3D::CVertexProgram *program)
_VertexProgramEnabled = false;
// Find nelvp
IGPUProgram::CSource *source = NULL;
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (program->getSource(i)->Profile == CVertexProgram::nelvp)
@ -1557,7 +1557,7 @@ bool CDriverGL::compileARBVertexProgram(NL3D::CVertexProgram *program)
return false;
}
// Insert into driver list. (so it is deleted when driver is deleted).
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IGPUProgramDrvInfos*)NULL);
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL);
// Create a driver info
CVertexProgamDrvInfosGL *drvInfo;
@ -1600,7 +1600,7 @@ bool CDriverGL::activeARBVertexProgram(CVertexProgram *program)
if (program)
{
// Driver info
CVertexProgamDrvInfosGL *drvInfo = safe_cast<CVertexProgamDrvInfosGL*>((IGPUProgramDrvInfos*)program->m_DrvInfo);
CVertexProgamDrvInfosGL *drvInfo = safe_cast<CVertexProgamDrvInfosGL*>((IProgramDrvInfos*)program->m_DrvInfo);
nlassert(drvInfo);
glEnable( GL_VERTEX_PROGRAM_ARB );
@ -1644,7 +1644,7 @@ bool CDriverGL::compileEXTVertexShader(CVertexProgram *program)
_VertexProgramEnabled = false;
// Find nelvp
IGPUProgram::CSource *source = NULL;
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (program->getSource(i)->Profile == CVertexProgram::nelvp)
@ -1684,7 +1684,7 @@ bool CDriverGL::compileEXTVertexShader(CVertexProgram *program)
*/
// Insert into driver list. (so it is deleted when driver is deleted).
ItGPUPrgDrvInfoPtrList it= _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IGPUProgramDrvInfos*)NULL);
ItGPUPrgDrvInfoPtrList it= _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL);
// Create a driver info
CVertexProgamDrvInfosGL *drvInfo;
@ -1727,7 +1727,7 @@ bool CDriverGL::activeEXTVertexShader(CVertexProgram *program)
if (program)
{
// Driver info
CVertexProgamDrvInfosGL *drvInfo = safe_cast<CVertexProgamDrvInfosGL*>((IGPUProgramDrvInfos*)program->m_DrvInfo);
CVertexProgamDrvInfosGL *drvInfo = safe_cast<CVertexProgamDrvInfosGL*>((IProgramDrvInfos*)program->m_DrvInfo);
nlassert(drvInfo);
glEnable(GL_VERTEX_SHADER_EXT);

View file

@ -1207,7 +1207,7 @@ void CLandscape::render(const CVector &refineCenter, const CVector &frontVecto
_TileVB.activateVP(i);
// c[0..3] take the ModelViewProjection Matrix.
driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
// c[4] take useful constants.
driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants0, 0, 1, 0.5f, 0);
// c[5] take RefineCenter
@ -1215,7 +1215,7 @@ void CLandscape::render(const CVector &refineCenter, const CVector &frontVecto
// c[6] take info for Geomorph trnasition to TileNear.
driver->setUniform2f(IDriver::VertexProgram, program->idx().TileDist, CLandscapeGlobals::TileDistFarSqr, CLandscapeGlobals::OOTileDistDeltaSqr);
// c[10] take the fog vector.
driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::Fog));
driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::Fog));
// c[12] take the current landscape Center / delta Pos to apply
driver->setUniform3f(IDriver::VertexProgram, program->idx().PZBModelPosition, _PZBModelPosition);
}

View file

@ -555,7 +555,7 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv,
}
// c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix();
drv->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
drv->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
return true;
}

View file

@ -315,10 +315,10 @@ inline void CMeshVPWindTree::setupPerInstanceConstants(IDriver *driver, CScene
setupLighting(scene, mbi, invertedModelMat);
// c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix();
driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection),
driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection),
IDriver::ModelViewProjection, IDriver::Identity);
// c[4..7] take the ModelView Matrix. After setupModelMatrix();00
driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::Fog));
driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::Fog));
// c[15] take Wind of level 0.

View file

@ -1,9 +1,9 @@
/**
* \file gpu_program.cpp
* \brief IGPUProgram
* \file program.cpp
* \brief IProgram
* \date 2013-09-07 15:00GMT
* \author Jan Boon (Kaetemi)
* IGPUProgram
* IProgram
*/
/*
@ -26,7 +26,7 @@
*/
#include <nel/misc/types_nl.h>
#include <nel/3d/gpu_program.h>
#include <nel/3d/program.h>
// STL includes
@ -44,7 +44,7 @@ namespace NL3D {
// ***************************************************************************
IGPUProgramDrvInfos::IGPUProgramDrvInfos(IDriver *drv, ItGPUPrgDrvInfoPtrList it)
IProgramDrvInfos::IProgramDrvInfos(IDriver *drv, ItGPUPrgDrvInfoPtrList it)
{
_Driver = drv;
_DriverIterator = it;
@ -52,27 +52,27 @@ IGPUProgramDrvInfos::IGPUProgramDrvInfos(IDriver *drv, ItGPUPrgDrvInfoPtrList it
// ***************************************************************************
IGPUProgramDrvInfos::~IGPUProgramDrvInfos ()
IProgramDrvInfos::~IProgramDrvInfos ()
{
_Driver->removeGPUPrgDrvInfoPtr(_DriverIterator);
}
// ***************************************************************************
IGPUProgram::IGPUProgram()
IProgram::IProgram()
{
}
// ***************************************************************************
IGPUProgram::~IGPUProgram()
IProgram::~IProgram()
{
// Must kill the drv mirror of this program.
m_DrvInfo.kill();
}
const char *CGPUProgramIndex::Names[NUM_UNIFORMS] =
const char *CProgramIndex::Names[NUM_UNIFORMS] =
{
"modelView",
"modelViewInverse",
@ -92,14 +92,14 @@ const char *CGPUProgramIndex::Names[NUM_UNIFORMS] =
"fog",
};
void IGPUProgram::buildInfo(CSource *source)
void IProgram::buildInfo(CSource *source)
{
nlassert(!m_Source);
m_Source = source;
// Fill index cache
for (int i = 0; i < CGPUProgramIndex::NUM_UNIFORMS; ++i)
for (int i = 0; i < CProgramIndex::NUM_UNIFORMS; ++i)
{
m_Index.Indices[i] = getUniformIndex(m_Index.Names[i]);
}
@ -107,7 +107,7 @@ void IGPUProgram::buildInfo(CSource *source)
buildInfo();
}
void IGPUProgram::buildInfo()
void IProgram::buildInfo()
{
}

View file

@ -163,17 +163,17 @@ void CStereoDebugger::setDriver(NL3D::UDriver *driver)
m_PixelProgram = new CPixelProgram();
// arbfp1
{
IGPUProgram::CSource *source = new IGPUProgram::CSource();
source->Features.MaterialFlags = CGPUProgramFeatures::TextureStages;
source->Profile = IGPUProgram::arbfp1;
IProgram::CSource *source = new IProgram::CSource();
source->Features.MaterialFlags = CProgramFeatures::TextureStages;
source->Profile = IProgram::arbfp1;
source->setSourcePtr(a_arbfp1);
m_PixelProgram->addSource(source);
}
// ps_2_0
{
IGPUProgram::CSource *source = new IGPUProgram::CSource();
source->Features.MaterialFlags = CGPUProgramFeatures::TextureStages;
source->Profile = IGPUProgram::ps_2_0;
IProgram::CSource *source = new IProgram::CSource();
source->Features.MaterialFlags = CProgramFeatures::TextureStages;
source->Profile = IProgram::ps_2_0;
source->setSourcePtr(a_ps_2_0);
m_PixelProgram->addSource(source);
}

View file

@ -251,14 +251,14 @@ public:
{
CSource *source = new CSource();
source->Profile = glsl330f;
source->Features.MaterialFlags = CGPUProgramFeatures::TextureStages;
source->Features.MaterialFlags = CProgramFeatures::TextureStages;
source->setSourcePtr(g_StereoOVR_glsl330f);
addSource(source);
}
{
CSource *source = new CSource();
source->Profile = fp40;
source->Features.MaterialFlags = CGPUProgramFeatures::TextureStages;
source->Features.MaterialFlags = CProgramFeatures::TextureStages;
source->setSourcePtr(g_StereoOVR_fp40);
source->ParamIndices["cLensCenter"] = 0;
source->ParamIndices["cScreenCenter"] = 1;
@ -270,7 +270,7 @@ public:
{
CSource *source = new CSource();
source->Profile = arbfp1;
source->Features.MaterialFlags = CGPUProgramFeatures::TextureStages;
source->Features.MaterialFlags = CProgramFeatures::TextureStages;
source->setSourcePtr(g_StereoOVR_arbfp1);
source->ParamIndices["cLensCenter"] = 0;
source->ParamIndices["cScreenCenter"] = 1;
@ -282,7 +282,7 @@ public:
{
CSource *source = new CSource();
source->Profile = ps_2_0;
source->Features.MaterialFlags = CGPUProgramFeatures::TextureStages;
source->Features.MaterialFlags = CProgramFeatures::TextureStages;
source->setSourcePtr(g_StereoOVR_ps_2_0);
source->ParamIndices["cLensCenter"] = 0;
source->ParamIndices["cScreenCenter"] = 1;

View file

@ -1872,11 +1872,11 @@ void CVegetableManager::setupVertexProgramConstants(IDriver *driver, bool fogE
// Standard
// setup VertexProgram constants.
// c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix();
driver->setUniformMatrix(IDriver::VertexProgram, _ActiveVertexProgram->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
driver->setUniformMatrix(IDriver::VertexProgram, _ActiveVertexProgram->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
// c[6] take the Fog vector. After setupModelMatrix();
if (fogEnabled)
{
driver->setUniformFog(IDriver::VertexProgram, _ActiveVertexProgram->getUniformIndex(CGPUProgramIndex::Fog));
driver->setUniformFog(IDriver::VertexProgram, _ActiveVertexProgram->getUniformIndex(CProgramIndex::Fog));
}
// c[8] take useful constants.
driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().ProgramConstants0, 0, 1, 0.5f, 2);

View file

@ -36,7 +36,7 @@ CVertexProgram::CVertexProgram()
CVertexProgram::CVertexProgram(const char *nelvp)
{
CSource *source = new CSource();
source->Profile = IGPUProgram::nelvp;
source->Profile = IProgram::nelvp;
source->setSource(nelvp);
addSource(source);
}

View file

@ -303,7 +303,7 @@ void CWaterEnvMap::renderTestMesh(IDriver &driver)
driver.activeVertexBuffer(_TestVB);
driver.activeIndexBuffer(_TestIB);
_MaterialPassThruZTest.setTexture(0, _EnvCubic);
driver.setUniformMatrix(IDriver::VertexProgram, testMeshVP->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
driver.setUniformMatrix(IDriver::VertexProgram, testMeshVP->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
driver.setUniform2f(IDriver::VertexProgram, testMeshVP->idx().ProgramConstant0, 2.f, 1.f);
//driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS);
driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS);

View file

@ -958,8 +958,8 @@ void CWaterModel::setupMaterialNVertexShader(IDriver *drv, CWaterShape *shape, c
drv->setUniform4f(IDriver::VertexProgram, program->idx().DiffuseMapVector1, _ColorMapMatColumn0.y, _ColorMapMatColumn1.y, 0, _ColorMapMatColumn0.y * obsPos.x + _ColorMapMatColumn1.y * obsPos.y + _ColorMapMatPos.y);
}
// set builtins
drv->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
drv->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::Fog));
drv->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
drv->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::Fog));
// retrieve current time
double date = scene->getCurrentTime();
// set bumpmaps pos

View file

@ -373,7 +373,7 @@ void CDecal::renderTriCache(NL3D::IDriver &drv, NL3D::CShadowPolyReceiver &/*
memcpy(vba.getVertexCoordPointer(), &_TriCache[0], sizeof(CRGBAVertex) * _TriCache.size());
}
drv.activeVertexBuffer(_VB);
drv.setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection), NL3D::IDriver::ModelViewProjection, NL3D::IDriver::Identity);
drv.setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), NL3D::IDriver::ModelViewProjection, NL3D::IDriver::Identity);
drv.setUniform4f(IDriver::VertexProgram, program->idx().WorldToUV0, _WorldToUVMatrix[0][0], _WorldToUVMatrix[1][0], _WorldToUVMatrix[2][0], _WorldToUVMatrix[3][0]);
drv.setUniform4f(IDriver::VertexProgram, program->idx().WorldToUV1, _WorldToUVMatrix[0][1], _WorldToUVMatrix[1][1], _WorldToUVMatrix[2][1], _WorldToUVMatrix[3][1]);
drv.setUniform4f(IDriver::VertexProgram, program->idx().Diffuse, _Diffuse.R * (1.f / 255.f), _Diffuse.G * (1.f / 255.f), _Diffuse.B * (1.f / 255.f), 1.f);