Sign in to follow this  
JDX_John

Are render-target textures special?

Recommended Posts

Hardware we're targeting is old enough to have issues like requiring power-of-2 texture sizes - integrated Intel chips like GMA950 are the low-end of our range.

For rendering full-screen, you might often want to render to a full-size off-screen buffer using a render-texture. I wondered if this has exactly the same rules as other textures - because rendering the entire scene to a pow2 target is going to be a pain when few resolutions are power of two... you'd get stretching/squashing artifacts.

Is anyone expert in older hardware specs and tips/tricks?

Share this post


Link to post
Share on other sites
I've used non-power-of-two render target textures on Intels going back to the 910/915 range and they work Just Fine. (What I haven't done is try LockRect'ing the texture and seeing what the Pitch value is; that might be an interesting exercise.)

Share this post


Link to post
Share on other sites
I'm not sure about the exact D3D rules, but under OpenGL you can create NPOT textures on these devices, for both texturing and rendering, subject to a bunch of restrictions. The big ones are that such textures cannot be mipmapped, and the only supported wrap mode is Clamp to Edge.
On OS X at least, these textures are supported all the way back to Rage 128. I'd be shocked if that same functionally wasn't also available somehow in D3D.
Restriction-free NPOT textures obviously only appeared on later devices.

Share this post


Link to post
Share on other sites
[quote name='JDX_John' timestamp='1318947838' post='4873924']
And [i]regular[/i] textures [i]did[/i] have to obey the pow2 rule on such chips?

Thanks!
[/quote]

Yup, that's roundabout it. Of course, the fillrate overhead of using render to texture hurts performance with these chips, but otherwise everything works as expected. My old 915-equipped laptop has gone to the great parts bin in the sky, but I've just tested and confirmed on a 945.

[quote name='frogblast' timestamp='1318952926' post='4873954']
I'm not sure about the exact D3D rules, but under OpenGL you can create NPOT textures on these devices, for both texturing and rendering, subject to a bunch of restrictions. The big ones are that such textures cannot be mipmapped, and the only supported wrap mode is Clamp to Edge.
On OS X at least, these textures are supported all the way back to Rage 128. I'd be shocked if that same functionally wasn't also available somehow in D3D.
Restriction-free NPOT textures obviously only appeared on later devices.
[/quote]

That would be GL_ARB_texture_rectangle; I haven't checked the extension string on an Intel for this but I'd be amazed if Intel exposed it (even if the hardware did support it). Although they do expose GL_ARB_vertex_buffer_object on these parts (and even ARB asm vertex/fragment programs!) so I've been surprised by them before.

The D3D terminology is conditional versus unconditional non-power-of-2 support, and works in broadly the same way.

The restrictions aren't that big a deal with standard render target usage; most commonly you're not going to need mipmaps or repeat wrap modes anyway.

The bear trap here is the GeForce FX series (hopefully you'll never have to come across one of these) which exposed GL_ARB_texture_non_power_of_two (as it was required to in order to claim OpenGL 2.0 support) but dropped you back to full software emulation without warning if you tried to use it (as it was allowed to per the OpenGL spec). Grrrrr. (I never got to test how this part behaved under D3D.)

Share this post


Link to post
Share on other sites
Render targets can be pretty much any resolution that the hardware supports, without regard to power of two-ness.

However textures and targets that aren't power of two are likely to use extra memory due being rounded up to some hardware specific tile or pitch requirement, and are harder (impossible? hard to remember) to use UV tiling

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this