diff options
author | marha <marha@users.sourceforge.net> | 2011-04-27 15:56:59 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-04-27 15:56:59 +0000 |
commit | 100633b3e7619842f345cb7603b0db6b5761dd11 (patch) | |
tree | 3c3af754c7e801c07263269837d6a05072ff834c /mesalib/src/mesa/main/uniforms.c | |
parent | 205a4bdae76f287126db9f45a4f0ba631e3efca1 (diff) | |
parent | 96d6df5da9cddedf4931bf8e17f96e242467c661 (diff) | |
download | vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.tar.gz vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.tar.bz2 vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/main/uniforms.c')
-rw-r--r-- | mesalib/src/mesa/main/uniforms.c | 106 |
1 files changed, 92 insertions, 14 deletions
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index 24dc1336c..8d934642e 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -412,11 +412,10 @@ split_location_offset(GLint *location, GLint *offset) */
static void
_mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location,
- GLfloat *params)
+ GLsizei bufSize, GLfloat *params)
{
struct gl_program *prog;
- GLint paramPos;
- GLint offset;
+ GLint paramPos, offset;
split_location_offset(&location, &offset);
@@ -426,9 +425,18 @@ _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location, const struct gl_program_parameter *p =
&prog->Parameters->Parameters[paramPos];
GLint rows, cols, i, j, k;
+ GLsizei numBytes;
get_uniform_rows_cols(p, &rows, &cols);
+ numBytes = rows * cols * sizeof *params;
+ if (bufSize < numBytes) {
+ _mesa_error( ctx, GL_INVALID_OPERATION,
+ "glGetnUniformfvARB(out of bounds: bufSize is %d,"
+ " but %d bytes are required)", bufSize, numBytes );
+ return;
+ }
+
k = 0;
for (i = 0; i < rows; i++) {
const int base = paramPos + offset + i;
@@ -447,11 +455,10 @@ _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location, */
static void
_mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location,
- GLint *params)
+ GLsizei bufSize, GLint *params)
{
struct gl_program *prog;
- GLint paramPos;
- GLint offset;
+ GLint paramPos, offset;
split_location_offset(&location, &offset);
@@ -461,9 +468,18 @@ _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location, const struct gl_program_parameter *p =
&prog->Parameters->Parameters[paramPos];
GLint rows, cols, i, j, k;
+ GLsizei numBytes;
get_uniform_rows_cols(p, &rows, &cols);
+ numBytes = rows * cols * sizeof *params;
+ if (bufSize < numBytes) {
+ _mesa_error( ctx, GL_INVALID_OPERATION,
+ "glGetnUniformivARB(out of bounds: bufSize is %d,"
+ " but %d bytes are required)", bufSize, numBytes );
+ return;
+ }
+
k = 0;
for (i = 0; i < rows; i++) {
const int base = paramPos + offset + i;
@@ -483,11 +499,10 @@ _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location, */
static void
_mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location,
- GLuint *params)
+ GLsizei bufSize, GLuint *params)
{
struct gl_program *prog;
- GLint paramPos;
- GLint offset;
+ GLint paramPos, offset;
split_location_offset(&location, &offset);
@@ -497,9 +512,18 @@ _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location, const struct gl_program_parameter *p =
&prog->Parameters->Parameters[paramPos];
GLint rows, cols, i, j, k;
+ GLsizei numBytes;
get_uniform_rows_cols(p, &rows, &cols);
+ numBytes = rows * cols * sizeof *params;
+ if (bufSize < numBytes) {
+ _mesa_error( ctx, GL_INVALID_OPERATION,
+ "glGetnUniformuivARB(out of bounds: bufSize is %d,"
+ " but %d bytes are required)", bufSize, numBytes );
+ return;
+ }
+
k = 0;
for (i = 0; i < rows; i++) {
const int base = paramPos + offset + i;
@@ -513,6 +537,19 @@ _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location, /**
+ * Called via glGetUniformdv().
+ * New in GL_ARB_gpu_shader_fp64, OpenGL 4.0
+ */
+static void
+_mesa_get_uniformdv(struct gl_context *ctx, GLuint program, GLint location,
+ GLsizei bufSize, GLdouble *params)
+{
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformdvARB"
+ "(GL_ARB_gpu_shader_fp64 not implemented)");
+}
+
+
+/**
* Called via glGetUniformLocation().
*
* The return value will encode two values, the uniform location and an
@@ -1350,29 +1387,65 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, void GLAPIENTRY
-_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params)
+_mesa_GetnUniformfvARB(GLhandleARB program, GLint location,
+ GLsizei bufSize, GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- _mesa_get_uniformfv(ctx, program, location, params);
+ _mesa_get_uniformfv(ctx, program, location, bufSize, params);
+}
+
+void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params)
+{
+ _mesa_GetnUniformfvARB(program, location, INT_MAX, params);
}
void GLAPIENTRY
-_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params)
+_mesa_GetnUniformivARB(GLhandleARB program, GLint location,
+ GLsizei bufSize, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- _mesa_get_uniformiv(ctx, program, location, params);
+ _mesa_get_uniformiv(ctx, program, location, bufSize, params);
+}
+
+void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params)
+{
+ _mesa_GetnUniformivARB(program, location, INT_MAX, params);
}
/* GL3 */
void GLAPIENTRY
+_mesa_GetnUniformuivARB(GLhandleARB program, GLint location,
+ GLsizei bufSize, GLuint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_get_uniformuiv(ctx, program, location, bufSize, params);
+}
+
+void GLAPIENTRY
_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params)
{
+ _mesa_GetnUniformuivARB(program, location, INT_MAX, params);
+}
+
+
+/* GL4 */
+void GLAPIENTRY
+_mesa_GetnUniformdvARB(GLhandleARB program, GLint location,
+ GLsizei bufSize, GLdouble *params)
+{
GET_CURRENT_CONTEXT(ctx);
- _mesa_get_uniformuiv(ctx, program, location, params);
+ _mesa_get_uniformdv(ctx, program, location, bufSize, params);
}
+void GLAPIENTRY
+_mesa_GetUniformdv(GLhandleARB program, GLint location, GLdouble *params)
+{
+ _mesa_GetnUniformdvARB(program, location, INT_MAX, params);
+}
GLint GLAPIENTRY
@@ -1454,6 +1527,11 @@ _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec) SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
+ /* GL_ARB_robustness */
+ SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
+ SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
+ SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
+ SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
#endif /* FEATURE_GL */
}
|