Sign in to follow this  

[DX9] Create Shader from BYTE Array

This topic is 2665 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
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

This topic is 2665 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this