C++: DirectX Flags Hardware_vertexprocessing .. What does this line mean?

I believe some players in my game are having issues with vertex processing. However, I'm confused about this line for adjusting:

if (devType == D3DDEVTYPE_REF) hardware = false;
DWORD flags = (hardware) ? D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE : D3DCREATE_SOFTWARE_VERTEXPROCESSING;

I want to use If ....SupportsHardwareTransformAndLight Then to check if vertexprocessing is enabeld, which is fine, but I look at the above and wondering what exactly it is doing. Is it checking if vertex will work, otherwise use software? Or is it trying to use both? Shouldn't it be one or the other? aka  D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE or just D3DCREATE_SOFTWARE_VERTEXPROCESSING ?

From what I gather it means if TRUE then do hardware, if false, do software.

Thanks!
LVL 7
VallerianiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

itsmeandnobodyelseCommented:
>>>> wondering what exactly it is doing

It is the same as

DWORD flags = 0;

if (hardware)
   // set both bits for hardware and pure device
   flags =  D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE;
else
   // set only software bit
   flags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkrCommented:
You can rewrite

DWORD flags = (hardware) ? D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE  : D3DCREATE_SOFTWARE_VERTEXPROCESSING;

as

DWORD flags;

if (hardware == TRUE) {

  flags = D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE;

} else {

  flags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

}

For more on this so called 'ternary operator', see http://en.wikipedia.org/wiki/?:#C++
0
jkrCommented:
Ooops, that link does not work, use http://en.wikipedia.org/wiki/%3F:#C.2B.2B instead.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

VallerianiAuthor Commented:
Thanks!
0
itsmeandnobodyelseCommented:
Seems I have bad luck this day ;-)
0
VallerianiAuthor Commented:
Ack!!! I thought I had selected two. I ment to select the bottom and the top. My bad! Let me see if I can get this corrected!
0
VallerianiAuthor Commented:
Just have to wait for a mod :) Sorry about that.
0
itsmeandnobodyelseCommented:
>>>> Sorry about that.
Don't worry. I only was afraid I got a bad karma ;-)
0
VallerianiAuthor Commented:
Thanks both!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.