PDA

View Full Version : bitwise operators status



m3xican
11-02-2007, 10:40 AM
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?

oc2k1
11-02-2007, 11:36 AM
They are not supported for the GF7 in hardware. Integers and boolean operators requires a GF8.

m3xican
11-05-2007, 11:42 AM
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:

Zengar
11-05-2007, 12:11 PM
I'd just guess that the compiler can precomptute the constant values. Anyway, G8x is the first GPU to support integer oprations in hardware.