File 7d784721.patch of Package webkit2gtk3.38012

From 7d784721e440d04932945e2decb933720c4e0fc7 Mon Sep 17 00:00:00 2001
From: Kimmo Kinnunen <kkinnunen@apple.com>
Date: Wed, 12 Mar 2025 01:42:08 -0700
Subject: [PATCH] WebGL context primitive restart can be toggled from
 WebContent process https://bugs.webkit.org/show_bug.cgi?id=285858
 rdar://142693598

Reviewed by Cameron McCormack.

Primitive restart is enabled for WebGL2 and disabled for WebGL 1
contexts by default. There is no use-case for toggling it from
WCP. Do not pass enable/disable to ANGLE.

* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::disable):
(WebCore::GraphicsContextGLANGLE::enable):

Originally-landed-as: b48791700366. rdar://146807693
Canonical link: https://commits.webkit.org/292004@main
---
 .../graphics/angle/GraphicsContextGLANGLE.cpp        | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp b/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
index 55f23b3eb337b..bbe382cf413d1 100644
--- a/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
+++ b/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
@@ -1187,7 +1187,11 @@ void GraphicsContextGLANGLE::disable(GCGLenum cap)
 {
     if (!makeContextCurrent())
         return;
-
+    if (cap == PRIMITIVE_RESTART_FIXED_INDEX) {
+        if (m_isForWebGL2)
+            addError(GCGLErrorCode::InvalidOperation);
+        return;
+    }
     GL_Disable(cap);
 }
 
@@ -1221,7 +1225,11 @@ void GraphicsContextGLANGLE::enable(GCGLenum cap)
 {
     if (!makeContextCurrent())
         return;
-
+    if (cap == PRIMITIVE_RESTART_FIXED_INDEX) {
+        if (!m_isForWebGL2)
+            addError(GCGLErrorCode::InvalidOperation);
+        return;
+    }
     GL_Enable(cap);
 }
 
openSUSE Build Service is sponsored by