ARB_texture_non_power_of_two and Mac
http://www.idevgames.com/forums/printth ... 814&page=2
Do you guys know of a reliable way of detecting the lying drivers? Help with this would be very appreciated.
Moderator: Inside3D Admins
mh wrote:You could fall back on GL_ARB_texture_rectangle for the 2D stuff; the restrictions it imposes are fine in that case and it's more likely to be properly hardware accelerated in cases where full unconditional non-power-of-two support is unavailable
mh wrote:(or is supported in the driver but not hardware accelerated).
mh wrote:I've seen the same problem happen on some older GeForces as well so I don't think that just blacklisting Radeons is going to give you a comprehensive fix.
szo wrote:mh wrote:I've seen the same problem happen on some older GeForces as well so I don't think that just blacklisting Radeons is going to give you a comprehensive fix.
Is this only with Mac, or did you experience it on windows or linux two? If the latter, then there is no guarantee at all that GL_ARB_texture_non_power_of_two is hardware accelerated for mipmaps?
EDIT: Also, would it be safe to assume that GL_ARB_texture_non_power_of_two is usable without mipmaps, i.e. 2D only, if it is advertised by the driver?
mh wrote:szo wrote:mh wrote:I've seen the same problem happen on some older GeForces as well so I don't think that just blacklisting Radeons is going to give you a comprehensive fix.
Is this only with Mac, or did you experience it on windows or linux two? If the latter, then there is no guarantee at all that GL_ARB_texture_non_power_of_two is hardware accelerated for mipmaps?
EDIT: Also, would it be safe to assume that GL_ARB_texture_non_power_of_two is usable without mipmaps, i.e. 2D only, if it is advertised by the driver?
It was on Windows, and was with a GeForce FX. Both bad news.
Personally I had thought that the FX experience was an abberation before now, a case of NV claiming support for it in order to be able to claim GL2 but utterly unusable in practice; since you've observed it on Mac with a reasonably modern Radeon it does seem quite unreliable.
It's a problem I've hit with OpenGL before; there's actually no guarantee that anything at all is hardware accelerated and no facility to query the driver for hardware acceleration exists. But I would have hoped that in 2012 having to deal with this kind of crap, and/or do vendor/driver-specific workarounds, would have been a thing of the past.
Only thing I can think of might be to load some dummy textures at startup, spend a few frames drawing them, time it, and base a decision on that, but it seems a flaky way of doing it. On the other hand the performance drop-off is so severe that maybe it would work out quite well. With your Windows build you could create a D3D device and query that during startup - that will definitely tell you if you get hardware acceleration or not, but it's useless for Mac and Linux, of course.
An intelligent enough driver should be able to work out that you're using non_power_of_two in scenarios where it can be accelerated and do the right thing, but you're reliant on the driver.
Spike wrote:try checking for GL_APPLE_texture_2D_limited_npot? as far as I'm aware, its a gles-only extension, but you might get lucky.
szo wrote:However a test on a G4 Mac with an ATI Radeon 7550
Baker wrote:szo wrote:However a test on a G4 Mac with an ATI Radeon 7550
I just want to point out that a G4 Mac is at best 2004 era and old PowerPC chip. Not that this observation is material to the problem at hand, but my Macbook Pro with a Radeon of does non-power of two just fine.
And I'm rather confident that this applies to any modern era Mac.
Baker wrote:Those old era Macs with Radeons had a lot of quirks it would seem as the Fruitz of Dojo 1.2 version had all kinds of texture memory checking and a few odd workarounds here and there.
szo wrote:Can you show some sample checks (or a link to the mentioned sources?)
void GL_CheckTextureRAM (GLenum theTarget, GLint theLevel, GLint theInternalFormat, GLsizei theWidth,
GLsizei theHeight, GLsizei theDepth , GLint theBorder, GLenum theFormat,
GLenum theType)
{
GLint myWidth = -1;
GLenum myError,
myTarget;
// flush existing errors:
glGetError ();
// check our target texture type:
switch (theTarget)
{
case GL_TEXTURE_1D:
case GL_PROXY_TEXTURE_1D:
myTarget = GL_PROXY_TEXTURE_1D;
glTexImage1D (myTarget, theLevel, theInternalFormat, theWidth, theBorder, theFormat, theType, NULL);
break;
case GL_TEXTURE_2D:
case GL_PROXY_TEXTURE_2D:
myTarget = GL_PROXY_TEXTURE_2D;
glTexImage2D (myTarget, theLevel, theInternalFormat, theWidth, theHeight, theBorder, theFormat,
theType, NULL);
break;
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
myTarget = GL_PROXY_TEXTURE_3D;
glTexImage3D (myTarget, theLevel, theInternalFormat, theWidth, theHeight, theDepth, theBorder,
theFormat, theType, NULL);
break;
default:
return;
}
myError = glGetError ();
// get the width of the texture [should be zero on failure]:
glGetTexLevelParameteriv (myTarget, theLevel, GL_TEXTURE_WIDTH, &myWidth);
// now let's see if the width is equal to our requested value:
if (myError != GL_NO_ERROR || theWidth != myWidth)
{
Sys_Error ("Out of texture RAM. Please try a lower resolution and/or depth!");
}
}/*
=============
Draw_TransPicTranslate
Only used for the player color selection menu
=============
*/
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation)
{
int v, u, c, p;
unsigned trans[64*64], *dest;
byte *src;
GL_Bind (translate_texture);
c = pic->width * pic->height;
dest = trans;
for (v=0 ; v<64 ; v++, dest += 64)
{
src = &menuplyr_pixels[ ((v*pic->height)>>6) *pic->width];
for (u=0 ; u<64 ; u++)
{
p = src[(u*pic->width)>>6];
dest[u] = (p == 255) ? p : d_8to24table[translation[p]];
}
}
#ifdef MACOSX_TEXRAM_CHECK
GL_CheckTextureRAM (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE);
#endif /* MACOSX */
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glColor3f (1,1,1);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x, y);
glTexCoord2f (1, 0);
glVertex2f (x+pic->width, y);
glTexCoord2f (1, 1);
glVertex2f (x+pic->width, y+pic->height);
glTexCoord2f (0, 1);
glVertex2f (x, y+pic->height);
glEnd ();
}Baker wrote:But the source is in a .dmg which is a disk image and I'm not sure how you can open that without using a Mac.
mh wrote:I'd still pad the 2d stuff at least if not able to use npo2; the quality drop-off is just too much otherwise.
Users browsing this forum: No registered users and 0 guests