summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-07-17 22:00:47 -0600
committerBrian Paul <brianp@vmware.com>2009-07-17 22:00:47 -0600
commitb96ae1b2c463d6d99ee0418083ef68f4027b7cd7 (patch)
treef34f89c267b940eb7408475bd0c2ff57c7fbe992
parentf81f57e25db18b1c69f2f8076380603340fa2cda (diff)
parentcd10996d4f517c69e306eaf6dfb0654432651b3a (diff)
Merge branch 'mesa_7_5_branch'
Conflicts: Makefile progs/glsl/multitex.c src/mesa/main/enums.c src/mesa/main/state.c src/mesa/main/texenvprogram.c src/mesa/main/version.h
-rw-r--r--docs/cell.html2
-rw-r--r--docs/news.html10
-rw-r--r--docs/relnotes-7.5.html4
-rw-r--r--progs/glsl/array.c16
-rw-r--r--progs/glsl/bitmap.c27
-rw-r--r--progs/glsl/brick.c19
-rw-r--r--progs/glsl/bump.c24
-rw-r--r--progs/glsl/deriv.c19
-rw-r--r--progs/glsl/fragcoord.c19
-rw-r--r--progs/glsl/identity.c19
-rw-r--r--progs/glsl/linktest.c53
-rw-r--r--progs/glsl/mandelbrot.c31
-rw-r--r--progs/glsl/multinoise.c39
-rw-r--r--progs/glsl/multitex.c60
-rw-r--r--progs/glsl/noise.c21
-rw-r--r--progs/glsl/pointcoord.c23
-rw-r--r--progs/glsl/points.c23
-rw-r--r--progs/glsl/samplers.c9
-rw-r--r--progs/glsl/shadow_sampler.c49
-rw-r--r--progs/glsl/skinning.c27
-rw-r--r--progs/glsl/texaaline.c5
-rw-r--r--progs/glsl/texdemo1.c9
-rw-r--r--progs/glsl/toyball.c13
-rw-r--r--progs/glsl/trirast.c31
-rw-r--r--progs/glsl/twoside.c27
-rw-r--r--progs/glsl/vert-or-frag-only.c25
-rw-r--r--progs/glsl/vert-tex.c13
-rw-r--r--progs/util/shaderutil.c36
-rw-r--r--scons/fixes.py27
-rw-r--r--scons/gallium.py2
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c42
-rw-r--r--src/gallium/state_trackers/python/SConscript13
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/interpreter.py20
-rw-r--r--src/gallium/state_trackers/python/samples/tri.py2
-rw-r--r--src/gallium/state_trackers/python/st_device.c8
-rw-r--r--src/gallium/state_trackers/python/st_hardpipe_winsys.c181
-rw-r--r--src/gallium/state_trackers/wgl/SConscript1
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_extgallium.c79
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_extgallium.h47
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c7
-rw-r--r--src/mesa/main/attrib.c8
-rw-r--r--src/mesa/main/imports.c125
-rw-r--r--src/mesa/main/mtypes.h7
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c23
44 files changed, 775 insertions, 470 deletions
diff --git a/docs/cell.html b/docs/cell.html
index ada903cf8a..30626b60b4 100644
--- a/docs/cell.html
+++ b/docs/cell.html
@@ -12,7 +12,7 @@
The Mesa
<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
driver is part of the
-<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
+<a href="http://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
architecture.
Tungsten Graphics did the original implementation of the Cell driver.
</p>
diff --git a/docs/news.html b/docs/news.html
index ee4a86c2a2..712ecedc10 100644
--- a/docs/news.html
+++ b/docs/news.html
@@ -11,6 +11,14 @@
<H1>News</H1>
+<h2>July 17, 2009</h2>
+<p>
+<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
+This is a new features release. People especially concerned about
+stability may want to wait for the follow-on 7.5.1 bug-fix release.
+</p>
+
+
<h2>June 23, 2009</h2>
<p>
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
@@ -99,7 +107,7 @@ Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
<p>
Gallium3D is the codename for the new Mesa device driver architecture
which is currently under development.
-A <a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
+A <a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent"> summary</a> of the architecture can be found on the
Tungsten Graphics website.
</p>
diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html
index 5a67d3fb52..8bcacd62e1 100644
--- a/docs/relnotes-7.5.html
+++ b/docs/relnotes-7.5.html
@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
-<H1>Mesa 7.5 Release Notes / date TBD</H1>
+<H1>Mesa 7.5 Release Notes / 17 July 2009</H1>
<p>
Mesa 7.5 is a new development release.
@@ -17,7 +17,7 @@ with the 7.4.x branch or wait for Mesa 7.5.1.
</p>
<p>
The main new feature of Mesa 7.5 is the
-<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
+<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
diff --git a/progs/glsl/array.c b/progs/glsl/array.c
index 6da15b2fcc..4ed18485ea 100644
--- a/progs/glsl/array.c
+++ b/progs/glsl/array.c
@@ -10,9 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -144,9 +142,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -219,19 +217,17 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
/* Setup the HeightArray[] uniform */
for (i = 0; i < 20; i++)
HeightArray[i] = i / 20.0;
- u = glGetUniformLocation_func(program, "HeightArray");
- glUniform1fv_func(u, 20, HeightArray);
+ u = glGetUniformLocation(program, "HeightArray");
+ glUniform1fv(u, 20, HeightArray);
assert(glGetError() == 0);
diff --git a/progs/glsl/bitmap.c b/progs/glsl/bitmap.c
index 08fac15c89..8b1853d9ab 100644
--- a/progs/glsl/bitmap.c
+++ b/progs/glsl/bitmap.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -79,11 +76,11 @@ Redisplay(void)
BitmapText("-X");
}
else {
- glUseProgram_func(Program);
+ glUseProgram(Program);
/* vertex positions (deltas) depend on texture size and window size */
if (uScale != -1) {
- glUniform2f_func(uScale,
+ glUniform2f(uScale,
2.0 * TEX_WIDTH / WinWidth,
2.0 * TEX_HEIGHT / WinHeight);
}
@@ -106,7 +103,7 @@ Redisplay(void)
glTexCoord2f(0, 1); glVertex3fv(nx);
glEnd();
- glUseProgram_func(0);
+ glUseProgram(0);
}
glPopMatrix();
@@ -161,9 +158,9 @@ Key(unsigned char key, int x, int y)
printf("Using billboard texture\n");
break;
case 27:
- glDeleteShader_func(FragShader);
- glDeleteShader_func(VertShader);
- glDeleteProgram_func(Program);
+ glDeleteShader(FragShader);
+ glDeleteShader(VertShader);
+ glDeleteProgram(Program);
glutDestroyWindow(Win);
exit(0);
}
@@ -278,21 +275,19 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
- glUseProgram_func(Program);
+ glUseProgram(Program);
- uScale = glGetUniformLocation_func(Program, "scale");
- uTex = glGetUniformLocation_func(Program, "tex2d");
+ uScale = glGetUniformLocation(Program, "scale");
+ uTex = glGetUniformLocation(Program, "tex2d");
if (uTex != -1) {
- glUniform1i_func(uTex, 0); /* tex unit 0 */
+ glUniform1i(uTex, 0); /* tex unit 0 */
}
- glUseProgram_func(0);
+ glUseProgram(0);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
diff --git a/progs/glsl/brick.c b/progs/glsl/brick.c
index 607acd0597..1d08b231e7 100644
--- a/progs/glsl/brick.c
+++ b/progs/glsl/brick.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -83,9 +80,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -145,13 +142,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -161,9 +156,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c
index c401e590f7..ddb986abcb 100644
--- a/progs/glsl/bump.c
+++ b/progs/glsl/bump.c
@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
+#include <GL/glew.h>
#include <GL/glut.h>
-#include <GL/glu.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -60,7 +58,7 @@ static void
Square(GLfloat size)
{
glNormal3f(0, 0, 1);
- glVertexAttrib3f_func(tangentAttrib, 1, 0, 0);
+ glVertexAttrib3f(tangentAttrib, 1, 0, 0);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-size, -size);
glTexCoord2f(1, 0); glVertex2f( size, -size);
@@ -164,9 +162,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -230,17 +228,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
assert(glGetError() == 0);
@@ -250,7 +246,7 @@ Init(void)
CheckError(__LINE__);
- tangentAttrib = glGetAttribLocation_func(program, "Tangent");
+ tangentAttrib = glGetAttribLocation(program, "Tangent");
printf("Tangent Attrib: %d\n", tangentAttrib);
assert(tangentAttrib >= 0);
diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c
index 3fd674c331..9cf1e40e3e 100644
--- a/progs/glsl/deriv.c
+++ b/progs/glsl/deriv.c
@@ -14,10 +14,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -71,9 +68,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -178,13 +175,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -198,9 +193,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/fragcoord.c b/progs/glsl/fragcoord.c
index 509ad47e7f..9f56a038c9 100644
--- a/progs/glsl/fragcoord.c
+++ b/progs/glsl/fragcoord.c
@@ -13,10 +13,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -86,9 +83,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -130,13 +127,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -144,9 +139,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/identity.c b/progs/glsl/identity.c
index 5ba7468cc4..a772ccd716 100644
--- a/progs/glsl/identity.c
+++ b/progs/glsl/identity.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -70,9 +67,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -142,8 +139,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
if (FragProgFile)
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -156,7 +151,7 @@ Init(void)
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -165,9 +160,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c
index fe5d1564e0..ec3fffbf9c 100644
--- a/progs/glsl/linktest.c
+++ b/progs/glsl/linktest.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -133,11 +130,11 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(VertShader1);
- glDeleteShader_func(VertShader2);
- glDeleteShader_func(FragShader1);
- glDeleteShader_func(FragShader2);
- glDeleteProgram_func(Program);
+ glDeleteShader(VertShader1);
+ glDeleteShader(VertShader2);
+ glDeleteShader(FragShader1);
+ glDeleteShader(FragShader2);
+ glDeleteProgram(Program);
glutDestroyWindow(Win);
}
@@ -176,11 +173,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
- glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+ glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetProgramInfoLog_func(prog, 1000, &len, log);
+ glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -192,8 +189,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1);
@@ -201,26 +196,26 @@ Init(void)
FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1);
FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2);
- Program = glCreateProgram_func();
- glAttachShader_func(Program, VertShader1);
- glAttachShader_func(Program, VertShader2);
- glAttachShader_func(Program, FragShader1);
- glAttachShader_func(Program, FragShader2);
+ Program = glCreateProgram();
+ glAttachShader(Program, VertShader1);
+ glAttachShader(Program, VertShader2);
+ glAttachShader(Program, FragShader1);
+ glAttachShader(Program, FragShader2);
- glLinkProgram_func(Program);
+ glLinkProgram(Program);
CheckLink(Program);
- glUseProgram_func(Program);
+ glUseProgram(Program);
- uDiffuse = glGetUniformLocation_func(Program, "diffuse");
- uSpecular = glGetUniformLocation_func(Program, "specular");
- uTexture = glGetUniformLocation_func(Program, "texture");
+ uDiffuse = glGetUniformLocation(Program, "diffuse");
+ uSpecular = glGetUniformLocation(Program, "specular");
+ uTexture = glGetUniformLocation(Program, "texture");
printf("DiffusePos %d SpecularPos %d TexturePos %d\n",
uDiffuse, uSpecular, uTexture);
- glUniform4fv_func(uDiffuse, 1, diffuse);
- glUniform4fv_func(uSpecular, 1, specular);
+ glUniform4fv(uDiffuse, 1, diffuse);
+ glUniform4fv(uSpecular, 1, specular);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
@@ -229,11 +224,11 @@ Init(void)
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f);
- assert(glIsProgram_func(Program));
- assert(glIsShader_func(VertShader1));
- assert(glIsShader_func(VertShader2));
- assert(glIsShader_func(FragShader1));
- assert(glIsShader_func(FragShader2));
+ assert(glIsProgram(Program));
+ assert(glIsShader(VertShader1));
+ assert(glIsShader(VertShader2));
+ assert(glIsShader(FragShader1));
+ assert(glIsShader(FragShader2));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/mandelbrot.c b/progs/glsl/mandelbrot.c
index eeea4eb52a..38dffc3e74 100644
--- a/progs/glsl/mandelbrot.c
+++ b/progs/glsl/mandelbrot.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -57,9 +54,9 @@ Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* set interactive uniform parameters */
- glUniform1fv_func(uZoom, 1, &zoom);
- glUniform1fv_func(uXcenter, 1, &xCenter);
- glUniform1fv_func(uYcenter, 1, &yCenter);
+ glUniform1fv(uZoom, 1, &zoom);
+ glUniform1fv(uXcenter, 1, &xCenter);
+ glUniform1fv(uYcenter, 1, &yCenter);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
@@ -95,9 +92,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -156,19 +153,17 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
InitUniforms(program, Uniforms);
- uZoom = glGetUniformLocation_func(program, "Zoom");
- uXcenter = glGetUniformLocation_func(program, "Xcenter");
- uYcenter = glGetUniformLocation_func(program, "Ycenter");
+ uZoom = glGetUniformLocation(program, "Zoom");
+ uXcenter = glGetUniformLocation(program, "Xcenter");
+ uYcenter = glGetUniformLocation(program, "Ycenter");
assert(glGetError() == 0);
@@ -176,9 +171,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c
index 400511508e..0afe230801 100644
--- a/progs/glsl/multinoise.c
+++ b/progs/glsl/multinoise.c
@@ -9,10 +9,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
static const char *VertShaderText =
"void main() {\n"
@@ -108,10 +105,10 @@ CleanUp(void)
{
GLint i;
- glDeleteShader_func(vertShader);
+ glDeleteShader(vertShader);
for( i = 0; i < 4; i++ ) {
- glDeleteShader_func(fragShader[ i ]);
- glDeleteProgram_func(program[ i ]);
+ glDeleteShader(fragShader[ i ]);
+ glDeleteProgram(program[ i ]);
}
glutDestroyWindow(win);
}
@@ -144,7 +141,7 @@ Key(unsigned char key, int x, int y)
case '2':
case '3':
case '4':
- glUseProgram_func(program[ key - '1' ]);
+ glUseProgram(program[ key - '1' ]);
break;
case 27:
CleanUp();
@@ -187,15 +184,15 @@ LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
- glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
+ glShaderSource(shader, 1, (const GLchar **) &text, NULL);
- glCompileShader_func(shader);
+ glCompileShader(shader);
- glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetShaderInfoLog_func(shader, 1000, &len, log);
+ glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
exit(1);
}
@@ -209,11 +206,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
- glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+ glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetProgramInfoLog_func(prog, 1000, &len, log);
+ glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
@@ -234,22 +231,20 @@ Init(void)
/*exit(1);*/
}
- GetExtensionFuncs();
-
- vertShader = glCreateShader_func(GL_VERTEX_SHADER);
+ vertShader = glCreateShader(GL_VERTEX_SHADER);
LoadAndCompileShader(vertShader, VertShaderText);
for( i = 0; i < 4; i++ ) {
- fragShader[ i ] = glCreateShader_func(GL_FRAGMENT_SHADER);
+ fragShader[ i ] = glCreateShader(GL_FRAGMENT_SHADER);
LoadAndCompileShader(fragShader[ i ], FragShaderText[ i ]);
- program[ i ] = glCreateProgram_func();
- glAttachShader_func(program[ i ], fragShader[ i ]);
- glAttachShader_func(program[ i ], vertShader);
- glLinkProgram_func(program[ i ]);
+ program[ i ] = glCreateProgram();
+ glAttachShader(program[ i ], fragShader[ i ]);
+ glAttachShader(program[ i ], vertShader);
+ glLinkProgram(program[ i ]);
CheckLink(program[ i ]);
}
- glUseProgram_func(program[ 0 ]);
+ glUseProgram(program[ 0 ]);
assert(glGetError() == 0);
diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c
index c6e0b10b49..5e971716ad 100644
--- a/progs/glsl/multitex.c
+++ b/progs/glsl/multitex.c
@@ -31,7 +31,6 @@
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
-#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "multitex";
@@ -83,10 +82,10 @@ static const GLfloat VertCoords[4][2] = {
static void
SetupVertexBuffer(void)
{
- glGenBuffersARB_func(1, &VBO);
- glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO);
+ glGenBuffersARB(1, &VBO);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
- glBufferDataARB_func(GL_ARRAY_BUFFER_ARB,
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(VertCoords) +
sizeof(Tex0Coords) +
sizeof(Tex1Coords),
@@ -95,23 +94,23 @@ SetupVertexBuffer(void)
/* non-interleaved vertex arrays */
- glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
+ glBufferSubDataARB(GL_ARRAY_BUFFER_ARB,
0, /* offset */
sizeof(VertCoords), /* size */
VertCoords); /* data */
- glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
+ glBufferSubDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(VertCoords), /* offset */
sizeof(Tex0Coords), /* size */
Tex0Coords); /* data */
- glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
+ glBufferSubDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(VertCoords) +
sizeof(Tex0Coords), /* offset */
sizeof(Tex1Coords), /* size */
Tex1Coords); /* data */
- glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
@@ -121,39 +120,39 @@ DrawPolygonArray(void)
void *vertPtr, *tex0Ptr, *tex1Ptr;
if (UseVBO) {
- glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
vertPtr = (void *) 0;
tex0Ptr = (void *) sizeof(VertCoords);
tex1Ptr = (void *) (sizeof(VertCoords) + sizeof(Tex0Coords));
}
else {
- glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
vertPtr = VertCoords;
tex0Ptr = Tex0Coords;
tex1Ptr = Tex1Coords;
}
if (VertCoord_attr >= 0) {
- glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
- 0, vertPtr);
- glEnableVertexAttribArray_func(VertCoord_attr);
+ glVertexAttribPointer(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
+ 0, VertCoords);
+ glEnableVertexAttribArray(VertCoord_attr);
}
else {
glVertexPointer(2, GL_FLOAT, 0, vertPtr);
glEnableClientState(GL_VERTEX_ARRAY);
}
- glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
- 0, tex0Ptr);
- glEnableVertexAttribArray_func(TexCoord0_attr);
+ glVertexAttribPointer(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
+ 0, Tex0Coords);
+ glEnableVertexAttribArray(TexCoord0_attr);
- glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
- 0, tex1Ptr);
- glEnableVertexAttribArray_func(TexCoord1_attr);
+ glVertexAttribPointer(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
+ 0, Tex1Coords);
+ glEnableVertexAttribArray(TexCoord1_attr);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
@@ -165,11 +164,11 @@ DrawPolygonVert(void)
glBegin(GL_TRIANGLE_FAN);
for (i = 0; i < 4; i++) {
- glVertexAttrib2fv_func(TexCoord0_attr, Tex0Coords[i]);
- glVertexAttrib2fv_func(TexCoord1_attr, Tex1Coords[i]);
+ glVertexAttrib2fv(TexCoord0_attr, Tex0Coords[i]);
+ glVertexAttrib2fv(TexCoord1_attr, Tex1Coords[i]);
if (VertCoord_attr >= 0)
- glVertexAttrib2fv_func(VertCoord_attr, VertCoords[i]);
+ glVertexAttrib2fv(VertCoord_attr, VertCoords[i]);
else
glVertex2fv(VertCoords[i]);
}
@@ -327,27 +326,27 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
InitUniforms(program, uniforms);
- VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
+ VertCoord_attr = glGetAttribLocation(program, "VertCoord");
if (VertCoord_attr > 0) {
/* We want the VertCoord attrib to have position zero so that
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
* to set that attribute last (which is a PITA to manage).
*/
- glBindAttribLocation_func(program, 0, "VertCoord");
+ glBindAttribLocation(program, 0, "VertCoord");
/* re-link */
- glLinkProgram_func(program);
+ glLinkProgram(program);
/* VertCoord_attr should be zero now */
- VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
+ VertCoord_attr = glGetAttribLocation(program, "VertCoord");
assert(VertCoord_attr == 0);
}
- TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
- TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
+ TexCoord0_attr = glGetAttribLocation(program, "TexCoord0");
+ TexCoord1_attr = glGetAttribLocation(program, "TexCoord1");
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
@@ -380,7 +379,6 @@ InitGL(void)
printf(" z/Z - change viewing distance\n");
printf(" SPACE - toggle animation\n");
printf(" Esc - exit\n");
- GetExtensionFuncs();
InitTextures();
InitPrograms();
diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c
index 83e4696fc9..59f594e78b 100644
--- a/progs/glsl/noise.c
+++ b/progs/glsl/noise.c
@@ -9,10 +9,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -68,7 +65,7 @@ Redisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glUniform1fv_func(Uniforms[2].location, 1, &Slice);
+ glUniform1fv(Uniforms[2].location, 1, &Slice);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
@@ -104,9 +101,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -176,13 +173,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -192,9 +187,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/pointcoord.c b/progs/glsl/pointcoord.c
index aa01e2166d..27b73a05de 100644
--- a/progs/glsl/pointcoord.c
+++ b/progs/glsl/pointcoord.c
@@ -11,10 +11,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -65,9 +62,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -142,18 +139,16 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
- tex0 = glGetUniformLocation_func(program, "tex0");
+ tex0 = glGetUniformLocation(program, "tex0");
printf("Uniforms: tex0: %d\n", tex0);
- glUniform1i_func(tex0, 0); /* tex unit 0 */
+ glUniform1i(tex0, 0); /* tex unit 0 */
/*assert(glGetError() == 0);*/
@@ -161,9 +156,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
MakeTexture();
diff --git a/progs/glsl/points.c b/progs/glsl/points.c
index 1b346228aa..e5ee38c449 100644
--- a/progs/glsl/points.c
+++ b/progs/glsl/points.c
@@ -11,10 +11,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -100,7 +97,7 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, 1.2, 0);
- glUseProgram_func(0);
+ glUseProgram(0);
DrawPoints(GL_FALSE);
glPopMatrix();
@@ -109,9 +106,9 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, -1.2, 0);
- glUseProgram_func(Program);
+ glUseProgram(Program);
if (uViewportInv != -1) {
- glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
+ glUniform2f(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
}
DrawPoints(GL_TRUE);
glPopMatrix();
@@ -151,9 +148,9 @@ Key(unsigned char key, int x, int y)
Smooth = !Smooth;
break;
case 27:
- glDeleteShader_func(FragShader);
- glDeleteShader_func(VertShader);
- glDeleteProgram_func(Program);
+ glDeleteShader(FragShader);
+ glDeleteShader(VertShader);
+ glDeleteProgram(Program);
glutDestroyWindow(Win);
exit(0);
}
@@ -226,17 +223,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
- glUseProgram_func(Program);
+ glUseProgram(Program);
- uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
+ uViewportInv = glGetUniformLocation(Program, "viewportInv");
- glUseProgram_func(0);
+ glUseProgram(0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
diff --git a/progs/glsl/samplers.c b/progs/glsl/samplers.c
index cbb264dad1..113e5bbeff 100644
--- a/progs/glsl/samplers.c
+++ b/progs/glsl/samplers.c
@@ -42,7 +42,6 @@
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -291,7 +290,7 @@ CreateProgram(void)
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
free(fragShaderText);
@@ -316,10 +315,10 @@ InitProgram(void)
#else
sprintf(uname, "tex[%d]", s);
#endif
- loc = glGetUniformLocation_func(Program, uname);
+ loc = glGetUniformLocation(Program, uname);
assert(loc >= 0);
- glUniform1i_func(loc, s);
+ glUniform1i(loc, s);
}
}
@@ -334,8 +333,6 @@ InitGL(void)
printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER));
- GetExtensionFuncs();
-
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &NumSamplers);
if (NumSamplers > MAX_SAMPLERS)
NumSamplers = MAX_SAMPLERS;
diff --git a/progs/glsl/shadow_sampler.c b/progs/glsl/shadow_sampler.c
index 673ad465ad..0a4d04dd8c 100644
--- a/progs/glsl/shadow_sampler.c
+++ b/progs/glsl/shadow_sampler.c
@@ -11,10 +11,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
/** Use GL_RECTANGLE texture (with projective texcoords)? */
@@ -67,7 +64,7 @@ Redisplay(void)
glPushMatrix();
CheckError(__LINE__);
- glUseProgram_func(program);
+ glUseProgram(program);
CheckError(__LINE__);
glBegin(GL_POLYGON);
@@ -87,7 +84,7 @@ Redisplay(void)
glPopMatrix();
- glUseProgram_func(0);
+ glUseProgram(0);
glWindowPos2iARB(80, 20);
PrintString("white black white black");
@@ -111,9 +108,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -179,13 +176,13 @@ static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
- glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
- glCompileShader_func(shader);
- glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+ glShaderSource(shader, 1, (const GLchar **) &text, NULL);
+ glCompileShader(shader);
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetShaderInfoLog_func(shader, 1000, &len, log);
+ glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
@@ -223,11 +220,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
- glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+ glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetProgramInfoLog_func(prog, 1000, &len, log);
+ glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -267,35 +264,33 @@ Init(void)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- GetExtensionFuncs();
-
- fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
+ fragShader = glCreateShader(GL_FRAGMENT_SHADER);
if (FragProgFile)
ReadShader(fragShader, FragProgFile);
else
LoadAndCompileShader(fragShader, fragShaderText);
- vertShader = glCreateShader_func(GL_VERTEX_SHADER);
+ vertShader = glCreateShader(GL_VERTEX_SHADER);
if (VertProgFile)
ReadShader(vertShader, VertProgFile);
else
LoadAndCompileShader(vertShader, vertShaderText);
- program = glCreateProgram_func();
- glAttachShader_func(program, fragShader);
- glAttachShader_func(program, vertShader);
- glLinkProgram_func(program);
+ program = glCreateProgram();
+ glAttachShader(program, fragShader);
+ glAttachShader(program, vertShader);
+ glLinkProgram(program);
CheckLink(program);
- glUseProgram_func(program);
+ glUseProgram(program);
- uTexture2D = glGetUniformLocation_func(program, "shadowTex2D");
- uTextureRect = glGetUniformLocation_func(program, "shadowTexRect");
+ uTexture2D = glGetUniformLocation(program, "shadowTex2D");
+ uTextureRect = glGetUniformLocation(program, "shadowTexRect");
printf("uTexture2D %d uTextureRect %d\n", uTexture2D, uTextureRect);
if (uTexture2D >= 0) {
- glUniform1i_func(uTexture2D, 0); /* use texture unit 0 */
+ glUniform1i(uTexture2D, 0); /* use texture unit 0 */
}
if (uTextureRect >= 0) {
- glUniform1i_func(uTextureRect, 1); /* use texture unit 0 */
+ glUniform1i(uTextureRect, 1); /* use texture unit 0 */
}
CheckError(__LINE__);
diff --git a/progs/glsl/skinning.c b/progs/glsl/skinning.c
index d7b968fed0..65ba98348b 100644
--- a/progs/glsl/skinning.c
+++ b/progs/glsl/skinning.c
@@ -13,10 +13,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -65,11 +62,11 @@ Cylinder(GLfloat length, GLfloat radius, GLint slices, GLint stacks)
float a = (float) i / (slices - 1) * M_PI * 2.0;
float x = radius * cos(a);
float y = radius * sin(a);
- glVertexAttrib1f_func(WeightAttr, w0);
+ glVertexAttrib1f(WeightAttr, w0);
glNormal3f(x, y, 0.0);
glVertex3f(x, y, z0);
- glVertexAttrib1f_func(WeightAttr, w0 + dw);
+ glVertexAttrib1f(WeightAttr, w0 + dw);
glNormal3f(x, y, 0.0);
glVertex3f(x, y, z0 + dz);
}
@@ -107,8 +104,8 @@ Redisplay(void)
{
UpdateMatrices();
- glUniformMatrix4fv_func(uMat0, 1, GL_FALSE, Matrices[0]);
- glUniformMatrix4fv_func(uMat1, 1, GL_FALSE, Matrices[1]);
+ glUniformMatrix4fv(uMat0, 1, GL_FALSE, Matrices[0]);
+ glUniformMatrix4fv(uMat1, 1, GL_FALSE, Matrices[1]);
if (WireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -149,9 +146,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -222,18 +219,16 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
- uMat0 = glGetUniformLocation_func(program, "mat0");
- uMat1 = glGetUniformLocation_func(program, "mat1");
+ uMat0 = glGetUniformLocation(program, "mat0");
+ uMat1 = glGetUniformLocation(program, "mat1");
- WeightAttr = glGetAttribLocation_func(program, "weight");
+ WeightAttr = glGetAttribLocation(program, "weight");
assert(glGetError() == 0);
diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c
index 6720941a6e..1f566c86a6 100644
--- a/progs/glsl/texaaline.c
+++ b/progs/glsl/texaaline.c
@@ -12,10 +12,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
static GLint WinWidth = 300, WinHeight = 300;
@@ -329,8 +326,6 @@ Init(void)
exit(1);
}
- GetExtensionFuncs();
-
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
diff --git a/progs/glsl/texdemo1.c b/progs/glsl/texdemo1.c
index 08a87a5152..d55f9e7dd9 100644
--- a/progs/glsl/texdemo1.c
+++ b/progs/glsl/texdemo1.c
@@ -31,7 +31,6 @@
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
-#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "texdemo1";
@@ -98,7 +97,7 @@ draw(void)
/* sphere w/ reflection map */
glPushMatrix();
glTranslatef(0, 1, 0);
- glUseProgram_func(Program1);
+ glUseProgram(Program1);
/* setup texture matrix */
glActiveTexture(GL_TEXTURE0);
@@ -117,7 +116,7 @@ draw(void)
glPopMatrix();
/* ground */
- glUseProgram_func(Program2);
+ glUseProgram(Program2);
glTranslatef(0, -1.0, 0);
DrawGround(5);
@@ -381,7 +380,7 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
InitUniforms(program, uniforms);
@@ -408,8 +407,6 @@ Init(GLboolean useImageFiles)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- GetExtensionFuncs();
-
InitTextures(useImageFiles);
InitPrograms();
diff --git a/progs/glsl/toyball.c b/progs/glsl/toyball.c
index 2b644acb6d..7fe27aebfe 100644
--- a/progs/glsl/toyball.c
+++ b/progs/glsl/toyball.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -100,9 +97,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -170,13 +167,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
InitUniforms(program, Uniforms);
diff --git a/progs/glsl/trirast.c b/progs/glsl/trirast.c
index 3d4decaa2f..f7546f25a2 100644
--- a/progs/glsl/trirast.c
+++ b/progs/glsl/trirast.c
@@ -16,10 +16,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -86,9 +83,9 @@ Redisplay(void)
RotateVerts(Zrot, 3, TriVerts, v);
ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax);
- glUniform2fv_func(uv0, 1, v[0]);
- glUniform2fv_func(uv1, 1, v[1]);
- glUniform2fv_func(uv2, 1, v[2]);
+ glUniform2fv(uv0, 1, v[0]);
+ glUniform2fv(uv1, 1, v[1]);
+ glUniform2fv(uv2, 1, v[2]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -133,9 +130,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -197,17 +194,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
- uv0 = glGetUniformLocation_func(program, "v0");
- uv1 = glGetUniformLocation_func(program, "v1");
- uv2 = glGetUniformLocation_func(program, "v2");
+ uv0 = glGetUniformLocation(program, "v0");
+ uv1 = glGetUniformLocation(program, "v1");
+ uv2 = glGetUniformLocation(program, "v2");
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
/*assert(glGetError() == 0);*/
@@ -217,9 +212,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/twoside.c b/progs/glsl/twoside.c
index 9ebc4ec360..b6c1b477dd 100644
--- a/progs/glsl/twoside.c
+++ b/progs/glsl/twoside.c
@@ -13,10 +13,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -60,11 +57,11 @@ Redisplay(void)
glFrontFace(FrontWinding);
if (DetermineFacingInFragProg) {
- glUniform1i_func(u_fragface, 1);
+ glUniform1i(u_fragface, 1);
glDisable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
else {
- glUniform1i_func(u_fragface, 0);
+ glUniform1i(u_fragface, 0);
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
@@ -76,7 +73,7 @@ Redisplay(void)
/* Draw a tristrip ring */
glBegin(GL_TRIANGLE_STRIP);
glColor4fv(Red);
- glSecondaryColor3fv_func(Green);
+ glSecondaryColor3fv(Green);
for (i = 0; i <= sections; i++) {
float a = (float) i / (sections) * M_PI * 2.0;
float x = radius * cos(a);
@@ -126,9 +123,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -230,15 +227,13 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
- u_fragface = glGetUniformLocation_func(program, "fragface");
+ u_fragface = glGetUniformLocation(program, "fragface");
printf("Uniforms: %d\n", u_fragface);
/*assert(glGetError() == 0);*/
@@ -247,9 +242,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(program));
- assert(glIsShader_func(fragShader));
- assert(glIsShader_func(vertShader));
+ assert(glIsProgram(program));
+ assert(glIsShader(fragShader));
+ assert(glIsShader(vertShader));
glEnable(GL_DEPTH_TEST);
diff --git a/progs/glsl/vert-or-frag-only.c b/progs/glsl/vert-or-frag-only.c
index 8e1612aca4..81fcab8c5b 100644
--- a/progs/glsl/vert-or-frag-only.c
+++ b/progs/glsl/vert-or-frag-only.c
@@ -12,10 +12,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -59,14 +56,14 @@ Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* render with vertex shader only */
- glUseProgram_func(VertProgram);
+ glUseProgram(VertProgram);
glPushMatrix();
glTranslatef(-1.5, 0, 0);
DrawQuadTex();
glPopMatrix();
/* render with fragment shader only */
- glUseProgram_func(FragProgram);
+ glUseProgram(FragProgram);
glPushMatrix();
glTranslatef(+1.5, 0, 0);
DrawQuadColor();
@@ -91,10 +88,10 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(FragShader);
- glDeleteShader_func(VertShader);
- glDeleteProgram_func(VertProgram);
- glDeleteProgram_func(FragProgram);
+ glDeleteShader(FragShader);
+ glDeleteShader(VertShader);
+ glDeleteProgram(VertProgram);
+ glDeleteProgram(FragProgram);
glutDestroyWindow(Win);
}
@@ -130,8 +127,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
if (FragProgFile)
FragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -150,10 +145,10 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
- assert(glIsProgram_func(VertProgram));
- assert(glIsProgram_func(FragProgram));
- assert(glIsShader_func(FragShader));
- assert(glIsShader_func(VertShader));
+ assert(glIsProgram(VertProgram));
+ assert(glIsProgram(FragProgram));
+ assert(glIsShader(FragShader));
+ assert(glIsShader(VertShader));
glColor3f(1, 0, 0);
}
diff --git a/progs/glsl/vert-tex.c b/progs/glsl/vert-tex.c
index b74bf50679..e791a5759a 100644
--- a/progs/glsl/vert-tex.c
+++ b/progs/glsl/vert-tex.c
@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
-#include <GL/gl.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -134,9 +131,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -240,13 +237,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
- GetExtensionFuncs();
-
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
- glUseProgram_func(program);
+ glUseProgram(program);
assert(glGetError() == 0);
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index 5cef84eb49..13b68d90e0 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -11,7 +11,6 @@
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
-#include "extfuncs.h"
#include "shaderutil.h"
@@ -20,7 +19,6 @@ Init(void)
{
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
- GetExtensionFuncs();
firstCall = GL_FALSE;
}
}
@@ -51,14 +49,14 @@ CompileShaderText(GLenum shaderType, const char *text)
Init();
- shader = glCreateShader_func(shaderType);
- glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
- glCompileShader_func(shader);
- glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+ shader = glCreateShader(shaderType);
+ glShaderSource(shader, 1, (const GLchar **) &text, NULL);
+ glCompileShader(shader);
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetShaderInfoLog_func(shader, 1000, &len, log);
+ glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
exit(1);
}
@@ -110,24 +108,24 @@ CompileShaderFile(GLenum shaderType, const char *filename)
GLuint
LinkShaders(GLuint vertShader, GLuint fragShader)
{
- GLuint program = glCreateProgram_func();
+ GLuint program = glCreateProgram();
assert(vertShader || fragShader);
if (fragShader)
- glAttachShader_func(program, fragShader);
+ glAttachShader(program, fragShader);
if (vertShader)
- glAttachShader_func(program, vertShader);
- glLinkProgram_func(program);
+ glAttachShader(program, vertShader);
+ glLinkProgram(program);
/* check link */
{
GLint stat;
- glGetProgramiv_func(program, GL_LINK_STATUS, &stat);
+ glGetProgramiv(program, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetProgramInfoLog_func(program, 1000, &len, log);
+ glGetProgramInfoLog(program, 1000, &len, log);
fprintf(stderr, "Shader link error:\n%s\n", log);
return 0;
}
@@ -144,7 +142,7 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
for (i = 0; uniforms[i].name; i++) {
uniforms[i].location
- = glGetUniformLocation_func(program, uniforms[i].name);
+ = glGetUniformLocation(program, uniforms[i].name);
printf("Uniform %s location: %d\n", uniforms[i].name,
uniforms[i].location);
@@ -152,19 +150,19 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
switch (uniforms[i].size) {
case 1:
if (uniforms[i].type == GL_INT)
- glUniform1i_func(uniforms[i].location,
+ glUniform1i(uniforms[i].location,
(GLint) uniforms[i].value[0]);
else
- glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform1fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 2:
- glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform2fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 3:
- glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform3fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 4:
- glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
+ glUniform4fv(uniforms[i].location, 1, uniforms[i].value);
break;
default:
abort();
diff --git a/scons/fixes.py b/scons/fixes.py
new file mode 100644
index 0000000000..714cccf61d
--- /dev/null
+++ b/scons/fixes.py
@@ -0,0 +1,27 @@
+import sys
+
+# Monkey patch os.spawnve on windows to become thread safe
+if sys.platform == 'win32':
+ import os
+ import threading
+ from os import spawnve as old_spawnve
+
+ spawn_lock = threading.Lock()
+
+ def new_spawnve(mode, file, args, env):
+ spawn_lock.acquire()
+ try:
+ if mode == os.P_WAIT:
+ ret = old_spawnve(os.P_NOWAIT, file, args, env)
+ else:
+ ret = old_spawnve(mode, file, args, env)
+ finally:
+ spawn_lock.release()
+ if mode == os.P_WAIT:
+ pid, status = os.waitpid(ret, 0)
+ ret = status >> 8
+ return ret
+
+ os.spawnve = new_spawnve
+
+
diff --git a/scons/gallium.py b/scons/gallium.py
index 7be0a25004..e9e799dc78 100644
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -38,6 +38,8 @@ import SCons.Action
import SCons.Builder
import SCons.Scanner
+import fixes
+
def quietCommandLines(env):
# Quiet command lines
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index e134e44337..b1e18805c7 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -72,6 +72,24 @@ do { \
R[3] = A[3] - B[3]; \
} while (0)
+/** Add and limit result to ceiling of 1.0 */
+#define VEC4_ADD_SAT(R, A, B) \
+do { \
+ R[0] = A[0] + B[0]; if (R[0] > 1.0f) R[0] = 1.0f; \
+ R[1] = A[1] + B[1]; if (R[1] > 1.0f) R[1] = 1.0f; \
+ R[2] = A[2] + B[2]; if (R[2] > 1.0f) R[2] = 1.0f; \
+ R[3] = A[3] + B[3]; if (R[3] > 1.0f) R[3] = 1.0f; \
+} while (0)
+
+/** Subtract and limit result to floor of 0.0 */
+#define VEC4_SUB_SAT(R, A, B) \
+do { \
+ R[0] = A[0] - B[0]; if (R[0] < 0.0f) R[0] = 0.0f; \
+ R[1] = A[1] - B[1]; if (R[1] < 0.0f) R[1] = 0.0f; \
+ R[2] = A[2] - B[2]; if (R[2] < 0.0f) R[2] = 0.0f; \
+ R[3] = A[3] - B[3]; if (R[3] < 0.0f) R[3] = 0.0f; \
+} while (0)
+
#define VEC4_MUL(R, A, B) \
do { \
R[0] = A[0] * B[0]; \
@@ -676,19 +694,19 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
*/
switch (softpipe->blend->rgb_func) {
case PIPE_BLEND_ADD:
- VEC4_ADD(quadColor[0], source[0], dest[0]); /* R */
- VEC4_ADD(quadColor[1], source[1], dest[1]); /* G */
- VEC4_ADD(quadColor[2], source[2], dest[2]); /* B */
+ VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */
+ VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */
+ VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */
break;
case PIPE_BLEND_SUBTRACT:
- VEC4_SUB(quadColor[0], source[0], dest[0]); /* R */
- VEC4_SUB(quadColor[1], source[1], dest[1]); /* G */
- VEC4_SUB(quadColor[2], source[2], dest[2]); /* B */
+ VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */
+ VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */
+ VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */
break;
case PIPE_BLEND_REVERSE_SUBTRACT:
- VEC4_SUB(quadColor[0], dest[0], source[0]); /* R */
- VEC4_SUB(quadColor[1], dest[1], source[1]); /* G */
- VEC4_SUB(quadColor[2], dest[2], source[2]); /* B */
+ VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */
+ VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */
+ VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */
break;
case PIPE_BLEND_MIN:
VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */
@@ -709,13 +727,13 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
*/
switch (softpipe->blend->alpha_func) {
case PIPE_BLEND_ADD:
- VEC4_ADD(quadColor[3], source[3], dest[3]); /* A */
+ VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
break;
case PIPE_BLEND_SUBTRACT:
- VEC4_SUB(quadColor[3], source[3], dest[3]); /* A */
+ VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */
break;
case PIPE_BLEND_REVERSE_SUBTRACT:
- VEC4_SUB(quadColor[3], dest[3], source[3]); /* A */
+ VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */
break;
case PIPE_BLEND_MIN:
VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript
index 1581182aec..ec385e7c44 100644
--- a/src/gallium/state_trackers/python/SConscript
+++ b/src/gallium/state_trackers/python/SConscript
@@ -15,6 +15,19 @@ if 'python' in env['statetrackers']:
env.Append(CPPPATH = '.')
+ if env['platform'] == 'windows':
+ env.Append(LIBS = [
+ 'opengl32',
+ 'gdi32',
+ 'user32',
+ 'kernel32',
+ ])
+ else:
+ env.Append(LIBS = [
+ 'GL',
+ 'X11',
+ ])
+
pyst = env.ConvenienceLibrary(
target = 'pyst',
source = [
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py
index 5885e162c2..6f0bd6ae52 100755
--- a/src/gallium/state_trackers/python/retrace/interpreter.py
+++ b/src/gallium/state_trackers/python/retrace/interpreter.py
@@ -456,6 +456,7 @@ class Context(Object):
x, y, z, w = unpack_from(format, data, offset)
sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
index += 1
+ sys.stdout.flush()
def set_constant_buffer(self, shader, index, buffer):
if buffer is not None:
@@ -537,6 +538,7 @@ class Context(Object):
sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
assert len(values) == velem.nr_components
sys.stdout.write('\t},\n')
+ sys.stdout.flush()
def dump_indices(self, ibuf, isize, start, count):
if not self.interpreter.verbosity(2):
@@ -564,6 +566,7 @@ class Context(Object):
minindex = min(minindex, index)
maxindex = max(maxindex, index)
sys.stdout.write('\t},\n')
+ sys.stdout.flush()
return minindex, maxindex
@@ -591,6 +594,20 @@ class Context(Object):
self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
self._set_dirty()
+ def surface_copy(self, dest, destx, desty, src, srcx, srcy, width, height):
+ if dest is not None and src is not None:
+ if self.interpreter.options.all:
+ self.interpreter.present(src, 'surface_copy_src', srcx, srcy, width, height)
+ self.real.surface_copy(dest, destx, desty, src, srcx, srcy, width, height)
+ if dest in self.cbufs:
+ self._set_dirty()
+ flags = gallium.PIPE_FLUSH_FRAME
+ else:
+ flags = 0
+ self.flush(flags)
+ if self.interpreter.options.all:
+ self.interpreter.present(dest, 'surface_copy_dest', destx, desty, width, height)
+
def is_texture_referenced(self, texture, face, level):
#return self.real.is_texture_referenced(format, texture, face, level)
pass
@@ -660,7 +677,7 @@ class Interpreter(parser.TraceDumper):
self.interpret_call(call)
def handle_call(self, call):
- if self.options.stop and call.no >= self.options.stop:
+ if self.options.stop and call.no > self.options.stop:
sys.exit(0)
if (call.klass, call.method) in self.ignore_calls:
@@ -670,6 +687,7 @@ class Interpreter(parser.TraceDumper):
if self.verbosity(1):
parser.TraceDumper.handle_call(self, call)
+ sys.stdout.flush()
args = [(str(name), self.interpret_arg(arg)) for name, arg in call.args]
diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py
index 4b9659861d..b721e0b575 100644
--- a/src/gallium/state_trackers/python/samples/tri.py
+++ b/src/gallium/state_trackers/python/samples/tri.py
@@ -139,7 +139,7 @@ def test(dev):
tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
).get_surface()
zbuf = dev.texture_create(
- PIPE_FORMAT_Z32_UNORM,
+ PIPE_FORMAT_Z16_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL,
).get_surface()
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 8246b378ce..ea7d18738f 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -44,8 +44,14 @@
static void
st_device_really_destroy(struct st_device *st_dev)
{
- if(st_dev->screen)
+ if(st_dev->screen) {
+ /* FIXME: Don't really destroy until we keep track of every single
+ * reference or we end up causing a segmentation fault every time
+ * python exits. */
+#if 0
st_dev->screen->destroy(st_dev->screen);
+#endif
+ }
FREE(st_dev);
}
diff --git a/src/gallium/state_trackers/python/st_hardpipe_winsys.c b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
index 8b33c70fd7..43aaaabf2a 100644
--- a/src/gallium/state_trackers/python/st_hardpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
@@ -28,31 +28,206 @@
/**
* @file
- * Stub for hardware pipe driver support.
+ * Get a hardware accelerated Gallium screen/context from the OpenGL driver.
*/
#include "pipe/p_compiler.h"
+#ifdef PIPE_OS_WINDOWS
+#include <windows.h>
+#include <GL/gl.h>
+#else
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <GL/gl.h>
+#include <GL/glx.h>
+#endif
+
#include "st_winsys.h"
+typedef struct pipe_screen * (GLAPIENTRY *PFNGETGALLIUMSCREENMESAPROC) (void);
+typedef struct pipe_context * (GLAPIENTRY* PFNCREATEGALLIUMCONTEXTMESAPROC) (void);
+
+static PFNGETGALLIUMSCREENMESAPROC pfnGetGalliumScreenMESA = NULL;
+static PFNCREATEGALLIUMCONTEXTMESAPROC pfnCreateGalliumContextMESA = NULL;
+
+
/* XXX: Force init_gallium symbol to be linked */
extern void init_gallium(void);
void (*force_init_gallium_linkage)(void) = &init_gallium;
+#ifdef PIPE_OS_WINDOWS
+
+static INLINE boolean
+st_hardpipe_load(void)
+{
+ WNDCLASS wc;
+ HWND hwnd;
+ HGLRC hglrc;
+ HDC hdc;
+ PIXELFORMATDESCRIPTOR pfd;
+ int iPixelFormat;
+
+ if(pfnGetGalliumScreenMESA && pfnCreateGalliumContextMESA)
+ return TRUE;
+
+ memset(&wc, 0, sizeof wc);
+ wc.lpfnWndProc = DefWindowProc;
+ wc.lpszClassName = "gallium";
+ wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
+ RegisterClass(&wc);
+
+ hwnd = CreateWindow(wc.lpszClassName, "gallium", 0, 0, 0, 0, 0, NULL, 0, wc.hInstance, NULL);
+ if (!hwnd)
+ return FALSE;
+
+ hdc = GetDC(hwnd);
+ if (!hdc)
+ return FALSE;
+
+ pfd.cColorBits = 3;
+ pfd.cRedBits = 1;
+ pfd.cGreenBits = 1;
+ pfd.cBlueBits = 1;
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
+ pfd.iLayerType = PFD_MAIN_PLANE;
+ pfd.iPixelType = PFD_TYPE_RGBA;
+ pfd.nSize = sizeof(pfd);
+ pfd.nVersion = 1;
+
+ iPixelFormat = ChoosePixelFormat(hdc, &pfd);
+ if (!iPixelFormat) {
+ pfd.dwFlags |= PFD_DOUBLEBUFFER;
+ iPixelFormat = ChoosePixelFormat(hdc, &pfd);
+ }
+ if (!iPixelFormat)
+ return FALSE;
+
+ SetPixelFormat(hdc, iPixelFormat, &pfd);
+ hglrc = wglCreateContext(hdc);
+ if (!hglrc)
+ return FALSE;
+
+ if (!wglMakeCurrent(hdc, hglrc))
+ return FALSE;
+
+ pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)wglGetProcAddress("wglGetGalliumScreenMESA");
+ if(!pfnGetGalliumScreenMESA)
+ return FALSE;
+
+ pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)wglGetProcAddress("wglCreateGalliumContextMESA");
+ if(!pfnCreateGalliumContextMESA)
+ return FALSE;
+
+ DestroyWindow(hwnd);
+
+ return TRUE;
+}
+
+#else
+
+static INLINE boolean
+st_hardpipe_load(void)
+{
+ Display *dpy;
+ int scrnum;
+ Window root;
+ int attribSingle[] = {
+ GLX_RGBA,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ None };
+ int attribDouble[] = {
+ GLX_RGBA,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_DOUBLEBUFFER,
+ None };
+ XVisualInfo *visinfo;
+ GLXContext ctx = NULL;
+ XSetWindowAttributes attr;
+ unsigned long mask;
+ int width = 100, height = 100;
+ Window win;
+
+ dpy = XOpenDisplay(NULL);
+ if (!dpy)
+ return FALSE;
+
+ scrnum = 0;
+
+ root = RootWindow(dpy, scrnum);
+
+ visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
+ if (!visinfo)
+ visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
+ if (!visinfo)
+ return FALSE;
+
+ ctx = glXCreateContext( dpy, visinfo, NULL, True );
+
+ if (!ctx)
+ return FALSE;
+
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask;
+
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
+
+ if (!glXMakeCurrent(dpy, win, ctx))
+ return FALSE;
+
+ pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXGetGalliumScreenMESA");
+ if(!pfnGetGalliumScreenMESA)
+ return FALSE;
+
+ pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXCreateGalliumContextMESA");
+ if(!pfnCreateGalliumContextMESA)
+ return FALSE;
+
+ glXDestroyContext(dpy, ctx);
+ XFree(visinfo);
+ XDestroyWindow(dpy, win);
+ XCloseDisplay(dpy);
+
+ return TRUE;
+}
+
+#endif
+
+
static struct pipe_screen *
st_hardpipe_screen_create(void)
{
- return st_softpipe_winsys.screen_create();
+ if(st_hardpipe_load())
+ return pfnGetGalliumScreenMESA();
+ else
+ return st_softpipe_winsys.screen_create();
}
static struct pipe_context *
st_hardpipe_context_create(struct pipe_screen *screen)
{
- return st_softpipe_winsys.context_create(screen);
+ if(st_hardpipe_load()) {
+ if(screen == pfnGetGalliumScreenMESA())
+ return pfnCreateGalliumContextMESA();
+ else
+ return NULL;
+ }
+ else
+ return st_softpipe_winsys.context_create(screen);
}
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index a086657487..69b88618ec 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -29,6 +29,7 @@ if env['platform'] in ['windows']:
'shared/stw_extensionsstring.c',
'shared/stw_extswapinterval.c',
'shared/stw_getprocaddress.c',
+ 'shared/stw_extgallium.c',
'shared/stw_arbpixelformat.c',
'shared/stw_tls.c',
]
diff --git a/src/gallium/state_trackers/wgl/shared/stw_extgallium.c b/src/gallium/state_trackers/wgl/shared/stw_extgallium.c
new file mode 100644
index 0000000000..fc22737d7e
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/shared/stw_extgallium.c
@@ -0,0 +1,79 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "pipe/p_screen.h"
+#include "stw_public.h"
+#include "stw_device.h"
+#include "stw_winsys.h"
+
+#ifdef DEBUG
+#include "trace/tr_screen.h"
+#include "trace/tr_context.h"
+#endif
+
+
+struct pipe_screen * APIENTRY
+wglGetGalliumScreenMESA(void)
+{
+ return stw_dev ? stw_dev->screen : NULL;
+}
+
+
+/* XXX: Unify with stw_create_layer_context */
+struct pipe_context * APIENTRY
+wglCreateGalliumContextMESA(void)
+{
+ struct pipe_screen *screen = NULL;
+ struct pipe_context *pipe = NULL;
+
+ if(!stw_dev)
+ return NULL;
+
+ screen = stw_dev->screen;
+
+#ifdef DEBUG
+ /* Unwrap screen */
+ if(stw_dev->trace_running)
+ screen = trace_screen(screen)->screen;
+#endif
+
+ pipe = stw_dev->stw_winsys->create_context( screen );
+ if (pipe == NULL)
+ goto no_pipe;
+
+#ifdef DEBUG
+ /* Wrap context */
+ if(stw_dev->trace_running)
+ pipe = trace_context_create(stw_dev->screen, pipe);
+#endif
+
+ return pipe;
+
+no_pipe:
+ return NULL;
+}
diff --git a/src/gallium/state_trackers/wgl/shared/stw_extgallium.h b/src/gallium/state_trackers/wgl/shared/stw_extgallium.h
new file mode 100644
index 0000000000..cc35f2bb7f
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/shared/stw_extgallium.h
@@ -0,0 +1,47 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef STW_EXTGALLIUM_H_
+#define STW_EXTGALLIUM_H_
+
+
+#include <windows.h>
+
+
+struct pipe_screen;
+struct pipe_context;
+
+
+struct pipe_screen * APIENTRY
+wglGetGalliumScreenMESA(void);
+
+
+struct pipe_context * APIENTRY
+wglCreateGalliumContextMESA(void);
+
+
+#endif /* STW_EXTGALLIUM_H_ */
diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
index 54cc038905..879ced925a 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
@@ -34,6 +34,7 @@
#include "glapi/glapi.h"
#include "stw_public.h"
+#include "stw_extgallium.h"
struct stw_extension_entry
{
@@ -60,6 +61,10 @@ static const struct stw_extension_entry stw_extension_entries[] = {
STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ),
STW_EXTENSION_ENTRY( wglSwapIntervalEXT ),
+ /* WGL_EXT_gallium ? */
+ STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ),
+ STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ),
+
{ NULL, NULL }
};
@@ -75,7 +80,7 @@ stw_get_proc_address(
return entry->proc;
if (lpszProc[0] == 'g' && lpszProc[1] == 'l')
- return (PROC) _glapi_get_proc_address( lpszProc );
+ return (PROC) _glapi_get_proc_address( lpszProc );
return NULL;
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 476a24434c..cb49c4cb07 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -849,7 +849,6 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
/* Restore texture object state for each target */
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
const struct gl_texture_object *obj = NULL;
- GLfloat bordColor[4];
GLenum target;
obj = &texstate->SavedObj[u][tgt];
@@ -875,12 +874,7 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
_mesa_BindTexture(target, obj->Name);
- bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]);
- bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]);
- bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]);
- bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]);
-
- _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor);
+ _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, obj->BorderColor);
_mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT);
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 3fb67083a2..1722579e82 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -1021,6 +1021,22 @@ output_if_debug(const char *prefixString, const char *outputString,
}
}
+static const char *error_string( GLenum error );
+
+static void flush_delayed_errors( GLcontext *ctx )
+{
+ char s2[MAXSTRING];
+
+ if (ctx->ErrorDebugCount) {
+ _mesa_snprintf(s2, MAXSTRING, "%d similar %s errors",
+ ctx->ErrorDebugCount,
+ error_string(ctx->ErrorValue));
+
+ output_if_debug("Mesa: ", s2, GL_TRUE);
+
+ ctx->ErrorDebugCount = 0;
+ }
+}
/**
* Report a warning (a recoverable error condition) to stderr if
@@ -1034,10 +1050,12 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
{
char str[MAXSTRING];
va_list args;
- (void) ctx;
va_start( args, fmtString );
(void) vsnprintf( str, MAXSTRING, fmtString, args );
va_end( args );
+
+ if (ctx)
+ flush_delayed_errors( ctx );
output_if_debug("Mesa warning", str, GL_TRUE);
}
@@ -1065,6 +1083,31 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
}
+static const char *error_string( GLenum error )
+{
+ switch (error) {
+ case GL_NO_ERROR:
+ return "GL_NO_ERROR";
+ case GL_INVALID_VALUE:
+ return "GL_INVALID_VALUE";
+ case GL_INVALID_ENUM:
+ return "GL_INVALID_ENUM";
+ case GL_INVALID_OPERATION:
+ return "GL_INVALID_OPERATION";
+ case GL_STACK_OVERFLOW:
+ return "GL_STACK_OVERFLOW";
+ case GL_STACK_UNDERFLOW:
+ return "GL_STACK_UNDERFLOW";
+ case GL_OUT_OF_MEMORY:
+ return "GL_OUT_OF_MEMORY";
+ case GL_TABLE_TOO_LARGE:
+ return "GL_TABLE_TOO_LARGE";
+ case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
+ return "GL_INVALID_FRAMEBUFFER_OPERATION";
+ default:
+ return "unknown";
+ }
+}
/**
* Record an OpenGL state error. These usually occur when the user
@@ -1081,74 +1124,46 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
void
_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
{
- const char *debugEnv;
- GLboolean debug;
+ static GLint debug = -1;
- debugEnv = _mesa_getenv("MESA_DEBUG");
+ /* Check debug environment variable only once:
+ */
+ if (debug == -1) {
+ const char *debugEnv = _mesa_getenv("MESA_DEBUG");
#ifdef DEBUG
- if (debugEnv && _mesa_strstr(debugEnv, "silent"))
- debug = GL_FALSE;
- else
- debug = GL_TRUE;
+ if (debugEnv && _mesa_strstr(debugEnv, "silent"))
+ debug = GL_FALSE;
+ else
+ debug = GL_TRUE;
#else
- if (debugEnv)
- debug = GL_TRUE;
- else
- debug = GL_FALSE;
+ if (debugEnv)
+ debug = GL_TRUE;
+ else
+ debug = GL_FALSE;
#endif
+ }
- if (debug) {
- va_list args;
- char where[MAXSTRING];
- const char *errstr;
-
- va_start( args, fmtString );
- vsnprintf( where, MAXSTRING, fmtString, args );
- va_end( args );
-
- switch (error) {
- case GL_NO_ERROR:
- errstr = "GL_NO_ERROR";
- break;
- case GL_INVALID_VALUE:
- errstr = "GL_INVALID_VALUE";
- break;
- case GL_INVALID_ENUM:
- errstr = "GL_INVALID_ENUM";
- break;
- case GL_INVALID_OPERATION:
- errstr = "GL_INVALID_OPERATION";
- break;
- case GL_STACK_OVERFLOW:
- errstr = "GL_STACK_OVERFLOW";
- break;
- case GL_STACK_UNDERFLOW:
- errstr = "GL_STACK_UNDERFLOW";
- break;
- case GL_OUT_OF_MEMORY:
- errstr = "GL_OUT_OF_MEMORY";
- break;
- case GL_TABLE_TOO_LARGE:
- errstr = "GL_TABLE_TOO_LARGE";
- break;
- case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
- errstr = "GL_INVALID_FRAMEBUFFER_OPERATION";
- break;
- default:
- errstr = "unknown";
- break;
+ if (debug) {
+ if (ctx->ErrorValue == error &&
+ ctx->ErrorDebugFmtString == fmtString) {
+ ctx->ErrorDebugCount++;
}
-
- {
+ else {
char s[MAXSTRING], s2[MAXSTRING];
va_list args;
+
+ flush_delayed_errors( ctx );
+
va_start(args, fmtString);
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
- _mesa_snprintf(s2, MAXSTRING, "%s in %s", errstr, s);
+ _mesa_snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s);
output_if_debug("Mesa: User error", s2, GL_TRUE);
+
+ ctx->ErrorDebugFmtString = fmtString;
+ ctx->ErrorDebugCount = 0;
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d7e7d2ac21..d0309f5e90 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2986,6 +2986,13 @@ struct __GLcontextRec
#endif
GLenum ErrorValue; /**< Last error code */
+
+ /**
+ * Recognize and silence repeated error debug messages in buggy apps.
+ */
+ const char *ErrorDebugFmtString;
+ GLuint ErrorDebugCount;
+
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 909189f9d3..15f84b6638 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -237,14 +237,12 @@ do_memcpy(void *dest, const void *src, size_t n)
}
-static int
-logbase2(int n)
+static INLINE unsigned
+logbase2(unsigned n)
{
- GLint i = 1, log2 = 0;
- while (n > i) {
- i *= 2;
- log2++;
- }
+ unsigned log2 = 0;
+ while (n >>= 1)
+ ++log2;
return log2;
}
@@ -950,8 +948,9 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
/* Image is stored in hardware format in a buffer managed by the
* kernel. Need to explicitly map and unmap it.
*/
+ unsigned face = _mesa_tex_target_to_face(target);
- st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level,
+ st_teximage_flush_before_map(ctx->st, stImage->pt, face, level,
PIPE_TRANSFER_READ);
texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
@@ -1080,13 +1079,15 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
* from uploading the buffer under us.
*/
if (stImage->pt) {
+ unsigned face = _mesa_tex_target_to_face(target);
+
if (format == GL_DEPTH_COMPONENT &&
pf_is_depth_and_stencil(stImage->pt->format))
transfer_usage = PIPE_TRANSFER_READ_WRITE;
else
transfer_usage = PIPE_TRANSFER_WRITE;
- st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level,
+ st_teximage_flush_before_map(ctx->st, stImage->pt, face, level,
transfer_usage);
texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset,
transfer_usage,
@@ -1213,7 +1214,9 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
int y;
if (stImage->pt) {
- st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level,
+ unsigned face = _mesa_tex_target_to_face(target);
+
+ st_teximage_flush_before_map(ctx->st, stImage->pt, face, level,
PIPE_TRANSFER_WRITE);
texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
PIPE_TRANSFER_WRITE,