Advertisement Jump to content
Sign in to follow this  
directx user

X3000 using enum in hlsl shader

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

Hi,

 

I am building an Algorithm, which is suposed to run on both, the cpu and the gpu. It would be really usefull if I could just use my enum in the shaders header file and could just include it in both, my cpp and the hlsl shader itself (enum determines which function is going to be executed). But Unluckily I always get the error X3000 unexspected token when i try to use enums in my shader.

 

On the internet I read that enum is a reserved keyword for HLSL though I found very few examples of HLSL Code using enums, it should be possible or am I wrong?

 

Not even this hlsl file compiles:

enum { test1, test2};


[numthreads(8, 1, 1)]
void CS_NEW( uint ID : SV_DispatchThreadID  )
{
	
}

I am using the Inbuild HLSL Compiler from Visual Studio 2012, am I the only one having this Issue?

Share this post


Link to post
Share on other sites
Advertisement

Well thats unfortunate, I dont know why enum is listed in the msdn then. 

http://msdn.microsoft.com/en-us/library/windows/desktop/bb509569(v=vs.85).aspx

 

Maybe they are only reserving it to implement it later.But anyway thx for the quick explanation.

 

But anyway I dont know, why it would be so difficult to implement something simple as enums, which is only a mater of replacing strings with numbers.

Edited by directx user

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!