summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBryan Cain <[email protected]>2011-09-05 14:54:37 -0500
committerBryan Cain <[email protected]>2011-09-05 19:51:29 -0500
commit4e64cfbb4ec92877803e70257af8b97c484c00c0 (patch)
tree475e304989741806f2cd9544d3ca4d38c91c006b /src/mesa/main
parentf9b7d3bd4a744537db29f8688cf4c4109fb19ab1 (diff)
mesa: add a UniformBooleanTrue option
Drivers supporting native integers set UniformBooleanTrue to the integer value that should be used for true when uploading uniform booleans. This is ~0 for Gallium and 1 for i965. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/uniforms.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 44ebf0a5351..ad5979796d6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2722,6 +2722,12 @@ struct gl_constants
*/
GLboolean NativeIntegers;
+ /**
+ * If the driver supports real 32-bit integers, what integer value should be
+ * used for boolean true in uniform uploads? (Usually 1 or ~0.)
+ */
+ GLuint UniformBooleanTrue;
+
/** Which texture units support GL_ATI_envmap_bumpmap as targets */
GLbitfield SupportedBumpUnits;
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index fe1ce6d7b2c..b0f9c33b8d3 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -802,7 +802,10 @@ set_program_uniform(struct gl_context *ctx, struct gl_program *program,
else
uniformVal[i].b = uniformVal[i].u ? 1 : 0;
- if (!ctx->Const.NativeIntegers)
+ if (ctx->Const.NativeIntegers)
+ uniformVal[i].u =
+ uniformVal[i].b ? ctx->Const.UniformBooleanTrue : 0;
+ else
uniformVal[i].f = uniformVal[i].b ? 1.0f : 0.0f;
}
}