diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-03-31 17:26:31 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-03-31 17:31:14 +0100 |
commit | c5d4a44f449a8203a8b1da9b18806a718d80f131 (patch) | |
tree | 63b454fc89d69a48d8802862601e58812b0acd80 /src/gallium/auxiliary/util/u_format_pack.py | |
parent | 8e833c7988a218d3c01ff79f17bdeed40058b32e (diff) |
util: Use u_format_pack.py's code instead of u_format_access.py.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_pack.py')
-rw-r--r-- | src/gallium/auxiliary/util/u_format_pack.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index f40b3bdf2e..4831912f02 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -38,6 +38,7 @@ import sys +import math from u_format_parse import * @@ -90,6 +91,20 @@ def generate_format_type(format): print +def generate_srgb_tables(): + print 'static ubyte srgb_to_linear[256] = {' + for i in range(256): + print ' %s,' % (int(math.pow((i / 255.0 + 0.055) / 1.055, 2.4) * 255)) + print '};' + print + print 'static ubyte linear_to_srgb[256] = {' + print ' 0,' + for i in range(1, 256): + print ' %s,' % (int((1.055 * math.pow(i / 255.0, 0.41666) - 0.055) * 255)) + print '};' + print + + def bswap_format(format): '''Generate a structure that describes the format.''' |