Bug 29573

Summary: [glsl2] struct within a struct causes an assertion failure
Product: Mesa Reporter: Ian Romanick <idr>
Component: Mesa coreAssignee: Kenneth Graunke <kenneth>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: medium CC: vlee, xunx.fang
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 30124    

Description Ian Romanick 2010-08-13 20:08:05 UTC
In CorrectFull.frag, the following structure causes an assertion failure:

struct light1 
{
    float intensity;
   vec3 position;
   int test_int[2];
   struct 
   {
      int a;
      float f; 
   } light2;
} lightVar;

This variable is never dereferenced in the program.  The assertion failure is:

ir_validate.cpp:382: void check_node_type(ir_instruction*, void*): Assertion `ir->type != glsl_type::error_type' failed.

This was first triggered after the commit listed below, but I believe that is spurious.  The actual assertion is that the declaration of a variable lightVar_light2 has an error type.  My guess is that rearranging optimization passes have caused ir_validate to be called before this unused declaration could be removed.

commit 2f4fe151681a6f6afe1d452eece6cf4144f44e49
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Aug 10 13:06:49 2010 -0700

    glsl2: Move the common optimization passes to a helper function.
    
    These are passes that we expect all codegen to be happy with.  The
    other lowering passes for Mesa IR are moved to the Mesa IR generator.
Comment 1 Eric Anholt 2010-08-30 11:25:13 UTC
*** Bug 29688 has been marked as a duplicate of this bug. ***
Comment 2 madbiologist 2010-09-14 22:53:11 UTC
Any progress on this?
Comment 3 Kenneth Graunke 2010-09-18 02:24:07 UTC
Should be fixed in master:

commit ca92ae2699c4aad21c0811b9a5562b9223816caf
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Sep 18 11:11:09 2010 +0200

    glsl: Properly handle nested structure types.
    
    Fixes piglit test CorrectFull.frag.
Comment 4 Gordon Jin 2010-09-25 19:31:38 UTC
verified with mesa:
(master)16a457bba6909d0c34036277eb3a56f27f425c3d
(7.9)361084ac4b16c6af59671b776b832034990766f0

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.