Bug 93878

Summary: [llvmpipe][softpipe] piglit arb_gpu_shader_fp64-double-gettransformfeedbackvarying regression
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: Samuel Iglesias Gonsálvez <siglesias>
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: lemody, siglesias
Version: gitKeywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2016-01-26 21:59:41 UTC
mesa: 98cebc913cd7ad07ce9699b5f63d72fe3969c851 (master 11.2.0-devel)

$ ./bin/arb_gpu_shader_fp64-double-gettransformfeedbackvarying -auto
arb_gpu_shader_fp64-double-gettransformfeedbackvarying: src/compiler/glsl/lower_packed_varyings.cpp:314: void {anonymous}::lower_packed_varyings_visitor::bitwise_assign_pack(ir_rvalue*, ir_rvalue*): Assertion `lhs->type->base_type == GLSL_TYPE_INT' failed.
Aborted (core dumped)

(gdb) bt
#0  0x00007febd3691267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007febd3692eca in __GI_abort () at abort.c:89
#2  0x00007febd368a03d in __assert_fail_base (fmt=0x7febd37ec028 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7febd29f3148 "lhs->type->base_type == GLSL_TYPE_INT", 
    file=file@entry=0x7febd29f3098 "src/compiler/glsl/lower_packed_varyings.cpp", line=line@entry=314, 
    function=function@entry=0x7febd29f3400 <(anonymous namespace)::lower_packed_varyings_visitor::bitwise_assign_pack(ir_rvalue*, ir_rvalue*)::__PRETTY_FUNCTION__> "void {anonymous}::lower_packed_varyings_visitor::bitwise_assign_pack(ir_rvalue*, ir_rvalue*)") at assert.c:92
#3  0x00007febd368a0f2 in __GI___assert_fail (assertion=0x7febd29f3148 "lhs->type->base_type == GLSL_TYPE_INT", 
    file=0x7febd29f3098 "src/compiler/glsl/lower_packed_varyings.cpp", line=314, 
    function=0x7febd29f3400 <(anonymous namespace)::lower_packed_varyings_visitor::bitwise_assign_pack(ir_rvalue*, ir_rvalue*)::__PRETTY_FUNCTION__> "void {anonymous}::lower_packed_varyings_visitor::bitwise_assign_pack(ir_rvalue*, ir_rvalue*)") at assert.c:101
#4  0x00007febd1d976c0 in (anonymous namespace)::lower_packed_varyings_visitor::bitwise_assign_pack (this=0x7fff861200a0, lhs=0x2191e00, rhs=0x219e890)
    at src/compiler/glsl/lower_packed_varyings.cpp:314
#5  0x00007febd1d9874d in (anonymous namespace)::lower_packed_varyings_visitor::lower_rvalue (this=0x7fff861200a0, rvalue=0x219e890, fine_location=104, 
    unpacked_var=0x2191080, name=0x2192fe0 "tfout", gs_input_toplevel=false, vertex_index=0) at src/compiler/glsl/lower_packed_varyings.cpp:523
#6  0x00007febd1d9760c in (anonymous namespace)::lower_packed_varyings_visitor::run (this=0x7fff861200a0, shader=0x219ea50)
    at src/compiler/glsl/lower_packed_varyings.cpp:293
#7  0x00007febd1d98ef4 in lower_packed_varyings (mem_ctx=0x21607b0, locations_used=1, mode=ir_var_shader_out, gs_input_vertices=0, shader=0x219ea50)
    at src/compiler/glsl/lower_packed_varyings.cpp:724
#8  0x00007febd1d875e5 in assign_varying_locations (ctx=0x7febd4146010, mem_ctx=0x21607b0, prog=0x2199be0, producer=0x219ea50, consumer=0x0, 
    num_tfeedback_decls=1, tfeedback_decls=0x2191c20) at src/compiler/glsl/link_varyings.cpp:1795
#9  0x00007febd1d799a1 in link_shaders (ctx=0x7febd4146010, prog=0x2199be0) at src/compiler/glsl/linker.cpp:4496
#10 0x00007febd1babe5a in _mesa_glsl_link_shader (ctx=0x7febd4146010, prog=0x2199be0) at src/mesa/program/ir_to_mesa.cpp:2958
#11 0x00007febd1afea10 in link_program (ctx=0x7febd4146010, program=2) at src/mesa/main/shaderapi.c:1048
#12 0x00007febd1affbf2 in _mesa_LinkProgram (programObj=2) at src/mesa/main/shaderapi.c:1520
#13 0x00007febd3cf6fac in stub_glLinkProgram (program=2) at piglit/tests/util/piglit-dispatch-gen.c:32599
#14 0x0000000000401133 in run_test (test=0x6020e0 <tests>)
    at piglit/tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c:93
#15 0x00000000004012a3 in piglit_init (argc=1, argv=0x7fff86120d88)
    at piglit/tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c:123
#16 0x00007febd3d6755b in run_test (gl_fw=0x2053380, argc=1, argv=0x7fff86120d88)
    at piglit/tests/util/piglit-framework-gl/piglit_winsys_framework.c:73
#17 0x00007febd3d4bcca in piglit_gl_test_run (argc=1, argv=0x7fff86120d88, config=0x7fff86120c40)
    at piglit/tests/util/piglit-framework-gl.c:199
#18 0x000000000040102f in main (argc=1, argv=0x7fff86120d88)
    at piglit/tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c:38
(gdb) frame 4
#4  0x00007febd1d976c0 in (anonymous namespace)::lower_packed_varyings_visitor::bitwise_assign_pack (this=0x7fff861200a0, lhs=0x2191e00, rhs=0x219e890)
    at src/compiler/glsl/lower_packed_varyings.cpp:314
314	      assert(lhs->type->base_type == GLSL_TYPE_INT);
(gdb) print lhs->type->base_type
$1 = GLSL_TYPE_FLOAT

781d2787bc1cf975757a95d0d9324f734fa61c09 is the first bad commit
commit 781d2787bc1cf975757a95d0d9324f734fa61c09
Author: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Date:   Tue Jan 12 15:36:56 2016 +0100

    glsl: restrict consumer stage condition to modify interpolation type
    
    Only modify interpolation type for integer-based varyings or when the
    consumer is known and different than fragment shader.
    
    If we are linking separate shader programs and the consumer is unknown,
    the consumer could be added later and be a fragment shader. If we
    modify the interpolation type in this case, we could read wrong
    values in the fragment shader inputs, as shown in bug 93320.
    
    Fixes the following CTS test:
       ES31-CTS.vertex_attrib_binding.advanced-bindingUpdate
    
    Fixes the following dEQP tests:
    
    dEQP-GLES31.functional.separate_shader.random.102
    dEQP-GLES31.functional.separate_shader.random.111
    dEQP-GLES31.functional.separate_shader.random.115
    dEQP-GLES31.functional.separate_shader.random.17
    dEQP-GLES31.functional.separate_shader.random.22
    dEQP-GLES31.functional.separate_shader.random.23
    dEQP-GLES31.functional.separate_shader.random.3
    dEQP-GLES31.functional.separate_shader.random.32
    dEQP-GLES31.functional.separate_shader.random.39
    dEQP-GLES31.functional.separate_shader.random.64
    dEQP-GLES31.functional.separate_shader.random.73
    dEQP-GLES31.functional.separate_shader.random.91
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93320
    Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
    Reviewed-by: Tapani Pälli <tapani.palli@intel.com>

:040000 040000 8563d9d06dfdf2cc552cc153a3063ce1b2a89630 9e5a9f21b23a7d215ddf322815b8327e10288033 M	src
bisect run success
Comment 1 Samuel Iglesias Gonsálvez 2016-01-27 09:53:50 UTC
According to ARB_gpu_shader_fp64 spec, doubles don't support interpolation:

"This extension does not support interpolation of double-precision
values; doubles used as fragment shader inputs must be qualified as
"flat"."

Mesa was assigning the flat qualifier to the doubles
before 781d278 because there was no consumer stage (these programs only
have a vertex shader attached to it) but not because there were doubles. I am going to write a patch to make explicit the double's case to fix these regressions.
Comment 2 Samuel Iglesias Gonsálvez 2016-01-28 10:37:16 UTC
Patch pushed to master:

commit f9c43dd22f92cd631f7feffb362a4cd3dad06c87
Author: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Date:   Tue Jan 26 12:47:26 2016 +0100

    glsl: double-precision values don't support interpolation

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.