[Piglit] [PATCH 16/45] gen_shader_bit_encoding: cleanup some style issues

Matt Turner mattst88 at gmail.com
Fri Nov 14 14:04:23 PST 2014


On Wed, Nov 12, 2014 at 3:45 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  generated_tests/gen_shader_bit_encoding_tests.py | 142 ++++++++++++-----------
>  1 file changed, 76 insertions(+), 66 deletions(-)
>
> diff --git a/generated_tests/gen_shader_bit_encoding_tests.py b/generated_tests/gen_shader_bit_encoding_tests.py
> index 84b9390..d409db0 100644
> --- a/generated_tests/gen_shader_bit_encoding_tests.py
> +++ b/generated_tests/gen_shader_bit_encoding_tests.py
> @@ -29,31 +29,42 @@ from templates import template_file
>  TEMPLATE = template_file(os.path.basename(os.path.splitext(__file__)[0]),
>                           'template.shader_test.mako')
>
> -
> -def floatBitsToInt(f):
> +def floatbitstoint(f):

These were named with capital letters to match the GLSL built-in
function names. I don't see any reason to change them.

>      return struct.unpack('i', struct.pack('f', f))[0]
>
> -def floatBitsToUint(f):
> +
> +def floatbitstouint(f):
>      return struct.unpack('I', struct.pack('f', f))[0]
>
> -def intBitsToFloat(i):
> +
> +def intbitstofloat(i):
>      return struct.unpack('f', struct.pack('i', i))[0]
>
> -def uintBitsToFloat(u):
> +
> +def uintbitstofloat(u):
>      return struct.unpack('f', struct.pack('I', u))[0]
>
> +
>  def passthrough(f):
>      return f
>
> +
>  def neg(num):
>      return -num
>
> +
>  def neg_abs(num):
>      return -abs(num)
>
> +
>  def vec4(f):
>      return [f, f, f, f]
>
> +
> +# Don't test +inf or -inf, since we don't have a way to pass them via
> +# shader_runner [test] sections. Don't test NaN, since it has many
> +# representations. Don't test subnormal values, since hardware might
> +# flush them to zero.
>  test_data = {
>      # Interesting floating-point inputs
>      'mixed':                        (2.0, 9.5, -4.5, -25.0),
> @@ -65,11 +76,6 @@ test_data = {
>      'normalized smallest negative': vec4(-1.1754944e-38),
>      'normalized largest':           vec4( 3.4028235e+38),
>      'normalized largest negative':  vec4(-3.4028235e+38)
> -
> -    # Don't test +inf or -inf, since we don't have a way to pass them via
> -    # shader_runner [test] sections. Don't test NaN, since it has many
> -    # representations. Don't test subnormal values, since hardware might
> -    # flush them to zero.

This comment was here (i.e., in the block) because that's where you'd
have expected to find entries for inf and NaN.


More information about the Piglit mailing list