Hello,
without talking too much about the modalities, why does this code work:
//iteratre through render instances
for(auto pInstance : vSorted)
{
//store pointer to instance and state groups
const StateGroup** pStateGroups = pInstance->GetStateGroups();
std::bitset<64> bPreviousApplied;
//iterate through instance state groups
for(unsigned int i = 0; i < pInstance->GetStateCount(); i++)
{
//store pointer to state group and state pointer
const StateGroup* pGroup(*pStateGroups);
const BaseState** pvCmds = pGroup->GetCommands();
//iterate through command group
for(unsigned int j = 0; j < pGroup->GetCommandCount(); j++)
{
//get pointer to state
const BaseState* pState(*pvCmds);
//get state type
const BaseState::Type type(pState->GetType());
//ignore if same command was applied earlier on stack
if(bPreviousApplied[type])
{
pvCmds++;
continue;
}
//set applied status to skip any further commands of this type
bPreviousApplied[type] = true;
and this one doesn't?
//iteratre through render instances
for(auto pInstance : vSorted)
{
//store pointer to instance and state groups
const StateGroup** pStateGroups = pInstance->GetStateGroups();
DWORD bPreviousApplied(0);
//iterate through instance state groups
for(unsigned int i = 0; i < pInstance->GetStateCount(); i++)
{
//store pointer to state group and state pointer
const StateGroup* pGroup(*pStateGroups);
const BaseState** pvCmds = pGroup->GetCommands();
//iterate through command group
for(unsigned int j = 0; j < pGroup->GetCommandCount(); j++)
{
//get pointer to state
const BaseState* pState(*pvCmds);
//get state type
const BaseState::Type type(pState->GetType());
//ignore if same command was applied earlier on stack
if((bPreviousApplied & (1 << type)) == (1 << type))
{
pvCmds++;
continue;
}
//set applied status to skip any further commands of this type
bPreviousApplied |= (1 << type);
in the second code, where all I did was change the std::bitset to a standard dword. However, in this code he will almost never jump into the if condition, resulting in strange visual anomalies. Well, does somebody see anything I screwed up? I though I got the bit-part of c++ figured out, but seems I didn't. I'd be glad for any help, its already getting late and I start feeling kinda numb :/