Added: trunk/LayoutTests/fast/canvas/webgl/large-texture-creation-expected.txt (0 => 295429)
--- trunk/LayoutTests/fast/canvas/webgl/large-texture-creation-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/large-texture-creation-expected.txt 2022-06-09 19:25:08 UTC (rev 295429)
@@ -0,0 +1,14 @@
+Test creating a max-size texture.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Canvas.getContext
+PASS context exists
+
+PASS getError was one of: NO_ERROR or OUT_OF_MEMORY : unexpected result when creating MAX_TEXTURE_SIZE texture
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/webgl/large-texture-creation.html (0 => 295429)
--- trunk/LayoutTests/fast/canvas/webgl/large-texture-creation.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/large-texture-creation.html 2022-06-09 19:25:08 UTC (rev 295429)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>WebGL Framebuffer Test</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" width="2" height="2"> </canvas>
+<script>
+description("Test creating a max-size texture.");
+
+debug("");
+debug("Canvas.getContext");
+
+if (window.internals)
+ window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
+var canvas = document.getElementById("canvas");
+var gl = create3DContext(canvas);
+if (!gl) {
+ testFailed("context does not exist");
+} else {
+ testPassed("context exists");
+
+ debug("");
+
+ texSize = gl.getParameter(gl.MAX_TEXTURE_SIZE)
+ var tex = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, tex);
+ gl.texImage2D(gl.TEXTURE_2D,
+ 0, // level
+ gl.RGBA, // internalFormat
+ texSize, // width
+ texSize, // height
+ 0, // border
+ gl.RGBA, // format
+ gl.FLOAT, // type
+ null); // data
+ err = gl.getError();
+ glErrorShouldBe(gl, [gl.NO_ERROR, gl.OUT_OF_MEMORY], "unexpected result when creating MAX_TEXTURE_SIZE texture")
+}
+
+debug("");
+
+</script>
+</body>
+</html>
+
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_resources.mm (295428 => 295429)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_resources.mm 2022-06-09 19:05:16 UTC (rev 295428)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_resources.mm 2022-06-09 19:25:08 UTC (rev 295429)
@@ -273,11 +273,10 @@
{
return angle::Result::Stop;
}
- refOut->reset(new Texture(context, desc, mips, renderTargetOnly, allowFormatView, memoryLess));
- if (!refOut || !refOut->get())
- {
- ANGLE_MTL_CHECK(context, false, GL_OUT_OF_MEMORY);
- }
+ ASSERT(refOut);
+ Texture *newTexture = new Texture(context, desc, mips, renderTargetOnly, allowFormatView, memoryLess);
+ ANGLE_MTL_CHECK(context, newTexture->valid(), GL_OUT_OF_MEMORY);
+ refOut->reset(newTexture);
if (!mtlFormat.hasDepthAndStencilBits())
{
refOut->get()->setColorWritableMask(GetEmulatedColorWriteMask(mtlFormat));
@@ -301,13 +300,10 @@
bool renderTargetOnly,
TextureRef *refOut)
{
-
- refOut->reset(new Texture(context, desc, surfaceRef, slice, renderTargetOnly));
-
- if (!(*refOut) || !(*refOut)->get())
- {
- ANGLE_MTL_CHECK(context, false, GL_OUT_OF_MEMORY);
- }
+ ASSERT(refOut);
+ Texture *newTexture = new Texture(context, desc, surfaceRef, slice, renderTargetOnly);
+ ANGLE_MTL_CHECK(context, newTexture->valid(), GL_OUT_OF_MEMORY);
+ refOut->reset(newTexture);
if (!mtlFormat.hasDepthAndStencilBits())
{
refOut->get()->setColorWritableMask(GetEmulatedColorWriteMask(mtlFormat));