Return shader variable information using GLenum values.

Instead of duplicating GL header define values, explictly return
GLenum for variable queries in the shader inspection API. This
reduces the duplicate defines in the shader compiler header.

BUG=angle:466

Change-Id: Iddaaff597b188251fa2e546f352bf77ab3ac43bc
Reviewed-on: https://chromium-review.googlesource.com/205860
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Remove duplicate SH and GL functions.

In several places we were using variable query methods that
were duplicated between the old SH enums and the corresponding
GL enums. We can use the common GL enum versions now.

BUG=angle:466

Change-Id: Ib8797fe6bc75828e05aed37b1f5fbd4b9ba03d22
Reviewed-on: https://chromium-review.googlesource.com/205594
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Consolidate varying packing sort order methods.

We were using the same list in the shader varying sorting
as well as in the varying packing validation in the
translator.

BUG=angle:466

Change-Id: Ic11758288e7a522d7c18a293de9e137e487e3978
Reviewed-on: https://chromium-review.googlesource.com/205595
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Add GLES 3 types to the VariablePacker test.

These include the new sampler types, non-square matices, and
unsigned int vectors.

BUG=angle:466

Change-Id: I0d88fadfc3f81a2d9be604ee1dffefd5a4a343c5
Reviewed-on: https://chromium-review.googlesource.com/205838
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Use shader variable types for variable collection.

Retire the old TVariableInfoList structure, and use the new
objects which we will expose more directly through the API.

BUG=angle:466

Change-Id: I999a97369bfb67cf73cd659c4fe885b41429d304
Reviewed-on: https://chromium-review.googlesource.com/205839
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Consolidate shader variable storage in Compiler.

The Compiler base class now stores all the shader variables and
interface block information, instead of duplicating the information
in the HLSL translator.

BUG=angle:466

Change-Id: Ia69079fde64fbd6b0cbfc66defd5e37d99ee3e6e
Reviewed-on: https://chromium-review.googlesource.com/206020
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Fix GCC warning about initialization order.

Shifting these fields was breaking the build in Linux GCC.

BUG=angle:690

Change-Id: I34286753f7ab636900f25f880187dbb297e9c040
Reviewed-on: https://chromium-review.googlesource.com/206632
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Fix ConvertPrecision.

This method had never been fully implemented, and was returning
"highp" for every case value.

This should fix problems with the GPU FYI bots.

BUG=angle:691

Change-Id: Ie6ffa80cf2c063e506df06fb25d622227edeffa3
Reviewed-on: https://chromium-review.googlesource.com/206565
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Allow ConvertPrecision to return undefined.

The overly-restrictive check would fail on sampler types or other
GL types with no defined precision.

This fixes failures on the Debug GPU FYI bots.

BUG=angle:691

Change-Id: I443b7038a7b7a05675898b9b21e6112b1ac4c5ca
Reviewed-on: https://chromium-review.googlesource.com/206552
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Support building angle with clang-cl

This works around http://llvm.org/PR20013.

Change-Id: Ibbd8ab4678cf1caf39b329ea304bdbdc21075ddf
Reviewed-on: https://chromium-review.googlesource.com/206481
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: <ehsan@mozilla.com>
Add ANGLE_NO_EXCEPTIONS macro

This macro allows us to hide angle's usage of try/catch so that we can
properly hide them from compilers that do not support exceptions
properly (such as clang-cl and gcc/clang with -fno-exceptions).

Change-Id: I75f466a5322e5840e007711ea851f444bd6ca299
Reviewed-on: https://chromium-review.googlesource.com/206562
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: <ehsan@mozilla.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Fix not rewriting else-if blocks.

We would miss expanding the else-if clauses in a chain
of selection statements.

BUG=346463
BUG=391697

Change-Id: Iee644b875cf68d0ed3dc0b73542efc49ecb23242
Reviewed-on: https://chromium-review.googlesource.com/206822
Reviewed-by: Nicolas Capens <capn@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Add a new TIntermRaw node type to translator.

This raw node stores text strings that we directly copy to the
output. This allows for more tricky substitutions that don't fit
in to the HLSL/GLSL shared parsing model.

BUG=346463
BUG=391697

Change-Id: Ibbde6db4fc98ef6d892f219631ca1a258a902a86
Reviewed-on: https://chromium-review.googlesource.com/206823
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Fix HLSL compiler error with else-rewriting in functions.

In functions with return types where we would use if-else rewriting,
we would potentially generate a spurious HLSL error that warned of
branches with no return value in the function.

This was causing a maps regression where overlays would not draw
in Earth mode.

BUG=346463
BUG=391697

Change-Id: I9f4fa959057a3a2dab6cdd98f8381b5871cabf03
Reviewed-on: https://chromium-review.googlesource.com/206824
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Removed sampler state getters and setters from gl::Texture

BUG=angle:688
Change-Id: I3f203e4d10059c12a0c00e967ad6c7d3b3a18074
Reviewed-on: https://chromium-review.googlesource.com/206335
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Brandon Jones <bajones@chromium.org>
Add helper methods for FBO attachment validation.

Subsequent refactoring will eliminate duplicate code.

BUG=angle:571

Change-Id: I086320beb5c432c326d29d047931575e6f2a1d64
Reviewed-on: https://chromium-review.googlesource.com/205603
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Add a ValidateAttachmentTarget helper method.

This helper returns the appropriate error with the user specifies
an attachment that is invalid or out-of-range (for indexed color
attachments).

BUG=angle:571

Change-Id: I80ed347e3540579110e40e742fbacb0467cb85fd
Reviewed-on: https://chromium-review.googlesource.com/205604
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Improve the const correctness.

This improvement to the const correctness makes ProgramBinary::save
compile with clang-cl as well, which is more strict than MSVC.

Change-Id: Iae091643fa1df7f094b89dbe7529c4e173f04a6d
Reviewed-on: https://chromium-review.googlesource.com/206714
Tested-by: <ehsan@mozilla.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Fixed an issue with Streaming Vertex data overflowing it's buffer.

Bug=angle:689
Change-Id: Ia0ee6f951822901560888ea300a3889601fa1d89
Reviewed-on: https://chromium-review.googlesource.com/207010
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Brandon Jones <bajones@chromium.org>
Share ArrayString and Str helper methods.

Placing these string helper methods allows us to re-use them in
the relevant place of the shader translator.

BUG=angle:466

Change-Id: Idd638542027d3b1035bc79fc941e80bf436c82af
Reviewed-on: https://chromium-review.googlesource.com/206567
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>