Bug 29747

Summary: [glsl2 i965] varying matrix gets assertion `c->regs[PROGRAM_STATE_VAR][index].nr != 0'
Product: Mesa Reporter: Gordon Jin <gordon.jin>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: idr
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 29044    
Attachments: test case for piglit shader_runner

Description Gordon Jin 2010-08-22 22:51:53 UTC
Created attachment 38085 [details]
test case for piglit shader_runner

Environment:
------------
Platform:       Piketon 
Arch:           x86_64
Mesa:		(master)8a878c266a8bf50b49d3ef8c5984790581e33133
Libdrm:         (master)2.4.21-16-gb61e81a191d3a5c269c5f7c40199aebc9ebc034c
Xf86_video_intel:		(master)2.12.0-71-g42312bbd8c9cbadf0adc4556b76987857d105bd9
Kernel_version:         2.6.35
Xserver:		xorg-server-1.9.0


Bug detailed description:
--------------------------
The attached test case uses "varying mat3x2", and it gets assertion in i965 driver after glsl2 merge:
brw_vs_emit.c:1145: get_src_reg: Assertion `c->regs[PROGRAM_STATE_VAR][index].nr != 0' failed.

It passed with mesa master before glsl2 merge.
It passes with LIBGL_ALWAYS_SOFTWARE=1.
It passes if the matrix is defined as mat3 or mat2x3.
It passes if myVar1 is constructed before gl_Position assignment.
Comment 1 Eric Anholt 2010-08-23 11:05:27 UTC
Screwed up and didn't --author the piglit commit.  Sorry.

commit 3ae5053143416ccfbb8e290574c49f84a9d76f46
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Aug 23 10:56:30 2010 -0700

    glsl-varying-mat3x2: New test for bug #29747.
    
    This ended up not being an issue with varyings so much as the constant
    handling in ir_to_mesa.cpp.

Mesa fix:

commit ebef04011736ea8e13692fed87623d425c4d1b08
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Aug 23 10:57:54 2010 -0700

    ir_to_mesa: Fix constant array handling to return the temp we created.
    
    We ended up returning CONST[loc] rather than TEMP[loc2].  Things would
    *usually* end up working out OK, since the constants often ended up
    getting allocated to CONST[loc..loc+columns] with no swizzle.  But for
    the case where the contigous temporary copy of the swizzled constant
    vec4 args was actually needed, we'd end up reading some other constant
    values, possibly including ones not actually allocated.
    
    Fixes: glsl-varying-mat3x2.
Comment 2 Gordon Jin 2010-08-24 18:19:54 UTC
Verified with the latest mesa. Thanks for refining the test case.

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.