Jump to content
  • Advertisement
Sign in to follow this  
Bvandeweyer

HLSL: array conversion error

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

I'm stuggling with arrays in HLSL. Even a simple code like this:
int Array[2],
Array[1] = 2,
Array[2] = 1;
gives me the following error: "Cannot convert from int to int[ ]..." This means I can't write any value in the array, but I have no idea why this happens. Somehow an integer or float can't be converted to be put into the array. Anyone knows why it gives this error, and how to solve this ? I've been trying to solve this for the past 3 days, but without any luck (even google let me down for the first time). Any help is highly appreciated ! Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Umm...
1) Shouldn't your lines be ending with semicolons?
2) If you have a size 2 array, the indices will be from 0 to 1, not 1 to 2.

Share this post


Link to post
Share on other sites
Well, I thought that too...

but with the semicolons I receive:
"Syntax error: unexpected token '['"

and with the array range starting from 0:
"Error X3059: 'Array': array dimension must be between 1 and 65536"

So when I use the piece of code from my previous post, the syntax looks right, apart from that nasty conversion problem...

BTW, I'm using NVidia's FXComposer to write my shaders and thus get the errors there (but it doesn't work in the gameengine either though).

I think I'm going crazy... ;)

Thanks though.

Share this post


Link to post
Share on other sites
Bear in mind that I know nothing about HLSL... but is "Array" a reserved keyword? Would it work if you changed "Array" to "my_array"?
Just a hunch. [smile] You did say any help...

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!