Roland Scheidegger wrote:
On 07.06.2008 23:34, Tomas Carnecky wrote:
I even have a small application that demonstrates the problem. If this
is a new bug to you, should I open a bug and attach the app to it?
The app source is attached in case you'd want to test it yourself.
To test fixed-pipeline texturing:
$ ./foo
To test shader texturing:
$ ./foo shader
You should see a red gradient from top to bottom, if you see a red
rectangle with no gradient then that shows the bug.
I think the attached patch (against mesa master) should fix this
problem. I'll commit it if it actually works :-).
It seems to work with your patch. Though I have to say I'm a bit
disappointed with the performance in mesa from git. Normally I have a
2.6.25 kernel, mesa-7.0.3 and libdrm-2.3.0, xf86-video-intel from git.
With these versions opengl works quite well (disregarding the occasional
lockups somewhere in the xserver intel driver, gdb backtrace shows it's
stuck in ioctl(), waiting for irq or something like that). With mesa/drm
from git, when I start glxgears it takes about 5 seconds until the
window is mapped, and another 5-10 seconds until the gears appear. When
I enable TTM in mesa it takes much longer (up to one minute) to start up
(and runs at about 5% of the speed of the non-ttm driver). It may very
well be a problem with my setup etc.
The i915 dri driver has the same bug AFAICS, see
src/mesa/drivers/dri/i915/i915_fragprog.c, the EMIT_TEX() macro.
tom
#define GL_GLEXT_PROTOTYPES
#include <string.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
static const char *shaderSource =
"!!ARBfp1.0"
"TEMP output;"
"TEX output, fragment.texcoord[0], texture[0], RECT;"
"MUL result.color, fragment.color, output;"
"END"
;
static void render()
{
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -5.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1.0f, 1.0f, 0.0f);
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex2i(-1, -1);
glTexCoord2i(100, 0);
glVertex2i(1, -1);
glTexCoord2i(100, 100);
glVertex2i(1, 1);
glTexCoord2i(0, 100);
glVertex2i(-1, 1);
glEnd();
glutSwapBuffers();
}
static void setup_shader()
{
glEnable(GL_FRAGMENT_PROGRAM_ARB);
GLuint shaderName;
glGenProgramsARB(1, &shaderName);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shaderName);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,
GL_PROGRAM_FORMAT_ASCII_ARB, strlen(shaderSource), shaderSource);
}
static void create_texture()
{
glEnable(GL_TEXTURE_RECTANGLE_ARB);
GLuint textureName;
glGenTextures(1, &textureName);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureName);
static unsigned char textureData[100 * 100 * 3];
for (int i = 0; i < 100; ++i) {
for (int j = 1; j < 100; ++j) {
textureData[i * 100 * 3 + j * 3 + 0] = i;
textureData[i * 100 * 3 + j * 3 + 1] = 0;
textureData[i * 100 * 3 + j * 3 + 2] = 0;
}
}
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, 100, 100, 0, GL_RGB,
GL_UNSIGNED_BYTE, textureData);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(300, 300);
int window = glutCreateWindow(argv[0]);
glutDisplayFunc(render);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (float) 300 / 300, 0.1f, 200.0f);
glMatrixMode(GL_MODELVIEW);
create_texture();
if (argv[1] && strcmp(argv[1], "shader") == 0)
setup_shader();
glutMainLoop();
return 0;
}
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev