Mesa (master): mesa: Set correct values for range/ precision of shader integer types
Ian Romanick
idr at kemper.freedesktop.org
Thu Jan 20 21:39:01 UTC 2011
Module: Mesa
Branch: master
Commit: 04dca296e0a5e5ffbb8acb699e013a23ebd7b645
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=04dca296e0a5e5ffbb8acb699e013a23ebd7b645
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Thu Jan 20 12:05:38 2011 -0800
mesa: Set correct values for range/precision of shader integer types
---
src/mesa/main/context.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index fe370fa..e017939 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -534,8 +534,17 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
prog->MediumFloat.RangeMax = 127;
prog->MediumFloat.Precision = 23;
prog->LowFloat = prog->HighFloat = prog->MediumFloat;
- /* assume ints are stored as floats for now */
- prog->LowInt = prog->MediumInt = prog->HighInt = prog->MediumFloat;
+
+ /* Assume ints are stored as floats for now, since this is the least-common
+ * denominator. The OpenGL ES spec implies (page 132) that the precision
+ * of integer types should be 0. Practically speaking, IEEE
+ * single-precision floating point values can only store integers in the
+ * range [-0x01000000, 0x01000000] without loss of precision.
+ */
+ prog->MediumInt.RangeMin = 24;
+ prog->MediumInt.RangeMax = 24;
+ prog->MediumInt.Precision = 0;
+ prog->LowInt = prog->HighInt = prog->MediumInt;
}
More information about the mesa-commit
mailing list