Some fixes
This commit is contained in:
parent
680f260803
commit
c9a2f9dbfc
7 changed files with 19 additions and 11 deletions
|
@ -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 ¶ms) = 0; // set all user-provided params from the storage
|
||||
virtual void setUniformParams(TProgram program, CGPUProgramParams ¶ms) = 0; // set all user-provided params from the storage
|
||||
// @}
|
||||
|
||||
|
||||
|
|
|
@ -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; };
|
||||
|
|
|
@ -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 ¶ms); // set all user-provided params from the storage
|
||||
virtual void setUniformParams(TProgram program, CGPUProgramParams ¶ms); // set all user-provided params from the storage
|
||||
// @}
|
||||
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ bool CDriverD3D::setUniformMaterial(TProgram program, const CMaterial &material)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CDriverD3D::setUniformParams(TProgram program, const CGPUProgramParams ¶ms)
|
||||
void CDriverD3D::setUniformParams(TProgram program, CGPUProgramParams ¶ms)
|
||||
{
|
||||
// todo
|
||||
}
|
||||
|
|
|
@ -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 ¶ms); // set all user-provided params from the storage
|
||||
virtual void setUniformParams(TProgram program, CGPUProgramParams ¶ms); // 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;
|
||||
|
|
|
@ -387,7 +387,7 @@ bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material
|
|||
return true;
|
||||
}
|
||||
|
||||
void CDriverGL::setUniformParams(TProgram program, const CGPUProgramParams ¶ms)
|
||||
void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams ¶ms)
|
||||
{
|
||||
IGPUProgram *prog = NULL;
|
||||
switch (program)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue