aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/uniform_query.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
committermarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
commit82c8df11062f72a7d467e26cedbbd8b322ff7a70 (patch)
tree7e7a3e408d09d3e50ff0d2f9befeb5b7ab5617a5 /mesalib/src/mesa/main/uniform_query.cpp
parent8574eba804031f6b19713f0b02952280730bf62e (diff)
downloadvcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.gz
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.bz2
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.zip
randrproto fontconfig libX11 libXdmcp libxcb mesa xkbcomp xserver git update 22 Mar 2015
xserver commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56 libxcb commit a90be9955d2c5a635f791d44db1154633b9d3322 libX11 commit 5a499ca7b064bf7e6a4fcc169f22862dce0c60c5 libXdmcp commit 0c09444d276fbf46a0e8b427a4f6a325d0625742 xkbcomp commit fc3e6ddb2c8e922ea80f2dc5cbc1df2102e30d99 randrproto commit b1ba68df8a5fc113a387123ec2f312195e28e47f fontconfig commit 69ff6b6e260584e383c38b1b7034ddcbb23d214f mesa commit 397b491173f0d2df4deb44d21c170bf16840d507
Diffstat (limited to 'mesalib/src/mesa/main/uniform_query.cpp')
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp69
1 files changed, 65 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 9f82de952..2ab5528c3 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -260,8 +260,8 @@ validate_uniform_parameters(struct gl_context *ctx,
if (uni->array_elements == 0) {
if (count > 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(count > 1 for non-array, location=%d)",
- caller, location);
+ "%s(count = %u for non-array \"%s\"@%d)",
+ caller, count, uni->name, location);
return NULL;
}
@@ -601,6 +601,46 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
}
}
+
+/**
+ * Return printable string for a given GLSL_TYPE_x
+ */
+static const char *
+glsl_type_name(enum glsl_base_type type)
+{
+ switch (type) {
+ case GLSL_TYPE_UINT:
+ return "uint";
+ case GLSL_TYPE_INT:
+ return "int";
+ case GLSL_TYPE_FLOAT:
+ return "float";
+ case GLSL_TYPE_DOUBLE:
+ return "double";
+ case GLSL_TYPE_BOOL:
+ return "bool";
+ case GLSL_TYPE_SAMPLER:
+ return "sampler";
+ case GLSL_TYPE_IMAGE:
+ return "image";
+ case GLSL_TYPE_ATOMIC_UINT:
+ return "atomic_uint";
+ case GLSL_TYPE_STRUCT:
+ return "struct";
+ case GLSL_TYPE_INTERFACE:
+ return "interface";
+ case GLSL_TYPE_ARRAY:
+ return "array";
+ case GLSL_TYPE_VOID:
+ return "void";
+ case GLSL_TYPE_ERROR:
+ return "error";
+ default:
+ return "other";
+ }
+}
+
+
/**
* Called via glUniform*() functions.
*/
@@ -620,11 +660,28 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
if (uni == NULL)
return;
+ if (uni->type->is_matrix()) {
+ /* Can't set matrix uniforms (like mat4) with glUniform */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glUniform%u(uniform \"%s\"@%d is matrix)",
+ src_components, uni->name, location);
+ return;
+ }
+
/* Verify that the types are compatible.
*/
const unsigned components = uni->type->is_sampler()
? 1 : uni->type->vector_elements;
+ if (components != src_components) {
+ /* glUniformN() must match float/vecN type */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glUniform%u(\"%s\"@%u has %u components, not %u)",
+ src_components, uni->name, location,
+ components, src_components);
+ return;
+ }
+
bool match;
switch (uni->type->base_type) {
case GLSL_TYPE_BOOL:
@@ -639,8 +696,12 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
break;
}
- if (uni->type->is_matrix() || components != src_components || !match) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)");
+ if (!match) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glUniform%u(\"%s\"@%d is %s, not %s)",
+ src_components, uni->name, location,
+ glsl_type_name(uni->type->base_type),
+ glsl_type_name(basicType));
return;
}