Some fixes

This commit is contained in:
kaetemi 2013-09-10 01:29:53 +02:00
parent bc409d3426
commit 14df080ede
7 changed files with 19 additions and 11 deletions

View file

@ -1201,7 +1201,7 @@ public:
// Set feature parameters
virtual bool setUniformDriver(TProgram program) = 0; // set all driver-specific features params (based on program->features->DriverFlags) (called automatically when rendering with cmaterial and using a user program)
virtual bool setUniformMaterial(TProgram program, CMaterial &material) = 0; // set all material-specific feature params (based on program->features->MaterialFlags) (called automatically when rendering with cmaterial and using a user program)
virtual void setUniformParams(TProgram program, const CGPUProgramParams &params) = 0; // set all user-provided params from the storage
virtual void setUniformParams(TProgram program, CGPUProgramParams &params) = 0; // set all user-provided params from the storage
// @}

View file

@ -57,7 +57,7 @@ public:
// The virtual dtor is important.
virtual ~IGPUProgramDrvInfos(void);
virtual uint getUniformIndex(char *name) const = 0;
virtual uint getUniformIndex(const char *name) const = 0;
};
#define NL_GPU_PROGRAM_LIGHTS 8
@ -261,7 +261,7 @@ public:
inline void removeSource(size_t i) { nlassert(!m_Source); m_Sources.erase(m_Sources.begin() + i); }
// Get the idx of a parameter (ogl: uniform, d3d: constant, etcetera) by name. Invalid name returns ~0
inline uint getUniformIndex(char *name) const { return m_DrvInfo->getUniformIndex(name); };
inline uint getUniformIndex(const char *name) const { return m_DrvInfo->getUniformIndex(name); };
// Get feature information of the current program
inline CSource *source() const { return m_Source; };

View file

@ -309,7 +309,7 @@ public:
CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it);
~CVertexProgamDrvInfosD3D();
virtual uint getUniformIndex(char *name) const
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
@ -331,7 +331,7 @@ public:
CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it);
~CPixelProgramDrvInfosD3D();
virtual uint getUniformIndex(char *name) const
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
@ -1210,7 +1210,7 @@ public:
// Set feature parameters
virtual bool setUniformDriver(TProgram program); // set all driver-specific features params (based on program->features->DriverFlags)
virtual bool setUniformMaterial(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags)
virtual void setUniformParams(TProgram program, const CGPUProgramParams &params); // set all user-provided params from the storage
virtual void setUniformParams(TProgram program, CGPUProgramParams &params); // set all user-provided params from the storage
// @}

View file

@ -229,7 +229,7 @@ bool CDriverD3D::setUniformMaterial(TProgram program, const CMaterial &material)
return true;
}
void CDriverD3D::setUniformParams(TProgram program, const CGPUProgramParams &params)
void CDriverD3D::setUniformParams(TProgram program, CGPUProgramParams &params)
{
// todo
}

View file

@ -1417,7 +1417,7 @@ private:
virtual bool setUniformDriver(TProgram program); // set all driver-specific features params (based on program->features->DriverFlags)
virtual bool setUniformMaterial(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags)
bool setUniformMaterialInternal(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags)
virtual void setUniformParams(TProgram program, const CGPUProgramParams &params); // set all user-provided params from the storage
virtual void setUniformParams(TProgram program, CGPUProgramParams &params); // set all user-provided params from the storage
// @}
@ -1650,7 +1650,7 @@ public:
// The gl id is auto created here.
CVertexProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it);
virtual uint getUniformIndex(char *name) const
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
@ -1670,7 +1670,7 @@ public:
// The gl id is auto created here.
CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it);
virtual uint getUniformIndex(char *name) const
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;

View file

@ -387,7 +387,7 @@ bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material
return true;
}
void CDriverGL::setUniformParams(TProgram program, const CGPUProgramParams &params)
void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
{
IGPUProgram *prog = NULL;
switch (program)

View file

@ -533,6 +533,14 @@ size_t CGPUProgramParams::getOffset(uint index) const
return m_Map[index];
}
size_t CGPUProgramParams::getOffset(const std::string &name) const
{
std::map<std::string, size_t>::const_iterator it = m_MapName.find(name);
if (it == m_MapName.end())
return s_End;
return it->second;
}
/// Remove by offset
void CGPUProgramParams::freeOffset(size_t offset)
{