Title: [295587] trunk/Source/WebCore/platform/graphics/texmap
Revision
295587
Author
hironori.fu...@sony.com
Date
2022-06-15 23:04:36 -0700 (Wed, 15 Jun 2022)

Log Message

Remove unused code for GL_TEXTURE_RECTANGLE_ARB
https://bugs.webkit.org/show_bug.cgi?id=241670

Reviewed by Don Olmstead.

The code for GL_TEXTURE_RECTANGLE_ARB was added by 105925@main (Bug
87738) for Qt-Mac port. But, no longer used.

* Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexture):
(WebCore::prepareTransformationMatrixWithFlags):
(WebCore::TextureMapperGL::drawTexturePlanarYUV):
(WebCore::TextureMapperGL::drawTextureSemiPlanarYUV):
(WebCore::TextureMapperGL::drawTexturePackedYUV):
(WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
* Source/WebCore/platform/graphics/texmap/TextureMapperGL.h:
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:
(WebCore::TextureMapperShaderProgram::create):
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h:

Canonical link: https://commits.webkit.org/251592@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (295586 => 295587)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2022-06-16 05:49:13 UTC (rev 295586)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2022-06-16 06:04:36 UTC (rev 295587)
@@ -469,14 +469,11 @@
 
 void TextureMapperGL::drawTexture(GLuint texture, Flags flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges)
 {
-    bool useRect = flags & ShouldUseARBTextureRect;
     bool useAntialiasing = m_enableEdgeDistanceAntialiasing
         && exposedEdges == AllEdges
         && !modelViewMatrix.mapQuad(targetRect).isRectilinear();
 
     TextureMapperShaderProgram::Options options;
-    if (useRect)
-        options.add(TextureMapperShaderProgram::Rect);
     if (opacity < 1)
         options.add(TextureMapperShaderProgram::Opacity);
     if (useAntialiasing) {
@@ -534,24 +531,19 @@
         patternTransform.rotate(-270);
         patternTransform.translate(0, -1);
     }
-    if (flags & TextureMapperGL::ShouldFlipTexture)
+    if (flags & TextureMapperGL::ShouldFlipTexture) {
         patternTransform.flipY();
-    if (flags & TextureMapperGL::ShouldUseARBTextureRect)
-        patternTransform.scaleNonUniform(size.width(), size.height());
-    if (flags & TextureMapperGL::ShouldFlipTexture)
         patternTransform.translate(0, -1);
+    }
 }
 
 void TextureMapperGL::drawTexturePlanarYUV(const std::array<GLuint, 3>& textures, const std::array<GLfloat, 16>& yuvToRgbMatrix, Flags flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, std::optional<GLuint> alphaPlane, unsigned exposedEdges)
 {
-    bool useRect = flags & ShouldUseARBTextureRect;
     bool useAntialiasing = m_enableEdgeDistanceAntialiasing
         && exposedEdges == AllEdges
         && !modelViewMatrix.mapQuad(targetRect).isRectilinear();
 
     TextureMapperShaderProgram::Options options = alphaPlane ? TextureMapperShaderProgram::TextureYUVA : TextureMapperShaderProgram::TextureYUV;
-    if (useRect)
-        options.add(TextureMapperShaderProgram::Rect);
     if (opacity < 1)
         options.add(TextureMapperShaderProgram::Opacity);
     if (useAntialiasing) {
@@ -607,7 +599,6 @@
 
 void TextureMapperGL::drawTextureSemiPlanarYUV(const std::array<GLuint, 2>& textures, bool uvReversed, const std::array<GLfloat, 16>& yuvToRgbMatrix, Flags flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges)
 {
-    bool useRect = flags & ShouldUseARBTextureRect;
     bool useAntialiasing = m_enableEdgeDistanceAntialiasing
         && exposedEdges == AllEdges
         && !modelViewMatrix.mapQuad(targetRect).isRectilinear();
@@ -614,8 +605,6 @@
 
     TextureMapperShaderProgram::Options options = uvReversed ?
         TextureMapperShaderProgram::TextureNV21 : TextureMapperShaderProgram::TextureNV12;
-    if (useRect)
-        options.add(TextureMapperShaderProgram::Rect);
     if (opacity < 1)
         options.add(TextureMapperShaderProgram::Opacity);
     if (useAntialiasing) {
@@ -664,14 +653,11 @@
 
 void TextureMapperGL::drawTexturePackedYUV(GLuint texture, const std::array<GLfloat, 16>& yuvToRgbMatrix, Flags flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges)
 {
-    bool useRect = flags & ShouldUseARBTextureRect;
     bool useAntialiasing = m_enableEdgeDistanceAntialiasing
         && exposedEdges == AllEdges
         && !modelViewMatrix.mapQuad(targetRect).isRectilinear();
 
     TextureMapperShaderProgram::Options options = TextureMapperShaderProgram::TexturePackedYUV;
-    if (useRect)
-        options.add(TextureMapperShaderProgram::Rect);
     if (opacity < 1)
         options.add(TextureMapperShaderProgram::Opacity);
     if (useAntialiasing) {
@@ -827,11 +813,9 @@
     glUseProgram(program.programID());
 
     bool repeatWrap = wrapMode() == RepeatWrap && m_contextAttributes.supportsNPOTTextures;
-    GLenum target;
+    GLenum target = GLenum(GL_TEXTURE_2D);
     if (flags & ShouldUseExternalOESTextureRect)
         target = GLenum(GL_TEXTURE_EXTERNAL_OES);
-    else
-        target = flags & ShouldUseARBTextureRect ? GLenum(GL_TEXTURE_RECTANGLE_ARB) : GLenum(GL_TEXTURE_2D);
 
     for (unsigned i = 0; i < texturesAndSamplers.size(); ++i) {
         auto& textureAndSampler = texturesAndSamplers[i];

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (295586 => 295587)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h	2022-06-16 05:49:13 UTC (rev 295586)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h	2022-06-16 06:04:36 UTC (rev 295587)
@@ -49,7 +49,6 @@
         NoFlag = 0x00,
         ShouldBlend = 0x01,
         ShouldFlipTexture = 0x02,
-        ShouldUseARBTextureRect = 0x04,
         ShouldAntialias = 0x08,
         ShouldRotateTexture90 = 0x10,
         ShouldRotateTexture180 = 0x20,

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp (295586 => 295587)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp	2022-06-16 05:49:13 UTC (rev 295586)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp	2022-06-16 06:04:36 UTC (rev 295587)
@@ -140,15 +140,6 @@
         }
     );
 
-#define RECT_TEXTURE_DIRECTIVE \
-    GLSL_DIRECTIVE(ifdef ENABLE_Rect) \
-        GLSL_DIRECTIVE(define SamplerType sampler2DRect) \
-        GLSL_DIRECTIVE(define SamplerFunction texture2DRect) \
-    GLSL_DIRECTIVE(else) \
-        GLSL_DIRECTIVE(define SamplerType sampler2D) \
-        GLSL_DIRECTIVE(define SamplerFunction texture2D) \
-    GLSL_DIRECTIVE(endif)
-
 #define ANTIALIASING_TEX_COORD_DIRECTIVE \
     GLSL_DIRECTIVE(if defined(ENABLE_Antialiasing) && defined(ENABLE_Texture)) \
         GLSL_DIRECTIVE(define transformTexCoord fragmentTransformTexCoord) \
@@ -185,7 +176,6 @@
 // directives scope: the first one applies to the matrices variables and the next one to the
 // rest of them. The precision is only used in GLES.
 static const char* fragmentTemplateHeaderCommon =
-    RECT_TEXTURE_DIRECTIVE
     ANTIALIASING_TEX_COORD_DIRECTIVE
     BLUR_CONSTANTS
     ROUNDED_RECT_CONSTANTS
@@ -229,11 +219,11 @@
 
 static const char* fragmentTemplateCommon =
     STRINGIFY(
-        uniform SamplerType s_sampler;
-        uniform SamplerType s_samplerY;
-        uniform SamplerType s_samplerU;
-        uniform SamplerType s_samplerV;
-        uniform SamplerType s_samplerA;
+        uniform sampler2D s_sampler;
+        uniform sampler2D s_samplerY;
+        uniform sampler2D s_samplerU;
+        uniform sampler2D s_samplerV;
+        uniform sampler2D s_samplerA;
         uniform sampler2D s_contentTexture;
         uniform SamplerExternalOESType s_externalOESTexture;
         uniform float u_opacity;
@@ -263,7 +253,7 @@
 
         void applyManualRepeat(inout vec2 pos) { pos = fract(pos); }
 
-        void applyTextureRGB(inout vec4 color, vec2 texCoord) { color = u_textureColorSpaceMatrix * SamplerFunction(s_sampler, texCoord); }
+        void applyTextureRGB(inout vec4 color, vec2 texCoord) { color = u_textureColorSpaceMatrix * texture2D(s_sampler, texCoord); }
 
         void applyPremultiply(inout vec4 color) { color = vec4(color.rgb * color.a, color.a); }
 
@@ -274,38 +264,38 @@
         }
         void applyTextureYUV(inout vec4 color, vec2 texCoord)
         {
-            float y = SamplerFunction(s_samplerY, texCoord).r;
-            float u = SamplerFunction(s_samplerU, texCoord).r;
-            float v = SamplerFunction(s_samplerV, texCoord).r;
+            float y = texture2D(s_samplerY, texCoord).r;
+            float u = texture2D(s_samplerU, texCoord).r;
+            float v = texture2D(s_samplerV, texCoord).r;
             vec4 data = "" u, v), 1.0);
             color = u_textureColorSpaceMatrix * data;
         }
         void applyTextureYUVA(inout vec4 color, vec2 texCoord)
         {
-            float y = SamplerFunction(s_samplerY, texCoord).r;
-            float u = SamplerFunction(s_samplerU, texCoord).r;
-            float v = SamplerFunction(s_samplerV, texCoord).r;
-            float a = SamplerFunction(s_samplerA, texCoord).r;
+            float y = texture2D(s_samplerY, texCoord).r;
+            float u = texture2D(s_samplerU, texCoord).r;
+            float v = texture2D(s_samplerV, texCoord).r;
+            float a = texture2D(s_samplerA, texCoord).r;
             vec4 data = "" u, v), a);
             color = u_textureColorSpaceMatrix * data;
         }
         void applyTextureNV12(inout vec4 color, vec2 texCoord)
         {
-            float y = SamplerFunction(s_samplerY, texCoord).r;
-            vec2 uv = SamplerFunction(s_samplerU, texCoord).rg;
+            float y = texture2D(s_samplerY, texCoord).r;
+            vec2 uv = texture2D(s_samplerU, texCoord).rg;
             vec4 data = "" uv.x, uv.y), 1.0);
             color = u_textureColorSpaceMatrix * data;
         }
         void applyTextureNV21(inout vec4 color, vec2 texCoord)
         {
-            float y = SamplerFunction(s_samplerY, texCoord).r;
-            vec2 uv = SamplerFunction(s_samplerU, texCoord).gr;
+            float y = texture2D(s_samplerY, texCoord).r;
+            vec2 uv = texture2D(s_samplerU, texCoord).gr;
             vec4 data = "" uv.x, uv.y), 1.0);
             color = u_textureColorSpaceMatrix * data;
         }
         void applyTexturePackedYUV(inout vec4 color, vec2 texCoord)
         {
-            vec4 data = "" texCoord);
+            vec4 data = "" texCoord);
             color = u_textureColorSpaceMatrix * vec4(yuvToRgb(data.b, data.g, data.r), data.a);
         }
         void applyOpacity(inout vec4 color) { color *= u_opacity; }
@@ -373,13 +363,13 @@
         vec4 sampleColorAtRadius(float radius, vec2 texCoord)
         {
             vec2 coord = texCoord + radius * u_blurRadius;
-            return SamplerFunction(s_sampler, coord);
+            return texture2D(s_sampler, coord);
         }
 
         float sampleAlphaAtRadius(float radius, vec2 texCoord)
         {
             vec2 coord = texCoord - u_shadowOffset + radius * u_blurRadius;
-            return SamplerFunction(s_sampler, coord).a * float(coord.x > 0. && coord.y > 0. && coord.x < 1. && coord.y < 1.);
+            return texture2D(s_sampler, coord).a * float(coord.x > 0. && coord.y > 0. && coord.x < 1. && coord.y < 1.);
         }
 
         void applyBlurFilter(inout vec4 color, vec2 texCoord)
@@ -533,7 +523,6 @@
     SET_APPLIER_FROM_OPTIONS(TextureNV12);
     SET_APPLIER_FROM_OPTIONS(TextureNV21);
     SET_APPLIER_FROM_OPTIONS(TexturePackedYUV);
-    SET_APPLIER_FROM_OPTIONS(Rect);
     SET_APPLIER_FROM_OPTIONS(SolidColor);
     SET_APPLIER_FROM_OPTIONS(Opacity);
     SET_APPLIER_FROM_OPTIONS(Antialiasing);

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h (295586 => 295587)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h	2022-06-16 05:49:13 UTC (rev 295586)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h	2022-06-16 06:04:36 UTC (rev 295587)
@@ -82,7 +82,6 @@
 public:
     enum Option {
         TextureRGB       = 1L << 0,
-        Rect             = 1L << 1,
         SolidColor       = 1L << 2,
         Opacity          = 1L << 3,
         Antialiasing     = 1L << 5,
@@ -147,7 +146,6 @@
     using values = EnumValues<
         WebCore::TextureMapperShaderProgram::Option,
         WebCore::TextureMapperShaderProgram::TextureRGB,
-        WebCore::TextureMapperShaderProgram::Rect,
         WebCore::TextureMapperShaderProgram::SolidColor,
         WebCore::TextureMapperShaderProgram::Opacity,
         WebCore::TextureMapperShaderProgram::Antialiasing,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to