rect tex & np2 tex,which one does ATi & 3DLabs support

My video play application will use non power of two texture to display video in OpenGL,now there are 2 extensions I can use:ARB_texture_non_power_of_two & GL_ARB_texture_rectangle,but I should choose a extension that can be used in most card,so which one does ATi & 3DLabs support?

I also has below questions:

  • Which one will be faster in texture upload?
  • Does np2 texture need extra padding size?for example, the real size of “500x500” is “512x512”;
  • Which one will be faster in pixel shader operation?

GL_ARB_texture_rectangle is not supported by ATI.
ATI supports only GL_EXT_texture_rectangle, which does not define sampler2Drect for pixel shaders.
AFAIK GL_ARB_texture_rectangle became core functionality in OpenGL 2.0 (or was it 1.5?).

NPOT textures are supported on Radeon 9 and above, but they’re not reported since support is limited and therefore not compilant with the specs (no mipmaps and perhaps some other limitation).
So, you can assume that any Radeon with ARB_fragment_program will support these limited NPOT textures.
On NVIDIA these are supported on GeForce FX in software mode and on GeForce 6 with full hadrware acceleration.

Which one will be faster in texture upload?
-should be equal

Does np2 texture need extra padding size?
-implementation dependent, so we don’t know actually. Could need extra horizontal padding but not vertical for example.

Which one will be faster in pixel shader operation?
-should make no significant difference, except for GeForce FX which will be slow with NPOT textures

Originally posted by k_szczech:
[b] GL_ARB_texture_rectangle is not supported by ATI.
ATI supports only GL_EXT_texture_rectangle, which does not define sampler2Drect for pixel shaders.
AFAIK GL_ARB_texture_rectangle became core functionality in OpenGL 2.0 (or was it 1.5?).

NPOT textures are supported on Radeon 9 and above, but they’re not reported since support is limited and therefore not compilant with the specs (no mipmaps and perhaps some other limitation).
So, you can assume that any Radeon with ARB_fragment_program will support these limited NPOT textures.
On NVIDIA these are supported on GeForce FX in software mode and on GeForce 6 with full hadrware acceleration.

Which one will be faster in texture upload?
-should be equal

Does np2 texture need extra padding size?
-implementation dependent, so we don’t know actually. Could need extra horizontal padding but not vertical for example.

Which one will be faster in pixel shader operation?
-should make no significant difference, except for GeForce FX which will be slow with NPOT textures [/b]
To my knowledge neither Radeon 9600 nor Radeon 9800 support NPOT in hardware. Or should I say, you can use it, but the rendering is extremely slow.

“GL_ARB_texture_rectangle is not supported by ATI”

not true anymore, newer drivers support it (EXT got ARBed)

not true anymore, newer drivers support it (EXT got ARBed)
Better late than never. Thanks for correction. I based my answer on delphi3d.net:
http://delphi3d.net/hardware/extsupport.php?extension=GL_ARB_texture_rectangle

Is this extension reported by Radeon 9500? Or is it reported by Radeon X / Radeon X1k GPU’s only?

Originally posted by k_szczech:
Is this extension reported by Radeon 9500? Or is it reported by Radeon X / Radeon X1k GPU’s only?
Positive on >= 9500.

Originally posted by pango:
- Does np2 texture need extra padding size?for example, the real size of “500x500” is “512x512”;
Yes, there’s some padding, but not neccesarily to the next POT.

Originally posted by CrazyButcher:
[b] “GL_ARB_texture_rectangle is not supported by ATI”

not true anymore, newer drivers support it (EXT got ARBed) [/b]
Does ATi support “GL_ARB_texture_rectangle”?

Yes

AFAIK GL_ARB_texture_rectangle became core functionality in OpenGL 2.0 (or was it 1.5?).
AFAIK ARB_texture_rectangle didn’t get into core. And most likely it won’t ever get into core, as NPOT support is now near-perfect in recent cards, and NPOT is a strict superset of RECT (except for a sigle division/multiplication to correct coordinates, an operation that the driver injects or optimizes away anyways).

Thanks everyone’s reply,now I want to know: Which extension should I choose,if I want to let my program can be runned in most NVIDIA & ATi card?

Basically RECT textures were a knee jerk ARB reaction to adding some sort of NPOT support in OpenGL and the last time i used them they were not supported on ATI. They are painful to use because they do not use normalized texture coordinates and i think you won’t get wide support for it. NPOT textures on the other hand are more standard and widely available. But beware, NV3x (FX5900 etc.), although had support for NPOT textures but it was essentially worthless since your app would run at 5FPS max, but RECT textures worked fine on that. R3xx (from the same era) had decent NPOT support IIRC (Humus?).
But NV3x is pretty old (and wasn’t all that popular in its prime as well), and NPOT textures have come a long way and there is good support in >= NV4x. My suggestion would be to stick to NPOT.

Originally posted by Zulfiqar Malik:
Basically RECT textures were a knee jerk ARB reaction to adding some sort of NPOT support in OpenGL and the last time i used them they were not supported on ATI. They are painful to use because they do not use normalized texture coordinates and i think you won’t get wide support for it. NPOT textures on the other hand are more standard and widely available. But beware, NV3x (FX5900 etc.), although had support for NPOT textures but it was essentially worthless since your app would run at 5FPS max, but RECT textures worked fine on that. R3xx (from the same era) had decent NPOT support IIRC (Humus?).
But NV3x is pretty old (and wasn’t all that popular in its prime as well), and NPOT textures have come a long way and there is good support in >= NV4x. My suggestion would be to stick to NPOT.

Thanks for your reply,but are you sure : Is ATi support NPOT texture?

Originally posted by pango:
Thanks for your reply,but are you sure : Is ATi support NPOT texture?
They are partially supported on current ATI hw. You can not use mipmaps or repeat addressing mode, otherwise you will end with sw emulation.

You can not use mipmaps or repeat addressing mode, otherwise you will end with sw emulation.
Both of them are not available with RECT either. So NPOT is still the variant that’s easier to use, because you don’t need to modify the texture coordinates. Performance should be roughly the same.

RECT is only the better choice if you have to support old GF cards (that is, FX or less). Or if you really want non-normalized coordinates.

@pango: Since you are using it for a certain video related software therefore i assumed that you probably won’t need mipmaps (and they are not supported in RECT textures as well).
As far as i can remember, ATI has supported NPOT textures since R3xx (with some limitations mentioned by Komat). You can lookup and find whether it suffices your need or not (which it definitely should, i think :slight_smile: ). Even if they don’t, using RECT textures would still not be an option for you.

Thanks so many people reply my post,then I think I should use the NPOT extension,and in fact,the mipmaps function is not used in my app,but I also has some problems:

  • Does NOT texture need extra padding memory?I mean if I create a 500x500 RGBA texture,the video memory driver alloced is 500x500x4,or 512x512x4?

  • Why so many people prefered to NPOT,not RECT,I know the RECT texture is the recommended method for video processing in NVIDIA’S <<GPU Programming Guide>>,but why so many people oppose it?

Mainly because RECT textures are not supported on many ATi platforms. I don’t know how up to date GPU programming guide is, but back in the days using NPOT brought nVidia hardware down to its knees, but they had pretty good performance with RECT textures.
Most people don’t like RECT textures because of support issues on most platforms and the fact that they are non-standard (like not using normalized texture coordinates, which sucks!).
As for extra padding, even if the driver does some extra padding then i think it might be transparent to the application, but even if its not you can easily take account for it in your app (simple enough i guess).

Originally posted by Zulfiqar Malik:
As for extra padding, even if the driver does some extra padding then i think it might be transparent to the application, but even if its not you can easily take account for it in your app (simple enough i guess).
What I want to know is whether extra memory space is needed for NPOT texture?Because my app will play more than one stream videos simultaneously,so the display memory is scarce for my app,if driver allocate 2048x2048x4 bytes memory for 1920x1080 size video,there will be so large memory is wasted,it is not a good news for me.

It depends on what hw you are targeting, because I think GeforceFX are slow with NPOT.

Other GL 2.0 cards do NPOT well and it’s simpler.

I think the idea behind NPOT(and RECT) is to save VRAM but we can’t really know what the driver does. It’s really intended to 2D related work such as yours.