I've got the following code in a shader:
// v & y are both uints
nPixel = v;
nPixel << 8;
nPixel |= y;
and this gives me the following error in compilation:
shader.fx(80,10): error X3535: Bitwise operations not supported on legacy targets.
shader.fx(92,18): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed
The error is on the following line:
nPixel |= y;
What am I doing wrong here?
Answer
Bitwise operations and integer operations were new for SM 4.0/DX10. As your error says:
Bitwise operations not supported on legacy targets.
You'll have to target DX10.
Alternatively, this blog post suggests using a texture to map results of AND,OR,XOR to different color channels.
bitwise operators texture: AND,OR,XOR
Seems plausible, and might be faster than the alternative I suggested in the comments.
No comments:
Post a Comment