Diff
Modified: trunk/Source/WebCore/ChangeLog (120607 => 120608)
--- trunk/Source/WebCore/ChangeLog 2012-06-18 17:17:51 UTC (rev 120607)
+++ trunk/Source/WebCore/ChangeLog 2012-06-18 17:23:55 UTC (rev 120608)
@@ -1,3 +1,27 @@
+2012-06-18 Martin Robinson <mrobin...@igalia.com>
+
+ [TextureMapper] Replace the source transform with a flip uniform
+ https://bugs.webkit.org/show_bug.cgi?id=89317
+
+ Reviewed by Noam Rosenthal.
+
+ No new tests. This should not change any observable behavior.
+
+ * platform/graphics/texmap/TextureMapperGL.cpp: Instead of building and passing
+ the m4src matrix to the shader, just pass a single uniform that says whether or
+ not the texture should be flipped.
+ * platform/graphics/texmap/TextureMapperShaderManager.cpp: Change the shader programs
+ to deal with a flip variable rather than a source matrix.
+ (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram): Instead of getting the location
+ of the source matrix, get the location of the flip uniform.
+ (WebCore::TextureMapperShaderProgramSimple::TextureMapperShaderProgramSimple): Ditto.
+ (WebCore::TextureMapperShaderProgramRectSimple::TextureMapperShaderProgramRectSimple): Ditto.
+ (WebCore::TextureMapperShaderProgramOpacityAndMask::TextureMapperShaderProgramOpacityAndMask): Ditto.
+ (WebCore::TextureMapperShaderProgramRectOpacityAndMask::TextureMapperShaderProgramRectOpacityAndMask): Ditto.
+ * platform/graphics/texmap/TextureMapperShaderManager.h:
+ (WebCore::TextureMapperShaderProgram::flipLocation): Added this getter.
+ (TextureMapperShaderProgram): Rename the source matrix location member to reflect above changes.
+
2012-06-18 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r120598.
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (120607 => 120608)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2012-06-18 17:17:51 UTC (rev 120607)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2012-06-18 17:23:55 UTC (rev 120608)
@@ -386,14 +386,8 @@
GL_CMD(glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture));
GL_CMD(glUniform1i(program->sourceTextureLocation(), 0));
- const GLfloat m4src[] = {
- targetRect.width(), 0, 0, 0,
- 0, (flags & ShouldFlipTexture) ? -targetRect.height() : targetRect.height(), 0, 0,
- 0, 0, 1, 0,
- 0, (flags & ShouldFlipTexture) ? 1 : 0, 0, 1};
+ GL_CMD(glUniform1f(program->flipLocation(), !!(flags & ShouldFlipTexture)));
- GL_CMD(glUniformMatrix4fv(program->sourceMatrixLocation(), 1, GL_FALSE, m4src));
-
if (TextureMapperShaderProgram::isValidUniformLocation(program->opacityLocation()))
GL_CMD(glUniform1f(program->opacityLocation(), opacity));
@@ -424,12 +418,7 @@
GL_CMD(glBindTexture(GL_TEXTURE_2D, texture));
GL_CMD(glUniform1i(program->sourceTextureLocation(), 0));
- const GLfloat m4src[] = {
- 1, 0, 0, 0,
- 0, (flags & ShouldFlipTexture) ? -1 : 1, 0, 0,
- 0, 0, 1, 0,
- 0, (flags & ShouldFlipTexture) ? 1 : 0, 0, 1};
- GL_CMD(glUniformMatrix4fv(program->sourceMatrixLocation(), 1, GL_FALSE, m4src));
+ GL_CMD(glUniform1f(program->flipLocation(), !!(flags & ShouldFlipTexture)));
if (TextureMapperShaderProgram::isValidUniformLocation(program->opacityLocation()))
GL_CMD(glUniform1f(program->opacityLocation(), opacity));
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp (120607 => 120608)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp 2012-06-18 17:17:51 UTC (rev 120607)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp 2012-06-18 17:23:55 UTC (rev 120608)
@@ -76,12 +76,13 @@
static const char* vertexShaderSourceOpacityAndMask =
VERTEX_SHADER(
- uniform mat4 InMatrix, InSourceMatrix;
+ uniform mat4 InMatrix;
+ uniform lowp float u_flip;
attribute vec4 InVertex;
varying highp vec2 OutTexCoordSource, OutTexCoordMask;
void main(void)
{
- OutTexCoordSource = vec2(InSourceMatrix * InVertex);
+ OutTexCoordSource = vec2(InVertex.x, mix(InVertex.y, 1. - InVertex.y, u_flip));
OutTexCoordMask = vec2(InVertex);
gl_Position = InMatrix * InVertex;
}
@@ -113,12 +114,13 @@
static const char* vertexShaderSourceSimple =
VERTEX_SHADER(
- uniform mat4 InMatrix, InSourceMatrix;
+ uniform mat4 InMatrix;
+ uniform lowp float u_flip;
attribute vec4 InVertex;
varying highp vec2 OutTexCoordSource;
void main(void)
{
- OutTexCoordSource = vec2(InSourceMatrix * InVertex);
+ OutTexCoordSource = vec2(InVertex.x, mix(InVertex.y, 1. - InVertex.y, u_flip));
gl_Position = InMatrix * InVertex;
}
);
@@ -187,7 +189,7 @@
, m_vertexShader(0)
, m_fragmentShader(0)
, m_matrixLocation(-1)
- , m_sourceMatrixLocation(-1)
+ , m_flipLocation(-1)
, m_sourceTextureLocation(-1)
, m_opacityLocation(-1)
, m_maskTextureLocation(-1)
@@ -240,7 +242,7 @@
: TextureMapperShaderProgram(vertexShaderSourceSimple, fragmentShaderSourceSimple)
{
initializeProgram();
- getUniformLocation(m_sourceMatrixLocation, "InSourceMatrix");
+ getUniformLocation(m_flipLocation, "u_flip");
getUniformLocation(m_matrixLocation, "InMatrix");
getUniformLocation(m_sourceTextureLocation, "SourceTexture");
getUniformLocation(m_opacityLocation, "Opacity");
@@ -258,7 +260,7 @@
: TextureMapperShaderProgram(vertexShaderSourceSimple, fragmentShaderSourceRectSimple)
{
initializeProgram();
- getUniformLocation(m_sourceMatrixLocation, "InSourceMatrix");
+ getUniformLocation(m_flipLocation, "u_flip");
getUniformLocation(m_matrixLocation, "InMatrix");
getUniformLocation(m_sourceTextureLocation, "SourceTexture");
getUniformLocation(m_opacityLocation, "Opacity");
@@ -269,7 +271,7 @@
{
initializeProgram();
getUniformLocation(m_matrixLocation, "InMatrix");
- getUniformLocation(m_sourceMatrixLocation, "InSourceMatrix");
+ getUniformLocation(m_flipLocation, "u_flip");
getUniformLocation(m_sourceTextureLocation, "SourceTexture");
getUniformLocation(m_maskTextureLocation, "MaskTexture");
getUniformLocation(m_opacityLocation, "Opacity");
@@ -280,7 +282,7 @@
{
initializeProgram();
getUniformLocation(m_matrixLocation, "InMatrix");
- getUniformLocation(m_sourceMatrixLocation, "InSourceMatrix");
+ getUniformLocation(m_flipLocation, "u_flip");
getUniformLocation(m_sourceTextureLocation, "SourceTexture");
getUniformLocation(m_maskTextureLocation, "MaskTexture");
getUniformLocation(m_opacityLocation, "Opacity");
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h (120607 => 120608)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h 2012-06-18 17:17:51 UTC (rev 120607)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h 2012-06-18 17:23:55 UTC (rev 120608)
@@ -52,7 +52,7 @@
virtual void prepare(float opacity, const BitmapTexture*) { }
GLint matrixLocation() const { return m_matrixLocation; }
- GLint sourceMatrixLocation() const { return m_sourceMatrixLocation; }
+ GLint flipLocation() const { return m_flipLocation; }
GLint sourceTextureLocation() const { return m_sourceTextureLocation; }
GLint maskTextureLocation() const { return m_maskTextureLocation; }
GLint opacityLocation() const { return m_opacityLocation; }
@@ -71,7 +71,7 @@
GLuint m_vertexShader;
GLuint m_fragmentShader;
GLint m_matrixLocation;
- GLint m_sourceMatrixLocation;
+ GLint m_flipLocation;
GLint m_sourceTextureLocation;
GLint m_opacityLocation;
GLint m_maskTextureLocation;