summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-01-20 12:05:38 -0800
committerIan Romanick <[email protected]>2011-01-20 13:35:59 -0800
commit04dca296e0a5e5ffbb8acb699e013a23ebd7b645 (patch)
tree6d87f765778b356035e2f87f1cd9d895d5be6e9d /src
parentdde3270c19143b42a55a93e1e85bb24194462671 (diff)
mesa: Set correct values for range/precision of shader integer types
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/context.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index fe370fa369b..e017939a45c 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;
}