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>
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index c004b49..1454538 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2404,7 +2404,9 @@
     VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
     VertexFormat::GetInputLayout(inputLayout, programBinary, vertexAttributes, mState.vertexAttribCurrentValues);
 
-    mRenderer->applyShaders(programBinary, mState.rasterizer.rasterizerDiscard, transformFeedbackActive, inputLayout);
+    const Framebuffer *fbo = getDrawFramebuffer();
+
+    mRenderer->applyShaders(programBinary, inputLayout, fbo, mState.rasterizer.rasterizerDiscard, transformFeedbackActive);
 
     programBinary->applyUniforms();
 }