Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: bitwise operators status

  1. #1
    Intern Newbie m3xican's Avatar
    Join Date
    Nov 2007
    Location
    Italy -> Naples
    Posts
    36

    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?

  2. #2
    Junior Member Regular Contributor oc2k1's Avatar
    Join Date
    Jan 2007
    Location
    germany
    Posts
    170

    Re: bitwise operators status

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

  3. #3
    Intern Newbie m3xican's Avatar
    Join Date
    Nov 2007
    Location
    Italy -> Naples
    Posts
    36

    Re: bitwise operators status

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

    Code :
    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

  4. #4
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,932

    Re: bitwise operators status

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •