X3000 using enum in hlsl shader

Started by
1 comment, last by directx user 10 years, 4 months ago

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?

Advertisement

There are no enums in HLSL.

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.

This topic is closed to new replies.

Advertisement