Jump to content
  • Advertisement
Sign in to follow this  
XeonXT

[DX9] Create Shader from BYTE Array

This topic is 2973 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I compile a vertex shader with fxc.exe with /Fh such that I get an object-code header file, I am left with the following array describing my shader:

const BYTE g_vs20_VS[] =
{
0, 2, 254, 255, 254, 255,
22, 0, 67, 84, 65, 66,
28, 0, 0, 0, 35, 0,
0, 0, 0, 2, 254, 255,
0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0,
28, 0, 0, 0, 118, 115,
95, 50, 95, 48, 0, 77,
105, 99, 114, 111, 115, 111,
102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32,
83, 104, 97, 100, 101, 114,
32, 67, 111, 109, 112, 105,
108, 101, 114, 32, 57, 46,
50, 55, 46, 57, 53, 50,
46, 51, 48, 50, 50, 0,
31, 0, 0, 2, 0, 0,
0, 128, 0, 0, 15, 144,
31, 0, 0, 2, 5, 0,
0, 128, 1, 0, 15, 144,
1, 0, 0, 2, 0, 0,
15, 192, 0, 0, 228, 144,
1, 0, 0, 2, 0, 0,
3, 224, 1, 0, 228, 144,
255, 255, 0, 0
};


However, device->CreateVertexShader takes a DWORD array rather than a BYTE array.

What am I missing here?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Figured it out by testing and praying.

In case anyone else ever has this dilemma, the answer is simple: just cast that puppy and forget your troubles.

device->CreateVertexShader((DWORD*)mah1337ByteCodez, ...);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!