Bitwise operators status

Hi,

I need to use the bitwise AND in a fragment shader, and I know the last specification doc says that bitwise operators are illegal, but… on my pc these operators work fine, this is the configuration of my linux box (OpenSuse 10.3):

VENDOR: NVIDIA Corporation
RENDERER: GeForce 7600 GT/PCI/SSE2
VERSION: 2.1.1 NVIDIA 100.14.19
SHADING LANGUAGE VERSION: 1.20 NVIDIA via Cg compiler

I’ve noticed that the latest specs are form 2006, so, what’s the real status of bitwise operators nowadays? Are they supported by current hardware?

They are not supported for the GF7 in hardware. Integers and boolean operators requires a GF8.

So I’m wondering why this Fragment Shader works fine on my GF7:

void main()
{
	int a = 515;
	int b = 255;
	int ris = a & b;

	if(ris == 3)
		gl_FragColor = vec4(0.0, 1.0,  0.0,  1.0);
	else
		gl_FragColor = vec4(1.0, 0.0,  0.0,  1.0);
}

maybe it’s because the Shading Language uses the Cg NVIDIA compiler :confused:

I’d just guess that the compiler can precomptute the constant values. Anyway, G8x is the first GPU to support integer oprations in hardware.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.