summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shaderobjects_3dlabs.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-11-03 17:29:31 +0000
committerBrian Paul <[email protected]>2006-11-03 17:29:31 +0000
commitbdb251bcbf94e71f3adba4183c363259c01cde60 (patch)
tree7891c50964b145dc2d752e1a9ebd41059ee6ede0 /src/mesa/shader/shaderobjects_3dlabs.c
parente90e8278240f1c4c00b5cc466e92ffd671181b31 (diff)
Added OpenGL 2.1 glUniformMatrix* functions.
Refactor the _mesa_UniformMatrix() functions to use a helper function. Implement GetUniformfv function (might need more work someday).
Diffstat (limited to 'src/mesa/shader/shaderobjects_3dlabs.c')
-rwxr-xr-xsrc/mesa/shader/shaderobjects_3dlabs.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mesa/shader/shaderobjects_3dlabs.c b/src/mesa/shader/shaderobjects_3dlabs.c
index aed6a96c6a7..0209e868ade 100755
--- a/src/mesa/shader/shaderobjects_3dlabs.c
+++ b/src/mesa/shader/shaderobjects_3dlabs.c
@@ -1514,6 +1514,37 @@ _program_WriteUniform(struct gl2_program_intf **intf, GLint loc,
return GL_TRUE;
}
+static GLboolean
+_program_ReadUniform(struct gl2_program_intf **intf, GLint loc,
+ GLsizei count, GLfloat *data)
+{
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) (intf);
+ const slang_uniform_bindings *uniforms = &impl->_obj.prog.uniforms;
+ const slang_uniform_binding *uniform;
+ GLint i, j;
+
+ if (loc < 0 || loc >= uniforms->count)
+ return GL_FALSE;
+
+ uniform = &uniforms->table[loc];
+
+ /* loop over shader types (fragment, vertex) */
+ for (i = 0; i < SLANG_SHADER_MAX; i++) {
+ if (uniform->address[i] != ~0) {
+ GLfloat *src = (GLfloat *)
+ (&impl->_obj.prog.machines[i]->mem[uniform->address[i] / 4]);
+ GLuint total =
+ count * slang_export_data_quant_components(uniform->quant);
+ for (j = 0; j < total; j++)
+ data[j] = src[j];
+ break;
+ }
+ }
+
+ return GL_TRUE;
+}
+
+
static GLvoid
_program_GetActiveAttrib(struct gl2_program_intf **intf, GLuint index,
GLsizei maxLength, GLsizei * length, GLint * size,
@@ -1647,6 +1678,7 @@ static struct gl2_program_intf _program_vftbl = {
_program_GetActiveUniformCount,
_program_GetUniformLocation,
_program_WriteUniform,
+ _program_ReadUniform,
_program_GetActiveAttrib,
_program_GetActiveAttribMaxLength,
_program_GetActiveAttribCount,