mesa/src
Paul Berry fc2330b0be glsl: Catch redeclaration of interface block instance names at compile time.
From section 4.1.9 (Arrays) of the GLSL 4.40 spec (as of revision 7):

    However, unless noted otherwise, blocks cannot be redeclared;
    an unsized array in a user-declared block cannot be sized
    through redeclaration.

The only place where the spec notes that interface blocks can be
redeclared is to allow for redeclaration of built-in interface blocks
such as gl_PerVertex.  Therefore, user-defined interface blocks can
never be redeclared.  This is a clarification of previous intent (see
Khronos bug 10659).

We were already preventing interface block redeclaration using the
same block name at compile time, but we weren't preventing interface
block redeclaration using the same instance name (and different block
names) at compile time.  And we weren't preventing an instance name
from conflicting with a previously-declared ordinary variable.

In practice the problem would be caught at link time, but only because
of a coincidence: since ast_interface_block::hir() wasn't doing any
checking to see if the instance name already existed in the shader, it
was creating a second ir_variable in the shader having the same name
but a different type.  Coincidentally, when the linker checked for
intrastage consistency of global variable declarations, it treated the
two declarations from the same shader as a conflict, so it reported a
link error.

But it seems dangerous to rely on that linker behaviour to catch
illegal redeclarations that really ought to be detected at compile
time.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:35 -07:00
..
egl egl/main: remove undefined X11_LIBS automake variable 2013-10-09 10:36:01 -04:00
gallium radeon/winsys: fix handling in radeon_drm_cs_flush v2 2013-10-10 11:50:38 +02:00
gbm gbm: Link to libwayland-drm if Wayland EGL platform is enabled 2013-08-12 15:16:22 -07:00
getopt getopt: Make code more portable. 2011-01-12 16:54:21 +00:00
glsl glsl: Catch redeclaration of interface block instance names at compile time. 2013-10-10 14:27:35 -07:00
glx glx: Generate fewer errors in MakeContextCurrent 2013-10-08 13:24:20 -04:00
gtest gtest: Build it only for 'make check'. 2013-01-13 12:38:44 +01:00
mapi glapi: add output info to GetProgramiv's params 2013-10-07 09:06:33 -07:00
mesa i965/blorp: Allow format conversions for CopyTexSubImage. 2013-10-09 16:36:50 -07:00
Makefile.am gbm: Link to libwayland-drm if Wayland EGL platform is enabled 2013-08-12 15:16:22 -07:00
SConscript Remove libGLU 2012-08-31 10:58:15 -07:00