Fix crash on zero size but non-NULL bufferData.

Could cause a crash when running the WebGL CTS with Firefox.

BUG=angle:675

Change-Id: I58bf9eed622660d4702b775f368ff9cbd693197a
Reviewed-on: https://chromium-review.googlesource.com/203456
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>
Use commit_id.py on Windows, and handle missing git.

This allows us to delete the Windows batch file.

Changes the commit_id script to take the working directory so that it
can be called from a different working directory than the angle
repository is in.

Renames the generated commit header to angle_commit.h. This is being
written to the shared generated code directory for the entire build,
and "commit.h" is insufficiently unique.

BUG=angle:669

Change-Id: I35e80411a7e8ba1e02ce3f6a4fc54ed4dbc918f3
Reviewed-on: https://chromium-review.googlesource.com/202048
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Use a Caps structure to store extension and texture format support.

Removes support for fallbacks in D3D9 texture formats. The fallback
formats did not work properly anyways.

BUG=angle:658

Change-Id: Idfa5183bf71fd8ebf4608f940f9d93177b9eff08
Reviewed-on: https://chromium-review.googlesource.com/200813
Tested-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Add a std140 padding helper class.

Using a helper class keeps our main parser stateless as we define
std140 structs which need padding. The only functional change
should be that we no longer use a global counter for struct padding
hidden variables, but a local padding per-struct.

BUG=angle:466

Change-Id: I8b92d65884b86571c8b2f052b0cba6150a4bbab0
Reviewed-on: https://chromium-review.googlesource.com/202911
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>
Move draw call validation to new functions.

Separate draw call validation functions will give us a flexible
base for refactoring and cleaning up all draw call validation.

BUG=angle:571

Change-Id: Ia8e3c83cfe48fedb8f2c7aef1fb282f646c66e82
Reviewed-on: https://chromium-review.googlesource.com/202974
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Refactor draw validation functions.

We use a significant amount of code duplication in our draw
validation, that we can consolidate.

BUG=angle:571

Change-Id: I96787cbddf00d9289e368456fb85079d8acec513
Reviewed-on: https://chromium-review.googlesource.com/202975
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Eliminate conversion operations.

They've been replaced by using constructor nodes, so any code handling conversion operators
can be removed.

BUG=380353

Change-Id: I70413179e7443efccbf997a5dd0f053c23689589
Reviewed-on: https://chromium-review.googlesource.com/203453
Tested-by: Nicolas Capens <nicolascapens@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Generate pixel shader output to match the bound framebuffer.

Only generate pixel shader output variables for render targets that are
currently bound.  Fixes some performance issues with D3D10 cards that were
slow to discard unused outputs.

Fixed memory leaks in ProgramBinary by refactoring the freeing of the
current state into a reset function.

BUG=angle:670

Change-Id: I40f83e15724fb9a1a9ae61363a056999f1fa26d2
Reviewed-on: https://chromium-review.googlesource.com/202977
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
Re-enable MRT on D3D 10 and 10.1 cards.

BUG=angle:670

Change-Id: I88b4823f25ec28fa52831d856ff9fb836fdfc533
Reviewed-on: https://chromium-review.googlesource.com/203120
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
Fix ifdef complaints in clang

BUG=angle:677

Change-Id: Iee457dfc0990e5ffd61932b1f286f3c0208568bc
Reviewed-on: https://chromium-review.googlesource.com/203427
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
Fix dependent typename build error on non-MSVC compilers

BUG=angle:677

Change-Id: Ic0d257ef41e8c80baeddd664eb6c2cc5db94ee43
Reviewed-on: https://chromium-review.googlesource.com/203428
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
Fix build warnings about unused private variables on clang

BUG=angle:638,677

Change-Id: Id9e80f0b86d9c24633b2d353a409844c22441d21
Reviewed-on: https://chromium-review.googlesource.com/203429
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
Fix buffer overflow error on buffer resize.

We were using the new, larger size for our buffer data copy step,
instead of the old, smaller size. This bug was causing a crash on
older nVidia drivers during normal browser usage.

Reproducible with the index-validation-large-buffer WebGL test.

BUG=angle:667
BUG=384420

Change-Id: I98ee893e0d8ba0bfc9adfe5a338da9b940248879
Reviewed-on: https://chromium-review.googlesource.com/203776
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Add new ref-counted Renderbuffer class.

Renderbuffers are a clear object type in GL, and this patch adds
a more consistent state representation for them. They're managed
by the ResourceManager, and have a storage implementation similar
to Textures, but much simpler.

BUG=angle:660

Change-Id: Ia17199bb8cb570d48db42e1f28ccbcc12a902fcf
Reviewed-on: https://chromium-review.googlesource.com/201834
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Remove Renderer pointer from FBO attachments.

Removing the Renderer pointer is one step towards making FBO
attachments a minimal state object. Eventually we will be able
to store them as arrays instead of arrays of pointers.

BUG=angle:660

Change-Id: Idce34e06c339ecb18c60fef12d2ed911d0c4e0f6
Reviewed-on: https://chromium-review.googlesource.com/201835
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Refactoring VertexArrays

BUG=angle:676
Change-Id: If17b05ab667d79adcaacfbd1811ed92c0ce47fff
Reviewed-on: https://chromium-review.googlesource.com/203294
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
Implement support for constructing a 2x2 matrix from a vector.

BUG=380353

Change-Id: Ica0b94104e39f87b4a3439df40221b1f682fd678
Reviewed-on: https://chromium-review.googlesource.com/203293
Tested-by: Nicolas Capens <nicolascapens@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Fix compile warnings with attributes.

BUG=angle:676

Change-Id: I291c0b618854179f726cb4c969fb65182d3b591e
Reviewed-on: https://chromium-review.googlesource.com/204340
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Add a macro for unused trace variables.

This fixes the standalone 64-bit Debug build.

Change-Id: I348b71a96ada435867367e565bc84b570d2bfb67
Reviewed-on: https://chromium-review.googlesource.com/204292
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Split the ANGLE_platform_angle_d3d extension by adding child extensions.

Renames the ANGLE_platform_angle_d3d extension to ANGLE_platform_angle
which acts as an umbrella extension for all the angle display types but
requires the sub-extensions (d3d, opengl, software) to be present for the
enums to be valid (similar to the OES_framebuffer_object extension).

BUG=angle:668

Change-Id: I2c00021558d8b781b20f948f5e0df03f734bd033
Reviewed-on: https://chromium-review.googlesource.com/202597
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>