Backed out 2 changesets (bug 1956355) for causing build bustages @WebGLContextGL.cpp.

Backed out changeset 5e479ac652f4 (bug 1956355)
Backed out changeset 194f0fa0c62e (bug 1956355)
This commit is contained in:
Goloman Adrian
2025-03-28 00:14:41 +02:00
parent 642c75059d
commit 8a1d3d3bcc
9 changed files with 53 additions and 337 deletions

View File

@@ -6,7 +6,6 @@
#include "ClientWebGLContext.h"
#include <bitset>
#include <fmt/format.h>
#include "ClientWebGLExtensions.h"
#include "gfxCrashReporterUtils.h"
@@ -2487,7 +2486,7 @@ void ClientWebGLContext::GetParameter(JSContext* cx, GLenum pname,
case LOCAL_GL_TRANSFORM_FEEDBACK_ACTIVE:
case LOCAL_GL_TRANSFORM_FEEDBACK_PAUSED:
retval.set(JS::BooleanValue(*maybe));
return;
break;
// 4 bools
case LOCAL_GL_COLOR_WRITEMASK: {
@@ -2502,19 +2501,9 @@ void ClientWebGLContext::GetParameter(JSContext* cx, GLenum pname,
return;
}
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE: {
auto readType = (GLenum)*maybe;
// Map HALF_FLOAT to HALF_FLOAT_OES for webgl 1 clients.
if (readType == LOCAL_GL_HALF_FLOAT && !mIsWebGL2) {
readType = LOCAL_GL_HALF_FLOAT_OES;
}
retval.set(JS::NumberValue(readType));
return;
}
default:
retval.set(JS::NumberValue(*maybe));
return;
break;
}
}
}
@@ -5139,7 +5128,7 @@ void ClientWebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
dom::CallerType aCallerType,
ErrorResult& out_error) const {
const FuncScope funcScope(*this, "readPixels");
if (!ReadPixels_SharedPrecheck(&type, aCallerType, out_error)) return;
if (!ReadPixels_SharedPrecheck(aCallerType, out_error)) return;
const auto& state = State();
if (!ValidateNonNegative("width", width)) return;
if (!ValidateNonNegative("height", height)) return;
@@ -5159,7 +5148,7 @@ void ClientWebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
dom::CallerType aCallerType,
ErrorResult& out_error) const {
const FuncScope funcScope(*this, "readPixels");
if (!ReadPixels_SharedPrecheck(&type, aCallerType, out_error)) return;
if (!ReadPixels_SharedPrecheck(aCallerType, out_error)) return;
const auto& state = State();
if (!ValidateNonNegative("width", width)) return;
if (!ValidateNonNegative("height", height)) return;
@@ -5256,28 +5245,9 @@ bool ClientWebGLContext::DoReadPixels(const webgl::ReadPixelsDesc& desc,
}
bool ClientWebGLContext::ReadPixels_SharedPrecheck(
GLenum* const inout_readType, dom::CallerType aCallerType,
ErrorResult& out_error) const {
dom::CallerType aCallerType, ErrorResult& out_error) const {
if (IsContextLost()) return false;
GLenum validHalfFloatType = LOCAL_GL_HALF_FLOAT;
GLenum forbiddenHalfFloatType = LOCAL_GL_HALF_FLOAT_OES;
if (!mIsWebGL2) {
std::swap(validHalfFloatType, forbiddenHalfFloatType); // Tragic.
}
if (*inout_readType == forbiddenHalfFloatType) {
const auto msg = fmt::format(
FMT_STRING("For WebGL {}, for `type`, enum {} is forbidden. Use {}."),
mIsWebGL2 ? "2" : "1", EnumString(forbiddenHalfFloatType),
EnumString(validHalfFloatType));
EnqueueError({LOCAL_GL_INVALID_ENUM, msg});
return false;
}
// Normalize to HALF_FLOAT non-_OES internally:
if (*inout_readType == LOCAL_GL_HALF_FLOAT_OES) {
*inout_readType = LOCAL_GL_HALF_FLOAT;
}
if (mCanvasElement && mCanvasElement->IsWriteOnly() &&
aCallerType != dom::CallerType::System) {
JsWarning("readPixels: Not allowed");