[Mesa-dev] [Bug 90207] [r600g, bisected] regression: NI/Turks crash on WebGL Water (most WebGL stuff)

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Apr 28 13:48:36 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=90207

--- Comment #13 from José Fonseca <jfonseca at vmware.com> ---
I think I figured out the problem.

As commented on DECL_RESOURCE_FUNC macro, the RESOURCE_VAR inline function is
not type safe, and stuff that's not a ir_variable is wrongly being casted into
it. 

This patch seems to do the trick, but I'm not 100% sure.

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index a84ec84..d2ca49b 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -302,8 +302,10 @@ _mesa_count_active_attribs(struct gl_shader_program
*shProg)
    struct gl_program_resource *res = shProg->ProgramResourceList;
    unsigned count = 0;
    for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
-         if (is_active_attrib(RESOURCE_VAR(res)))
-            count++;
+      if (res->Type == GL_PROGRAM_INPUT &&
+          res->StageReferences & (1 << MESA_SHADER_VERTEX) &&
+          is_active_attrib(RESOURCE_VAR(res)))
+         count++;
    }
    return count;
 }



I think we should invest the time to make RESOURCE_VAR and friends more robust,
by adding assertions that the types are indeed correct.  (Replace
DECL_RESOURCE_FUNC helper macro by manually written code if necessary.)

This sort of bugs is hard to find otherwise.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are on the CC list for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150428/80c92103/attachment.html>


More information about the mesa-dev mailing list