HDK : GU_Detail pointer changes in 12.5 ?

   2046   2   1
User Avatar
Member
301 posts
Joined: July 2005
Offline
Hi,

I have the following code which currently works in H12.0 but not for H12.5.

The return value from gaptid.get() has some large integer value in H12.5 not corresponding to any of the enum resulting in nothing matches in the case statement.

It may be that I have done it wrong since 12.0 but just happened to work.

I did a simplified test of not housing the GU_Detail pointer in a vector and it works so I am wondering if there are some smart pointer / copy constructor magic that I failed to understand.



typedef std::vector<GU_Detail *> GDPContainer;

template <typename F, typename I>
bool GUDetailVisitor<F,I>::visit()
{
GDPContainer::const_iterator gEI = _gdpContainer.end();
GDPContainer::const_iterator gIter = _gdpContainer.begin();
std::cerr << “GUDetailVisitor::visit _gdpContainer.size() = ” << _gdpContainer.size() << std::endl;
size_t numGDP = _gdpContainer.size();
size_t gdpIndex = 0;
for (;gIter!=gEI;++gIter,gdpIndex++)
{
VisitationMode vm = VM_ACCUMULATE;
if (gdpIndex == (numGDP-1))
vm = VM_EMIT;
bool processStatus = false;
bool encountered_GA_PRIMPOLY = false;
bool encountered_GA_PRIMNURBCURVE = false;
bool treatAsFur_GA_PRIMNURBCURVE = true;
const GEO_Primitive *gprim;

GU_Detail *gdp = *gIter;
GA_FOR_ALL_PRIMITIVES(gdp, gprim)
{
GA_PrimitiveTypeId gaptid = gprim->getTypeId();
switch(gaptid.get()) {
case GA_PRIMPOLY:
if (!encountered_GA_PRIMPOLY)
{
std::cerr << “New visitor encountered GA_PRIMPOLY” << std::endl;
encountered_GA_PRIMPOLY = true;
const GEO_PrimPoly* prim = dynamic_cast<const GEO_PrimPoly*>(gprim);
processStatus = processPrimPoly(prim,gdp,vm);
}
else
continue;
break;


GU_Detail object is created this way

_gdpContainer = new GU_Detail();
if (_gdpContainer)
{
std::cerr << “GUDetailVisitor constructor loading \”" << filenames.c_str() << “\”"<< std::endl;
_gdpContainer->load(is);



Houdini 12.5.487 OS X output

numfiles = 1
GUDetailVisitor constructor loading “/Users/nicholas/sphere.bgeo”
GUDetailVisitor constructor min = -0.984808 -1 -0.936608
GUDetailVisitor constructor max = 0.984808 1 0.936608
GUDetailVisitor constructor gaptid.get() = 167798304
GUDetailVisitor constructor gaptid.get() = 167798304

Houdini 12.0.888 OS X output
numfiles = 1
GUDetailVisitor constructor loading “/Users/nicholas/sphere.bgeo”
GUDetailVisitor constructor min = -0.984808 -1 -0.936608
GUDetailVisitor constructor max = 0.984808 1 0.936608
GUDetailVisitor constructor gaptid.get() = 1
GUDetailVisitor constructor gaptid.get() = 1

Cheers
Nicholas Yue
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Hmm… nothing jumps out at me as being wrong in there, but the primitive type ID definitely shouldn't be 167798304, and that number doesn't jump out as a likely floating point number or ASCII text; maybe it's a pointer that got written in there. Have you found any other suspicious information?

Try printing out gprim->getMapOffset(), and check whether &gprim->getDetail() == gdp.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
301 posts
Joined: July 2005
Offline
I believe I have resolve the issue. It seems to be related to Boost program_options.

H12.0 - Boost 1.46.1 : date_time, iostreams, regex, thread
H12.5 - Boost 1.51.0 : chrono, iostreams, program_options, regex, system, thread

My build was pulling in a different version of Boost and since with H12.5 it has it's own program_options, things become problematic whereas in H12.0 it was fine since it does not ship with program_options.

Until I encounter further problem, I think this is resolved.

For those porting existing code from H12.0 to H12.5, check the Boost version lying around if you are using your own build system (like me, I was using CMake) rather than hcustom.
Nicholas Yue
  • Quick Links