• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

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!
0
Valleriani
Asked:
Valleriani
  • 4
  • 3
  • 2
2 Solutions
 
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
 
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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now