Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,28 @@ jobs:
- run: apt update && apt install -y libx11-dev
- run: cargo test --target ${{ matrix.target }}

integrity:
name: Integrity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Update gfx/angle
run: |
python3 ./update.py
git add .
- name: Check gfx/angle integrity
run: git diff --staged --no-ext-diff --exit-code

build_result:
name: Result
runs-on: ubuntu-latest
if: always()
needs:
- "build"
- "linux-cross-compile"
- "integrity"

steps:
- name: Mark the job as successful
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mozangle"
version = "0.6.0"
version = "0.7.0"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably do just patch release as the changes do not look breaking.

authors = ["The ANGLE Project Authors", "The Servo Project Developers"]
license = "BSD-3-Clause"
description = "Mozilla's fork of Google ANGLE, repackaged as a Rust crate."
Expand Down
2 changes: 1 addition & 1 deletion UPSTREAM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gfx/angle is taken from FIREFOX_140_12_0esr_RELEASE: f8025617e815f21388b40baf189338d31a5f9a0a
gfx/angle is taken from FIREFOX_153_1_0esr_RELEASE: 468445e58d3acc7e4e059be99856daff1f2ae8f1
27 changes: 17 additions & 10 deletions generate_build_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from os import path, listdir
from os import listdir, path

REPO = path.dirname(__file__)
ANGLE = path.join(REPO, "gfx", "angle")
Expand Down Expand Up @@ -110,26 +110,33 @@ def write(data, f):

def no_platform_sources(source):
# Filter out any accidental inclusion of platform-specific source files.
return "system_utils_posix.cpp" not in source and "system_utils_linux.cpp" not in source
return (
"system_utils_posix.cpp" not in source
and "system_utils_linux.cpp" not in source
)


def write_lib(lib, data, f):
name = str.encode(lib2const(lib))
defines = [
b"(%s, %s)" % (
string_literal(k),
b"None" if v is True else b"Some(%s)" % string_literal(v)
)
b"(%s, %s)"
% (string_literal(k), b"None" if v is True else b"Some(%s)" % string_literal(v))
for k, v in data["DEFINES"].items()
]

f.write(b"pub const %s: Data = Data {\n" % name)
f.write(b" lib: %s,\n" % string_literal(lib))
write_list(b"sources", map(string_literal, filter(no_platform_sources, data["SOURCES"])), f)
write_list(
b"sources", map(string_literal, filter(no_platform_sources, data["SOURCES"])), f
)
write_list(b"includes", map(string_literal, data["LOCAL_INCLUDES"]), f)
write_list(b"defines", defines, f)
write_list(b"os_libs", map(string_literal, data["OS_LIBS"]), f)
write_list(b"use_libs", map(lib_enum, filter(lambda s: "zlib" not in s, data["USE_LIBS"])), f)
write_list(
b"use_libs",
map(lib_enum, filter(lambda s: "zlib" not in s, data["USE_LIBS"])),
f,
)
if data["SHARED"]:
f.write(b" shared: true,\n")
else:
Expand All @@ -144,7 +151,7 @@ def lib_enum(s: str):
def string_literal(s):
prelen = 1
raw = repr(s).replace('"', '\\"')
return b"\"%s\"" % raw[prelen:-prelen].encode("utf-8")
return b'"%s"' % raw[prelen:-prelen].encode("utf-8")


def write_list(name, items, f):
Expand All @@ -155,5 +162,5 @@ def write_list(name, items, f):
f.write(b" ],\n")


if __name__ == '__main__':
if __name__ == "__main__":
run()
6 changes: 3 additions & 3 deletions gfx/angle/checkout/out/gen/angle/angle_commit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define ANGLE_COMMIT_HASH "6eb59c58d21b"
#define ANGLE_COMMIT_HASH "7b0bc3d196d4"
#define ANGLE_COMMIT_HASH_SIZE 12
#define ANGLE_COMMIT_DATE "2026-06-01 14:52:43 +0200"
#define ANGLE_COMMIT_POSITION 19766
#define ANGLE_COMMIT_DATE "2026-06-09 02:49:49 -0700"
#define ANGLE_COMMIT_POSITION 19767
#define ANGLE_HAS_BINARY_LOADING
52 changes: 46 additions & 6 deletions gfx/angle/checkout/src/compiler/translator/IntermNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,12 @@ bool TIntermAggregate::isConstantNullValue() const

const TConstantUnion *TIntermAggregate::getConstantValue() const
{
// Cap constant-fold allocations. This runs during parsing, before the
// post-parse ValidateTypeSizeLimitations check that uses the configurable
// ShBuiltInResources limits (which are not accessible here). Firefox
// defaults to MaxPrivateVariableSizeInBytes = 1 MB, so 256K floats.
constexpr size_t kMaxConstantFoldElements = 256 * 1024;

if (!hasConstantValue())
{
return nullptr;
Expand All @@ -850,14 +856,25 @@ const TConstantUnion *TIntermAggregate::getConstantValue() const
if (isArray())
{
size_t elementSize = mArguments.front()->getAsTyped()->getType().getObjectSize();
constArray = new TConstantUnion[elementSize * getOutermostArraySize()];
angle::CheckedNumeric<size_t> checkedArraySize = elementSize;
checkedArraySize *= getOutermostArraySize();
size_t arraySize = 0;
if (!checkedArraySize.AssignIfValid(&arraySize) || arraySize > kMaxConstantFoldElements)
{
return nullptr;
}
constArray = new TConstantUnion[arraySize];

size_t elementOffset = 0u;
for (TIntermNode *constructorArg : mArguments)
{
const TConstantUnion *elementConstArray =
constructorArg->getAsTyped()->getConstantValue();
ASSERT(elementConstArray);
if (!elementConstArray)
{
delete[] constArray;
return nullptr;
}
size_t elementSizeBytes = sizeof(TConstantUnion) * elementSize;
memcpy(static_cast<void *>(&constArray[elementOffset]),
static_cast<const void *>(elementConstArray), elementSizeBytes);
Expand All @@ -866,8 +883,12 @@ const TConstantUnion *TIntermAggregate::getConstantValue() const
return constArray;
}

size_t resultSize = getType().getObjectSize();
constArray = new TConstantUnion[resultSize];
size_t resultSize = getType().getObjectSize();
if (resultSize > kMaxConstantFoldElements)
{
return nullptr;
}
constArray = new TConstantUnion[resultSize];
TBasicType basicType = getBasicType();

size_t resultIndex = 0u;
Expand All @@ -877,6 +898,11 @@ const TConstantUnion *TIntermAggregate::getConstantValue() const
TIntermNode *argument = mArguments.front();
TIntermTyped *argumentTyped = argument->getAsTyped();
const TConstantUnion *argumentConstantValue = argumentTyped->getConstantValue();
if (!argumentConstantValue)
{
delete[] constArray;
return nullptr;
}
// Check the special case of constructing a matrix diagonal from a single scalar,
// or a vector from a single scalar.
if (argumentTyped->getType().getObjectSize() == 1u)
Expand Down Expand Up @@ -949,6 +975,11 @@ const TConstantUnion *TIntermAggregate::getConstantValue() const
TIntermTyped *argumentTyped = argument->getAsTyped();
size_t argumentSize = argumentTyped->getType().getObjectSize();
const TConstantUnion *argumentConstantValue = argumentTyped->getConstantValue();
if (!argumentConstantValue)
{
delete[] constArray;
return nullptr;
}
for (size_t i = 0u; i < argumentSize; ++i)
{
if (resultIndex >= resultSize)
Expand Down Expand Up @@ -2239,8 +2270,17 @@ const TConstantUnion *TIntermBinary::getConstantValue() const
return nullptr;
}

const TConstantUnion *leftConstantValue = mLeft->getConstantValue();
int index = mRight->getConstantValue()->getIConst();
const TConstantUnion *leftConstantValue = mLeft->getConstantValue();
if (!leftConstantValue)
{
return nullptr;
}
const TConstantUnion *rightConstantValue = mRight->getConstantValue();
if (!rightConstantValue)
{
return nullptr;
}
int index = rightConstantValue->getIConst();
const TConstantUnion *constIndexingResult = nullptr;
if (mOp == EOpIndexDirect)
{
Expand Down
8 changes: 6 additions & 2 deletions gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3458,11 +3458,15 @@ bool OutputHLSL::writeConstantInitialization(TInfoSinkBase &out,
{
if (initializer->hasConstantValue())
{
const TConstantUnion *constValue = initializer->getConstantValue();
if (!constValue)
{
return false;
}
symbolNode->traverse(this);
out << ArrayString(symbolNode->getType());
out << " = {";
writeConstantUnionArray(out, initializer->getConstantValue(),
initializer->getType().getObjectSize());
writeConstantUnionArray(out, constValue, initializer->getType().getObjectSize());
out << "}";
return true;
}
Expand Down
1 change: 1 addition & 0 deletions gfx/angle/checkout/src/gpu_info_util/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ std::string VendorName(VendorID vendor)
case kVendorID_NVIDIA:
return "NVIDIA";
case kVendorID_Qualcomm:
case kVendorID_Qualcomm_DXGI:
return "Qualcomm";
case kVendorID_VeriSilicon:
return "VeriSilicon";
Expand Down
23 changes: 12 additions & 11 deletions gfx/angle/checkout/src/gpu_info_util/SystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,18 @@ bool GetSystemInfo(SystemInfo *info);
bool GetSystemInfoVulkan(SystemInfo *info);

// Known PCI vendor IDs
constexpr VendorID kVendorID_AMD = 0x1002;
constexpr VendorID kVendorID_ARM = 0x13B5;
constexpr VendorID kVendorID_Broadcom = 0x14E4;
constexpr VendorID kVendorID_GOOGLE = 0x1AE0;
constexpr VendorID kVendorID_ImgTec = 0x1010;
constexpr VendorID kVendorID_Intel = 0x8086;
constexpr VendorID kVendorID_NVIDIA = 0x10DE;
constexpr VendorID kVendorID_Qualcomm = 0x5143;
constexpr VendorID kVendorID_VMWare = 0x15ad;
constexpr VendorID kVendorID_Apple = 0x106B;
constexpr VendorID kVendorID_Microsoft = 0x1414;
constexpr VendorID kVendorID_AMD = 0x1002;
constexpr VendorID kVendorID_ARM = 0x13B5;
constexpr VendorID kVendorID_Broadcom = 0x14E4;
constexpr VendorID kVendorID_GOOGLE = 0x1AE0;
constexpr VendorID kVendorID_ImgTec = 0x1010;
constexpr VendorID kVendorID_Intel = 0x8086;
constexpr VendorID kVendorID_NVIDIA = 0x10DE;
constexpr VendorID kVendorID_Qualcomm = 0x5143;
constexpr VendorID kVendorID_Qualcomm_DXGI = 0x4D4F4351;
constexpr VendorID kVendorID_VMWare = 0x15ad;
constexpr VendorID kVendorID_Apple = 0x106B;
constexpr VendorID kVendorID_Microsoft = 0x1414;

// Known non-PCI (i.e. Khronos-registered) vendor IDs
constexpr VendorID kVendorID_Vivante = 0x10001;
Expand Down
1 change: 1 addition & 0 deletions gfx/angle/checkout/src/gpu_info_util/SystemInfo_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ bool GetSystemInfoVulkanWithICD(SystemInfo *info, vk::ICD preferredICD)
gpu.detailedDriverVersion.patch = properties.driverVersion & 0x3F;
break;
case kVendorID_Qualcomm:
case kVendorID_Qualcomm_DXGI:
gpu.driverVendor = "Qualcomm Technologies, Inc";
if (properties.driverVersion & 0x80000000)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,6 @@ angle::Result Renderer11::drawLineLoop(const gl::Context *context,
GetLineLoopIndices(indices, type, static_cast<GLuint>(count),
glState.isPrimitiveRestartEnabled(), &mScratchIndexDataBuffer);


uint64_t spaceNeeded64 = sizeof(GLuint) * mScratchIndexDataBuffer.size();
ANGLE_CHECK(GetImplAs<Context11>(context), spaceNeeded64 <= std::numeric_limits<int>::max(),
"Failed to create a 32-bit looping index buffer for "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <tuple>

#include "common/MemoryBuffer.h"
#include "anglebase/numerics/checked_math.h"
#include "common/utilities.h"
#include "libANGLE/Context.h"
#include "libANGLE/ImageIndex.h"
Expand Down Expand Up @@ -799,22 +800,35 @@ angle::Result TextureStorage11::setData(const gl::Context *context,

const d3d11::Format &d3d11Format =
d3d11::Format::Get(image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps());
const d3d11::DXGIFormatSize &dxgiFormatInfo =
d3d11::GetDXGIFormatSizeInfo(d3d11Format.texFormat);

const size_t outputPixelSize = dxgiFormatInfo.pixelBytes;

UINT bufferRowPitch = static_cast<unsigned int>(outputPixelSize) * width;
UINT bufferDepthPitch = bufferRowPitch * height;

const size_t neededSize = bufferDepthPitch * depth;
angle::MemoryBuffer *conversionBuffer = nullptr;
const uint8_t *data = nullptr;
UINT bufferRowPitch = 0;
UINT bufferDepthPitch = 0;

LoadImageFunctionInfo loadFunctionInfo = d3d11Format.getLoadFunctions()(type);
if (loadFunctionInfo.requiresConversion)
{
ANGLE_TRY(mRenderer->getScratchMemoryBuffer(context11, neededSize, &conversionBuffer));
const d3d11::DXGIFormatSize &dxgiFormatInfo =
d3d11::GetDXGIFormatSizeInfo(d3d11Format.texFormat);

const size_t outputPixelSize = dxgiFormatInfo.pixelBytes;

angle::CheckedNumeric<uint64_t> checkedBufferRowPitch = outputPixelSize;
checkedBufferRowPitch *= static_cast<uint64_t>(width);

angle::CheckedNumeric<uint64_t> checkedBufferDepthPitch = checkedBufferRowPitch * height;
angle::CheckedNumeric<uint64_t> checkedNeededSize = checkedBufferDepthPitch * depth;

ANGLE_CHECK_GL_MATH(context11, checkedNeededSize.IsValid<size_t>() &&
checkedBufferRowPitch.IsValid<UINT>() &&
checkedBufferDepthPitch.IsValid<UINT>());

bufferRowPitch = checkedBufferRowPitch.ValueOrDie<UINT>();
bufferDepthPitch = checkedBufferDepthPitch.ValueOrDie<UINT>();

ANGLE_TRY(mRenderer->getScratchMemoryBuffer(
context11, checkedNeededSize.ValueOrDie<size_t>(), &conversionBuffer));
loadFunctionInfo.loadFunction(width, height, depth, pixelData + srcSkipBytes, srcRowPitch,
srcDepthPitch, conversionBuffer->data(), bufferRowPitch,
bufferDepthPitch);
Expand Down
1 change: 1 addition & 0 deletions gfx/angle/checkout/src/libANGLE/renderer/driver_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const char *GetVendorString(uint32_t vendorId)
return "NVIDIA";
case VENDOR_ID_POWERVR:
return "Imagination Technologies";
case VENDOR_ID_QUALCOMM_DXGI:
case VENDOR_ID_QUALCOMM:
return "Qualcomm";
case VENDOR_ID_SAMSUNG:
Expand Down
34 changes: 20 additions & 14 deletions gfx/angle/checkout/src/libANGLE/renderer/driver_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@ enum VendorID : uint32_t
VENDOR_ID_APPLE = 0x106B,
VENDOR_ID_ARM = 0x13B5,
// Broadcom devices won't use PCI, but this is their Vulkan vendor id.
VENDOR_ID_BROADCOM = 0x14E4,
VENDOR_ID_GOOGLE = 0x1AE0,
VENDOR_ID_INTEL = 0x8086,
VENDOR_ID_MESA = 0x10005,
VENDOR_ID_MICROSOFT = 0x1414,
VENDOR_ID_NVIDIA = 0x10DE,
VENDOR_ID_POWERVR = 0x1010,
// This is Qualcomm PCI Vendor ID.
// Android doesn't have a PCI bus, but all we need is a unique id.
VENDOR_ID_QUALCOMM = 0x5143,
VENDOR_ID_SAMSUNG = 0x144D,
VENDOR_ID_VIVANTE = 0x9999,
VENDOR_ID_VMWARE = 0x15AD,
VENDOR_ID_BROADCOM = 0x14E4,
VENDOR_ID_GOOGLE = 0x1AE0,
VENDOR_ID_INTEL = 0x8086,
VENDOR_ID_MESA = 0x10005,
VENDOR_ID_MICROSOFT = 0x1414,
VENDOR_ID_NVIDIA = 0x10DE,
VENDOR_ID_POWERVR = 0x1010,
VENDOR_ID_QUALCOMM_DXGI = 0x4D4F4351,
VENDOR_ID_QUALCOMM = 0x5143,
VENDOR_ID_SAMSUNG = 0x144D,
VENDOR_ID_VIVANTE = 0x9999,
VENDOR_ID_VMWARE = 0x15AD,
};

enum AndroidDeviceID : uint32_t
Expand Down Expand Up @@ -94,7 +93,14 @@ inline bool IsPowerVR(uint32_t vendorId)

inline bool IsQualcomm(uint32_t vendorId)
{
return vendorId == VENDOR_ID_QUALCOMM;
// Qualcomm is an unusual one. It has two different vendor IDs depending on
// where you look. On Windows, DXGI will report the VENDOR_ID_QUALCOMM_DXGI
// value (due to it being an ACPI device rather than PCI device), but their
// native Vulkan driver will actually report their PCI vendor ID (the
// VENDOR_ID_QUALCOMM value). So we have to check both, to ensure we arrive
// at the right conclusion regardless of what source we are querying for
// vendor information.
return vendorId == VENDOR_ID_QUALCOMM || vendorId == VENDOR_ID_QUALCOMM_DXGI;
}

inline bool IsSamsung(uint32_t vendorId)
Expand Down
Loading
Loading