Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to do binary operations with integers in the hlsl code. For example:

int n = 10 & 15;

Binary value of 10 = 1010 and Binary value of 15 = 1111.

With this, n = 10, because (1010 & 1111) = 1010. This is what I need, but if I declare the int values before, I get an error. For example:

int n1 = 10;
int n2 = 15;
int n = n1 & n2;

this shows the error: "error X3535: Bitwise operations not supported on legacy targets."

I made this simple code to help understanding, because I have no idea what is causing this.

I already tried to change the variables type to uint, but the error remains.

I'm using deferred lighting in xna and I want to store the emissive light intensity together with the specular power.

share|improve this question
1  
Related (or duplicate?): gamedev.stackexchange.com/questions/30513/… What version are you targeting? –  Byte56 2 days ago
    
vertex and pixel shader version 2_0, but I want to know why it works when the number is not declared. –  glz 2 days ago
    
It probably does the calculation at compile time when you're using constants, but I'm not sure. –  Byte56 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.