diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/filters/CustomFilterValidatedProgram.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/filters/CustomFilterValidatedProgram.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/filters/CustomFilterValidatedProgram.cpp b/Source/WebCore/platform/graphics/filters/CustomFilterValidatedProgram.cpp index 4211e82b7..85ddda5a2 100644 --- a/Source/WebCore/platform/graphics/filters/CustomFilterValidatedProgram.cpp +++ b/Source/WebCore/platform/graphics/filters/CustomFilterValidatedProgram.cpp @@ -83,10 +83,12 @@ CustomFilterValidatedProgram::CustomFilterValidatedProgram(CustomFilterGlobalCon originalFragmentShader = defaultFragmentShaderString(); // Shaders referenced from the CSS mix function use a different validator than regular WebGL shaders. See CustomFilterGlobalContext.h for more details. - ANGLEWebKitBridge* validator = programInfo.mixSettings().enabled ? m_globalContext->mixShaderValidator() : m_globalContext->webglShaderValidator(); + bool blendsElementTexture = (programInfo.programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE); + ANGLEWebKitBridge* validator = blendsElementTexture ? m_globalContext->mixShaderValidator() : m_globalContext->webglShaderValidator(); String vertexShaderLog, fragmentShaderLog; - bool vertexShaderValid = validator->validateShaderSource(originalVertexShader.utf8().data(), SHADER_TYPE_VERTEX, m_validatedVertexShader, vertexShaderLog, SH_ATTRIBUTES_UNIFORMS); - bool fragmentShaderValid = validator->validateShaderSource(originalFragmentShader.utf8().data(), SHADER_TYPE_FRAGMENT, m_validatedFragmentShader, fragmentShaderLog, SH_ATTRIBUTES_UNIFORMS); + Vector<ANGLEShaderSymbol> symbols; + bool vertexShaderValid = validator->compileShaderSource(originalVertexShader.utf8().data(), SHADER_TYPE_VERTEX, m_validatedVertexShader, vertexShaderLog, symbols); + bool fragmentShaderValid = validator->compileShaderSource(originalFragmentShader.utf8().data(), SHADER_TYPE_FRAGMENT, m_validatedFragmentShader, fragmentShaderLog, symbols); if (!vertexShaderValid || !fragmentShaderValid) { // FIXME: Report the validation errors. // https://bugs.webkit.org/show_bug.cgi?id=74416 @@ -94,12 +96,7 @@ CustomFilterValidatedProgram::CustomFilterValidatedProgram(CustomFilterGlobalCon } // Validate the author's samplers. - Vector<ANGLEShaderSymbol> uniforms; - if (!validator->getUniforms(SH_VERTEX_SHADER, uniforms)) - return; - if (!validator->getUniforms(SH_FRAGMENT_SHADER, uniforms)) - return; - for (Vector<ANGLEShaderSymbol>::iterator it = uniforms.begin(); it != uniforms.end(); ++it) { + for (Vector<ANGLEShaderSymbol>::iterator it = symbols.begin(); it != symbols.end(); ++it) { if (it->isSampler()) { // FIXME: For now, we restrict shaders with any sampler defined. // When we implement texture parameters, we will allow shaders whose samplers are bound to valid textures. @@ -111,7 +108,7 @@ CustomFilterValidatedProgram::CustomFilterValidatedProgram(CustomFilterGlobalCon } // We need to add texture access, blending, and compositing code to shaders that are referenced from the CSS mix function. - if (programInfo.mixSettings().enabled) { + if (blendsElementTexture) { rewriteMixVertexShader(); rewriteMixFragmentShader(); } @@ -129,7 +126,7 @@ PassRefPtr<CustomFilterCompiledProgram> CustomFilterValidatedProgram::compiledPr void CustomFilterValidatedProgram::rewriteMixVertexShader() { - ASSERT(m_programInfo.mixSettings().enabled); + ASSERT(m_programInfo.programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE); // During validation, ANGLE renamed the author's "main" function to "css_main". // We write our own "main" function and call "css_main" from it. @@ -148,7 +145,7 @@ void CustomFilterValidatedProgram::rewriteMixVertexShader() void CustomFilterValidatedProgram::rewriteMixFragmentShader() { - ASSERT(m_programInfo.mixSettings().enabled); + ASSERT(m_programInfo.programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE); StringBuilder builder; // ANGLE considered these symbols as built-ins during validation under the SH_CSS_SHADERS_SPEC flag. |