<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Bisected] dEQP-GLES3: uniform linking logic in the presence of structs"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89726#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Bisected] dEQP-GLES3: uniform linking logic in the presence of structs"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89726">bug 89726</a>
              from <span class="vcard"><a class="email" href="mailto:imirkin@alum.mit.edu" title="Ilia Mirkin <imirkin@alum.mit.edu>"> <span class="fn">Ilia Mirkin</span></a>
</span></b>
        <pre>Yeah.... IMO that's the wrong fix though. I think my earlier code was just
bonkers (which I knew at the time, but was hoping I could get away with). This
is what I'm testing right now:

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 38b37a6..be87b0a 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1077,15 +1077,6 @@ glsl_type::std140_base_alignment(bool row_major) const
       return base_alignment;
    }

-   /* A sampler may never occur in a UBO (without bindless of some sort),
-    * however it is convenient to use this alignment function even with
-    * regular uniforms. This allows use of this function on uniform structs
-    * that contain samplers.
-    */
-   if (this->is_sampler()) {
-      return 0;
-   }
-
    assert(!"not reached");
    return -1;
 }
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 799c74b..59adc29 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -547,6 +547,8 @@ private:
    virtual void enter_record(const glsl_type *type, const char *name,
                              bool row_major) {
       assert(type->is_record());
+      if (this->ubo_block_index == -1)
+         return;
       this->ubo_byte_offset = glsl_align(
             this->ubo_byte_offset, type->std140_base_alignment(row_major));
    }
@@ -554,6 +556,8 @@ private:
    virtual void leave_record(const glsl_type *type, const char *name,
                              bool row_major) {
       assert(type->is_record());
+      if (this->ubo_block_index == -1)
+         return;
       this->ubo_byte_offset = glsl_align(
             this->ubo_byte_offset, type->std140_base_alignment(row_major));
    }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>