PDA

View Full Version : rect tex & np2 tex,which one does ATi & 3DLabs support



pango
01-07-2007, 10:33 PM
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?

k_szczech
01-08-2007, 01:48 AM
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

dobradusa
01-08-2007, 02:43 AM
Originally posted by k_szczech:
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 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.

CrazyButcher
01-08-2007, 02:45 AM
"GL_ARB_texture_rectangle is not supported by ATI"

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

k_szczech
01-08-2007, 04:23 AM
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?

Jens Scheddin
01-08-2007, 06:30 AM
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.

Humus
01-08-2007, 01:58 PM
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.

pango
01-09-2007, 02:02 AM
Originally posted by CrazyButcher:
"GL_ARB_texture_rectangle is not supported by ATI"

not true anymore, newer drivers support it (EXT got ARBed) Does ATi support "GL_ARB_texture_rectangle"?

Humus
01-10-2007, 10:46 PM
Yes

Overmind
01-11-2007, 01:29 AM
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).

pango
01-11-2007, 02:01 AM
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?

Zulfiqar Malik
01-12-2007, 11:38 PM
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.

pango
01-13-2007, 02:10 AM
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?

Komat
01-13-2007, 04:31 AM
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.

Overmind
01-13-2007, 04:40 AM
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.

Zulfiqar Malik
01-13-2007, 06:53 AM
@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 :) ). Even if they don't, using RECT textures would still not be an option for you.

pango
01-14-2007, 05:14 PM
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?

Zulfiqar Malik
01-14-2007, 09:10 PM
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).

pango
01-15-2007, 01:13 AM
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.

V-man
01-15-2007, 10:15 AM
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.

Mark Kilgard
01-18-2007, 12:31 PM
I'm going to try to clear up a couple of mis-conceptions about non-power-of-two (NPOT) and rectangle textures:

* NVIDIA has supported the texture rectangle functionality in hardware since the original GeForce (NV10). If you want to support non-power-of-two texture sizes and don't require mipmaps, the NV/EXT/ARB texture rectangle extensions do the job.

* ATI doesn't support the NV/EXT/ARB texture rectangle extensions on their Windows and Linux drivers but their Apple drivers [B]do{/B] support the EXT/ARB texture rectangle extensions. (Apple uses the texture rectangle functionality as the basis for their compositing window system functionality.)

* NVIDIA has complete hardware-accelerated texturing support for non-power-of-two textures in its GeForce 6, 7, and 8 series GPUs.

* OpenGL 2.0 requires non-power-of-two texturing, BUT does not require hardware acceleration. Therefore if you want to know if the functionality is hardware accelerated, look for the "GL_ARB_texture_non_power_of_two" string in the extensions string. Do not simply assume that OpenGL 2.0 means hardware accelerated non-power-of-two textures because if you will get slooow software rasterization on older GPUs.

* All the NV/EXT/ARB texture rectangle extensions are essentially the same API-wise. They use the exact same enumerants. They are simply document the extensions relative to different versions of the OpenGL core specification. The one caveat is that the ARB_texture_rectangle extension added interactions with the OpenGL Shading Language.

* Texture rectangles (on NVIDIA hardware at least) are highly memory efficient. Non-power-of-two textures on NVIDIA hardware are memory efficient without mipmaps but NPOT with mipmaps are not as memory efficient as power-of-two textures. For example, a 127x127 texture with mipmaps would actually take up more video memory than a 128x128 (power-of-two) texture with mipmaps.

* Someone described texture rectangles as "a knee jerk ARB reaction to adding some sort of NPOT support in OpenGL". That's not quite true. NVIDIA began providing the NV_texture_rectangle extension back in early 2001; it wasn't an ARB project back then. It was just a way to expose a unique capability of the original GeForce architecture for imaging and video applications. Apple and NVIDIA worked to agree on the EXT version of the extension and much later pushed for an ARB standardization (mid 2004). The original effort was long before true non-power-of-textures were widely support (roughly early 2004). Texture rectangles were really designed for image- and video-processing applications that regularly worked with images that typically did not have power-of-two width and height (for example, a 640x480 video frame). Such application domains typically do not require mipmaps and prefer a non-normalized coordinate system (that is [0..width X 0..height] with half-integer pixel centers). This is exactly what texture rectangles provide. The name "texture rectangle" mimics the name "pixel rectangle" used to describe the rendering primitive emitted by a glDrawPixels or glCopyPixels command in OpenGL.

* In older NVIDIA GPUs, there were more situations where you had to use a texture rectangle rather than a conventional 2D texture. For example, floating-point textures in the NV3x generation (GeForce FX or 5) had to be rectangle textures. With the NV4x (GeForce 6) and on, an texture target (1D, 2D, 3D, cube, and rectangle) can work with floating-point texture formats. The NV2x generation (GeForce 3 and Geforce 4 Ti) had a number of special texture shader operations that worked just with texture rectangles. With modern programmable shading, these limitations no longer exist unless you are trying to target these older architectures.

* The ARB_texture_rectangle functionality is not part of the core OpenGL specification. It could be added in some future revision, but I doubt it will because the non-power-of-two texture functionality is core (as of OpenGL 2.0) and is more general.

I hope this helps.

- Mark Kilgard

Play safe. Make good choices.

arekkusu
01-18-2007, 12:42 PM
Originally posted by Mark Kilgard:
* OpenGL 2.0 requires non-power-of-two texturing, BUT does not require hardware acceleration. Therefore if you want to know if the functionality is hardware accelerated, look for the "GL_ARB_texture_non_power_of_two" string in the extensions string.One clarification here-- the presence of the extension string is used to hint hardware accleration on Windows drivers. This is a policy and not anything that you can go look up in a spec.

On ATI's Mac drivers, the Radeon X1600 and later are exporting OpenGL 2.0 and the extension string, because the functionality is supported (although partially via software fallback.) Apple provides an (OS-specific) API to query if your current state vector is going to run with hardware acceleration for vertex and/or fragment processing, which is a more general solution to this problem.

Komat
01-18-2007, 12:56 PM
Originally posted by Mark Kilgard:

* ATI doesn't support the NV/EXT/ARB texture rectangle extensions on their Windows and Linux drivers but their Apple drivers [B]do{/B] support the EXT/ARB texture rectangle extensions.
ATI Windows drivers already support the texture rectangle extension in its variant without GLSL additions for several years. Latest ATI drivers added the GLSL support from the ARB variant.