OSDN Git Service

glsl: Allow default precision qualifiers to be set for sampler types.
authorPaul Berry <stereotype441@gmail.com>
Tue, 12 Feb 2013 20:36:41 +0000 (12:36 -0800)
committerPaul Berry <stereotype441@gmail.com>
Wed, 13 Feb 2013 15:57:58 +0000 (07:57 -0800)
commitd5948f2f5e37d1abc0d433ddf43407d87b2d1227
tree9f2952e44ee6edc353cba7da37781eb91016752e
parent60aa5f360a01ff56ba9566ac86c4e68543d829a5
glsl: Allow default precision qualifiers to be set for sampler types.

From GLSL ES 3.00 section 4.5.4 ("Default Precision Qualifiers"):

    "The precision statement

        precision precision-qualifier type;

    can be used to establish a default precision qualifier. The type
    field can be either int or float or any of the sampler types, and
    the precision-qualifier can be lowp, mediump, or highp."

GLSL ES 1.00 has similar language.  GLSL 1.30 doesn't allow precision
qualifiers on sampler types, but this seems like an oversight (since
the intention of including these in GLSL 1.30 is to allow
compatibility with ES shaders).

Previously, Mesa followed GLSL 1.30 and only allowed default precision
qualifiers to be set for float and int.  This patch makes it follow
GLSL ES rules in all cases.

Fixes Piglit tests default-precision-sampler.{vert,frag}.

Partially addresses https://bugs.freedesktop.org/show_bug.cgi?id=60737.

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/ast_to_hir.cpp