Ogre Version: :1 12 13:
Operating System: :OpenSuse Linux:
Render System: :OpenGL3+:
HERE I WILL BE REPORTING STRANGE SITUATIONS WHEN DEBUGGING OGRE WITH GDB :
Hello I have such several short methods of dealing with GPU programs I cannot properly debug
Code: Select all
bool Pass::hasGpuProgram(GpuProgramType programType) const {
return getProgramUsage(programType) != NULL;
}
const GpuProgramPtr& Pass::getGpuProgram(GpuProgramType programType) const
{
OGRE_LOCK_MUTEX(mGpuProgramChangeMutex);
OgreAssert(mProgramUsage[programType], "check whether program is available using hasGpuProgram()");
return mProgramUsage[programType]->getProgram();
}
//-----------------------------------------------------------------------
const GpuProgramPtr& Pass::getVertexProgram(void) const
{
return getGpuProgram(GPT_VERTEX_PROGRAM);
}
//-----------------------------------------------------------------------
const String& Pass::getGpuProgramName(GpuProgramType type) const
{
OGRE_LOCK_MUTEX(mGpuProgramChangeMutex);
const std::unique_ptr<GpuProgramUsage>& programUsage = getProgramUsage(type);
if (!programUsage)
return BLANKSTRING;
else
return programUsage->getProgramName();
}
//-----------------------------------------------------------------------
GpuProgramParametersSharedPtr Pass::getFragmentProgramParameters(void) const
{
return getGpuProgramParameters(GPT_FRAGMENT_PROGRAM);
}
//-----------------------------------------------------------------------
const GpuProgramPtr& Pass::getFragmentProgram(void) const
{
return getGpuProgram(GPT_FRAGMENT_PROGRAM);
}
I pinpointed my problem to that :
Some methods report properly the attached fragment program:
Code: Select all
(gdb) p pass->getGpuProgram(GPT_FRAGMENT_PROGRAM)->getName()
$2 = "myDCW1110TileFragmentShader"
Why the other way around the fragment programs are non-existent :
Code: Select all
(gdb) p pass->mProgramUsage
Code: Select all
$3 = {std::unique_ptr<Ogre::GpuProgramUsage> =
{get() = {<No data fields>}}, std::unique_ptr<Ogre::GpuProgramUsage> =
{get() = {<No data fields>}}, std::unique_ptr<Ogre::GpuProgramUsage> =
{get() = {<No data fields>}}, std::unique_ptr<Ogre::GpuProgramUsage> =
{get() = {<No data fields>}}, std::unique_ptr<Ogre::GpuProgramUsage> =
{get() = {<No data fields>}}, std::unique_ptr<Ogre::GpuProgramUsage> =
{get() = {<No data fields>}}}
And of course mProgramUsage is an array of type :
Code: Select all
(gdb) ptype pass->mProgramUsage
type = class std::unique_ptr<Ogre::GpuProgramUsage> [with _Tp = Ogre::GpuProgramUsage, _Dp = std::default_delete<Ogre::GpuProgramUsage>] {
private:
std::__uniq_ptr_data<_Tp, _Dp, true, true> _M_t;
public:
unique_ptr(std::unique_ptr<Ogre::GpuProgramUsage> &&);
unique_ptr(const std::unique_ptr<Ogre::GpuProgramUsage> &);
~unique_ptr();
std::unique_ptr<Ogre::GpuProgramUsage> & operator=(std::unique_ptr<Ogre::GpuProgramUsage> &&);
std::unique_ptr<Ogre::GpuProgramUsage> & operator=(std::nullptr_t);
std::unique_ptr<Ogre::GpuProgramUsage> & operator=(const std::unique_ptr<Ogre::GpuProgramUsage> &);
std::__add_lvalue_reference_helper<_Tp, true>::type operator*(void) const;
pointer operator->(void) const;
pointer get(void) const;
_Dp & get_deleter(void);
const _Dp & get_deleter(void) const;
operator bool(void) const;
pointer release(void);
void reset(pointer);
void swap(std::unique_ptr<Ogre::GpuProgramUsage> &);
typedef std::__uniq_ptr_impl<_Tp, _Dp>::pointer pointer;
typedef _Dp deleter_type;
} [6]
The problem is : why the mProgramUsage is empty ?
I suspect OGRE_LOCK_MUTEX(mGpuProgramChangeMutex); Is this right ?
Code: Select all
Ogre.log (optional)