mesa: Branch 'master' - 3 commits
Brian Paul
brianp at kemper.freedesktop.org
Wed Apr 18 20:55:20 UTC 2007
src/mesa/main/context.c | 2 +-
src/mesa/main/mtypes.h | 2 +-
src/mesa/shader/prog_parameter.c | 13 ++++++++-----
src/mesa/shader/prog_parameter.h | 4 +++-
src/mesa/shader/shader_api.c | 15 +++++++--------
5 files changed, 20 insertions(+), 16 deletions(-)
New commits:
diff-tree bac15c8db87261ea168caa98d818bd6917ca14d6 (from f3e8c32376d8bdf1c48a0a2ad97eddcde7fc2f00)
Author: Brian <brian at yutani.localnet.net>
Date: Wed Apr 18 14:55:18 2007 -0600
Remove bad assertions, decrement NumShaders in _mesa_detach_shader().
Fixes crashes w/ Brad King's depth peeling test.
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 004c9c8..0c4f483 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -309,8 +309,6 @@ _mesa_lookup_shader(GLcontext *ctx, GLui
* what we're expecting.
*/
if (sh && sh->Type == GL_SHADER_PROGRAM_MESA) {
- assert(sh->Type == GL_VERTEX_SHADER ||
- sh->Type == GL_FRAGMENT_SHADER);
return NULL;
}
return sh;
@@ -576,6 +574,7 @@ _mesa_detach_shader(GLcontext *ctx, GLui
_mesa_free(shProg->Shaders);
shProg->Shaders = newList;
+ shProg->NumShaders = n - 1;
return;
}
}
diff-tree f3e8c32376d8bdf1c48a0a2ad97eddcde7fc2f00 (from 6d3d9c1c6de33646b63d47892863939ee1b1e624)
Author: Brian <brian at yutani.localnet.net>
Date: Wed Apr 18 14:53:23 2007 -0600
s/GL_SHADER_PROGRAM/GL_SHADER_PROGRAM_MESA/ (a Mesa-specific token)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 93442b9..9dc7b11 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -629,7 +629,7 @@ delete_shader_cb(GLuint id, void *data,
}
else {
struct gl_shader_program *shProg = (struct gl_shader_program *) data;
- ASSERT(shProg->Type == GL_SHADER_PROGRAM);
+ ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA);
_mesa_free_shader_program(ctx, shProg);
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 89cdc79..0044494 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -47,7 +47,7 @@
/**
* Special, internal token
*/
-#define GL_SHADER_PROGRAM 0x9999
+#define GL_SHADER_PROGRAM_MESA 0x9999
/**
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 41646e7..004c9c8 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -58,7 +58,7 @@ _mesa_new_shader_program(GLcontext *ctx,
struct gl_shader_program *shProg;
shProg = CALLOC_STRUCT(gl_shader_program);
if (shProg) {
- shProg->Type = GL_SHADER_PROGRAM;
+ shProg->Type = GL_SHADER_PROGRAM_MESA;
shProg->Name = name;
shProg->RefCount = 1;
shProg->Attributes = _mesa_new_parameter_list();
@@ -114,7 +114,7 @@ _mesa_free_shader_program_data(GLcontext
{
GLuint i;
- assert(shProg->Type == GL_SHADER_PROGRAM);
+ assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
_mesa_clear_shader_program_data(ctx, shProg);
@@ -204,7 +204,7 @@ _mesa_lookup_shader_program(GLcontext *c
* in the same hash table. Check the object's type to be sure it's
* what we're expecting.
*/
- if (shProg && shProg->Type != GL_SHADER_PROGRAM) {
+ if (shProg && shProg->Type != GL_SHADER_PROGRAM_MESA) {
return NULL;
}
return shProg;
@@ -308,7 +308,7 @@ _mesa_lookup_shader(GLcontext *ctx, GLui
* in the same hash table. Check the object's type to be sure it's
* what we're expecting.
*/
- if (sh && sh->Type == GL_SHADER_PROGRAM) {
+ if (sh && sh->Type == GL_SHADER_PROGRAM_MESA) {
assert(sh->Type == GL_VERTEX_SHADER ||
sh->Type == GL_FRAGMENT_SHADER);
return NULL;
diff-tree 6d3d9c1c6de33646b63d47892863939ee1b1e624 (from e57e752eeef1611cbc8bf9e0aca8c2467267f027)
Author: Brian <brian at yutani.localnet.net>
Date: Wed Apr 18 14:19:17 2007 -0600
Replace _mesa_parameter_longest_name() with _mesa_longest_parameter_name().
The later takes a type parameter so we can match uniforms or attributes/inputs.
Used by the GL_ACTIVE_ATTRIBUTE_MAX_LENGTH and GL_ACTIVE_UNIFORM_MAX_LENGTH
queries. Fixes problem reported by Brad King in VTK.
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 2c8a340..fe90ca6 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -586,18 +586,21 @@ _mesa_clone_parameter_list(const struct
/**
- * Find longest name of any parameter in list.
+ * Find longest name of all uniform parameters in list.
*/
GLuint
-_mesa_parameter_longest_name(const struct gl_program_parameter_list *list)
+_mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
+ enum register_file type)
{
GLuint i, maxLen = 0;
if (!list)
return 0;
for (i = 0; i < list->NumParameters; i++) {
- GLuint len = _mesa_strlen(list->Parameters[i].Name);
- if (len > maxLen)
- maxLen = len;
+ if (list->Parameters[i].Type == type) {
+ GLuint len = _mesa_strlen(list->Parameters[i].Name);
+ if (len > maxLen)
+ maxLen = len;
+ }
}
return maxLen;
}
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h
index 3d32a64..879623b 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/shader/prog_parameter.h
@@ -131,6 +131,8 @@ _mesa_lookup_parameter_constant(const st
GLint *posOut, GLuint *swizzleOut);
extern GLuint
-_mesa_parameter_longest_name(const struct gl_program_parameter_list *list);
+_mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
+ enum register_file type);
+
#endif /* PROG_PARAMETER_H */
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index fc1ae28..41646e7 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -763,13 +763,13 @@ _mesa_get_programiv(GLcontext *ctx, GLui
*params = shProg->Attributes ? shProg->Attributes->NumParameters : 0;
break;
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
- *params = _mesa_parameter_longest_name(shProg->Attributes);
+ *params = _mesa_longest_parameter_name(shProg->Attributes, PROGRAM_INPUT);
break;
case GL_ACTIVE_UNIFORMS:
*params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0;
break;
case GL_ACTIVE_UNIFORM_MAX_LENGTH:
- *params = _mesa_parameter_longest_name(shProg->Uniforms);
+ *params = _mesa_longest_parameter_name(shProg->Uniforms, PROGRAM_UNIFORM);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
More information about the mesa-commit
mailing list