Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load(
"@build_bazel_rules_apple//apple:resources.bzl",
"apple_resource_bundle",
"apple_resource_group",
)
load("//build-system/bazel-utils:plist_fragment.bzl",
"plist_fragment",
)
filegroup(
name = "MetalSources",
srcs = glob([
"Sources/**/*.metal",
]),
visibility = ["//visibility:public"],
)
plist_fragment(
name = "MetalEngineMetalSourcesBundleInfoPlist",
extension = "plist",
template =
"""
<key>CFBundleIdentifier</key>
<string>org.telegram.MetalEngineMetalSources</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleName</key>
<string>MetalEngine</string>
"""
)
apple_resource_bundle(
name = "MetalEngineMetalSourcesBundle",
infoplists = [
":MetalEngineMetalSourcesBundleInfoPlist",
],
resources = [
":MetalSources",
],
)
swift_library(
name = "MetalEngine",
module_name = "MetalEngine",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
data = [
":MetalEngineMetalSourcesBundle",
],
deps = [
"//submodules/Display",
"//submodules/Utils/ShelfPack",
],
visibility = [
"//visibility:public",
],
)
+31
View File
@@ -0,0 +1,31 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MetalEngine",
platforms: [.macOS(.v10_13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "MetalEngine",
targets: ["MetalEngine"]),
],
dependencies: [
.package(name: "ShelfPack", path: "../Utils/ShelfPack"),
.package(name: "TGUIKit", path: "../../../../packages/TGUIKit"),
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "MetalEngine",
dependencies: [.product(name: "ShelfPack", package: "ShelfPack", condition: nil),
.product(name: "TGUIKit", package: "TGUIKit", condition: nil)],
path: "Sources/",
resources: [.copy("MetalEngineShaders.metal")]),
]
)
@@ -0,0 +1,8 @@
import Foundation
func alignUp(_ value: Int, alignment: Int) -> Int {
assert(((alignment - 1) & alignment) == 0)
let alignmentMask = alignment - 1
return ((value + alignmentMask) & (~alignmentMask))
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
#include <metal_stdlib>
using namespace metal;
vertex float4 clearVertex(const device float2* vertexArray [[ buffer(0) ]], unsigned int vid [[ vertex_id ]]) {
return float4(vertexArray[vid], 0.0, 1.0);
}
fragment half4 clearFragment(const device float4 &color [[ buffer(0) ]]) {
return half4(color);
}