Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: corrupt textures on X1600 with 10.5.3?




Chris,

Below please find the reproducer code kindly provided by my colleague:

---

#include <GL/glut.h>
#include <GL/glext.h>
#include <stdio.h>

int win_wd = 1024;
int win_ht = 512;

static const int prgs = 2;
static GLuint vps[prgs];
static GLuint fps[prgs];
static const char* arbvps[prgs] = 
{
"!!ARBvp1.0\n"
"OPTION ARB_position_invariant;\n"
    "MOV result.texcoord[0], vertex.texcoord[0];\n"
"END\n",

"!!ARBvp1.0\n"
"OPTION ARB_position_invariant;\n"
    "MOV result.texcoord[0], vertex.texcoord[0];\n"
"END\n"
};
static const char* arbfps[prgs] = 
{
"!!ARBfp1.0\n"
    "TEMP tcoord;\n"
    "MOV tcoord, fragment.texcoord[0];\n"
    "TEX result.color.x, tcoord, texture[0], 2D;\n"
    "ADD tcoord, tcoord, {0.1,0,0,0};\n"
    "TEX result.color.y, tcoord, texture[0], 2D;\n"
    "ADD tcoord, tcoord, {0,0.1,0,0};\n"
    "TEX result.color.z, tcoord, texture[0], 2D;\n"
    "ADD tcoord, tcoord, {-0.1,0,0,0};\n"
    "TEX result.color.w, tcoord, texture[0], 2D;\n"
"END\n",

    "!!ARBfp1.0\n"
    "TEMP tcoord;\n"
    "MOV tcoord, fragment.texcoord[0];\n"
    "ADD tcoord, tcoord, program.local[0];\n"
    "TEX result.color, tcoord, texture[0], 2D;\n"
"END\n"
};

void bmpstring (char* str)
{
int len = int(strlen(str));
for (int i = 0; i < len; ++i)
glutBitmapCharacter(GLUT_BITMAP_9_BY_15,str[i]);
}

void CreateTexture ()
{
    // Draw a simple quad at Z = 0 (Z range is [-1,1]).

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glViewport(0,0,512,512);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glClearDepth(1);
    glClearColor(0,0,0,1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_QUADS);
    glVertex3f(-0.5f,-0.5f,0);
    glVertex3f( 0.5f,-0.5f,0);
    glVertex3f( 0.5f, 0.5f,0);
    glVertex3f(-0.5f, 0.5f,0);
    glEnd();

    GLuint dummy;
    glGenTextures(1,&dummy);
    glBindTexture(GL_TEXTURE_2D,dummy);
    glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT,0,0,512,512,0);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D,GL_DEPTH_TEXTURE_MODE_ARB,GL_LUMINANCE);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_MODE_ARB,GL_NONE);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_FUNC_ARB,GL_LEQUAL);
}

void inlz_gl_context ()
{
glGenProgramsARB(prgs,vps);
glGenProgramsARB(prgs,fps);
glGetError();

    for (int i = 0; i < prgs; ++i)
    {
   glBindProgramARB(GL_VERTEX_PROGRAM_ARB,vps[i]);
   glProgramStringARB(GL_VERTEX_PROGRAM_ARB,GL_PROGRAM_FORMAT_ASCII_ARB,
            int(strlen(arbvps[i])),arbvps[i]);
   if ( glGetError() != GL_NO_ERROR )
   printf((char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB));

     glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,fps[i]);
   glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,GL_PROGRAM_FORMAT_ASCII_ARB,
            int(strlen(arbfps[i])),arbfps[i]);
   if ( glGetError() != GL_NO_ERROR )
   printf((char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
    }
}

void display ()
{
    // Left side: single pass, fetch the depth texture 4 times.

    glViewport(0,0,512,512);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity ();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity ();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_VERTEX_PROGRAM_ARB);
    glEnable(GL_FRAGMENT_PROGRAM_ARB);
    glBindProgramARB(GL_VERTEX_PROGRAM_ARB,vps[0]);
    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,fps[0]);
    glBegin(GL_QUADS);
    glTexCoord2f(0,0);
    glVertex3f(-1,-1,0);
    glTexCoord2f(1,0);
    glVertex3f( 1,-1,0);
    glTexCoord2f(1,1);
    glVertex3f( 1, 1,0);
    glTexCoord2f(0,1);
    glVertex3f(-1, 1,0);
    glEnd();
    glDisable(GL_VERTEX_PROGRAM_ARB);
    glDisable(GL_FRAGMENT_PROGRAM_ARB);
    glRasterPos2f(-0.85f,0.7f);
    glColor4f(0,0,0,1);
    bmpstring("Single pass, multiple depth texture fetches");

    // Right side: 4 passes, fetch the depth texture once per pass.

    glViewport(512,0,512,512);
    glEnable(GL_VERTEX_PROGRAM_ARB);
    glEnable(GL_FRAGMENT_PROGRAM_ARB);
    glBindProgramARB(GL_VERTEX_PROGRAM_ARB,vps[1]);
    glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,fps[1]);
    for (int i = 0; i < 4; ++i)
    {
        glColorMask(
            i == 0 ? GL_TRUE : GL_FALSE,
            i == 1 ? GL_TRUE : GL_FALSE,
            i == 2 ? GL_TRUE : GL_FALSE,
            i == 3 ? GL_TRUE : GL_FALSE
            );

         glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB,0,
            i == 0 || i == 3 ? 0.0f : 0.1f,
            i == 0 || i == 1 ? 0.0f : 0.1f,
            0,
            0
            );
        glBegin(GL_QUADS);
        glTexCoord2f(0,0);
        glVertex3f(-1,-1,0);
        glTexCoord2f(1,0);
        glVertex3f( 1,-1,0);
        glTexCoord2f(1,1);
        glVertex3f( 1, 1,0);
        glTexCoord2f(0,1);
        glVertex3f(-1, 1,0);
        glEnd();
    }
    glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
    glDisable(GL_VERTEX_PROGRAM_ARB);
    glDisable(GL_FRAGMENT_PROGRAM_ARB);
    glRasterPos2f(-0.85f,0.7f);
    glColor4f(0,0,0,1);
    bmpstring("Multiple passes, single depth texture fetch");

    glutSwapBuffers();
}

void reshape (int wd, int ht)
{
win_wd = wd;
win_ht = ht;
}

void idle ()
{
glutPostRedisplay();
}

int main (int argc, char **argv)
{
    glutInit(&argc, argv);

glutInitDisplayString ( "rgba double depth=24" );
    glutInitWindowSize    ( win_wd, win_ht );
    glutCreateWindow      ( "FPBugs" );
    inlz_gl_context();
    CreateTexture();

    glutDisplayFunc( display );
    glutReshapeFunc( reshape );
glutIdleFunc   ( idle );

    glutMainLoop();
    return 0;
}

---

HTH,
Dario


On 31 May 2008, at 08:28, Bentley, Chris wrote:

Hi all,

Damn!  Sorry about that.  We'll work on fixing it right away, so that we can get a fix out as soon as possible.
Obviously we have a hole in our automated testing.  If you send us the reproducer, we'll be diligent and add
it to our nightly tests.

chrisb


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden

References: 
 >corrupt textures on X1600 with 10.5.3? (From: Ben Supnik <email@hidden>)
 >Re: corrupt textures on X1600 with 10.5.3? (From: Dario Accornero <email@hidden>)
 >Re: corrupt textures on X1600 with 10.5.3? (From: Ben Supnik <email@hidden>)
 >RE: corrupt textures on X1600 with 10.5.3? (From: "Bentley, Chris" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.