Some fixes

--HG--
branch : multipass-stereo
This commit is contained in:
kaetemi 2013-09-10 01:29:53 +02:00
parent 0429e67903
commit 64643e564b
7 changed files with 19 additions and 11 deletions

View file

@ -1201,7 +1201,7 @@ public:
// Set feature parameters // 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 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 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. // The virtual dtor is important.
virtual ~IGPUProgramDrvInfos(void); virtual ~IGPUProgramDrvInfos(void);
virtual uint getUniformIndex(char *name) const = 0; virtual uint getUniformIndex(const char *name) const = 0;
}; };
#define NL_GPU_PROGRAM_LIGHTS 8 #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); } 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 // 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 // Get feature information of the current program
inline CSource *source() const { return m_Source; }; inline CSource *source() const { return m_Source; };

View file

@ -309,7 +309,7 @@ public:
CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it); CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it);
~CVertexProgamDrvInfosD3D(); ~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); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
@ -331,7 +331,7 @@ public:
CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it); CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it);
~CPixelProgramDrvInfosD3D(); ~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); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
@ -1210,7 +1210,7 @@ public:
// Set feature parameters // Set feature parameters
virtual bool setUniformDriver(TProgram program); // set all driver-specific features params (based on program->features->DriverFlags) 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 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; return true;
} }
void CDriverD3D::setUniformParams(TProgram program, const CGPUProgramParams &params) void CDriverD3D::setUniformParams(TProgram program, CGPUProgramParams &params)
{ {
// todo // 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 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 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) 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. // The gl id is auto created here.
CVertexProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it); 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); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
@ -1670,7 +1670,7 @@ public:
// The gl id is auto created here. // The gl id is auto created here.
CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it); 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); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;

View file

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

View file

@ -533,6 +533,14 @@ size_t CGPUProgramParams::getOffset(uint index) const
return m_Map[index]; 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 /// Remove by offset
void CGPUProgramParams::freeOffset(size_t offset) void CGPUProgramParams::freeOffset(size_t offset)
{ {