12012-10-30 Max Vujovic <mvujovic@adobe.com>
2
3 [CSS Shaders] Get rid of internal tex coord attribute
4 https://bugs.webkit.org/show_bug.cgi?id=94358
5
6 Reviewed by NOBODY (OOPS!).
7
8 Remove the internal css_a_texCoord attribute that WebKit added to shaders in order to
9 sample the element texture by texture coordinate.
10
11 Now, the WebKit-added sampling code can leverage a_texCoord if the author defined it, or
12 WebKit can add its own a_texCoord definition to the author's shader.
13
14 Note that vertex attributes are read-only in GLSL. Also, note that we already reject the
15 shader if the author did not define a_texCoord with the correct type. Essentially, if
16 a_texCoord exists in the author's validated shader, we are guaranteed that it's the correct
17 type and that its value is unmodified.
18
19 Test: css3/filters/custom/custom-filter-a-tex-coord-optional.html
20
21 * platform/graphics/filters/CustomFilterCompiledProgram.cpp:
22 (WebCore::CustomFilterCompiledProgram::CustomFilterCompiledProgram):
23 Remove the references to m_internalTexCoordAttribLocation.
24 (WebCore::CustomFilterCompiledProgram::initializeParameterLocations): Ditto.
25 * platform/graphics/filters/CustomFilterCompiledProgram.h: Ditto.
26 * platform/graphics/filters/CustomFilterRenderer.cpp:
27 (WebCore::CustomFilterRenderer::bindProgramAndBuffers): Ditto.
28 (WebCore::CustomFilterRenderer::unbindVertexAttributes): Ditto.
29 * platform/graphics/filters/CustomFilterValidatedProgram.cpp:
30 (WebCore::CustomFilterValidatedProgram::CustomFilterValidatedProgram):
31 Pass the set of symbols found in the author's shaders to the rewriteMixVertexShader
32 method.
33 (WebCore::CustomFilterValidatedProgram::rewriteMixVertexShader):
34 If the author didn't define a_texCoord, add it to the end of the author's vertex
35 shader, but before the shader's new main function. As before, the new main function
36 will pass the texture coordinate to the fragment shader via the css_v_texCoord varying.
37 * platform/graphics/filters/CustomFilterValidatedProgram.h:
38 (WebCore):
39 Add a forward declaration for ANGLEShaderSymbol.
40 (CustomFilterValidatedProgram):
41 Update the method prototype for rewriteMixVertexShader.
42