Skip to main content
GameDev.net gamedev.net
🔒 Locked

X3000 using enum in hlsl shader

Started by directx user Dec 15, 2013 at 1:00 AM 1 replies 13k views
Original Post
directx user
directx user

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?

Mona2000
Mona2000

There are no enums in HLSL.

directx user
directx user

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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.