I'd like to multiply a vector by -1
e.g.
mul r0, r0, -1
When I try this, I get this error message:
SimpleShaderA.vsh(20,17): error X2000: syntax error : unexpected integer '1l'
How can I specify -1 in my (first) shader program?
I'd like to multiply a vector by -1
e.g.
mul r0, r0, -1
When I try this, I get this error message:
SimpleShaderA.vsh(20,17): error X2000: syntax error : unexpected integer '1l'
How can I specify -1 in my (first) shader program?
The mul
assembly instruction takes registers as inputs, not constants. You can do this instead
def c0, -1, -1, -1, -1
mul r0, r0, c0
which uses the def instruction to define a constant vector in register c0
and uses that as the second multiplicand to mul
.
You could also use swizzling on the c0
register, so you could put different constants you may need to multiply by in c0
's components. You can also just write the multiplication in terms of c0
and assign it values via the Set***ShaderConstant*
APIs.