Run iOS CI on GitHub-hosted macOS (#4359)

This commit is contained in:
Bart Louwers
2026-06-24 05:03:38 +02:00
committed by GitHub
parent ea5dc44ee4
commit 9f6f8e3f1b
164 changed files with 408 additions and 43434 deletions

File diff suppressed because one or more lines are too long

View File

@@ -17,7 +17,7 @@ on:
jobs:
ios-build-dynamic:
runs-on: macos-14
runs-on: macos-26
defaults:
run:
working-directory: platform/ios
@@ -59,7 +59,7 @@ jobs:
MapLibre_ios_device.framework.dSYM.zip
ios-build-static:
runs-on: macos-14
runs-on: macos-15
defaults:
run:
working-directory: platform/ios

3
.gitmodules vendored
View File

@@ -113,3 +113,6 @@
[submodule "vendor/wgpu-native"]
path = vendor/wgpu-native
url = https://github.com/gfx-rs/wgpu-native.git
[submodule "vendor/metal-cpp"]
path = vendor/metal-cpp
url = https://github.com/apple/metal-cpp

View File

@@ -32,7 +32,7 @@ repos:
- id: buildifier
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.7.23
rev: v1.7.12.24
hooks:
- id: actionlint
additional_dependencies: [ shellcheck-py ]

View File

@@ -52,10 +52,10 @@
- (void)testProgressBoxing {
MLNOfflinePackProgress progress = {
.countOfResourcesCompleted = 3,
.countOfResourcesExpected = 2,
.countOfBytesCompleted = 7,
.countOfTilesCompleted = 1,
.countOfTileBytesCompleted = 6,
.countOfResourcesExpected = 2,
.maximumResourcesExpected = UINT64_MAX,
};
MLNOfflinePackProgress roundTrippedProgress =

View File

@@ -0,0 +1,275 @@
#!/usr/bin/env bash
# Create iOS development signing assets for CI and print them as YAML.
#
# Usage:
# APPSTORE_ISSUER_ID=<issuer-uuid> \
# APPSTORE_KEY_ID=<key-id> \
# APPSTORE_PRIVATE_KEY="$(cat AuthKey_<key-id>.p8)" \
# platform/ios/scripts/ios-ci-create-signing-assets.sh
#
# Optional environment:
# IOS_BUNDLE_ID_PREFIX=org.maplibre
# IOS_CI_RECREATE_DEVELOPMENT_CERTIFICATE=1
#
# The script creates a wildcard iOS Development provisioning profile for
# "${IOS_BUNDLE_ID_PREFIX}.*" and prints the certificate, profile, passwords,
# and bundle ID prefix as YAML for embedding in ios-ci.yml.
set -euo pipefail
bundle_id_prefix="${IOS_BUNDLE_ID_PREFIX:-org.maplibre}"
profile_name="${IOS_PROFILE_NAME:-MapLibre iOS CI Wildcard Development}"
certificate_name="${IOS_CERTIFICATE_NAME:-MapLibre iOS CI}"
require_env() {
local name="$1"
if [[ -z "${!name:-}" ]]; then
echo "$name is required" >&2
exit 1
fi
}
json_get() {
ruby -rjson -e 'path = ARGV.map { |item| item.match?(/\A\d+\z/) ? item.to_i : item }; value = JSON.parse(STDIN.read).dig(*path); puts value if value' "$@"
}
json_array_ids() {
ruby -rjson -e 'puts JSON.parse(STDIN.read).fetch("data", []).map { |item| item.fetch("id") }'
}
json_api_created_certificate_ids() {
ruby -rjson -e '
JSON.parse(STDIN.read).fetch("data", []).each do |item|
attrs = item.fetch("attributes")
puts item.fetch("id") if attrs["certificateType"] == "IOS_DEVELOPMENT" && attrs["displayName"] == "Created via API"
end
'
}
json_profile_ids_with_name() {
ruby -rjson -e '
profile_name = ARGV.fetch(0)
JSON.parse(STDIN.read).fetch("data", []).each do |item|
attrs = item.fetch("attributes")
puts item.fetch("id") if attrs["name"] == profile_name
end
' -- "$1"
}
urlencode() {
ruby -rcgi -e 'print CGI.escape(ARGV.fetch(0))' "$1"
}
base64_one_line() {
if base64 --help 2>&1 | grep -q -- '-w'; then
base64 -w 0 "$1"
else
base64 -i "$1" | tr -d '\n'
fi
}
make_jwt() {
ruby -ropenssl -rjson -rbase64 -e '
def b64url(value)
Base64.urlsafe_encode64(value).delete("=")
end
issuer_id = ENV.fetch("APPSTORE_ISSUER_ID")
key_id = ENV.fetch("APPSTORE_KEY_ID")
private_key = OpenSSL::PKey.read(ENV.fetch("APPSTORE_PRIVATE_KEY"))
now = Time.now.to_i
header = { "alg" => "ES256", "kid" => key_id, "typ" => "JWT" }
claims = { "iss" => issuer_id, "iat" => now - 60, "exp" => now + 1200, "aud" => "appstoreconnect-v1" }
signing_input = [b64url(header.to_json), b64url(claims.to_json)].join(".")
der_signature = private_key.sign(OpenSSL::Digest::SHA256.new, signing_input)
sequence = OpenSSL::ASN1.decode(der_signature)
raw_signature = sequence.value.map { |integer| integer.value.to_s(2).rjust(32, "\x00") }.join
puts [signing_input, b64url(raw_signature)].join(".")
'
}
asc_request() {
local method="$1"
local path="$2"
local body="${3:-}"
local url="https://api.appstoreconnect.apple.com$path"
local response_path
local status
local attempt=0
local max_attempts=4
local delay=5
response_path="$(mktemp)"
while true; do
attempt=$(( attempt + 1 ))
if [[ -n "$body" ]]; then
status="$(curl -sS \
-X "$method" \
-H "Authorization: Bearer $ASC_TOKEN" \
-H "Content-Type: application/json" \
-d "$body" \
-o "$response_path" \
-w "%{http_code}" \
"$url")"
else
status="$(curl -sS \
-X "$method" \
-H "Authorization: Bearer $ASC_TOKEN" \
-H "Content-Type: application/json" \
-o "$response_path" \
-w "%{http_code}" \
"$url")"
fi
echo "$status" > "${asc_status_file:-/dev/null}"
if [[ "$status" -ge 500 && "$attempt" -lt "$max_attempts" ]]; then
echo "App Store Connect request failed: $method $path returned HTTP $status (attempt $attempt/$max_attempts, retrying in ${delay}s)" >&2
cat "$response_path" >&2
sleep "$delay"
delay=$(( delay * 2 ))
continue
fi
break
done
if [[ "$status" -lt 200 || "$status" -ge 300 ]]; then
echo "App Store Connect request failed: $method $path returned HTTP $status" >&2
if [[ "$path" == "/v1/certificates" && "$status" == "403" ]]; then
echo "Check that the API key has access to Certificates, Identifiers & Profiles." >&2
fi
cat "$response_path" >&2
rm -f "$response_path"
return 1
fi
cat "$response_path"
rm -f "$response_path"
}
require_env APPSTORE_ISSUER_ID
require_env APPSTORE_KEY_ID
require_env APPSTORE_PRIVATE_KEY
command -v openssl >/dev/null || {
echo "openssl is required" >&2
exit 1
}
work_dir="$(mktemp -d)"
trap 'rm -rf "$work_dir"' EXIT
asc_status_file="$work_dir/asc_status"
p12_password="${P12_PASSWORD:-$(openssl rand -base64 32)}"
keychain_password="${KEYCHAIN_PASSWORD:-$(openssl rand -base64 32)}"
wildcard_identifier="$bundle_id_prefix.*"
private_key_path="$work_dir/ios-ci.key"
csr_path="$work_dir/ios-ci.csr"
certificate_der_path="$work_dir/ios-ci.cer"
certificate_pem_path="$work_dir/ios-ci.pem"
p12_path="$work_dir/ios-ci.p12"
profile_path="$work_dir/ios-ci.mobileprovision"
openssl genrsa -out "$private_key_path" 2048
openssl req -new -key "$private_key_path" -subj "/CN=$certificate_name" -out "$csr_path"
ASC_TOKEN="$(make_jwt)"
export ASC_TOKEN
if [[ "${IOS_CI_RECREATE_DEVELOPMENT_CERTIFICATE:-}" == "1" ]]; then
certificates_response="$(asc_request GET '/v1/certificates?filter%5BcertificateType%5D=IOS_DEVELOPMENT&limit=10')"
while IFS= read -r certificate_id_to_delete; do
[[ -z "$certificate_id_to_delete" ]] && continue
echo "Deleting existing API-created iOS Development certificate '$certificate_id_to_delete'."
asc_request DELETE "/v1/certificates/$certificate_id_to_delete" >/dev/null
done < <(printf '%s' "$certificates_response" | json_api_created_certificate_ids)
profile_filter="$(urlencode "$profile_name")"
profiles_response="$(asc_request GET "/v1/profiles?filter%5Bname%5D=$profile_filter&limit=200")"
while IFS= read -r profile_id_to_delete; do
[[ -z "$profile_id_to_delete" ]] && continue
echo "Deleting existing iOS CI provisioning profile '$profile_id_to_delete'."
asc_request DELETE "/v1/profiles/$profile_id_to_delete" >/dev/null
done < <(printf '%s' "$profiles_response" | json_profile_ids_with_name "$profile_name")
fi
csr_content="$(cat "$csr_path")"
csr_body="$(ruby -rjson -e 'puts JSON.generate({ data: { type: "certificates", attributes: { certificateType: "IOS_DEVELOPMENT", csrContent: ARGV.fetch(0) } } })' -- "$csr_content")"
if ! certificate_response="$(asc_request POST /v1/certificates "$csr_body")"; then
if [[ "$(cat "$asc_status_file" 2>/dev/null)" == "409" ]]; then
echo "A current iOS Development certificate already exists; deleting and retrying." >&2
certificates_response="$(asc_request GET '/v1/certificates?filter%5BcertificateType%5D=IOS_DEVELOPMENT&limit=10')"
while IFS= read -r certificate_id_to_delete; do
[[ -z "$certificate_id_to_delete" ]] && continue
echo "Deleting existing iOS Development certificate '$certificate_id_to_delete'."
asc_request DELETE "/v1/certificates/$certificate_id_to_delete" >/dev/null
done < <(printf '%s' "$certificates_response" | json_api_created_certificate_ids)
profile_filter="$(urlencode "$profile_name")"
profiles_response="$(asc_request GET "/v1/profiles?filter%5Bname%5D=$profile_filter&limit=200")"
while IFS= read -r profile_id_to_delete; do
[[ -z "$profile_id_to_delete" ]] && continue
echo "Deleting existing iOS CI provisioning profile '$profile_id_to_delete'."
asc_request DELETE "/v1/profiles/$profile_id_to_delete" >/dev/null
done < <(printf '%s' "$profiles_response" | json_profile_ids_with_name "$profile_name")
certificate_response="$(asc_request POST /v1/certificates "$csr_body")"
else
exit 1
fi
fi
certificate_id="$(printf '%s' "$certificate_response" | json_get data id)"
certificate_content="$(printf '%s' "$certificate_response" | json_get data attributes certificateContent)"
printf '%s' "$certificate_content" | base64 --decode >"$certificate_der_path" 2>/dev/null || printf '%s' "$certificate_content" | base64 -D >"$certificate_der_path"
openssl x509 -inform DER -in "$certificate_der_path" -out "$certificate_pem_path"
openssl pkcs12 -export -inkey "$private_key_path" -in "$certificate_pem_path" -out "$p12_path" -password "pass:$p12_password"
bundle_filter="$(urlencode "$wildcard_identifier")"
bundle_response="$(asc_request GET "/v1/bundleIds?filter%5Bidentifier%5D=$bundle_filter")"
bundle_id="$(printf '%s' "$bundle_response" | json_get data 0 id)"
if [[ -z "$bundle_id" ]]; then
bundle_response="$(asc_request POST /v1/bundleIds "$(ruby -rjson -e 'puts JSON.generate({ data: { type: "bundleIds", attributes: { name: ARGV.fetch(0), identifier: ARGV.fetch(1), platform: "IOS" } } })' -- "$profile_name" "$wildcard_identifier")")"
bundle_id="$(printf '%s' "$bundle_response" | json_get data id)"
fi
devices_response="$(asc_request GET '/v1/devices?filter%5Bplatform%5D=IOS&filter%5Bstatus%5D=ENABLED&limit=200')"
device_ids="$(printf '%s' "$devices_response" | json_array_ids)"
profile_body="$(
ruby -rjson -e '
devices = STDIN.read.lines.map(&:strip).reject(&:empty?).map { |id| { type: "devices", id: id } }
relationships = {
bundleId: { data: { type: "bundleIds", id: ARGV.fetch(1) } },
certificates: { data: [{ type: "certificates", id: ARGV.fetch(2) }] },
}
relationships[:devices] = { data: devices } unless devices.empty?
puts JSON.generate({
data: {
type: "profiles",
attributes: { name: ARGV.fetch(0), profileType: "IOS_APP_DEVELOPMENT" },
relationships: relationships,
},
})
' -- "$profile_name" "$bundle_id" "$certificate_id" <<<"$device_ids"
)"
profile_response="$(asc_request POST /v1/profiles "$profile_body")"
profile_content="$(printf '%s' "$profile_response" | json_get data attributes profileContent)"
printf '%s' "$profile_content" | base64 --decode >"$profile_path" 2>/dev/null || printf '%s' "$profile_content" | base64 -D >"$profile_path"
cat <<YAML
# Generated by platform/ios/scripts/ios-ci-create-signing-assets.sh.
# Paste the following block into the 'Install Apple signing assets' step env in ios-ci.yml.
BUILD_CERTIFICATE_BASE64: $(base64_one_line "$p12_path")
P12_PASSWORD: $p12_password
BUILD_PROVISION_PROFILE_BASE64: $(base64_one_line "$profile_path")
KEYCHAIN_PASSWORD: $keychain_password
IOS_BUNDLE_ID_PREFIX: $bundle_id_prefix
YAML
echo "Created signing certificate '$certificate_name' and provisioning profile '$profile_name'." >&2

View File

@@ -0,0 +1,83 @@
#!/usr/bin/env bash
# Install iOS CI signing assets on a GitHub-hosted macOS runner.
#
# Usage in GitHub Actions:
# - name: Install Apple signing assets
# run: scripts/ios-ci-install-signing-assets.sh
# env:
# BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
# P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
# KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
# IOS_BUNDLE_ID_PREFIX: ${{ vars.IOS_BUNDLE_ID_PREFIX }}
#
# The script imports the CI certificate into a temporary keychain, installs the
# provisioning profile, and writes platform/darwin/bazel/config.bzl so Bazel and
# rules_xcodeproj use the same team/profile/bundle prefix on ephemeral runners.
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd "$script_dir/../../.." && pwd)"
require_env() {
local name="$1"
if [[ -z "${!name:-}" ]]; then
echo "::error::$name is required"
exit 1
fi
}
decode_base64_to_file() {
local value="$1"
local path="$2"
if ! printf '%s' "$value" | base64 --decode >"$path" 2>/dev/null; then
printf '%s' "$value" | base64 -D >"$path"
fi
}
require_env BUILD_CERTIFICATE_BASE64
require_env P12_PASSWORD
require_env BUILD_PROVISION_PROFILE_BASE64
require_env KEYCHAIN_PASSWORD
ios_bundle_id_prefix="${IOS_BUNDLE_ID_PREFIX:-org.maplibre}"
runner_temp="${RUNNER_TEMP:-$(mktemp -d)}"
certificate_path="$runner_temp/ios-ci-certificate.p12"
profile_path="$runner_temp/ios-ci-profile.mobileprovision"
profile_plist_path="$runner_temp/ios-ci-profile.plist"
keychain_path="$runner_temp/ios-ci-signing.keychain-db"
profiles_dir="$HOME/Library/MobileDevice/Provisioning Profiles"
decode_base64_to_file "$BUILD_CERTIFICATE_BASE64" "$certificate_path"
decode_base64_to_file "$BUILD_PROVISION_PROFILE_BASE64" "$profile_path"
security create-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path"
security set-keychain-settings -lut 21600 "$keychain_path"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path"
security import "$certificate_path" -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k "$keychain_path"
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$keychain_path"
security list-keychain -d user -s "$keychain_path"
mkdir -p "$profiles_dir"
security cms -D -i "$profile_path" >"$profile_plist_path"
profile_uuid="$(/usr/libexec/PlistBuddy -c 'Print UUID' "$profile_plist_path")"
profile_name="$(/usr/libexec/PlistBuddy -c 'Print Name' "$profile_plist_path")"
team_id="$(/usr/libexec/PlistBuddy -c 'Print TeamIdentifier:0' "$profile_plist_path")"
cp "$profile_path" "$profiles_dir/$profile_uuid.mobileprovision"
cat >"$repo_root/platform/darwin/bazel/config.bzl" <<CONFIG
# Generated by platform/ios/scripts/ios-ci-install-signing-assets.sh.
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "$team_id"
APPLE_MOBILE_PROVISIONING_PROFILE_NAME = "$profile_name"
BUNDLE_ID_PREFIX = "$ios_bundle_id_prefix"
API_KEY = "0000000000"
CONFIG
echo "Installed provisioning profile '$profile_name' for team '$team_id'."
echo "Generated platform/darwin/bazel/config.bzl with bundle ID prefix '$ios_bundle_id_prefix'."

1
vendor/metal-cpp vendored Submodule

Submodule vendor/metal-cpp added at 27c4382b71

View File

@@ -1,41 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// QuartzCore/CADefines.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "../Foundation/NSDefines.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _CA_EXPORT _NS_EXPORT
#define _CA_EXTERN _NS_EXTERN
#define _CA_INLINE _NS_INLINE
#define _CA_PACKED _NS_PACKED
#define _CA_CONST(type, name) _NS_CONST(type, name)
#define _CA_ENUM(type, name) _NS_ENUM(type, name)
#define _CA_OPTIONS(type, name) _NS_OPTIONS(type, name)
#define _CA_VALIDATE_SIZE(ns, name) _NS_VALIDATE_SIZE(ns, name)
#define _CA_VALIDATE_ENUM(ns, name) _NS_VALIDATE_ENUM(ns, name)
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,57 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// QuartzCore/CAMetalDrawable.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "../Metal/MTLDrawable.hpp"
#include "../Metal/MTLTexture.hpp"
#include "CADefines.hpp"
#include "CAPrivate.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace CA
{
class MetalDrawable : public NS::Referencing<MetalDrawable, MTL::Drawable>
{
public:
class MetalLayer* layer() const;
MTL::Texture* texture() const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE CA::MetalLayer* CA::MetalDrawable::layer() const
{
return Object::sendMessage<MetalLayer*>(this, _CA_PRIVATE_SEL(layer));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE MTL::Texture* CA::MetalDrawable::texture() const
{
return Object::sendMessage<MTL::Texture*>(this, _CA_PRIVATE_SEL(texture));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,216 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// QuartzCore/CAMetalDrawable.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "../Metal/MTLPixelFormat.hpp"
#include "../Metal/MTLTexture.hpp"
#include "../Metal/MTLResidencySet.hpp"
#include "../Foundation/NSTypes.hpp"
#include <CoreGraphics/CGGeometry.h>
#include <CoreGraphics/CGColorSpace.h>
#include "CADefines.hpp"
#include "CAMetalDrawable.hpp"
#include "CAPrivate.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace CA
{
class MetalLayer : public NS::Referencing<MetalLayer>
{
public:
static class MetalLayer* layer();
MTL::Device* device() const;
void setDevice(MTL::Device* device);
MTL::PixelFormat pixelFormat() const;
void setPixelFormat(MTL::PixelFormat pixelFormat);
bool framebufferOnly() const;
void setFramebufferOnly(bool framebufferOnly);
CGSize drawableSize() const;
void setDrawableSize(CGSize drawableSize);
class MetalDrawable* nextDrawable();
NS::UInteger maximumDrawableCount() const;
void setMaximumDrawableCount(NS::UInteger maximumDrawableCount);
bool displaySyncEnabled() const;
void setDisplaySyncEnabled(bool displaySyncEnabled);
CGColorSpaceRef colorspace() const;
void setColorspace(CGColorSpaceRef colorspace);
bool allowsNextDrawableTimeout() const;
void setAllowsNextDrawableTimeout(bool allowsNextDrawableTimeout);
MTL::ResidencySet* residencySet() const;
};
} // namespace CA
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE CA::MetalLayer* CA::MetalLayer::layer()
{
return Object::sendMessage<CA::MetalLayer*>(_CA_PRIVATE_CLS(CAMetalLayer), _CA_PRIVATE_SEL(layer));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE MTL::Device* CA::MetalLayer::device() const
{
return Object::sendMessage<MTL::Device*>(this, _CA_PRIVATE_SEL(device));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setDevice(MTL::Device* device)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setDevice_), device);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE MTL::PixelFormat CA::MetalLayer::pixelFormat() const
{
return Object::sendMessage<MTL::PixelFormat>(this,
_CA_PRIVATE_SEL(pixelFormat));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setPixelFormat(MTL::PixelFormat pixelFormat)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setPixelFormat_),
pixelFormat);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE bool CA::MetalLayer::framebufferOnly() const
{
return Object::sendMessage<bool>(this, _CA_PRIVATE_SEL(framebufferOnly));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setFramebufferOnly(bool framebufferOnly)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setFramebufferOnly_),
framebufferOnly);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE CGSize CA::MetalLayer::drawableSize() const
{
return Object::sendMessage<CGSize>(this, _CA_PRIVATE_SEL(drawableSize));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setDrawableSize(CGSize drawableSize)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setDrawableSize_),
drawableSize);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE CA::MetalDrawable* CA::MetalLayer::nextDrawable()
{
return Object::sendMessage<MetalDrawable*>(this,
_CA_PRIVATE_SEL(nextDrawable));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE NS::UInteger CA::MetalLayer::maximumDrawableCount() const
{
return Object::sendMessage<NS::UInteger>(this,
_CA_PRIVATE_SEL(maximumDrawableCount));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setMaximumDrawableCount(NS::UInteger maximumDrawableCount)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setMaximumDrawableCount_),
maximumDrawableCount);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE bool CA::MetalLayer::displaySyncEnabled() const
{
return Object::sendMessage<bool>(this, _CA_PRIVATE_SEL(displaySyncEnabled));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setDisplaySyncEnabled(bool displaySyncEnabled)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setDisplaySyncEnabled_),
displaySyncEnabled);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE CGColorSpaceRef CA::MetalLayer::colorspace() const
{
return Object::sendMessage<CGColorSpaceRef>(this, _CA_PRIVATE_SEL(colorspace));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setColorspace(CGColorSpaceRef colorspace)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setColorspace_),
colorspace);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE bool CA::MetalLayer::allowsNextDrawableTimeout() const
{
return Object::sendMessage<bool>(this, _CA_PRIVATE_SEL(allowsNextDrawableTimeout));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE void CA::MetalLayer::setAllowsNextDrawableTimeout(bool allowsNextDrawableTimeout)
{
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setAllowsNextDrawableTimeout_),
allowsNextDrawableTimeout);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_CA_INLINE MTL::ResidencySet* CA::MetalLayer::residencySet() const
{
return Object::sendMessage<MTL::ResidencySet*>(this, _CA_PRIVATE_SEL(residencySet) );
}

View File

@@ -1,150 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// QuartzCore/CAPrivate.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "CADefines.hpp"
#include <objc/runtime.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _CA_PRIVATE_CLS(symbol) (Private::Class::s_k##symbol)
#define _CA_PRIVATE_SEL(accessor) (Private::Selector::s_k##accessor)
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#if defined(CA_PRIVATE_IMPLEMENTATION)
#ifdef METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _CA_PRIVATE_VISIBILITY __attribute__((visibility("hidden")))
#else
#define _CA_PRIVATE_VISIBILITY __attribute__((visibility("default")))
#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _CA_PRIVATE_IMPORT __attribute__((weak_import))
#ifdef __OBJC__
#define _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol) ((__bridge void*)objc_lookUpClass(#symbol))
#define _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol) ((__bridge void*)objc_getProtocol(#symbol))
#else
#define _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol) objc_lookUpClass(#symbol)
#define _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol) objc_getProtocol(#symbol)
#endif // __OBJC__
#define _CA_PRIVATE_DEF_CLS(symbol) void* s_k##symbol _CA_PRIVATE_VISIBILITY = _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol)
#define _CA_PRIVATE_DEF_PRO(symbol) void* s_k##symbol _CA_PRIVATE_VISIBILITY = _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol)
#define _CA_PRIVATE_DEF_SEL(accessor, symbol) SEL s_k##accessor _CA_PRIVATE_VISIBILITY = sel_registerName(symbol)
#define _CA_PRIVATE_DEF_STR(type, symbol) \
_CA_EXTERN type const CA##symbol _CA_PRIVATE_IMPORT; \
type const CA::symbol = (nullptr != &CA##symbol) ? CA##symbol : nullptr
#else
#define _CA_PRIVATE_DEF_CLS(symbol) extern void* s_k##symbol
#define _CA_PRIVATE_DEF_PRO(symbol) extern void* s_k##symbol
#define _CA_PRIVATE_DEF_SEL(accessor, symbol) extern SEL s_k##accessor
#define _CA_PRIVATE_DEF_STR(type, symbol) extern type const CA::symbol
#endif // CA_PRIVATE_IMPLEMENTATION
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace CA
{
namespace Private
{
namespace Class
{
_CA_PRIVATE_DEF_CLS(CAMetalLayer);
} // Class
} // Private
} // CA
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace CA
{
namespace Private
{
namespace Protocol
{
_CA_PRIVATE_DEF_PRO(CAMetalDrawable);
} // Protocol
} // Private
} // CA
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace CA
{
namespace Private
{
namespace Selector
{
_CA_PRIVATE_DEF_SEL(allowsNextDrawableTimeout,
"allowsNextDrawableTimeout");
_CA_PRIVATE_DEF_SEL(colorspace,
"colorspace");
_CA_PRIVATE_DEF_SEL(device,
"device");
_CA_PRIVATE_DEF_SEL(displaySyncEnabled,
"displaySyncEnabled");
_CA_PRIVATE_DEF_SEL(drawableSize,
"drawableSize");
_CA_PRIVATE_DEF_SEL(framebufferOnly,
"framebufferOnly");
_CA_PRIVATE_DEF_SEL(layer,
"layer");
_CA_PRIVATE_DEF_SEL(maximumDrawableCount,
"maximumDrawableCount");
_CA_PRIVATE_DEF_SEL(nextDrawable,
"nextDrawable");
_CA_PRIVATE_DEF_SEL(pixelFormat,
"pixelFormat");
_CA_PRIVATE_DEF_SEL(residencySet,
"residencySet");
_CA_PRIVATE_DEF_SEL(setAllowsNextDrawableTimeout_,
"setAllowsNextDrawableTimeout:");
_CA_PRIVATE_DEF_SEL(setColorspace_,
"setColorspace:");
_CA_PRIVATE_DEF_SEL(setDevice_,
"setDevice:");
_CA_PRIVATE_DEF_SEL(setDisplaySyncEnabled_,
"setDisplaySyncEnabled:");
_CA_PRIVATE_DEF_SEL(setDrawableSize_,
"setDrawableSize:");
_CA_PRIVATE_DEF_SEL(setFramebufferOnly_,
"setFramebufferOnly:");
_CA_PRIVATE_DEF_SEL(setMaximumDrawableCount_,
"setMaximumDrawableCount:");
_CA_PRIVATE_DEF_SEL(setPixelFormat_,
"setPixelFormat:");
_CA_PRIVATE_DEF_SEL(texture,
"texture");
} // Class
} // Private
} // CA
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,47 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/Foundation.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSArray.hpp"
#include "NSAutoreleasePool.hpp"
#include "NSBundle.hpp"
#include "NSData.hpp"
#include "NSDate.hpp"
#include "NSDefines.hpp"
#include "NSDictionary.hpp"
#include "NSEnumerator.hpp"
#include "NSError.hpp"
#include "NSLock.hpp"
#include "NSNotification.hpp"
#include "NSNumber.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSProcessInfo.hpp"
#include "NSRange.hpp"
#include "NSSet.hpp"
#include "NSSharedPtr.hpp"
#include "NSString.hpp"
#include "NSTypes.hpp"
#include "NSURL.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,124 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSArray.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSObject.hpp"
#include "NSTypes.hpp"
#include "NSEnumerator.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class Array : public Copying<Array>
{
public:
static Array* array();
static Array* array(const Object* pObject);
static Array* array(const Object* const* pObjects, UInteger count);
static Array* alloc();
Array* init();
Array* init(const Object* const* pObjects, UInteger count);
Array* init(const class Coder* pCoder);
template <class _Object = Object>
_Object* object(UInteger index) const;
UInteger count() const;
Enumerator<Object>* objectEnumerator() const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::array()
{
return Object::sendMessage<Array*>(_NS_PRIVATE_CLS(NSArray), _NS_PRIVATE_SEL(array));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::array(const Object* pObject)
{
return Object::sendMessage<Array*>(_NS_PRIVATE_CLS(NSArray), _NS_PRIVATE_SEL(arrayWithObject_), pObject);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::array(const Object* const* pObjects, UInteger count)
{
return Object::sendMessage<Array*>(_NS_PRIVATE_CLS(NSArray), _NS_PRIVATE_SEL(arrayWithObjects_count_), pObjects, count);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::alloc()
{
return NS::Object::alloc<Array>(_NS_PRIVATE_CLS(NSArray));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::init()
{
return NS::Object::init<Array>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::init(const Object* const* pObjects, UInteger count)
{
return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(initWithObjects_count_), pObjects, count);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Array::init(const class Coder* pCoder)
{
return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Array::count() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(count));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Object>
_NS_INLINE _Object* NS::Array::object(UInteger index) const
{
return Object::sendMessage<_Object*>(this, _NS_PRIVATE_SEL(objectAtIndex_), index);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Enumerator<NS::Object>* NS::Array::objectEnumerator() const
{
return NS::Object::sendMessage<Enumerator<NS::Object>*>(this, _NS_PRIVATE_SEL(objectEnumerator));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,83 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSAutoreleasePool.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class AutoreleasePool : public Object
{
public:
static AutoreleasePool* alloc();
AutoreleasePool* init();
void drain();
void addObject(Object* pObject);
static void showPools();
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::AutoreleasePool* NS::AutoreleasePool::alloc()
{
return NS::Object::alloc<AutoreleasePool>(_NS_PRIVATE_CLS(NSAutoreleasePool));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::AutoreleasePool* NS::AutoreleasePool::init()
{
return NS::Object::init<AutoreleasePool>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::AutoreleasePool::drain()
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(drain));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::AutoreleasePool::addObject(Object* pObject)
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(addObject_), pObject);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::AutoreleasePool::showPools()
{
Object::sendMessage<void>(_NS_PRIVATE_CLS(NSAutoreleasePool), _NS_PRIVATE_SEL(showPools));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,374 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSBundle.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSNotification.hpp"
#include "NSObject.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
_NS_CONST(NotificationName, BundleDidLoadNotification);
_NS_CONST(NotificationName, BundleResourceRequestLowDiskSpaceNotification);
class String* LocalizedString(const String* pKey, const String*);
class String* LocalizedStringFromTable(const String* pKey, const String* pTbl, const String*);
class String* LocalizedStringFromTableInBundle(const String* pKey, const String* pTbl, const class Bundle* pBdle, const String*);
class String* LocalizedStringWithDefaultValue(const String* pKey, const String* pTbl, const class Bundle* pBdle, const String* pVal, const String*);
class Bundle : public Referencing<Bundle>
{
public:
static Bundle* mainBundle();
static Bundle* bundle(const class String* pPath);
static Bundle* bundle(const class URL* pURL);
static class Array* allBundles();
static class Array* allFrameworks();
static Bundle* alloc();
Bundle* init(const class String* pPath);
Bundle* init(const class URL* pURL);
bool load();
bool unload();
bool isLoaded() const;
bool preflightAndReturnError(class Error** pError) const;
bool loadAndReturnError(class Error** pError);
class URL* bundleURL() const;
class URL* resourceURL() const;
class URL* executableURL() const;
class URL* URLForAuxiliaryExecutable(const class String* pExecutableName) const;
class URL* privateFrameworksURL() const;
class URL* sharedFrameworksURL() const;
class URL* sharedSupportURL() const;
class URL* builtInPlugInsURL() const;
class URL* appStoreReceiptURL() const;
class String* bundlePath() const;
class String* resourcePath() const;
class String* executablePath() const;
class String* pathForAuxiliaryExecutable(const class String* pExecutableName) const;
class String* privateFrameworksPath() const;
class String* sharedFrameworksPath() const;
class String* sharedSupportPath() const;
class String* builtInPlugInsPath() const;
class String* bundleIdentifier() const;
class Dictionary* infoDictionary() const;
class Dictionary* localizedInfoDictionary() const;
class Object* objectForInfoDictionaryKey(const class String* pKey);
class String* localizedString(const class String* pKey, const class String* pValue = nullptr, const class String* pTableName = nullptr) const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_PRIVATE_DEF_CONST(NS::NotificationName, BundleDidLoadNotification);
_NS_PRIVATE_DEF_CONST(NS::NotificationName, BundleResourceRequestLowDiskSpaceNotification);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::LocalizedString(const String* pKey, const String*)
{
return Bundle::mainBundle()->localizedString(pKey, nullptr, nullptr);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::LocalizedStringFromTable(const String* pKey, const String* pTbl, const String*)
{
return Bundle::mainBundle()->localizedString(pKey, nullptr, pTbl);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::LocalizedStringFromTableInBundle(const String* pKey, const String* pTbl, const Bundle* pBdl, const String*)
{
return pBdl->localizedString(pKey, nullptr, pTbl);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::LocalizedStringWithDefaultValue(const String* pKey, const String* pTbl, const Bundle* pBdl, const String* pVal, const String*)
{
return pBdl->localizedString(pKey, pVal, pTbl);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Bundle* NS::Bundle::mainBundle()
{
return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(mainBundle));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Bundle* NS::Bundle::bundle(const class String* pPath)
{
return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(bundleWithPath_), pPath);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Bundle* NS::Bundle::bundle(const class URL* pURL)
{
return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(bundleWithURL_), pURL);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Bundle::allBundles()
{
return Object::sendMessage<Array*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(allBundles));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Bundle::allFrameworks()
{
return Object::sendMessage<Array*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(allFrameworks));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Bundle* NS::Bundle::alloc()
{
return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(alloc));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Bundle* NS::Bundle::init(const String* pPath)
{
return Object::sendMessage<Bundle*>(this, _NS_PRIVATE_SEL(initWithPath_), pPath);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Bundle* NS::Bundle::init(const URL* pURL)
{
return Object::sendMessage<Bundle*>(this, _NS_PRIVATE_SEL(initWithURL_), pURL);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Bundle::load()
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(load));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Bundle::unload()
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(unload));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Bundle::isLoaded() const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isLoaded));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Bundle::preflightAndReturnError(Error** pError) const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(preflightAndReturnError_), pError);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Bundle::loadAndReturnError(Error** pError)
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(loadAndReturnError_), pError);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::bundleURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(bundleURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::resourceURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(resourceURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::executableURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(executableURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::URLForAuxiliaryExecutable(const String* pExecutableName) const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(URLForAuxiliaryExecutable_), pExecutableName);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::privateFrameworksURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(privateFrameworksURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::sharedFrameworksURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(sharedFrameworksURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::sharedSupportURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(sharedSupportURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::builtInPlugInsURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(builtInPlugInsURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::Bundle::appStoreReceiptURL() const
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(appStoreReceiptURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::bundlePath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(bundlePath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::resourcePath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(resourcePath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::executablePath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(executablePath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::pathForAuxiliaryExecutable(const String* pExecutableName) const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(pathForAuxiliaryExecutable_), pExecutableName);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::privateFrameworksPath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(privateFrameworksPath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::sharedFrameworksPath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(sharedFrameworksPath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::sharedSupportPath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(sharedSupportPath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::builtInPlugInsPath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(builtInPlugInsPath));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::bundleIdentifier() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(bundleIdentifier));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Bundle::infoDictionary() const
{
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(infoDictionary));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Bundle::localizedInfoDictionary() const
{
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(localizedInfoDictionary));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Object* NS::Bundle::objectForInfoDictionaryKey(const String* pKey)
{
return Object::sendMessage<Object*>(this, _NS_PRIVATE_SEL(objectForInfoDictionaryKey_), pKey);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Bundle::localizedString(const String* pKey, const String* pValue /* = nullptr */, const String* pTableName /* = nullptr */) const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(localizedStringForKey_value_table_), pKey, pValue, pTableName);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,54 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSData.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSObject.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class Data : public Copying<Data>
{
public:
void* mutableBytes() const;
UInteger length() const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void* NS::Data::mutableBytes() const
{
return Object::sendMessage<void*>(this, _NS_PRIVATE_SEL(mutableBytes));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Data::length() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(length));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,53 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSDate.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
using TimeInterval = double;
class Date : public Copying<Date>
{
public:
static Date* dateWithTimeIntervalSinceNow(TimeInterval secs);
};
} // NS
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Date* NS::Date::dateWithTimeIntervalSinceNow(NS::TimeInterval secs)
{
return NS::Object::sendMessage<NS::Date*>(_NS_PRIVATE_CLS(NSDate), _NS_PRIVATE_SEL(dateWithTimeIntervalSinceNow_), secs);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,45 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSDefines.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _NS_WEAK_IMPORT __attribute__((weak_import))
#ifdef METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _NS_EXPORT __attribute__((visibility("hidden")))
#else
#define _NS_EXPORT __attribute__((visibility("default")))
#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _NS_EXTERN extern "C" _NS_EXPORT
#define _NS_INLINE inline __attribute__((always_inline))
#define _NS_PACKED __attribute__((packed))
#define _NS_CONST(type, name) _NS_EXTERN type const name
#define _NS_ENUM(type, name) enum name : type
#define _NS_OPTIONS(type, name) \
using name = type; \
enum : name
#define _NS_CAST_TO_UINT(value) static_cast<NS::UInteger>(value)
#define _NS_VALIDATE_SIZE(ns, name) static_assert(sizeof(ns::name) == sizeof(ns##name), "size mismatch " #ns "::" #name)
#define _NS_VALIDATE_ENUM(ns, name) static_assert(_NS_CAST_TO_UINT(ns::name) == _NS_CAST_TO_UINT(ns##name), "value mismatch " #ns "::" #name)
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,128 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSDictionary.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSEnumerator.hpp"
#include "NSObject.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class Dictionary : public NS::Copying<Dictionary>
{
public:
static Dictionary* dictionary();
static Dictionary* dictionary(const Object* pObject, const Object* pKey);
static Dictionary* dictionary(const Object* const* pObjects, const Object* const* pKeys, UInteger count);
static Dictionary* alloc();
Dictionary* init();
Dictionary* init(const Object* const* pObjects, const Object* const* pKeys, UInteger count);
Dictionary* init(const class Coder* pCoder);
template <class _KeyType = Object>
Enumerator<_KeyType>* keyEnumerator() const;
template <class _Object = Object>
_Object* object(const Object* pKey) const;
UInteger count() const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::dictionary()
{
return Object::sendMessage<Dictionary*>(_NS_PRIVATE_CLS(NSDictionary), _NS_PRIVATE_SEL(dictionary));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::dictionary(const Object* pObject, const Object* pKey)
{
return Object::sendMessage<Dictionary*>(_NS_PRIVATE_CLS(NSDictionary), _NS_PRIVATE_SEL(dictionaryWithObject_forKey_), pObject, pKey);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::dictionary(const Object* const* pObjects, const Object* const* pKeys, UInteger count)
{
return Object::sendMessage<Dictionary*>(_NS_PRIVATE_CLS(NSDictionary), _NS_PRIVATE_SEL(dictionaryWithObjects_forKeys_count_),
pObjects, pKeys, count);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::alloc()
{
return NS::Object::alloc<Dictionary>(_NS_PRIVATE_CLS(NSDictionary));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::init()
{
return NS::Object::init<Dictionary>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::init(const Object* const* pObjects, const Object* const* pKeys, UInteger count)
{
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(initWithObjects_forKeys_count_), pObjects, pKeys, count);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Dictionary::init(const class Coder* pCoder)
{
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _KeyType>
_NS_INLINE NS::Enumerator<_KeyType>* NS::Dictionary::keyEnumerator() const
{
return Object::sendMessage<Enumerator<_KeyType>*>(this, _NS_PRIVATE_SEL(keyEnumerator));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Object>
_NS_INLINE _Object* NS::Dictionary::object(const Object* pKey) const
{
return Object::sendMessage<_Object*>(this, _NS_PRIVATE_SEL(objectForKey_), pKey);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Dictionary::count() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(count));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,78 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSEnumerator.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSObject.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
struct FastEnumerationState
{
unsigned long state;
Object** itemsPtr;
unsigned long* mutationsPtr;
unsigned long extra[5];
} _NS_PACKED;
class FastEnumeration : public Referencing<FastEnumeration>
{
public:
NS::UInteger countByEnumerating(FastEnumerationState* pState, Object** pBuffer, NS::UInteger len);
};
template <class _ObjectType>
class Enumerator : public Referencing<Enumerator<_ObjectType>, FastEnumeration>
{
public:
_ObjectType* nextObject();
class Array* allObjects();
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::FastEnumeration::countByEnumerating(FastEnumerationState* pState, Object** pBuffer, NS::UInteger len)
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(countByEnumeratingWithState_objects_count_), pState, pBuffer, len);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _ObjectType>
_NS_INLINE _ObjectType* NS::Enumerator<_ObjectType>::nextObject()
{
return Object::sendMessage<_ObjectType*>(this, _NS_PRIVATE_SEL(nextObject));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _ObjectType>
_NS_INLINE NS::Array* NS::Enumerator<_ObjectType>::allObjects()
{
return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(allObjects));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,173 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSError.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
using ErrorDomain = class String*;
_NS_CONST(ErrorDomain, CocoaErrorDomain);
_NS_CONST(ErrorDomain, POSIXErrorDomain);
_NS_CONST(ErrorDomain, OSStatusErrorDomain);
_NS_CONST(ErrorDomain, MachErrorDomain);
using ErrorUserInfoKey = class String*;
_NS_CONST(ErrorUserInfoKey, UnderlyingErrorKey);
_NS_CONST(ErrorUserInfoKey, LocalizedDescriptionKey);
_NS_CONST(ErrorUserInfoKey, LocalizedFailureReasonErrorKey);
_NS_CONST(ErrorUserInfoKey, LocalizedRecoverySuggestionErrorKey);
_NS_CONST(ErrorUserInfoKey, LocalizedRecoveryOptionsErrorKey);
_NS_CONST(ErrorUserInfoKey, RecoveryAttempterErrorKey);
_NS_CONST(ErrorUserInfoKey, HelpAnchorErrorKey);
_NS_CONST(ErrorUserInfoKey, DebugDescriptionErrorKey);
_NS_CONST(ErrorUserInfoKey, LocalizedFailureErrorKey);
_NS_CONST(ErrorUserInfoKey, StringEncodingErrorKey);
_NS_CONST(ErrorUserInfoKey, URLErrorKey);
_NS_CONST(ErrorUserInfoKey, FilePathErrorKey);
class Error : public Copying<Error>
{
public:
static Error* error(ErrorDomain domain, Integer code, class Dictionary* pDictionary);
static Error* alloc();
Error* init();
Error* init(ErrorDomain domain, Integer code, class Dictionary* pDictionary);
Integer code() const;
ErrorDomain domain() const;
class Dictionary* userInfo() const;
class String* localizedDescription() const;
class Array* localizedRecoveryOptions() const;
class String* localizedRecoverySuggestion() const;
class String* localizedFailureReason() const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_PRIVATE_DEF_CONST(NS::ErrorDomain, CocoaErrorDomain);
_NS_PRIVATE_DEF_CONST(NS::ErrorDomain, POSIXErrorDomain);
_NS_PRIVATE_DEF_CONST(NS::ErrorDomain, OSStatusErrorDomain);
_NS_PRIVATE_DEF_CONST(NS::ErrorDomain, MachErrorDomain);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, UnderlyingErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, LocalizedDescriptionKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, LocalizedFailureReasonErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, LocalizedRecoverySuggestionErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, LocalizedRecoveryOptionsErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, RecoveryAttempterErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, HelpAnchorErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, DebugDescriptionErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, LocalizedFailureErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, StringEncodingErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, URLErrorKey);
_NS_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, FilePathErrorKey);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Error* NS::Error::error(ErrorDomain domain, Integer code, class Dictionary* pDictionary)
{
return Object::sendMessage<Error*>(_NS_PRIVATE_CLS(NSError), _NS_PRIVATE_SEL(errorWithDomain_code_userInfo_), domain, code, pDictionary);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Error* NS::Error::alloc()
{
return Object::alloc<Error>(_NS_PRIVATE_CLS(NSError));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Error* NS::Error::init()
{
return Object::init<Error>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Error* NS::Error::init(ErrorDomain domain, Integer code, class Dictionary* pDictionary)
{
return Object::sendMessage<Error*>(this, _NS_PRIVATE_SEL(initWithDomain_code_userInfo_), domain, code, pDictionary);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Integer NS::Error::code() const
{
return Object::sendMessage<Integer>(this, _NS_PRIVATE_SEL(code));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::ErrorDomain NS::Error::domain() const
{
return Object::sendMessage<ErrorDomain>(this, _NS_PRIVATE_SEL(domain));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Error::userInfo() const
{
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(userInfo));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Error::localizedDescription() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(localizedDescription));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::Error::localizedRecoveryOptions() const
{
return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(localizedRecoveryOptions));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Error::localizedRecoverySuggestion() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(localizedRecoverySuggestion));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Error::localizedFailureReason() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(localizedFailureReason));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,118 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSLock.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
#include "NSDate.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
template <class _Class, class _Base = class Object>
class Locking : public _Base
{
public:
void lock();
void unlock();
};
class Condition : public Locking<Condition>
{
public:
static Condition* alloc();
Condition* init();
void wait();
bool waitUntilDate(Date* pLimit);
void signal();
void broadcast();
};
} // NS
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template<class _Class, class _Base /* = NS::Object */>
_NS_INLINE void NS::Locking<_Class, _Base>::lock()
{
NS::Object::sendMessage<void>(this, _NS_PRIVATE_SEL(lock));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template<class _Class, class _Base /* = NS::Object */>
_NS_INLINE void NS::Locking<_Class, _Base>::unlock()
{
NS::Object::sendMessage<void>(this, _NS_PRIVATE_SEL(unlock));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Condition* NS::Condition::alloc()
{
return NS::Object::alloc<NS::Condition>(_NS_PRIVATE_CLS(NSCondition));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Condition* NS::Condition::init()
{
return NS::Object::init<NS::Condition>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::Condition::wait()
{
NS::Object::sendMessage<void>(this, _NS_PRIVATE_SEL(wait));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Condition::waitUntilDate(NS::Date* pLimit)
{
return NS::Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(waitUntilDate_), pLimit);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::Condition::signal()
{
NS::Object::sendMessage<void>(this, _NS_PRIVATE_SEL(signal));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::Condition::broadcast()
{
NS::Object::sendMessage<void>(this, _NS_PRIVATE_SEL(broadcast));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,110 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSNotification.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSDictionary.hpp"
#include "NSObject.hpp"
#include "NSString.hpp"
#include "NSTypes.hpp"
#include <functional>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
using NotificationName = class String*;
class Notification : public NS::Referencing<Notification>
{
public:
NS::String* name() const;
NS::Object* object() const;
NS::Dictionary* userInfo() const;
};
using ObserverBlock = void(^)(Notification*);
using ObserverFunction = std::function<void(Notification*)>;
class NotificationCenter : public NS::Referencing<NotificationCenter>
{
public:
static class NotificationCenter* defaultCenter();
Object* addObserver(NotificationName name, Object* pObj, void* pQueue, ObserverBlock block);
Object* addObserver(NotificationName name, Object* pObj, void* pQueue, ObserverFunction &handler);
void removeObserver(Object* pObserver);
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Notification::name() const
{
return Object::sendMessage<NS::String*>(this, _NS_PRIVATE_SEL(name));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Object* NS::Notification::object() const
{
return Object::sendMessage<NS::Object*>(this, _NS_PRIVATE_SEL(object));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::Notification::userInfo() const
{
return Object::sendMessage<NS::Dictionary*>(this, _NS_PRIVATE_SEL(userInfo));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::NotificationCenter* NS::NotificationCenter::defaultCenter()
{
return NS::Object::sendMessage<NS::NotificationCenter*>(_NS_PRIVATE_CLS(NSNotificationCenter), _NS_PRIVATE_SEL(defaultCenter));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Object* NS::NotificationCenter::addObserver(NS::NotificationName name, Object* pObj, void* pQueue, NS::ObserverBlock block)
{
return NS::Object::sendMessage<Object*>(this, _NS_PRIVATE_SEL(addObserverName_object_queue_block_), name, pObj, pQueue, block);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Object* NS::NotificationCenter::addObserver(NS::NotificationName name, Object* pObj, void* pQueue, NS::ObserverFunction &handler)
{
__block ObserverFunction blockFunction = handler;
return addObserver(name, pObj, pQueue, ^(NS::Notification* pNotif) {blockFunction(pNotif);});
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::NotificationCenter::removeObserver(Object* pObserver)
{
return NS::Object::sendMessage<void>(this, _NS_PRIVATE_SEL(removeObserver_), pObserver);
}

View File

@@ -1,501 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSNumber.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSObjCRuntime.hpp"
#include "NSObject.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class Value : public Copying<Value>
{
public:
static Value* value(const void* pValue, const char* pType);
static Value* value(const void* pPointer);
static Value* alloc();
Value* init(const void* pValue, const char* pType);
Value* init(const class Coder* pCoder);
void getValue(void* pValue, UInteger size) const;
const char* objCType() const;
bool isEqualToValue(Value* pValue) const;
void* pointerValue() const;
};
class Number : public Copying<Number, Value>
{
public:
static Number* number(char value);
static Number* number(unsigned char value);
static Number* number(short value);
static Number* number(unsigned short value);
static Number* number(int value);
static Number* number(unsigned int value);
static Number* number(long value);
static Number* number(unsigned long value);
static Number* number(long long value);
static Number* number(unsigned long long value);
static Number* number(float value);
static Number* number(double value);
static Number* number(bool value);
static Number* alloc();
Number* init(const class Coder* pCoder);
Number* init(char value);
Number* init(unsigned char value);
Number* init(short value);
Number* init(unsigned short value);
Number* init(int value);
Number* init(unsigned int value);
Number* init(long value);
Number* init(unsigned long value);
Number* init(long long value);
Number* init(unsigned long long value);
Number* init(float value);
Number* init(double value);
Number* init(bool value);
char charValue() const;
unsigned char unsignedCharValue() const;
short shortValue() const;
unsigned short unsignedShortValue() const;
int intValue() const;
unsigned int unsignedIntValue() const;
long longValue() const;
unsigned long unsignedLongValue() const;
long long longLongValue() const;
unsigned long long unsignedLongLongValue() const;
float floatValue() const;
double doubleValue() const;
bool boolValue() const;
Integer integerValue() const;
UInteger unsignedIntegerValue() const;
class String* stringValue() const;
ComparisonResult compare(const Number* pOtherNumber) const;
bool isEqualToNumber(const Number* pNumber) const;
class String* descriptionWithLocale(const Object* pLocale) const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Value* NS::Value::value(const void* pValue, const char* pType)
{
return Object::sendMessage<Value*>(_NS_PRIVATE_CLS(NSValue), _NS_PRIVATE_SEL(valueWithBytes_objCType_), pValue, pType);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Value* NS::Value::value(const void* pPointer)
{
return Object::sendMessage<Value*>(_NS_PRIVATE_CLS(NSValue), _NS_PRIVATE_SEL(valueWithPointer_), pPointer);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Value* NS::Value::alloc()
{
return NS::Object::alloc<Value>(_NS_PRIVATE_CLS(NSValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Value* NS::Value::init(const void* pValue, const char* pType)
{
return Object::sendMessage<Value*>(this, _NS_PRIVATE_SEL(initWithBytes_objCType_), pValue, pType);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Value* NS::Value::init(const class Coder* pCoder)
{
return Object::sendMessage<Value*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::Value::getValue(void* pValue, UInteger size) const
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(getValue_size_), pValue, size);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE const char* NS::Value::objCType() const
{
return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(objCType));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Value::isEqualToValue(Value* pValue) const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isEqualToValue_), pValue);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void* NS::Value::pointerValue() const
{
return Object::sendMessage<void*>(this, _NS_PRIVATE_SEL(pointerValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(char value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithChar_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(unsigned char value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithUnsignedChar_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(short value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithShort_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(unsigned short value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithUnsignedShort_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(int value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithInt_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(unsigned int value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithUnsignedInt_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(long value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(unsigned long value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithUnsignedLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(long long value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithLongLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(unsigned long long value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithUnsignedLongLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(float value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithFloat_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(double value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithDouble_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::number(bool value)
{
return Object::sendMessage<Number*>(_NS_PRIVATE_CLS(NSNumber), _NS_PRIVATE_SEL(numberWithBool_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::alloc()
{
return NS::Object::alloc<Number>(_NS_PRIVATE_CLS(NSNumber));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(const Coder* pCoder)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(char value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithChar_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(unsigned char value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithUnsignedChar_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(short value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithShort_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(unsigned short value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithUnsignedShort_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(int value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithInt_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(unsigned int value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithUnsignedInt_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(long value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(unsigned long value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithUnsignedLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(long long value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithLongLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(unsigned long long value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithUnsignedLongLong_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(float value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithFloat_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(double value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithDouble_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Number* NS::Number::init(bool value)
{
return Object::sendMessage<Number*>(this, _NS_PRIVATE_SEL(initWithBool_), value);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE char NS::Number::charValue() const
{
return Object::sendMessage<char>(this, _NS_PRIVATE_SEL(charValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE unsigned char NS::Number::unsignedCharValue() const
{
return Object::sendMessage<unsigned char>(this, _NS_PRIVATE_SEL(unsignedCharValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE short NS::Number::shortValue() const
{
return Object::sendMessage<short>(this, _NS_PRIVATE_SEL(shortValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE unsigned short NS::Number::unsignedShortValue() const
{
return Object::sendMessage<unsigned short>(this, _NS_PRIVATE_SEL(unsignedShortValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE int NS::Number::intValue() const
{
return Object::sendMessage<int>(this, _NS_PRIVATE_SEL(intValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE unsigned int NS::Number::unsignedIntValue() const
{
return Object::sendMessage<unsigned int>(this, _NS_PRIVATE_SEL(unsignedIntValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE long NS::Number::longValue() const
{
return Object::sendMessage<long>(this, _NS_PRIVATE_SEL(longValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE unsigned long NS::Number::unsignedLongValue() const
{
return Object::sendMessage<unsigned long>(this, _NS_PRIVATE_SEL(unsignedLongValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE long long NS::Number::longLongValue() const
{
return Object::sendMessage<long long>(this, _NS_PRIVATE_SEL(longLongValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE unsigned long long NS::Number::unsignedLongLongValue() const
{
return Object::sendMessage<unsigned long long>(this, _NS_PRIVATE_SEL(unsignedLongLongValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE float NS::Number::floatValue() const
{
return Object::sendMessage<float>(this, _NS_PRIVATE_SEL(floatValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE double NS::Number::doubleValue() const
{
return Object::sendMessage<double>(this, _NS_PRIVATE_SEL(doubleValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Number::boolValue() const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(boolValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Integer NS::Number::integerValue() const
{
return Object::sendMessage<Integer>(this, _NS_PRIVATE_SEL(integerValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Number::unsignedIntegerValue() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(unsignedIntegerValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Number::stringValue() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(stringValue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::ComparisonResult NS::Number::compare(const Number* pOtherNumber) const
{
return Object::sendMessage<ComparisonResult>(this, _NS_PRIVATE_SEL(compare_), pOtherNumber);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Number::isEqualToNumber(const Number* pNumber) const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isEqualToNumber_), pNumber);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Number::descriptionWithLocale(const Object* pLocale) const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(descriptionWithLocale_), pLocale);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,43 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSObjCRuntime.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
_NS_ENUM(Integer, ComparisonResult) {
OrderedAscending = -1L,
OrderedSame,
OrderedDescending
};
const Integer NotFound = IntegerMax;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,302 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSObject.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
#include <objc/message.h>
#include <objc/runtime.h>
#include <type_traits>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
template <class _Class, class _Base = class Object>
class _NS_EXPORT Referencing : public _Base
{
public:
_Class* retain();
void release();
_Class* autorelease();
UInteger retainCount() const;
};
template <class _Class, class _Base = class Object>
class Copying : public Referencing<_Class, _Base>
{
public:
_Class* copy() const;
};
template <class _Class, class _Base = class Object>
class SecureCoding : public Referencing<_Class, _Base>
{
};
class Object : public Referencing<Object, objc_object>
{
public:
UInteger hash() const;
bool isEqual(const Object* pObject) const;
class String* description() const;
class String* debugDescription() const;
protected:
friend class Referencing<Object, objc_object>;
template <class _Class>
static _Class* alloc(const char* pClassName);
template <class _Class>
static _Class* alloc(const void* pClass);
template <class _Class>
_Class* init();
template <class _Dst>
static _Dst bridgingCast(const void* pObj);
static class MethodSignature* methodSignatureForSelector(const void* pObj, SEL selector);
static bool respondsToSelector(const void* pObj, SEL selector);
template <typename _Type>
static constexpr bool doesRequireMsgSendStret();
template <typename _Ret, typename... _Args>
static _Ret sendMessage(const void* pObj, SEL selector, _Args... args);
template <typename _Ret, typename... _Args>
static _Ret sendMessageSafe(const void* pObj, SEL selector, _Args... args);
private:
Object() = delete;
Object(const Object&) = delete;
~Object() = delete;
Object& operator=(const Object&) = delete;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class, class _Base /* = Object */>
_NS_INLINE _Class* NS::Referencing<_Class, _Base>::retain()
{
return Object::sendMessage<_Class*>(this, _NS_PRIVATE_SEL(retain));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class, class _Base /* = Object */>
_NS_INLINE void NS::Referencing<_Class, _Base>::release()
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(release));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class, class _Base /* = Object */>
_NS_INLINE _Class* NS::Referencing<_Class, _Base>::autorelease()
{
return Object::sendMessage<_Class*>(this, _NS_PRIVATE_SEL(autorelease));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class, class _Base /* = Object */>
_NS_INLINE NS::UInteger NS::Referencing<_Class, _Base>::retainCount() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(retainCount));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class, class _Base /* = Object */>
_NS_INLINE _Class* NS::Copying<_Class, _Base>::copy() const
{
return Object::sendMessage<_Class*>(this, _NS_PRIVATE_SEL(copy));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Dst>
_NS_INLINE _Dst NS::Object::bridgingCast(const void* pObj)
{
#ifdef __OBJC__
return (__bridge _Dst)pObj;
#else
return (_Dst)pObj;
#endif // __OBJC__
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <typename _Type>
_NS_INLINE constexpr bool NS::Object::doesRequireMsgSendStret()
{
#if (defined(__i386__) || defined(__x86_64__))
constexpr size_t kStructLimit = (sizeof(std::uintptr_t) << 1);
return sizeof(_Type) > kStructLimit;
#elif defined(__arm64__)
return false;
#elif defined(__arm__)
constexpr size_t kStructLimit = sizeof(std::uintptr_t);
return std::is_class_v<_Type> && (sizeof(_Type) > kStructLimit);
#else
#error "Unsupported architecture!"
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <>
_NS_INLINE constexpr bool NS::Object::doesRequireMsgSendStret<void>()
{
return false;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <typename _Ret, typename... _Args>
_NS_INLINE _Ret NS::Object::sendMessage(const void* pObj, SEL selector, _Args... args)
{
#if (defined(__i386__) || defined(__x86_64__))
if constexpr (std::is_floating_point<_Ret>())
{
using SendMessageProcFpret = _Ret (*)(const void*, SEL, _Args...);
const SendMessageProcFpret pProc = reinterpret_cast<SendMessageProcFpret>(&objc_msgSend_fpret);
return (*pProc)(pObj, selector, args...);
}
else
#endif // ( defined( __i386__ ) || defined( __x86_64__ ) )
#if !defined(__arm64__)
if constexpr (doesRequireMsgSendStret<_Ret>())
{
using SendMessageProcStret = void (*)(_Ret*, const void*, SEL, _Args...);
const SendMessageProcStret pProc = reinterpret_cast<SendMessageProcStret>(&objc_msgSend_stret);
_Ret ret;
(*pProc)(&ret, pObj, selector, args...);
return ret;
}
else
#endif // !defined( __arm64__ )
{
using SendMessageProc = _Ret (*)(const void*, SEL, _Args...);
const SendMessageProc pProc = reinterpret_cast<SendMessageProc>(&objc_msgSend);
return (*pProc)(pObj, selector, args...);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::MethodSignature* NS::Object::methodSignatureForSelector(const void* pObj, SEL selector)
{
return sendMessage<MethodSignature*>(pObj, _NS_PRIVATE_SEL(methodSignatureForSelector_), selector);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Object::respondsToSelector(const void* pObj, SEL selector)
{
return sendMessage<bool>(pObj, _NS_PRIVATE_SEL(respondsToSelector_), selector);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <typename _Ret, typename... _Args>
_NS_INLINE _Ret NS::Object::sendMessageSafe(const void* pObj, SEL selector, _Args... args)
{
if ((respondsToSelector(pObj, selector)) || (nullptr != methodSignatureForSelector(pObj, selector)))
{
return sendMessage<_Ret>(pObj, selector, args...);
}
if constexpr (!std::is_void<_Ret>::value)
{
return _Ret(0);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class>
_NS_INLINE _Class* NS::Object::alloc(const char* pClassName)
{
return sendMessage<_Class*>(objc_lookUpClass(pClassName), _NS_PRIVATE_SEL(alloc));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class>
_NS_INLINE _Class* NS::Object::alloc(const void* pClass)
{
return sendMessage<_Class*>(pClass, _NS_PRIVATE_SEL(alloc));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
template <class _Class>
_NS_INLINE _Class* NS::Object::init()
{
return sendMessage<_Class*>(this, _NS_PRIVATE_SEL(init));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Object::hash() const
{
return sendMessage<UInteger>(this, _NS_PRIVATE_SEL(hash));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Object::isEqual(const Object* pObject) const
{
return sendMessage<bool>(this, _NS_PRIVATE_SEL(isEqual_), pObject);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Object::description() const
{
return sendMessage<String*>(this, _NS_PRIVATE_SEL(description));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::Object::debugDescription() const
{
return sendMessageSafe<String*>(this, _NS_PRIVATE_SEL(debugDescription));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,531 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSPrivate.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <objc/runtime.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _NS_PRIVATE_CLS(symbol) (Private::Class::s_k##symbol)
#define _NS_PRIVATE_SEL(accessor) (Private::Selector::s_k##accessor)
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#if defined(NS_PRIVATE_IMPLEMENTATION)
#include <dlfcn.h>
namespace NS::Private
{
template <typename _Type>
inline _Type const LoadSymbol(const char* pSymbol)
{
const _Type* pAddress = static_cast<_Type*>(dlsym(RTLD_DEFAULT, pSymbol));
return pAddress ? *pAddress : _Type();
}
} // NS::Private
#ifdef METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _NS_PRIVATE_VISIBILITY __attribute__((visibility("hidden")))
#else
#define _NS_PRIVATE_VISIBILITY __attribute__((visibility("default")))
#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _NS_PRIVATE_IMPORT __attribute__((weak_import))
#ifdef __OBJC__
#define _NS_PRIVATE_OBJC_LOOKUP_CLASS(symbol) ((__bridge void*)objc_lookUpClass(#symbol))
#define _NS_PRIVATE_OBJC_GET_PROTOCOL(symbol) ((__bridge void*)objc_getProtocol(#symbol))
#else
#define _NS_PRIVATE_OBJC_LOOKUP_CLASS(symbol) objc_lookUpClass(#symbol)
#define _NS_PRIVATE_OBJC_GET_PROTOCOL(symbol) objc_getProtocol(#symbol)
#endif // __OBJC__
#define _NS_PRIVATE_DEF_CLS(symbol) void* s_k##symbol _NS_PRIVATE_VISIBILITY = _NS_PRIVATE_OBJC_LOOKUP_CLASS(symbol)
#define _NS_PRIVATE_DEF_PRO(symbol) void* s_k##symbol _NS_PRIVATE_VISIBILITY = _NS_PRIVATE_OBJC_GET_PROTOCOL(symbol)
#define _NS_PRIVATE_DEF_SEL(accessor, symbol) SEL s_k##accessor _NS_PRIVATE_VISIBILITY = sel_registerName(symbol)
#if defined(__MAC_26_0) || defined(__IPHONE_26_0) || defined(__TVOS_26_0)
#define _NS_PRIVATE_DEF_CONST(type, symbol) \
_NS_EXTERN type const NS##symbol _NS_PRIVATE_IMPORT; \
type const NS::symbol = (nullptr != &NS##symbol) ? NS##symbol : type()
#else
#define _NS_PRIVATE_DEF_CONST(type, symbol) \
_NS_EXTERN type const MTL##symbol _NS_PRIVATE_IMPORT; \
type const NS::symbol = Private::LoadSymbol<type>("NS" #symbol)
#endif
#else
#define _NS_PRIVATE_DEF_CLS(symbol) extern void* s_k##symbol
#define _NS_PRIVATE_DEF_PRO(symbol) extern void* s_k##symbol
#define _NS_PRIVATE_DEF_SEL(accessor, symbol) extern SEL s_k##accessor
#define _NS_PRIVATE_DEF_CONST(type, symbol) extern type const NS::symbol
#endif // NS_PRIVATE_IMPLEMENTATION
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
namespace Private
{
namespace Class
{
_NS_PRIVATE_DEF_CLS(NSArray);
_NS_PRIVATE_DEF_CLS(NSAutoreleasePool);
_NS_PRIVATE_DEF_CLS(NSBundle);
_NS_PRIVATE_DEF_CLS(NSCondition);
_NS_PRIVATE_DEF_CLS(NSDate);
_NS_PRIVATE_DEF_CLS(NSDictionary);
_NS_PRIVATE_DEF_CLS(NSError);
_NS_PRIVATE_DEF_CLS(NSNotificationCenter);
_NS_PRIVATE_DEF_CLS(NSNumber);
_NS_PRIVATE_DEF_CLS(NSObject);
_NS_PRIVATE_DEF_CLS(NSProcessInfo);
_NS_PRIVATE_DEF_CLS(NSSet);
_NS_PRIVATE_DEF_CLS(NSString);
_NS_PRIVATE_DEF_CLS(NSURL);
_NS_PRIVATE_DEF_CLS(NSValue);
} // Class
} // Private
} // MTL
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
namespace Private
{
namespace Protocol
{
} // Protocol
} // Private
} // NS
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
namespace Private
{
namespace Selector
{
_NS_PRIVATE_DEF_SEL(addObject_,
"addObject:");
_NS_PRIVATE_DEF_SEL(addObserverName_object_queue_block_,
"addObserverForName:object:queue:usingBlock:");
_NS_PRIVATE_DEF_SEL(activeProcessorCount,
"activeProcessorCount");
_NS_PRIVATE_DEF_SEL(allBundles,
"allBundles");
_NS_PRIVATE_DEF_SEL(allFrameworks,
"allFrameworks");
_NS_PRIVATE_DEF_SEL(allObjects,
"allObjects");
_NS_PRIVATE_DEF_SEL(alloc,
"alloc");
_NS_PRIVATE_DEF_SEL(appStoreReceiptURL,
"appStoreReceiptURL");
_NS_PRIVATE_DEF_SEL(arguments,
"arguments");
_NS_PRIVATE_DEF_SEL(array,
"array");
_NS_PRIVATE_DEF_SEL(arrayWithObject_,
"arrayWithObject:");
_NS_PRIVATE_DEF_SEL(arrayWithObjects_count_,
"arrayWithObjects:count:");
_NS_PRIVATE_DEF_SEL(automaticTerminationSupportEnabled,
"automaticTerminationSupportEnabled");
_NS_PRIVATE_DEF_SEL(autorelease,
"autorelease");
_NS_PRIVATE_DEF_SEL(beginActivityWithOptions_reason_,
"beginActivityWithOptions:reason:");
_NS_PRIVATE_DEF_SEL(boolValue,
"boolValue");
_NS_PRIVATE_DEF_SEL(broadcast,
"broadcast");
_NS_PRIVATE_DEF_SEL(builtInPlugInsPath,
"builtInPlugInsPath");
_NS_PRIVATE_DEF_SEL(builtInPlugInsURL,
"builtInPlugInsURL");
_NS_PRIVATE_DEF_SEL(bundleIdentifier,
"bundleIdentifier");
_NS_PRIVATE_DEF_SEL(bundlePath,
"bundlePath");
_NS_PRIVATE_DEF_SEL(bundleURL,
"bundleURL");
_NS_PRIVATE_DEF_SEL(bundleWithPath_,
"bundleWithPath:");
_NS_PRIVATE_DEF_SEL(bundleWithURL_,
"bundleWithURL:");
_NS_PRIVATE_DEF_SEL(caseInsensitiveCompare_,
"caseInsensitiveCompare:");
_NS_PRIVATE_DEF_SEL(characterAtIndex_,
"characterAtIndex:");
_NS_PRIVATE_DEF_SEL(charValue,
"charValue");
_NS_PRIVATE_DEF_SEL(countByEnumeratingWithState_objects_count_,
"countByEnumeratingWithState:objects:count:");
_NS_PRIVATE_DEF_SEL(cStringUsingEncoding_,
"cStringUsingEncoding:");
_NS_PRIVATE_DEF_SEL(code,
"code");
_NS_PRIVATE_DEF_SEL(compare_,
"compare:");
_NS_PRIVATE_DEF_SEL(copy,
"copy");
_NS_PRIVATE_DEF_SEL(count,
"count");
_NS_PRIVATE_DEF_SEL(dateWithTimeIntervalSinceNow_,
"dateWithTimeIntervalSinceNow:");
_NS_PRIVATE_DEF_SEL(defaultCenter,
"defaultCenter");
_NS_PRIVATE_DEF_SEL(descriptionWithLocale_,
"descriptionWithLocale:");
_NS_PRIVATE_DEF_SEL(disableAutomaticTermination_,
"disableAutomaticTermination:");
_NS_PRIVATE_DEF_SEL(disableSuddenTermination,
"disableSuddenTermination");
_NS_PRIVATE_DEF_SEL(debugDescription,
"debugDescription");
_NS_PRIVATE_DEF_SEL(description,
"description");
_NS_PRIVATE_DEF_SEL(dictionary,
"dictionary");
_NS_PRIVATE_DEF_SEL(dictionaryWithObject_forKey_,
"dictionaryWithObject:forKey:");
_NS_PRIVATE_DEF_SEL(dictionaryWithObjects_forKeys_count_,
"dictionaryWithObjects:forKeys:count:");
_NS_PRIVATE_DEF_SEL(domain,
"domain");
_NS_PRIVATE_DEF_SEL(doubleValue,
"doubleValue");
_NS_PRIVATE_DEF_SEL(drain,
"drain");
_NS_PRIVATE_DEF_SEL(enableAutomaticTermination_,
"enableAutomaticTermination:");
_NS_PRIVATE_DEF_SEL(enableSuddenTermination,
"enableSuddenTermination");
_NS_PRIVATE_DEF_SEL(endActivity_,
"endActivity:");
_NS_PRIVATE_DEF_SEL(environment,
"environment");
_NS_PRIVATE_DEF_SEL(errorWithDomain_code_userInfo_,
"errorWithDomain:code:userInfo:");
_NS_PRIVATE_DEF_SEL(executablePath,
"executablePath");
_NS_PRIVATE_DEF_SEL(executableURL,
"executableURL");
_NS_PRIVATE_DEF_SEL(fileSystemRepresentation,
"fileSystemRepresentation");
_NS_PRIVATE_DEF_SEL(fileURLWithPath_,
"fileURLWithPath:");
_NS_PRIVATE_DEF_SEL(floatValue,
"floatValue");
_NS_PRIVATE_DEF_SEL(fullUserName,
"fullUserName");
_NS_PRIVATE_DEF_SEL(getValue_size_,
"getValue:size:");
_NS_PRIVATE_DEF_SEL(globallyUniqueString,
"globallyUniqueString");
_NS_PRIVATE_DEF_SEL(hash,
"hash");
_NS_PRIVATE_DEF_SEL(hasPerformanceProfile_,
"hasPerformanceProfile:");
_NS_PRIVATE_DEF_SEL(hostName,
"hostName");
_NS_PRIVATE_DEF_SEL(infoDictionary,
"infoDictionary");
_NS_PRIVATE_DEF_SEL(init,
"init");
_NS_PRIVATE_DEF_SEL(initFileURLWithPath_,
"initFileURLWithPath:");
_NS_PRIVATE_DEF_SEL(initWithBool_,
"initWithBool:");
_NS_PRIVATE_DEF_SEL(initWithBytes_objCType_,
"initWithBytes:objCType:");
_NS_PRIVATE_DEF_SEL(initWithBytesNoCopy_length_encoding_freeWhenDone_,
"initWithBytesNoCopy:length:encoding:freeWhenDone:");
_NS_PRIVATE_DEF_SEL(initWithChar_,
"initWithChar:");
_NS_PRIVATE_DEF_SEL(initWithCoder_,
"initWithCoder:");
_NS_PRIVATE_DEF_SEL(initWithCString_encoding_,
"initWithCString:encoding:");
_NS_PRIVATE_DEF_SEL(initWithDomain_code_userInfo_,
"initWithDomain:code:userInfo:");
_NS_PRIVATE_DEF_SEL(initWithDouble_,
"initWithDouble:");
_NS_PRIVATE_DEF_SEL(initWithFloat_,
"initWithFloat:");
_NS_PRIVATE_DEF_SEL(initWithInt_,
"initWithInt:");
_NS_PRIVATE_DEF_SEL(initWithLong_,
"initWithLong:");
_NS_PRIVATE_DEF_SEL(initWithLongLong_,
"initWithLongLong:");
_NS_PRIVATE_DEF_SEL(initWithObjects_count_,
"initWithObjects:count:");
_NS_PRIVATE_DEF_SEL(initWithObjects_forKeys_count_,
"initWithObjects:forKeys:count:");
_NS_PRIVATE_DEF_SEL(initWithPath_,
"initWithPath:");
_NS_PRIVATE_DEF_SEL(initWithShort_,
"initWithShort:");
_NS_PRIVATE_DEF_SEL(initWithString_,
"initWithString:");
_NS_PRIVATE_DEF_SEL(initWithUnsignedChar_,
"initWithUnsignedChar:");
_NS_PRIVATE_DEF_SEL(initWithUnsignedInt_,
"initWithUnsignedInt:");
_NS_PRIVATE_DEF_SEL(initWithUnsignedLong_,
"initWithUnsignedLong:");
_NS_PRIVATE_DEF_SEL(initWithUnsignedLongLong_,
"initWithUnsignedLongLong:");
_NS_PRIVATE_DEF_SEL(initWithUnsignedShort_,
"initWithUnsignedShort:");
_NS_PRIVATE_DEF_SEL(initWithURL_,
"initWithURL:");
_NS_PRIVATE_DEF_SEL(integerValue,
"integerValue");
_NS_PRIVATE_DEF_SEL(intValue,
"intValue");
_NS_PRIVATE_DEF_SEL(isDeviceCertified_,
"isDeviceCertifiedFor:");
_NS_PRIVATE_DEF_SEL(isEqual_,
"isEqual:");
_NS_PRIVATE_DEF_SEL(isEqualToNumber_,
"isEqualToNumber:");
_NS_PRIVATE_DEF_SEL(isEqualToString_,
"isEqualToString:");
_NS_PRIVATE_DEF_SEL(isEqualToValue_,
"isEqualToValue:");
_NS_PRIVATE_DEF_SEL(isiOSAppOnMac,
"isiOSAppOnMac");
_NS_PRIVATE_DEF_SEL(isLoaded,
"isLoaded");
_NS_PRIVATE_DEF_SEL(isLowPowerModeEnabled,
"isLowPowerModeEnabled");
_NS_PRIVATE_DEF_SEL(isMacCatalystApp,
"isMacCatalystApp");
_NS_PRIVATE_DEF_SEL(isOperatingSystemAtLeastVersion_,
"isOperatingSystemAtLeastVersion:");
_NS_PRIVATE_DEF_SEL(keyEnumerator,
"keyEnumerator");
_NS_PRIVATE_DEF_SEL(length,
"length");
_NS_PRIVATE_DEF_SEL(lengthOfBytesUsingEncoding_,
"lengthOfBytesUsingEncoding:");
_NS_PRIVATE_DEF_SEL(load,
"load");
_NS_PRIVATE_DEF_SEL(loadAndReturnError_,
"loadAndReturnError:");
_NS_PRIVATE_DEF_SEL(localizedDescription,
"localizedDescription");
_NS_PRIVATE_DEF_SEL(localizedFailureReason,
"localizedFailureReason");
_NS_PRIVATE_DEF_SEL(localizedInfoDictionary,
"localizedInfoDictionary");
_NS_PRIVATE_DEF_SEL(localizedRecoveryOptions,
"localizedRecoveryOptions");
_NS_PRIVATE_DEF_SEL(localizedRecoverySuggestion,
"localizedRecoverySuggestion");
_NS_PRIVATE_DEF_SEL(localizedStringForKey_value_table_,
"localizedStringForKey:value:table:");
_NS_PRIVATE_DEF_SEL(lock,
"lock");
_NS_PRIVATE_DEF_SEL(longValue,
"longValue");
_NS_PRIVATE_DEF_SEL(longLongValue,
"longLongValue");
_NS_PRIVATE_DEF_SEL(mainBundle,
"mainBundle");
_NS_PRIVATE_DEF_SEL(maximumLengthOfBytesUsingEncoding_,
"maximumLengthOfBytesUsingEncoding:");
_NS_PRIVATE_DEF_SEL(methodSignatureForSelector_,
"methodSignatureForSelector:");
_NS_PRIVATE_DEF_SEL(mutableBytes,
"mutableBytes");
_NS_PRIVATE_DEF_SEL(name,
"name");
_NS_PRIVATE_DEF_SEL(nextObject,
"nextObject");
_NS_PRIVATE_DEF_SEL(numberWithBool_,
"numberWithBool:");
_NS_PRIVATE_DEF_SEL(numberWithChar_,
"numberWithChar:");
_NS_PRIVATE_DEF_SEL(numberWithDouble_,
"numberWithDouble:");
_NS_PRIVATE_DEF_SEL(numberWithFloat_,
"numberWithFloat:");
_NS_PRIVATE_DEF_SEL(numberWithInt_,
"numberWithInt:");
_NS_PRIVATE_DEF_SEL(numberWithLong_,
"numberWithLong:");
_NS_PRIVATE_DEF_SEL(numberWithLongLong_,
"numberWithLongLong:");
_NS_PRIVATE_DEF_SEL(numberWithShort_,
"numberWithShort:");
_NS_PRIVATE_DEF_SEL(numberWithUnsignedChar_,
"numberWithUnsignedChar:");
_NS_PRIVATE_DEF_SEL(numberWithUnsignedInt_,
"numberWithUnsignedInt:");
_NS_PRIVATE_DEF_SEL(numberWithUnsignedLong_,
"numberWithUnsignedLong:");
_NS_PRIVATE_DEF_SEL(numberWithUnsignedLongLong_,
"numberWithUnsignedLongLong:");
_NS_PRIVATE_DEF_SEL(numberWithUnsignedShort_,
"numberWithUnsignedShort:");
_NS_PRIVATE_DEF_SEL(objCType,
"objCType");
_NS_PRIVATE_DEF_SEL(object,
"object");
_NS_PRIVATE_DEF_SEL(objectAtIndex_,
"objectAtIndex:");
_NS_PRIVATE_DEF_SEL(objectEnumerator,
"objectEnumerator");
_NS_PRIVATE_DEF_SEL(objectForInfoDictionaryKey_,
"objectForInfoDictionaryKey:");
_NS_PRIVATE_DEF_SEL(objectForKey_,
"objectForKey:");
_NS_PRIVATE_DEF_SEL(operatingSystem,
"operatingSystem");
_NS_PRIVATE_DEF_SEL(operatingSystemVersion,
"operatingSystemVersion");
_NS_PRIVATE_DEF_SEL(operatingSystemVersionString,
"operatingSystemVersionString");
_NS_PRIVATE_DEF_SEL(pathForAuxiliaryExecutable_,
"pathForAuxiliaryExecutable:");
_NS_PRIVATE_DEF_SEL(performActivityWithOptions_reason_usingBlock_,
"performActivityWithOptions:reason:usingBlock:");
_NS_PRIVATE_DEF_SEL(performExpiringActivityWithReason_usingBlock_,
"performExpiringActivityWithReason:usingBlock:");
_NS_PRIVATE_DEF_SEL(physicalMemory,
"physicalMemory");
_NS_PRIVATE_DEF_SEL(pointerValue,
"pointerValue");
_NS_PRIVATE_DEF_SEL(preflightAndReturnError_,
"preflightAndReturnError:");
_NS_PRIVATE_DEF_SEL(privateFrameworksPath,
"privateFrameworksPath");
_NS_PRIVATE_DEF_SEL(privateFrameworksURL,
"privateFrameworksURL");
_NS_PRIVATE_DEF_SEL(processIdentifier,
"processIdentifier");
_NS_PRIVATE_DEF_SEL(processInfo,
"processInfo");
_NS_PRIVATE_DEF_SEL(processName,
"processName");
_NS_PRIVATE_DEF_SEL(processorCount,
"processorCount");
_NS_PRIVATE_DEF_SEL(rangeOfString_options_,
"rangeOfString:options:");
_NS_PRIVATE_DEF_SEL(release,
"release");
_NS_PRIVATE_DEF_SEL(removeObserver_,
"removeObserver:");
_NS_PRIVATE_DEF_SEL(resourcePath,
"resourcePath");
_NS_PRIVATE_DEF_SEL(resourceURL,
"resourceURL");
_NS_PRIVATE_DEF_SEL(respondsToSelector_,
"respondsToSelector:");
_NS_PRIVATE_DEF_SEL(retain,
"retain");
_NS_PRIVATE_DEF_SEL(retainCount,
"retainCount");
_NS_PRIVATE_DEF_SEL(setAutomaticTerminationSupportEnabled_,
"setAutomaticTerminationSupportEnabled:");
_NS_PRIVATE_DEF_SEL(setProcessName_,
"setProcessName:");
_NS_PRIVATE_DEF_SEL(sharedFrameworksPath,
"sharedFrameworksPath");
_NS_PRIVATE_DEF_SEL(sharedFrameworksURL,
"sharedFrameworksURL");
_NS_PRIVATE_DEF_SEL(sharedSupportPath,
"sharedSupportPath");
_NS_PRIVATE_DEF_SEL(sharedSupportURL,
"sharedSupportURL");
_NS_PRIVATE_DEF_SEL(shortValue,
"shortValue");
_NS_PRIVATE_DEF_SEL(showPools,
"showPools");
_NS_PRIVATE_DEF_SEL(signal,
"signal");
_NS_PRIVATE_DEF_SEL(string,
"string");
_NS_PRIVATE_DEF_SEL(stringValue,
"stringValue");
_NS_PRIVATE_DEF_SEL(stringWithString_,
"stringWithString:");
_NS_PRIVATE_DEF_SEL(stringWithCString_encoding_,
"stringWithCString:encoding:");
_NS_PRIVATE_DEF_SEL(stringByAppendingString_,
"stringByAppendingString:");
_NS_PRIVATE_DEF_SEL(systemUptime,
"systemUptime");
_NS_PRIVATE_DEF_SEL(thermalState,
"thermalState");
_NS_PRIVATE_DEF_SEL(unload,
"unload");
_NS_PRIVATE_DEF_SEL(unlock,
"unlock");
_NS_PRIVATE_DEF_SEL(unsignedCharValue,
"unsignedCharValue");
_NS_PRIVATE_DEF_SEL(unsignedIntegerValue,
"unsignedIntegerValue");
_NS_PRIVATE_DEF_SEL(unsignedIntValue,
"unsignedIntValue");
_NS_PRIVATE_DEF_SEL(unsignedLongValue,
"unsignedLongValue");
_NS_PRIVATE_DEF_SEL(unsignedLongLongValue,
"unsignedLongLongValue");
_NS_PRIVATE_DEF_SEL(unsignedShortValue,
"unsignedShortValue");
_NS_PRIVATE_DEF_SEL(URLForAuxiliaryExecutable_,
"URLForAuxiliaryExecutable:");
_NS_PRIVATE_DEF_SEL(userInfo,
"userInfo");
_NS_PRIVATE_DEF_SEL(userName,
"userName");
_NS_PRIVATE_DEF_SEL(UTF8String,
"UTF8String");
_NS_PRIVATE_DEF_SEL(valueWithBytes_objCType_,
"valueWithBytes:objCType:");
_NS_PRIVATE_DEF_SEL(valueWithPointer_,
"valueWithPointer:");
_NS_PRIVATE_DEF_SEL(wait,
"wait");
_NS_PRIVATE_DEF_SEL(waitUntilDate_,
"waitUntilDate:");
} // Class
} // Private
} // MTL
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,386 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSProcessInfo.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSNotification.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
#include <functional>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
_NS_CONST(NotificationName, ProcessInfoThermalStateDidChangeNotification);
_NS_CONST(NotificationName, ProcessInfoPowerStateDidChangeNotification);
_NS_CONST(NotificationName, ProcessInfoPerformanceProfileDidChangeNotification);
_NS_ENUM(NS::Integer, ProcessInfoThermalState) {
ProcessInfoThermalStateNominal = 0,
ProcessInfoThermalStateFair = 1,
ProcessInfoThermalStateSerious = 2,
ProcessInfoThermalStateCritical = 3
};
_NS_OPTIONS(std::uint64_t, ActivityOptions) {
ActivityIdleDisplaySleepDisabled = (1ULL << 40),
ActivityIdleSystemSleepDisabled = (1ULL << 20),
ActivitySuddenTerminationDisabled = (1ULL << 14),
ActivityAutomaticTerminationDisabled = (1ULL << 15),
ActivityUserInitiated = (0x00FFFFFFULL | ActivityIdleSystemSleepDisabled),
ActivityUserInitiatedAllowingIdleSystemSleep = (ActivityUserInitiated & ~ActivityIdleSystemSleepDisabled),
ActivityBackground = 0x000000FFULL,
ActivityLatencyCritical = 0xFF00000000ULL,
};
typedef NS::Integer DeviceCertification;
_NS_CONST(DeviceCertification, DeviceCertificationiPhonePerformanceGaming);
typedef NS::Integer ProcessPerformanceProfile;
_NS_CONST(ProcessPerformanceProfile, ProcessPerformanceProfileDefault);
_NS_CONST(ProcessPerformanceProfile, ProcessPerformanceProfileSustained);
class ProcessInfo : public Referencing<ProcessInfo>
{
public:
static ProcessInfo* processInfo();
class Array* arguments() const;
class Dictionary* environment() const;
class String* hostName() const;
class String* processName() const;
void setProcessName(const String* pString);
int processIdentifier() const;
class String* globallyUniqueString() const;
class String* userName() const;
class String* fullUserName() const;
UInteger operatingSystem() const;
OperatingSystemVersion operatingSystemVersion() const;
class String* operatingSystemVersionString() const;
bool isOperatingSystemAtLeastVersion(OperatingSystemVersion version) const;
UInteger processorCount() const;
UInteger activeProcessorCount() const;
unsigned long long physicalMemory() const;
TimeInterval systemUptime() const;
void disableSuddenTermination();
void enableSuddenTermination();
void disableAutomaticTermination(const class String* pReason);
void enableAutomaticTermination(const class String* pReason);
bool automaticTerminationSupportEnabled() const;
void setAutomaticTerminationSupportEnabled(bool enabled);
class Object* beginActivity(ActivityOptions options, const class String* pReason);
void endActivity(class Object* pActivity);
void performActivity(ActivityOptions options, const class String* pReason, void (^block)(void));
void performActivity(ActivityOptions options, const class String* pReason, const std::function<void()>& func);
void performExpiringActivity(const class String* pReason, void (^block)(bool expired));
void performExpiringActivity(const class String* pReason, const std::function<void(bool expired)>& func);
ProcessInfoThermalState thermalState() const;
bool isLowPowerModeEnabled() const;
bool isiOSAppOnMac() const;
bool isMacCatalystApp() const;
bool isDeviceCertified(DeviceCertification performanceTier) const;
bool hasPerformanceProfile(ProcessPerformanceProfile performanceProfile) const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_PRIVATE_DEF_CONST(NS::NotificationName, ProcessInfoThermalStateDidChangeNotification);
_NS_PRIVATE_DEF_CONST(NS::NotificationName, ProcessInfoPowerStateDidChangeNotification);
// The linker searches for these symbols in the Metal framework, be sure to link it in as well:
_NS_PRIVATE_DEF_CONST(NS::NotificationName, ProcessInfoPerformanceProfileDidChangeNotification);
_NS_PRIVATE_DEF_CONST(NS::DeviceCertification, DeviceCertificationiPhonePerformanceGaming);
_NS_PRIVATE_DEF_CONST(NS::ProcessPerformanceProfile, ProcessPerformanceProfileDefault);
_NS_PRIVATE_DEF_CONST(NS::ProcessPerformanceProfile, ProcessPerformanceProfileSustained);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::ProcessInfo* NS::ProcessInfo::processInfo()
{
return Object::sendMessage<ProcessInfo*>(_NS_PRIVATE_CLS(NSProcessInfo), _NS_PRIVATE_SEL(processInfo));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Array* NS::ProcessInfo::arguments() const
{
return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(arguments));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Dictionary* NS::ProcessInfo::environment() const
{
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(environment));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::ProcessInfo::hostName() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(hostName));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::ProcessInfo::processName() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(processName));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::setProcessName(const String* pString)
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(setProcessName_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE int NS::ProcessInfo::processIdentifier() const
{
return Object::sendMessage<int>(this, _NS_PRIVATE_SEL(processIdentifier));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::ProcessInfo::globallyUniqueString() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(globallyUniqueString));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::ProcessInfo::userName() const
{
return Object::sendMessageSafe<String*>(this, _NS_PRIVATE_SEL(userName));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::ProcessInfo::fullUserName() const
{
return Object::sendMessageSafe<String*>(this, _NS_PRIVATE_SEL(fullUserName));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::ProcessInfo::operatingSystem() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(operatingSystem));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::OperatingSystemVersion NS::ProcessInfo::operatingSystemVersion() const
{
return Object::sendMessage<OperatingSystemVersion>(this, _NS_PRIVATE_SEL(operatingSystemVersion));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::ProcessInfo::operatingSystemVersionString() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(operatingSystemVersionString));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::isOperatingSystemAtLeastVersion(OperatingSystemVersion version) const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isOperatingSystemAtLeastVersion_), version);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::ProcessInfo::processorCount() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(processorCount));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::ProcessInfo::activeProcessorCount() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(activeProcessorCount));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE unsigned long long NS::ProcessInfo::physicalMemory() const
{
return Object::sendMessage<unsigned long long>(this, _NS_PRIVATE_SEL(physicalMemory));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::TimeInterval NS::ProcessInfo::systemUptime() const
{
return Object::sendMessage<TimeInterval>(this, _NS_PRIVATE_SEL(systemUptime));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::disableSuddenTermination()
{
Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(disableSuddenTermination));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::enableSuddenTermination()
{
Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(enableSuddenTermination));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::disableAutomaticTermination(const String* pReason)
{
Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(disableAutomaticTermination_), pReason);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::enableAutomaticTermination(const String* pReason)
{
Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(enableAutomaticTermination_), pReason);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::automaticTerminationSupportEnabled() const
{
return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(automaticTerminationSupportEnabled));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::setAutomaticTerminationSupportEnabled(bool enabled)
{
Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(setAutomaticTerminationSupportEnabled_), enabled);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Object* NS::ProcessInfo::beginActivity(ActivityOptions options, const String* pReason)
{
return Object::sendMessage<Object*>(this, _NS_PRIVATE_SEL(beginActivityWithOptions_reason_), options, pReason);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::endActivity(Object* pActivity)
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(endActivity_), pActivity);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::performActivity(ActivityOptions options, const String* pReason, void (^block)(void))
{
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(performActivityWithOptions_reason_usingBlock_), options, pReason, block);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::performActivity(ActivityOptions options, const String* pReason, const std::function<void()>& function)
{
__block std::function<void()> blockFunction = function;
performActivity(options, pReason, ^() { blockFunction(); });
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::performExpiringActivity(const String* pReason, void (^block)(bool expired))
{
Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(performExpiringActivityWithReason_usingBlock_), pReason, block);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE void NS::ProcessInfo::performExpiringActivity(const String* pReason, const std::function<void(bool expired)>& function)
{
__block std::function<void(bool expired)> blockFunction = function;
performExpiringActivity(pReason, ^(bool expired) { blockFunction(expired); });
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::ProcessInfoThermalState NS::ProcessInfo::thermalState() const
{
return Object::sendMessage<ProcessInfoThermalState>(this, _NS_PRIVATE_SEL(thermalState));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::isLowPowerModeEnabled() const
{
return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isLowPowerModeEnabled));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::isiOSAppOnMac() const
{
return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isiOSAppOnMac));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::isMacCatalystApp() const
{
return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isMacCatalystApp));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::isDeviceCertified(DeviceCertification performanceTier) const
{
return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isDeviceCertified_), performanceTier);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::ProcessInfo::hasPerformanceProfile(ProcessPerformanceProfile performanceProfile) const
{
return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(hasPerformanceProfile_), performanceProfile);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,83 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSRange.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
struct Range
{
static Range Make(UInteger loc, UInteger len);
Range(UInteger loc, UInteger len);
bool Equal(const Range& range) const;
bool LocationInRange(UInteger loc) const;
UInteger Max() const;
UInteger location;
UInteger length;
} _NS_PACKED;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Range::Range(UInteger loc, UInteger len)
: location(loc)
, length(len)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Range NS::Range::Make(UInteger loc, UInteger len)
{
return Range(loc, len);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Range::Equal(const Range& range) const
{
return (location == range.location) && (length == range.length);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::Range::LocationInRange(UInteger loc) const
{
return (!(loc < location)) && ((loc - location) < length);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Range::Max() const
{
return location + length;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,87 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSSet.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSObject.hpp"
#include "NSEnumerator.hpp"
/*****Immutable Set*******/
namespace NS
{
class Set : public NS::Copying <Set>
{
public:
UInteger count() const;
Enumerator<Object>* objectEnumerator() const;
static Set* alloc();
Set* init();
Set* init(const Object* const* pObjects, UInteger count);
Set* init(const class Coder* pCoder);
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::Set::count() const
{
return NS::Object::sendMessage<NS::UInteger>(this, _NS_PRIVATE_SEL(count));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Enumerator<NS::Object>* NS::Set::objectEnumerator() const
{
return NS::Object::sendMessage<Enumerator<NS::Object>*>(this, _NS_PRIVATE_SEL(objectEnumerator));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Set* NS::Set::alloc()
{
return NS::Object::alloc<Set>(_NS_PRIVATE_CLS(NSSet));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Set* NS::Set::init()
{
return NS::Object::init<Set>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Set* NS::Set::init(const Object* const* pObjects, NS::UInteger count)
{
return NS::Object::sendMessage<Set*>(this, _NS_PRIVATE_SEL(initWithObjects_count_), pObjects, count);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Set* NS::Set::init(const class Coder* pCoder)
{
return Object::sendMessage<Set*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
}

View File

@@ -1,310 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSSharedPtr.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include <cstddef>
#include "NSDefines.hpp"
namespace NS
{
template <class _Class>
class SharedPtr
{
public:
/**
* Create a new null pointer.
*/
SharedPtr();
/**
* Destroy this SharedPtr, decreasing the reference count.
*/
~SharedPtr();
/**
* Create a new null pointer.
*/
SharedPtr(std::nullptr_t) noexcept;
/**
* SharedPtr copy constructor.
*/
SharedPtr(const SharedPtr<_Class>& other) noexcept;
/**
* Construction from another pointee type.
*/
template <class _OtherClass>
SharedPtr(const SharedPtr<_OtherClass>& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> * = nullptr) noexcept;
/**
* SharedPtr move constructor.
*/
SharedPtr(SharedPtr<_Class>&& other) noexcept;
/**
* Move from another pointee type.
*/
template <class _OtherClass>
SharedPtr(SharedPtr<_OtherClass>&& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> * = nullptr) noexcept;
/**
* Copy assignment operator.
* Copying increases reference count. Only releases previous pointee if objects are different.
*/
SharedPtr& operator=(const SharedPtr<_Class>& other);
/**
* Copy-assignment from different pointee.
* Copying increases reference count. Only releases previous pointee if objects are different.
*/
template <class _OtherClass>
typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, SharedPtr &>
operator=(const SharedPtr<_OtherClass>& other);
/**
* Move assignment operator.
* Move without affecting reference counts, unless pointees are equal. Moved-from object is reset to nullptr.
*/
SharedPtr& operator=(SharedPtr<_Class>&& other);
/**
* Move-asignment from different pointee.
* Move without affecting reference counts, unless pointees are equal. Moved-from object is reset to nullptr.
*/
template <class _OtherClass>
typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, SharedPtr &>
operator=(SharedPtr<_OtherClass>&& other);
/**
* Access raw pointee.
* @warning Avoid wrapping the returned value again, as it may lead double frees unless this object becomes detached.
*/
_Class* get() const;
/**
* Call operations directly on the pointee.
*/
_Class* operator->() const;
/**
* Implicit cast to bool.
*/
explicit operator bool() const;
/**
* Reset this SharedPtr to null, decreasing the reference count.
*/
void reset();
/**
* Detach the SharedPtr from the pointee, without decreasing the reference count.
*/
void detach();
template <class _OtherClass>
friend SharedPtr<_OtherClass> RetainPtr(_OtherClass* ptr);
template <class _OtherClass>
friend SharedPtr<_OtherClass> TransferPtr(_OtherClass* ptr);
private:
_Class* m_pObject;
};
/**
* Create a SharedPtr by retaining an existing raw pointer.
* Increases the reference count of the passed-in object.
* If the passed-in object was in an AutoreleasePool, it will be removed from it.
*/
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class> RetainPtr(_Class* pObject)
{
NS::SharedPtr<_Class> ret;
ret.m_pObject = pObject->retain();
return ret;
}
/*
* Create a SharedPtr by transfering the ownership of an existing raw pointer to SharedPtr.
* Does not increase the reference count of the passed-in pointer, it is assumed to be >= 1.
* This method does not remove objects from an AutoreleasePool.
*/
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class> TransferPtr(_Class* pObject)
{
NS::SharedPtr<_Class> ret;
ret.m_pObject = pObject;
return ret;
}
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::SharedPtr()
: m_pObject(nullptr)
{
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::~SharedPtr<_Class>() __attribute__((no_sanitize("undefined")))
{
m_pObject->release();
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::SharedPtr(std::nullptr_t) noexcept
: m_pObject(nullptr)
{
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::SharedPtr(const SharedPtr<_Class>& other) noexcept
: m_pObject(other.m_pObject->retain())
{
}
template <class _Class>
template <class _OtherClass>
_NS_INLINE NS::SharedPtr<_Class>::SharedPtr(const SharedPtr<_OtherClass>& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> *) noexcept
: m_pObject(reinterpret_cast<_Class*>(other.get()->retain()))
{
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::SharedPtr(SharedPtr<_Class>&& other) noexcept
: m_pObject(other.m_pObject)
{
other.m_pObject = nullptr;
}
template <class _Class>
template <class _OtherClass>
_NS_INLINE NS::SharedPtr<_Class>::SharedPtr(SharedPtr<_OtherClass>&& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> *) noexcept
: m_pObject(reinterpret_cast<_Class*>(other.get()))
{
other.detach();
}
template <class _Class>
_NS_INLINE _Class* NS::SharedPtr<_Class>::get() const
{
return m_pObject;
}
template <class _Class>
_NS_INLINE _Class* NS::SharedPtr<_Class>::operator->() const
{
return m_pObject;
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::operator bool() const
{
return nullptr != m_pObject;
}
template <class _Class>
_NS_INLINE void NS::SharedPtr<_Class>::reset() __attribute__((no_sanitize("undefined")))
{
m_pObject->release();
m_pObject = nullptr;
}
template <class _Class>
_NS_INLINE void NS::SharedPtr<_Class>::detach()
{
m_pObject = nullptr;
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>& NS::SharedPtr<_Class>::operator=(const SharedPtr<_Class>& other) __attribute__((no_sanitize("undefined")))
{
_Class* pOldObject = m_pObject;
m_pObject = other.m_pObject->retain();
pOldObject->release();
return *this;
}
template <class _Class>
template <class _OtherClass>
typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, NS::SharedPtr<_Class> &>
_NS_INLINE NS::SharedPtr<_Class>::operator=(const SharedPtr<_OtherClass>& other) __attribute__((no_sanitize("undefined")))
{
_Class* pOldObject = m_pObject;
m_pObject = reinterpret_cast<_Class*>(other.get()->retain());
pOldObject->release();
return *this;
}
template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>& NS::SharedPtr<_Class>::operator=(SharedPtr<_Class>&& other) __attribute__((no_sanitize("undefined")))
{
if (m_pObject != other.m_pObject)
{
m_pObject->release();
m_pObject = other.m_pObject;
}
else
{
m_pObject = other.m_pObject;
other.m_pObject->release();
}
other.m_pObject = nullptr;
return *this;
}
template <class _Class>
template <class _OtherClass>
typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, NS::SharedPtr<_Class> &>
_NS_INLINE NS::SharedPtr<_Class>::operator=(SharedPtr<_OtherClass>&& other) __attribute__((no_sanitize("undefined")))
{
if (m_pObject != other.get())
{
m_pObject->release();
m_pObject = reinterpret_cast<_Class*>(other.get());
other.detach();
}
else
{
m_pObject = other.get();
other.reset();
}
return *this;
}
template <class _ClassLhs, class _ClassRhs>
_NS_INLINE bool operator==(const NS::SharedPtr<_ClassLhs>& lhs, const NS::SharedPtr<_ClassRhs>& rhs)
{
return lhs.get() == rhs.get();
}
template <class _ClassLhs, class _ClassRhs>
_NS_INLINE bool operator!=(const NS::SharedPtr<_ClassLhs>& lhs, const NS::SharedPtr<_ClassRhs>& rhs)
{
return lhs.get() != rhs.get();
}

View File

@@ -1,255 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSString.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSObjCRuntime.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSRange.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
_NS_ENUM(NS::UInteger, StringEncoding) {
ASCIIStringEncoding = 1,
NEXTSTEPStringEncoding = 2,
JapaneseEUCStringEncoding = 3,
UTF8StringEncoding = 4,
ISOLatin1StringEncoding = 5,
SymbolStringEncoding = 6,
NonLossyASCIIStringEncoding = 7,
ShiftJISStringEncoding = 8,
ISOLatin2StringEncoding = 9,
UnicodeStringEncoding = 10,
WindowsCP1251StringEncoding = 11,
WindowsCP1252StringEncoding = 12,
WindowsCP1253StringEncoding = 13,
WindowsCP1254StringEncoding = 14,
WindowsCP1250StringEncoding = 15,
ISO2022JPStringEncoding = 21,
MacOSRomanStringEncoding = 30,
UTF16StringEncoding = UnicodeStringEncoding,
UTF16BigEndianStringEncoding = 0x90000100,
UTF16LittleEndianStringEncoding = 0x94000100,
UTF32StringEncoding = 0x8c000100,
UTF32BigEndianStringEncoding = 0x98000100,
UTF32LittleEndianStringEncoding = 0x9c000100
};
_NS_OPTIONS(NS::UInteger, StringCompareOptions) {
CaseInsensitiveSearch = 1,
LiteralSearch = 2,
BackwardsSearch = 4,
AnchoredSearch = 8,
NumericSearch = 64,
DiacriticInsensitiveSearch = 128,
WidthInsensitiveSearch = 256,
ForcedOrderingSearch = 512,
RegularExpressionSearch = 1024
};
using unichar = unsigned short;
class String : public Copying<String>
{
public:
static String* string();
static String* string(const String* pString);
static String* string(const char* pString, StringEncoding encoding);
static String* alloc();
String* init();
String* init(const String* pString);
String* init(const char* pString, StringEncoding encoding);
String* init(void* pBytes, UInteger len, StringEncoding encoding, bool freeBuffer);
unichar character(UInteger index) const;
UInteger length() const;
const char* cString(StringEncoding encoding) const;
const char* utf8String() const;
UInteger maximumLengthOfBytes(StringEncoding encoding) const;
UInteger lengthOfBytes(StringEncoding encoding) const;
bool isEqualToString(const String* pString) const;
Range rangeOfString(const String* pString, StringCompareOptions options) const;
const char* fileSystemRepresentation() const;
String* stringByAppendingString(const String* pString) const;
ComparisonResult caseInsensitiveCompare(const String* pString) const;
};
/// Create an NS::String* from a string literal.
#define MTLSTR(literal) (NS::String*)__builtin___CFStringMakeConstantString("" literal "")
template <std::size_t _StringLen>
[[deprecated("please use MTLSTR(str)")]] constexpr const String* MakeConstantString(const char (&str)[_StringLen])
{
return reinterpret_cast<const String*>(__CFStringMakeConstantString(str));
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::string()
{
return Object::sendMessage<String*>(_NS_PRIVATE_CLS(NSString), _NS_PRIVATE_SEL(string));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::string(const String* pString)
{
return Object::sendMessage<String*>(_NS_PRIVATE_CLS(NSString), _NS_PRIVATE_SEL(stringWithString_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::string(const char* pString, StringEncoding encoding)
{
return Object::sendMessage<String*>(_NS_PRIVATE_CLS(NSString), _NS_PRIVATE_SEL(stringWithCString_encoding_), pString, encoding);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::alloc()
{
return Object::alloc<String>(_NS_PRIVATE_CLS(NSString));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::init()
{
return Object::init<String>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::init(const String* pString)
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(initWithString_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::init(const char* pString, StringEncoding encoding)
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(initWithCString_encoding_), pString, encoding);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::init(void* pBytes, UInteger len, StringEncoding encoding, bool freeBuffer)
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(initWithBytesNoCopy_length_encoding_freeWhenDone_), pBytes, len, encoding, freeBuffer);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::unichar NS::String::character(UInteger index) const
{
return Object::sendMessage<unichar>(this, _NS_PRIVATE_SEL(characterAtIndex_), index);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::String::length() const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(length));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE const char* NS::String::cString(StringEncoding encoding) const
{
return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(cStringUsingEncoding_), encoding);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE const char* NS::String::utf8String() const
{
return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(UTF8String));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::String::maximumLengthOfBytes(StringEncoding encoding) const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(maximumLengthOfBytesUsingEncoding_), encoding);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::UInteger NS::String::lengthOfBytes(StringEncoding encoding) const
{
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(lengthOfBytesUsingEncoding_), encoding);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE bool NS::String::isEqualToString(const NS::String* pString) const
{
return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isEqualToString_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::Range NS::String::rangeOfString(const NS::String* pString, NS::StringCompareOptions options) const
{
return Object::sendMessage<Range>(this, _NS_PRIVATE_SEL(rangeOfString_options_), pString, options);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE const char* NS::String::fileSystemRepresentation() const
{
return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(fileSystemRepresentation));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::String* NS::String::stringByAppendingString(const String* pString) const
{
return Object::sendMessage<NS::String*>(this, _NS_PRIVATE_SEL(stringByAppendingString_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::ComparisonResult NS::String::caseInsensitiveCompare(const String* pString) const
{
return Object::sendMessage<NS::ComparisonResult>(this, _NS_PRIVATE_SEL(caseInsensitiveCompare_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,51 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSTypes.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include <CoreFoundation/CoreFoundation.h>
#include <cstdint>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
using TimeInterval = double;
using Integer = std::intptr_t;
using UInteger = std::uintptr_t;
const Integer IntegerMax = INTPTR_MAX;
const Integer IntegerMin = INTPTR_MIN;
const UInteger UIntegerMax = UINTPTR_MAX;
struct OperatingSystemVersion
{
Integer majorVersion;
Integer minorVersion;
Integer patchVersion;
} _NS_PACKED;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,90 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Foundation/NSURL.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "NSDefines.hpp"
#include "NSObject.hpp"
#include "NSPrivate.hpp"
#include "NSTypes.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class URL : public Copying<URL>
{
public:
static URL* fileURLWithPath(const class String* pPath);
static URL* alloc();
URL* init();
URL* init(const class String* pString);
URL* initFileURLWithPath(const class String* pPath);
const char* fileSystemRepresentation() const;
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::URL::fileURLWithPath(const String* pPath)
{
return Object::sendMessage<URL*>(_NS_PRIVATE_CLS(NSURL), _NS_PRIVATE_SEL(fileURLWithPath_), pPath);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::URL::alloc()
{
return Object::alloc<URL>(_NS_PRIVATE_CLS(NSURL));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::URL::init()
{
return Object::init<URL>();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::URL::init(const String* pString)
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(initWithString_), pString);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE NS::URL* NS::URL::initFileURLWithPath(const String* pPath)
{
return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(initFileURLWithPath_), pPath);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_NS_INLINE const char* NS::URL::fileSystemRepresentation() const
{
return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(fileSystemRepresentation));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright © 2024 Apple Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,47 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTL4FXFrameInterpolator.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "MTLFXFrameInterpolator.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class FrameInterpolator : public NS::Referencing<FrameInterpolator, MTLFX::FrameInterpolatorBase>
{
public:
void encodeToCommandBuffer(MTL4::CommandBuffer* commandBuffer);
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTL4FX::FrameInterpolator::encodeToCommandBuffer(MTL4::CommandBuffer* commandBuffer)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), commandBuffer );
}

View File

@@ -1,49 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTL4FXSpatialScaler.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "MTLFXSpatialScaler.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class SpatialScaler : public NS::Referencing< SpatialScaler, MTLFX::SpatialScalerBase >
{
public:
void encodeToCommandBuffer( MTL4::CommandBuffer* pCommandBuffer );
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTL4FX::SpatialScaler::encodeToCommandBuffer( MTL4::CommandBuffer* pCommandBuffer )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), pCommandBuffer );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,49 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXTemporalDenoisedScaler.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "MTLFXTemporalDenoisedScaler.hpp"
#include "../Metal/Metal.hpp"
#include <simd/simd.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class TemporalDenoisedScaler : public NS::Referencing< TemporalDenoisedScaler, MTLFX::TemporalDenoisedScalerBase >
{
public:
void encodeToCommandBuffer(MTL4::CommandBuffer* commandBuffer);
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTL4FX::TemporalDenoisedScaler::encodeToCommandBuffer( MTL4::CommandBuffer* commandBuffer )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), commandBuffer );
}

View File

@@ -1,49 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTL4FXTemporalScaler.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "MTLFXTemporalScaler.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class TemporalScaler : public NS::Referencing< TemporalScaler, MTLFX::TemporalScalerBase >
{
public:
void encodeToCommandBuffer( MTL4::CommandBuffer* pCommandBuffer );
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTL4FX::TemporalScaler::encodeToCommandBuffer( MTL4::CommandBuffer* pCommandBuffer )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), pCommandBuffer );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,41 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXDefines.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "../Foundation/NSDefines.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _MTLFX_EXPORT _NS_EXPORT
#define _MTLFX_EXTERN _NS_EXTERN
#define _MTLFX_INLINE _NS_INLINE
#define _MTLFX_PACKED _NS_PACKED
#define _MTLFX_CONST( type, name ) _NS_CONST( type, name )
#define _MTLFX_ENUM( type, name ) _NS_ENUM( type, name )
#define _MTLFX_OPTIONS( type, name ) _NS_OPTIONS( type, name )
#define _MTLFX_VALIDATE_SIZE( mtlfx, name ) _NS_VALIDATE_SIZE( mtlfx, name )
#define _MTLFX_VALIDATE_ENUM( mtlfx, name ) _NS_VALIDATE_ENUM( mtlfx, name )
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,719 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXFrameInterpolator.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "MTLFXTemporalScaler.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class TemporalScaler;
class TemporalDenoisedScaler;
class FrameInterpolator;
}
namespace MTLFX
{
class FrameInterpolatorDescriptor : public NS::Copying< FrameInterpolatorDescriptor >
{
public:
static FrameInterpolatorDescriptor* alloc();
FrameInterpolatorDescriptor* init();
MTL::PixelFormat colorTextureFormat() const;
void setColorTextureFormat(MTL::PixelFormat colorTextureFormat);
MTL::PixelFormat outputTextureFormat() const;
void setOutputTextureFormat(MTL::PixelFormat outputTextureFormat);
MTL::PixelFormat depthTextureFormat() const;
void setDepthTextureFormat(MTL::PixelFormat depthTextureFormat);
MTL::PixelFormat motionTextureFormat() const;
void setMotionTextureFormat(MTL::PixelFormat motionTextureFormat);
MTL::PixelFormat uiTextureFormat() const;
void setUITextureFormat(MTL::PixelFormat uiTextureFormat);
MTLFX::FrameInterpolatableScaler* scaler() const;
void setScaler(MTLFX::FrameInterpolatableScaler* scaler);
NS::UInteger inputWidth() const;
void setInputWidth( NS::UInteger inputWidth );
NS::UInteger inputHeight() const;
void setInputHeight( NS::UInteger inputHeight );
NS::UInteger outputWidth() const;
void setOutputWidth( NS::UInteger outputWidth );
NS::UInteger outputHeight() const;
void setOutputHeight( NS::UInteger outputHeight );
class FrameInterpolator* newFrameInterpolator( const MTL::Device* pDevice) const;
MTL4FX::FrameInterpolator* newFrameInterpolator( const MTL::Device* pDevice, const MTL4::Compiler* pCompiler) const;
static bool supportsMetal4FX(MTL::Device* device);
static bool supportsDevice(MTL::Device* device);
};
class FrameInterpolatorBase : public NS::Referencing<FrameInterpolatorBase>
{
public:
MTL::TextureUsage colorTextureUsage() const;
MTL::TextureUsage outputTextureUsage() const;
MTL::TextureUsage depthTextureUsage() const;
MTL::TextureUsage motionTextureUsage() const;
MTL::TextureUsage uiTextureUsage() const;
MTL::PixelFormat colorTextureFormat() const;
MTL::PixelFormat depthTextureFormat() const;
MTL::PixelFormat motionTextureFormat() const;
MTL::PixelFormat outputTextureFormat() const;
NS::UInteger inputWidth() const;
NS::UInteger inputHeight() const;
NS::UInteger outputWidth() const;
NS::UInteger outputHeight() const;
MTL::PixelFormat uiTextureFormat() const;
MTL::Texture* colorTexture() const;
void setColorTexture(MTL::Texture* colorTexture);
MTL::Texture* prevColorTexture() const;
void setPrevColorTexture(MTL::Texture* prevColorTexture);
MTL::Texture* depthTexture() const;
void setDepthTexture(MTL::Texture* depthTexture);
MTL::Texture* motionTexture() const;
void setMotionTexture(MTL::Texture* motionTexture);
float motionVectorScaleX() const;
void setMotionVectorScaleX(float scaleX);
float motionVectorScaleY() const;
void setMotionVectorScaleY(float scaleY);
float deltaTime() const;
void setDeltaTime( float deltaTime );
float nearPlane() const;
void setNearPlane( float nearPlane );
float farPlane() const;
void setFarPlane( float farPlane );
float fieldOfView() const;
void setFieldOfView( float fieldOfView );
float aspectRatio() const;
void setAspectRatio( float aspectRatio );
MTL::Texture* uiTexture() const;
void setUITexture(MTL::Texture* uiTexture);
float jitterOffsetX() const;
void setJitterOffsetX( float jitterOffsetX );
float jitterOffsetY() const;
void setJitterOffsetY( float jitterOffsetY );
bool isUITextureComposited() const;
void setIsUITextureComposited( bool uiTextureComposited );
bool shouldResetHistory() const;
void setShouldResetHistory( bool shouldResetHistory );
MTL::Texture* outputTexture() const;
void setOutputTexture( MTL::Texture* outputTexture );
MTL::Fence* fence() const;
void setFence( MTL::Fence* fence );
bool isDepthReversed() const;
void setDepthReversed( bool depthReversed );
};
class FrameInterpolator : public NS::Referencing<FrameInterpolator, FrameInterpolatorBase>
{
public:
void encodeToCommandBuffer(MTL::CommandBuffer* commandBuffer);
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::FrameInterpolatorDescriptor* MTLFX::FrameInterpolatorDescriptor::alloc()
{
return NS::Object::alloc< FrameInterpolatorDescriptor >( _MTLFX_PRIVATE_CLS( MTLFXFrameInterpolatorDescriptor ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::FrameInterpolatorDescriptor* MTLFX::FrameInterpolatorDescriptor::init()
{
return NS::Object::init< FrameInterpolatorDescriptor >();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorDescriptor::colorTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setColorTextureFormat( MTL::PixelFormat colorTextureFormat )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorTextureFormat_ ), colorTextureFormat );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorDescriptor::outputTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setOutputTextureFormat( MTL::PixelFormat outputTextureFormat )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputTextureFormat_ ), outputTextureFormat );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorDescriptor::depthTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( depthTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setDepthTextureFormat( MTL::PixelFormat depthTextureFormat )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDepthTextureFormat_ ), depthTextureFormat );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorDescriptor::motionTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( motionTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setMotionTextureFormat( MTL::PixelFormat motionTextureFormat )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionTextureFormat_ ), motionTextureFormat );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorDescriptor::uiTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( uiTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setUITextureFormat( MTL::PixelFormat uiTextureFormat )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setUITextureFormat_ ), uiTextureFormat );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::FrameInterpolatableScaler* MTLFX::FrameInterpolatorDescriptor::scaler() const
{
return NS::Object::sendMessage< MTLFX::FrameInterpolatableScaler* >( this, _MTLFX_PRIVATE_SEL( scaler ) );
}
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setScaler(MTLFX::FrameInterpolatableScaler* scaler)
{
NS::Object::sendMessage< void >(this, _MTLFX_PRIVATE_SEL( setScaler_ ), scaler );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorDescriptor::inputWidth() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setInputWidth( NS::UInteger inputWidth )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputWidth_ ), inputWidth );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorDescriptor::inputHeight() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setInputHeight( NS::UInteger inputHeight )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputHeight_ ), inputHeight );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorDescriptor::outputWidth() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setOutputWidth( NS::UInteger outputWidth )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputWidth_ ), outputWidth );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorDescriptor::outputHeight() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorDescriptor::setOutputHeight( NS::UInteger outputHeight )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputHeight_ ), outputHeight );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::FrameInterpolator* MTLFX::FrameInterpolatorDescriptor::newFrameInterpolator( const MTL::Device* device ) const
{
return NS::Object::sendMessage< MTLFX::FrameInterpolator* >( this, _MTLFX_PRIVATE_SEL( newFrameInterpolatorWithDevice_ ), device );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL4FX::FrameInterpolator* MTLFX::FrameInterpolatorDescriptor::newFrameInterpolator( const MTL::Device* device, const MTL4::Compiler* compiler ) const
{
return NS::Object::sendMessage< MTL4FX::FrameInterpolator* >( this, _MTLFX_PRIVATE_SEL( newFrameInterpolatorWithDevice_compiler_ ), device, compiler );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::FrameInterpolatorDescriptor::supportsMetal4FX(MTL::Device* device)
{
return NS::Object::sendMessageSafe< bool >( _MTLFX_PRIVATE_CLS(MTLFXFrameInterpolatorDescriptor), _MTLFX_PRIVATE_SEL( supportsMetal4FX_ ), device );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::FrameInterpolatorDescriptor::supportsDevice(MTL::Device* device)
{
return NS::Object::sendMessageSafe< bool >( _MTLFX_PRIVATE_CLS(MTLFXFrameInterpolatorDescriptor), _MTLFX_PRIVATE_SEL( supportsDevice_ ), device );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::FrameInterpolatorBase::colorTextureUsage() const
{
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( colorTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::FrameInterpolatorBase::outputTextureUsage() const
{
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( outputTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::FrameInterpolatorBase::depthTextureUsage() const
{
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( depthTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::FrameInterpolatorBase::motionTextureUsage() const
{
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( motionTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::FrameInterpolatorBase::uiTextureUsage() const
{
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( uiTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorBase::colorTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorBase::depthTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( depthTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorBase::motionTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( motionTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorBase::outputTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorBase::inputWidth() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorBase::inputHeight() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorBase::outputWidth() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::FrameInterpolatorBase::outputHeight() const
{
return NS::Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::FrameInterpolatorBase::uiTextureFormat() const
{
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( uiTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::FrameInterpolatorBase::colorTexture() const
{
return NS::Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( colorTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setColorTexture(MTL::Texture* colorTexture)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorTexture_ ), colorTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::FrameInterpolatorBase::prevColorTexture() const
{
return NS::Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( prevColorTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setPrevColorTexture(MTL::Texture* prevColorTexture)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setPrevColorTexture_ ), prevColorTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::FrameInterpolatorBase::depthTexture() const
{
return NS::Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( depthTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setDepthTexture(MTL::Texture* depthTexture)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDepthTexture_ ), depthTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::FrameInterpolatorBase::motionTexture() const
{
return NS::Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( motionTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setMotionTexture(MTL::Texture* motionTexture)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionTexture_ ), motionTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::motionVectorScaleX() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( motionVectorScaleX ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setMotionVectorScaleX(float scaleX)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionVectorScaleX_ ), scaleX );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::motionVectorScaleY() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( motionVectorScaleY ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setMotionVectorScaleY(float scaleY)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionVectorScaleY_ ), scaleY );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::deltaTime() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( deltaTime ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setDeltaTime( float deltaTime )
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDeltaTime_ ), deltaTime );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::nearPlane() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( nearPlane ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setNearPlane( float nearPlane )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setNearPlane_ ), nearPlane );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::farPlane() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( farPlane ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setFarPlane( float farPlane )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setFarPlane_ ), farPlane );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::fieldOfView() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( fieldOfView ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setFieldOfView( float fieldOfView )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setFieldOfView_ ), fieldOfView );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::aspectRatio() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( aspectRatio ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setAspectRatio( float aspectRatio )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setAspectRatio_ ), aspectRatio );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::FrameInterpolatorBase::uiTexture() const
{
return NS::Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( uiTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setUITexture(MTL::Texture* uiTexture)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setUITexture_ ), uiTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::jitterOffsetX() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( jitterOffsetX ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setJitterOffsetX( float jitterOffsetX )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setJitterOffsetX_ ), jitterOffsetX );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::FrameInterpolatorBase::jitterOffsetY() const
{
return NS::Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( jitterOffsetY ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setJitterOffsetY( float jitterOffsetY )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setJitterOffsetY_ ), jitterOffsetY );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::FrameInterpolatorBase::isUITextureComposited() const
{
return NS::Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isUITextureComposited ) );
}
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setIsUITextureComposited( bool uiTextureComposited )
{
NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setIsUITextureComposited_ ), uiTextureComposited );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::FrameInterpolatorBase::shouldResetHistory() const
{
return NS::Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( shouldResetHistory ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setShouldResetHistory(bool shouldResetHistory)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setShouldResetHistory_ ), shouldResetHistory );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::FrameInterpolatorBase::outputTexture() const
{
return NS::Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( outputTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setOutputTexture(MTL::Texture* outputTexture)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputTexture_ ), outputTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Fence* MTLFX::FrameInterpolatorBase::fence() const
{
return NS::Object::sendMessage< MTL::Fence* >( this, _MTLFX_PRIVATE_SEL( fence ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setFence(MTL::Fence* fence)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setFence_ ), fence );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::FrameInterpolatorBase::isDepthReversed() const
{
return NS::Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isDepthReversed ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolatorBase::setDepthReversed(bool depthReversed)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDepthReversed_ ), depthReversed );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::FrameInterpolator::encodeToCommandBuffer(MTL::CommandBuffer* commandBuffer)
{
return NS::Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), commandBuffer );
}

View File

@@ -1,482 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXPrivate.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include <objc/runtime.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _MTLFX_PRIVATE_CLS( symbol ) ( MTLFX::Private::Class::s_k##symbol )
#define _MTLFX_PRIVATE_SEL( accessor ) ( MTLFX::Private::Selector::s_k##accessor )
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#if defined( MTLFX_PRIVATE_IMPLEMENTATION )
#if defined( METALCPP_SYMBOL_VISIBILITY_HIDDEN )
#define _MTLFX_PRIVATE_VISIBILITY __attribute__( ( visibility("hidden" ) ) )
#else
#define _MTLFX_PRIVATE_VISIBILITY __attribute__( ( visibility("default" ) ) )
#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _MTLFX_PRIVATE_IMPORT __attribute__( ( weak_import ) )
#ifdef __OBJC__
#define _MTLFX_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) ( ( __bridge void* ) objc_lookUpClass( #symbol ) )
#define _MTLFX_PRIVATE_OBJC_GET_PROTOCOL( symbol ) ( ( __bridge void* ) objc_getProtocol( #symbol ) )
#else
#define _MTLFX_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) objc_lookUpClass(#symbol)
#define _MTLFX_PRIVATE_OBJC_GET_PROTOCOL( symbol ) objc_getProtocol(#symbol)
#endif // __OBJC__
#define _MTLFX_PRIVATE_DEF_CLS( symbol ) void* s_k##symbol _MTLFX_PRIVATE_VISIBILITY = _MTLFX_PRIVATE_OBJC_LOOKUP_CLASS( symbol )
#define _MTLFX_PRIVATE_DEF_PRO( symbol ) void* s_k##symbol _MTLFX_PRIVATE_VISIBILITY = _MTLFX_PRIVATE_OBJC_GET_PROTOCOL( symbol )
#define _MTLFX_PRIVATE_DEF_SEL( accessor, symbol ) SEL s_k##accessor _MTLFX_PRIVATE_VISIBILITY = sel_registerName( symbol )
#include <dlfcn.h>
#define MTLFX_DEF_FUNC( name, signature ) using Fn##name = signature; \
Fn##name name = reinterpret_cast< Fn##name >( dlsym( RTLD_DEFAULT, #name ) )
namespace MTLFX::Private
{
template <typename _Type>
inline _Type const LoadSymbol(const char* pSymbol)
{
const _Type* pAddress = static_cast<_Type*>(dlsym(RTLD_DEFAULT, pSymbol));
return pAddress ? *pAddress : nullptr;
}
} // MTLFX::Private
#if defined(__MAC_26_0) || defined(__IPHONE_26_0) || defined(__TVOS_26_0)
#define _MTLFX_PRIVATE_DEF_STR( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##symbol _MTLFX_PRIVATE_IMPORT; \
type const MTLFX::symbol = ( nullptr != &MTLFX##symbol ) ? MTLFX##ssymbol : nullptr
#define _MTLFX_PRIVATE_DEF_CONST( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol _MTLFX_PRIVATE_IMPORT; \
type const MTLFX::symbol = (nullptr != &MTLFX##ssymbol) ? MTLFX##ssymbol : nullptr
#define _MTLFX_PRIVATE_DEF_WEAK_CONST( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol; \
type const MTLFX::symbol = Private::LoadSymbol< type >( "MTLFX" #symbol )
#else
#define _MTLFX_PRIVATE_DEF_STR( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol; \
type const MTLFX::symbol = Private::LoadSymbol< type >( "MTLFX" #symbol )
#define _MTLFX_PRIVATE_DEF_CONST( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol; \
type const MTLFX::symbol = Private::LoadSymbol< type >( "MTLFX" #symbol )
#define _MTLFX_PRIVATE_DEF_WEAK_CONST( type, symbol ) _MTLFX_PRIVATE_DEF_CONST( type, symbol )
#endif
#else
#define _MTLFX_PRIVATE_DEF_CLS( symbol ) extern void* s_k##symbol
#define _MTLFX_PRIVATE_DEF_PRO( symbol ) extern void* s_k##symbol
#define _MTLFX_PRIVATE_DEF_SEL( accessor, symbol ) extern SEL s_k##accessor
#define _MTLFX_PRIVATE_DEF_STR( type, symbol ) extern type const MTLFX::symbol
#define _MTLFX_PRIVATE_DEF_CONST( type, symbol ) extern type const MTLFX::symbol
#define _MTLFX_PRIVATE_DEF_WEAK_CONST( type, symbol ) extern type const MTLFX::symbol
#endif // MTLFX_PRIVATE_IMPLEMENTATION
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
namespace Private
{
namespace Class
{
_MTLFX_PRIVATE_DEF_CLS( MTLFXSpatialScalerDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTLFXTemporalScalerDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTLFXFrameInterpolatorDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTLFXTemporalDenoisedScalerDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTL4FXSpatialScalerDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTL4FXTemporalScalerDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTL4FXFrameInterpolatorDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTL4FXTemporalDenoisedScalerDescriptor );
} // Class
} // Private
} // MTLFX
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
namespace Private
{
namespace Protocol
{
_MTLFX_PRIVATE_DEF_PRO( MTLFXSpatialScaler );
_MTLFX_PRIVATE_DEF_PRO( MTLFXTemporalScaler );
} // Protocol
} // Private
} // MTLFX
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
namespace Private
{
namespace Selector
{
_MTLFX_PRIVATE_DEF_SEL( aspectRatio,
"aspectRatio" );
_MTLFX_PRIVATE_DEF_SEL( colorProcessingMode,
"colorProcessingMode" );
_MTLFX_PRIVATE_DEF_SEL( colorTexture,
"colorTexture" );
_MTLFX_PRIVATE_DEF_SEL( colorTextureFormat,
"colorTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( colorTextureUsage,
"colorTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( deltaTime,
"deltaTime" );
_MTLFX_PRIVATE_DEF_SEL( denoiseStrengthMaskTexture,
"denoiseStrengthMaskTexture" );
_MTLFX_PRIVATE_DEF_SEL( denoiseStrengthMaskTextureFormat,
"denoiseStrengthMaskTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( denoiseStrengthMaskTextureUsage,
"denoiseStrengthMaskTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( depthTexture,
"depthTexture" );
_MTLFX_PRIVATE_DEF_SEL( depthTextureFormat,
"depthTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( depthTextureUsage,
"depthTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( diffuseAlbedoTexture,
"diffuseAlbedoTexture" );
_MTLFX_PRIVATE_DEF_SEL( diffuseAlbedoTextureFormat,
"diffuseAlbedoTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( diffuseAlbedoTextureUsage,
"diffuseAlbedoTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( encodeToCommandBuffer_,
"encodeToCommandBuffer:" );
_MTLFX_PRIVATE_DEF_SEL( exposureTexture,
"exposureTexture" );
_MTLFX_PRIVATE_DEF_SEL( farPlane,
"farPlane" );
_MTLFX_PRIVATE_DEF_SEL( fence,
"fence" );
_MTLFX_PRIVATE_DEF_SEL( fieldOfView,
"fieldOfView" );
_MTLFX_PRIVATE_DEF_SEL( height,
"height" );
_MTLFX_PRIVATE_DEF_SEL( inputContentHeight,
"inputContentHeight" );
_MTLFX_PRIVATE_DEF_SEL( inputContentMaxScale,
"inputContentMaxScale" );
_MTLFX_PRIVATE_DEF_SEL( inputContentMinScale,
"inputContentMinScale" );
_MTLFX_PRIVATE_DEF_SEL( inputContentWidth,
"inputContentWidth" );
_MTLFX_PRIVATE_DEF_SEL( inputHeight,
"inputHeight" );
_MTLFX_PRIVATE_DEF_SEL( inputWidth,
"inputWidth" );
_MTLFX_PRIVATE_DEF_SEL( isAutoExposureEnabled,
"isAutoExposureEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isDenoiseStrengthMaskTextureEnabled,
"isDenoiseStrengthMaskTextureEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isDepthReversed,
"isDepthReversed" );
_MTLFX_PRIVATE_DEF_SEL( isInputContentPropertiesEnabled,
"isInputContentPropertiesEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isTransparencyOverlayTextureEnabled,
"isTransparencyOverlayTextureEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isReactiveMaskTextureEnabled,
"isReactiveMaskTextureEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isSpecularHitDistanceTextureEnabled,
"isSpecularHitDistanceTextureEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isUITextureComposited,
"isUITextureComposited" );
_MTLFX_PRIVATE_DEF_SEL( jitterOffsetX,
"jitterOffsetX" );
_MTLFX_PRIVATE_DEF_SEL( jitterOffsetY,
"jitterOffsetY" );
_MTLFX_PRIVATE_DEF_SEL( maskTexture,
"maskTexture" );
_MTLFX_PRIVATE_DEF_SEL( maskTextureFormat,
"maskTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( maskTextureUsage,
"maskTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( motionTexture,
"motionTexture" );
_MTLFX_PRIVATE_DEF_SEL( motionTextureFormat,
"motionTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( motionTextureUsage,
"motionTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( motionVectorScaleX,
"motionVectorScaleX" );
_MTLFX_PRIVATE_DEF_SEL( motionVectorScaleY,
"motionVectorScaleY" );
_MTLFX_PRIVATE_DEF_SEL( nearPlane,
"nearPlane" );
_MTLFX_PRIVATE_DEF_SEL( newFrameInterpolatorWithDevice_,
"newFrameInterpolatorWithDevice:" );
_MTLFX_PRIVATE_DEF_SEL( newFrameInterpolatorWithDevice_compiler_,
"newFrameInterpolatorWithDevice:compiler:" );
_MTLFX_PRIVATE_DEF_SEL( newTemporalDenoisedScalerWithDevice_,
"newTemporalDenoisedScalerWithDevice:" );
_MTLFX_PRIVATE_DEF_SEL( newTemporalDenoisedScalerWithDevice_compiler_,
"newTemporalDenoisedScalerWithDevice:compiler:" );
_MTLFX_PRIVATE_DEF_SEL( newSpatialScalerWithDevice_,
"newSpatialScalerWithDevice:" );
_MTLFX_PRIVATE_DEF_SEL( newSpatialScalerWithDevice_compiler_,
"newSpatialScalerWithDevice:compiler:" );
_MTLFX_PRIVATE_DEF_SEL( newTemporalScalerWithDevice_,
"newTemporalScalerWithDevice:" );
_MTLFX_PRIVATE_DEF_SEL( newTemporalScalerWithDevice_compiler_,
"newTemporalScalerWithDevice:compiler:" );
_MTLFX_PRIVATE_DEF_SEL( normalTexture,
"normalTexture" );
_MTLFX_PRIVATE_DEF_SEL( normalTextureFormat,
"normalTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( normalTextureUsage,
"normalTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( outputHeight,
"outputHeight" );
_MTLFX_PRIVATE_DEF_SEL( outputTexture,
"outputTexture" );
_MTLFX_PRIVATE_DEF_SEL( outputTextureFormat,
"outputTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( outputTextureUsage,
"outputTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( outputWidth,
"outputWidth" );
_MTLFX_PRIVATE_DEF_SEL( preExposure,
"preExposure" );
_MTLFX_PRIVATE_DEF_SEL( transparencyOverlayTextureFormat,
"transparencyOverlayTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( transparencyOverlayTextureUsage,
"transparencyOverlayTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( prevColorTexture,
"prevColorTexture" );
_MTLFX_PRIVATE_DEF_SEL( reactiveMaskTextureFormat,
"reactiveMaskTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( reactiveTextureUsage,
"reactiveTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( reactiveMaskTexture,
"reactiveMaskTexture" );
_MTLFX_PRIVATE_DEF_SEL( reset,
"reset" );
_MTLFX_PRIVATE_DEF_SEL( requiresSynchronousInitialization,
"requiresSynchronousInitialization" );
_MTLFX_PRIVATE_DEF_SEL( roughnessTextureFormat,
"roughnessTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( roughnessTextureUsage,
"roughnessTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( scaler,
"scaler" );
_MTLFX_PRIVATE_DEF_SEL( scaler4,
"scaler4" );
_MTLFX_PRIVATE_DEF_SEL( setAspectRatio_,
"setAspectRatio:" );
_MTLFX_PRIVATE_DEF_SEL( setAutoExposureEnabled_,
"setAutoExposureEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setColorProcessingMode_,
"setColorProcessingMode:" );
_MTLFX_PRIVATE_DEF_SEL( setColorTexture_,
"setColorTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setColorTextureFormat_,
"setColorTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setDeltaTime_,
"setDeltaTime:" );
_MTLFX_PRIVATE_DEF_SEL( setDenoiseStrengthMaskTexture_,
"setDenoiseStrengthMaskTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setDenoiseStrengthMaskTextureEnabled_,
"setDenoiseStrengthMaskTextureEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setDenoiseStrengthMaskTextureFormat_,
"setDenoiseStrengthMaskTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthInverted_,
"setDepthInverted:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthReversed_,
"setDepthReversed:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthTexture_,
"setDepthTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthTextureFormat_,
"setDepthTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setDiffuseAlbedoTexture_,
"setDiffuseAlbedoTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setDiffuseAlbedoTextureFormat_,
"setDiffuseAlbedoTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setExposureTexture_,
"setExposureTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setFarPlane_,
"setFarPlane:" );
_MTLFX_PRIVATE_DEF_SEL( setFence_,
"setFence:" );
_MTLFX_PRIVATE_DEF_SEL( setFieldOfView_,
"setFieldOfView:" );
_MTLFX_PRIVATE_DEF_SEL( setHeight_,
"setHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentHeight_,
"setInputContentHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentMaxScale_,
"setInputContentMaxScale:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentMinScale_,
"setInputContentMinScale:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentPropertiesEnabled_,
"setInputContentPropertiesEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentWidth_,
"setInputContentWidth:" );
_MTLFX_PRIVATE_DEF_SEL( setInputHeight_,
"setInputHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setInputWidth_,
"setInputWidth:" );
_MTLFX_PRIVATE_DEF_SEL( setIsUITextureComposited_,
"setIsUITextureComposited:" );
_MTLFX_PRIVATE_DEF_SEL( setJitterOffsetX_,
"setJitterOffsetX:" );
_MTLFX_PRIVATE_DEF_SEL( setJitterOffsetY_,
"setJitterOffsetY:" );
_MTLFX_PRIVATE_DEF_SEL( setNearPlane_,
"setNearPlane:" );
_MTLFX_PRIVATE_DEF_SEL( setMaskTexture_,
"setMaskTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setMaskTextureFormat_,
"setMaskTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionTexture_,
"setMotionTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionTextureFormat_,
"setMotionTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionVectorScaleX_,
"setMotionVectorScaleX:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionVectorScaleY_,
"setMotionVectorScaleY:" );
_MTLFX_PRIVATE_DEF_SEL( setNormalTexture_,
"setNormalTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setNormalTextureFormat_,
"setNormalTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputHeight_,
"setOutputHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputTexture_,
"setOutputTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputTextureFormat_,
"setOutputTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputWidth_,
"setOutputWidth:" );
_MTLFX_PRIVATE_DEF_SEL( transparencyOverlayTexture,
"transparencyOverlayTexture" );
_MTLFX_PRIVATE_DEF_SEL( setTransparencyOverlayTexture_,
"setTransparencyOverlayTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setTransparencyOverlayTextureEnabled_,
"setTransparencyOverlayTextureEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setPreExposure_,
"setPreExposure:" );
_MTLFX_PRIVATE_DEF_SEL( setTransparencyOverlayTextureFormat_,
"setTransparencyOverlayTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setPrevColorTexture_,
"setPrevColorTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setReactiveMaskTexture_,
"setReactiveMaskTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setReactiveMaskTextureEnabled_,
"setReactiveMaskTextureEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setReactiveMaskTextureFormat_,
"setReactiveMaskTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setRequiresSynchronousInitialization_,
"setRequiresSynchronousInitialization:" );
_MTLFX_PRIVATE_DEF_SEL( setReset_,
"setReset:" );
_MTLFX_PRIVATE_DEF_SEL( roughnessTexture,
"roughnessTexture" );
_MTLFX_PRIVATE_DEF_SEL( setRoughnessTexture_,
"setRoughnessTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setRoughnessTextureFormat_,
"setRoughnessTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setScaler_,
"setScaler:" );
_MTLFX_PRIVATE_DEF_SEL( setShouldResetHistory_,
"setShouldResetHistory:" );
_MTLFX_PRIVATE_DEF_SEL( specularHitDistanceTexture,
"specularHitDistanceTexture" );
_MTLFX_PRIVATE_DEF_SEL( setSpecularHitDistanceTexture_,
"setSpecularHitDistanceTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setSpecularHitDistanceTextureEnabled_,
"setSpecularHitDistanceTextureEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setSpecularAlbedoTexture_,
"setSpecularAlbedoTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setSpecularAlbedoTextureFormat_,
"setSpecularAlbedoTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setSpecularHitDistanceTextureFormat_,
"setSpecularHitDistanceTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setUITexture_,
"setUITexture:" );
_MTLFX_PRIVATE_DEF_SEL( setUITextureFormat_,
"setUITextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setViewToClipMatrix_,
"setViewToClipMatrix:" );
_MTLFX_PRIVATE_DEF_SEL( setWidth_,
"setWidth:" );
_MTLFX_PRIVATE_DEF_SEL( setWorldToViewMatrix_,
"setWorldToViewMatrix:" );
_MTLFX_PRIVATE_DEF_SEL( shouldResetHistory,
"shouldResetHistory" );
_MTLFX_PRIVATE_DEF_SEL( specularAlbedoTexture,
"specularAlbedoTexture" );
_MTLFX_PRIVATE_DEF_SEL( specularAlbedoTextureFormat,
"specularAlbedoTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( specularAlbedoTextureUsage,
"specularAlbedoTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( specularHitDistanceTextureFormat,
"specularHitDistanceTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( specularHitDistanceTextureUsage,
"specularHitDistanceTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( supportedInputContentMaxScaleForDevice_,
"supportedInputContentMaxScaleForDevice:" );
_MTLFX_PRIVATE_DEF_SEL( supportedInputContentMinScaleForDevice_,
"supportedInputContentMinScaleForDevice:" );
_MTLFX_PRIVATE_DEF_SEL( supportsDevice_,
"supportsDevice:" );
_MTLFX_PRIVATE_DEF_SEL( supportsMetal4FX_,
"supportsMetal4FX:" );
_MTLFX_PRIVATE_DEF_SEL( uiTexture,
"uiTexture" );
_MTLFX_PRIVATE_DEF_SEL( uiTextureFormat,
"uiTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( uiTextureUsage,
"uiTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( viewToClipMatrix,
"viewToClipMatrix" );
_MTLFX_PRIVATE_DEF_SEL( width,
"width" );
_MTLFX_PRIVATE_DEF_SEL( worldToViewMatrix,
"worldToViewMatrix" );
} // Selector
} // Private
} // MTLFX
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,397 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXSpatialScaler.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class SpatialScaler;
}
namespace MTLFX
{
_MTLFX_ENUM( NS::Integer, SpatialScalerColorProcessingMode )
{
SpatialScalerColorProcessingModePerceptual = 0,
SpatialScalerColorProcessingModeLinear = 1,
SpatialScalerColorProcessingModeHDR = 2
};
class SpatialScalerDescriptor : public NS::Copying< SpatialScalerDescriptor >
{
public:
static class SpatialScalerDescriptor* alloc();
class SpatialScalerDescriptor* init();
MTL::PixelFormat colorTextureFormat() const;
void setColorTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat outputTextureFormat() const;
void setOutputTextureFormat( MTL::PixelFormat format );
NS::UInteger inputWidth() const;
void setInputWidth( NS::UInteger width );
NS::UInteger inputHeight() const;
void setInputHeight( NS::UInteger height );
NS::UInteger outputWidth() const;
void setOutputWidth( NS::UInteger width );
NS::UInteger outputHeight() const;
void setOutputHeight( NS::UInteger height );
SpatialScalerColorProcessingMode colorProcessingMode() const;
void setColorProcessingMode( SpatialScalerColorProcessingMode mode );
class SpatialScaler* newSpatialScaler( const MTL::Device* pDevice ) const;
MTL4FX::SpatialScaler* newSpatialScaler( const MTL::Device* pDevice, const MTL4::Compiler* pCompiler ) const;
static bool supportsDevice( const MTL::Device* pDevice);
static bool supportsMetal4FX( const MTL::Device* pDevice );
};
class SpatialScalerBase : public NS::Referencing< SpatialScaler >
{
public:
MTL::TextureUsage colorTextureUsage() const;
MTL::TextureUsage outputTextureUsage() const;
NS::UInteger inputContentWidth() const;
void setInputContentWidth( NS::UInteger width );
NS::UInteger inputContentHeight() const;
void setInputContentHeight( NS::UInteger height );
MTL::Texture* colorTexture() const;
void setColorTexture( MTL::Texture* pTexture );
MTL::Texture* outputTexture() const;
void setOutputTexture( MTL::Texture* pTexture );
MTL::PixelFormat colorTextureFormat() const;
MTL::PixelFormat outputTextureFormat() const;
NS::UInteger inputWidth() const;
NS::UInteger inputHeight() const;
NS::UInteger outputWidth() const;
NS::UInteger outputHeight() const;
SpatialScalerColorProcessingMode colorProcessingMode() const;
MTL::Fence* fence() const;
void setFence( MTL::Fence* pFence );
};
class SpatialScaler : public NS::Referencing< SpatialScaler, SpatialScalerBase >
{
public:
void encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer );
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerDescriptor* MTLFX::SpatialScalerDescriptor::alloc()
{
return NS::Object::alloc< SpatialScalerDescriptor >( _MTLFX_PRIVATE_CLS( MTLFXSpatialScalerDescriptor ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerDescriptor* MTLFX::SpatialScalerDescriptor::init()
{
return NS::Object::init< SpatialScalerDescriptor >();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScalerDescriptor::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setColorTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScalerDescriptor::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setOutputTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setInputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setInputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setOutputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setOutputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerColorProcessingMode MTLFX::SpatialScalerDescriptor::colorProcessingMode() const
{
return Object::sendMessage< SpatialScalerColorProcessingMode >( this, _MTLFX_PRIVATE_SEL( colorProcessingMode ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setColorProcessingMode( SpatialScalerColorProcessingMode mode )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorProcessingMode_ ), mode );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScaler* MTLFX::SpatialScalerDescriptor::newSpatialScaler( const MTL::Device* pDevice ) const
{
return Object::sendMessage< SpatialScaler* >( this, _MTLFX_PRIVATE_SEL( newSpatialScalerWithDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL4FX::SpatialScaler* MTLFX::SpatialScalerDescriptor::newSpatialScaler( const MTL::Device* pDevice, const MTL4::Compiler* pCompiler ) const
{
return Object::sendMessage< MTL4FX::SpatialScaler* >( this, _MTLFX_PRIVATE_SEL( newSpatialScalerWithDevice_compiler_ ), pDevice, pCompiler );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::SpatialScalerDescriptor::supportsDevice( const MTL::Device* pDevice )
{
return Object::sendMessageSafe< bool >( _NS_PRIVATE_CLS( MTLFXSpatialScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportsDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::SpatialScalerDescriptor::supportsMetal4FX( const MTL::Device* pDevice )
{
return Object::sendMessageSafe< bool >( _NS_PRIVATE_CLS( MTLFXSpatialScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportsMetal4FX_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::SpatialScalerBase::colorTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( colorTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::SpatialScalerBase::outputTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( outputTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerBase::inputContentWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerBase::setInputContentWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerBase::inputContentHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerBase::setInputContentHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::SpatialScalerBase::colorTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( colorTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerBase::setColorTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::SpatialScalerBase::outputTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( outputTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerBase::setOutputTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScalerBase::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScalerBase::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerBase::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerBase::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerBase::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerBase::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerColorProcessingMode MTLFX::SpatialScalerBase::colorProcessingMode() const
{
return Object::sendMessage< SpatialScalerColorProcessingMode >( this, _MTLFX_PRIVATE_SEL( colorProcessingMode ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Fence* MTLFX::SpatialScalerBase::fence() const
{
return Object::sendMessage< MTL::Fence* >( this, _MTLFX_PRIVATE_SEL( fence ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerBase::setFence( MTL::Fence* pFence )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setFence_ ), pFence );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), pCommandBuffer );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -1,803 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXTemporalScaler.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL4FX
{
class TemporalScaler;
}
namespace MTLFX
{
class TemporalScalerDescriptor : public NS::Copying< TemporalScalerDescriptor >
{
public:
static class TemporalScalerDescriptor* alloc();
class TemporalScalerDescriptor* init();
MTL::PixelFormat colorTextureFormat() const;
void setColorTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat depthTextureFormat() const;
void setDepthTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat motionTextureFormat() const;
void setMotionTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat outputTextureFormat() const;
void setOutputTextureFormat( MTL::PixelFormat format );
NS::UInteger inputWidth() const;
void setInputWidth( NS::UInteger width );
NS::UInteger inputHeight() const;
void setInputHeight( NS::UInteger height );
NS::UInteger outputWidth() const;
void setOutputWidth( NS::UInteger width );
NS::UInteger outputHeight() const;
void setOutputHeight( NS::UInteger height );
bool isAutoExposureEnabled() const;
void setAutoExposureEnabled( bool enabled );
bool isInputContentPropertiesEnabled() const;
void setInputContentPropertiesEnabled( bool enabled );
bool requiresSynchronousInitialization() const;
void setRequiresSynchronousInitialization(bool requiresSynchronousInitialization);
bool isReactiveMaskTextureEnabled() const;
void setReactiveMaskTextureEnabled( bool enabled );
MTL::PixelFormat reactiveMaskTextureFormat() const;
void setReactiveMaskTextureFormat( MTL::PixelFormat pixelFormat );
float inputContentMinScale() const;
void setInputContentMinScale( float scale );
float inputContentMaxScale() const;
void setInputContentMaxScale( float scale );
class TemporalScaler* newTemporalScaler( const MTL::Device* pDevice ) const;
MTL4FX::TemporalScaler* newTemporalScaler( const MTL::Device* pDevice, const MTL4::Compiler* pCompiler) const;
static float supportedInputContentMinScale( const MTL::Device* pDevice );
static float supportedInputContentMaxScale( const MTL::Device* pDevice );
static bool supportsDevice( const MTL::Device* pDevice );
static bool supportsMetal4FX( const MTL::Device* pDevice );
};
class FrameInterpolatableScaler : public NS::Copying< FrameInterpolatableScaler >
{
};
class TemporalScalerBase : public NS::Referencing< TemporalScaler, FrameInterpolatableScaler >
{
public:
MTL::TextureUsage colorTextureUsage() const;
MTL::TextureUsage depthTextureUsage() const;
MTL::TextureUsage motionTextureUsage() const;
MTL::TextureUsage outputTextureUsage() const;
NS::UInteger inputContentWidth() const;
void setInputContentWidth( NS::UInteger width );
NS::UInteger inputContentHeight() const;
void setInputContentHeight( NS::UInteger height );
MTL::Texture* colorTexture() const;
void setColorTexture( MTL::Texture* pTexture );
MTL::Texture* depthTexture() const;
void setDepthTexture( MTL::Texture* pTexture );
MTL::Texture* motionTexture() const;
void setMotionTexture( MTL::Texture* pTexture );
MTL::Texture* outputTexture() const;
void setOutputTexture( MTL::Texture* pTexture );
MTL::Texture* exposureTexture() const;
void setExposureTexture( MTL::Texture* pTexture );
float preExposure() const;
void setPreExposure( float preExposure );
float jitterOffsetX() const;
void setJitterOffsetX( float offset );
float jitterOffsetY() const;
void setJitterOffsetY( float offset );
float motionVectorScaleX() const;
void setMotionVectorScaleX( float scale );
float motionVectorScaleY() const;
void setMotionVectorScaleY( float scale );
MTL::Texture* reactiveMaskTexture() const;
void setReactiveMaskTexture( MTL::Texture* reactiveMaskTexture );
MTL::TextureUsage reactiveTextureUsage() const;
bool reset() const;
void setReset( bool reset );
bool isDepthReversed() const;
void setDepthReversed( bool depthReversed );
MTL::PixelFormat colorTextureFormat() const;
MTL::PixelFormat depthTextureFormat() const;
MTL::PixelFormat motionTextureFormat() const;
MTL::PixelFormat reactiveTextureFormat() const;
MTL::PixelFormat outputTextureFormat() const;
NS::UInteger inputWidth() const;
NS::UInteger inputHeight() const;
NS::UInteger outputWidth() const;
NS::UInteger outputHeight() const;
float inputContentMinScale() const;
float inputContentMaxScale() const;
MTL::Fence* fence() const;
void setFence( MTL::Fence* pFence );
};
class TemporalScaler : public NS::Referencing< TemporalScaler, TemporalScalerBase >
{
public:
void encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer );
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::TemporalScalerDescriptor* MTLFX::TemporalScalerDescriptor::alloc()
{
return NS::Object::alloc< TemporalScalerDescriptor >( _MTLFX_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::TemporalScalerDescriptor* MTLFX::TemporalScalerDescriptor::init()
{
return NS::Object::init< TemporalScalerDescriptor >();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setColorTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::depthTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( depthTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setDepthTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDepthTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::motionTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( motionTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setMotionTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setOutputTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setOutputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setOutputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::isAutoExposureEnabled() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isAutoExposureEnabled ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setAutoExposureEnabled( bool enabled )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setAutoExposureEnabled_ ), enabled );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::isInputContentPropertiesEnabled() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isInputContentPropertiesEnabled ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputContentPropertiesEnabled( bool enabled )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentPropertiesEnabled_ ), enabled );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::requiresSynchronousInitialization() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( requiresSynchronousInitialization ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setRequiresSynchronousInitialization(bool requiresSynchronousInitialization)
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setRequiresSynchronousInitialization_ ), requiresSynchronousInitialization );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::isReactiveMaskTextureEnabled() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isReactiveMaskTextureEnabled ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setReactiveMaskTextureEnabled( bool enabled )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setReactiveMaskTextureEnabled_ ), enabled );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::reactiveMaskTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( reactiveMaskTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setReactiveMaskTextureFormat( MTL::PixelFormat pixelFormat )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setReactiveMaskTextureFormat_ ), pixelFormat );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::inputContentMinScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMinScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputContentMinScale( float scale )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentMinScale_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::inputContentMaxScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMaxScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputContentMaxScale( float scale )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentMaxScale_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::TemporalScaler* MTLFX::TemporalScalerDescriptor::newTemporalScaler( const MTL::Device* pDevice ) const
{
return Object::sendMessage< TemporalScaler* >( this, _MTLFX_PRIVATE_SEL( newTemporalScalerWithDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL4FX::TemporalScaler* MTLFX::TemporalScalerDescriptor::newTemporalScaler( const MTL::Device* pDevice, const MTL4::Compiler* pCompiler ) const
{
return Object::sendMessage< MTL4FX::TemporalScaler* >( this, _MTLFX_PRIVATE_SEL( newTemporalScalerWithDevice_compiler_ ), pDevice, pCompiler );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::supportedInputContentMinScale( const MTL::Device* pDevice )
{
float scale = 1.0f;
if ( nullptr != methodSignatureForSelector( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMinScaleForDevice_ ) ) )
{
scale = sendMessage< float >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMinScaleForDevice_ ), pDevice );
}
return scale;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::supportedInputContentMaxScale( const MTL::Device* pDevice )
{
float scale = 1.0f;
if ( nullptr != methodSignatureForSelector( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMaxScaleForDevice_ ) ) )
{
scale = sendMessage< float >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMaxScaleForDevice_ ), pDevice );
}
else if ( supportsDevice( pDevice ) )
{
scale = 2.0f;
}
return scale;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::supportsDevice( const MTL::Device* pDevice )
{
return Object::sendMessageSafe< bool >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportsDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::supportsMetal4FX( const MTL::Device* pDevice )
{
return Object::sendMessageSafe< bool >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportsMetal4FX_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScalerBase::colorTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( colorTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScalerBase::depthTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( depthTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScalerBase::motionTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( motionTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScalerBase::outputTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( outputTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerBase::inputContentWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setInputContentWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerBase::inputContentHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setInputContentHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setInputContentHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScalerBase::colorTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( colorTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setColorTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setColorTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScalerBase::depthTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( depthTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setDepthTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDepthTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScalerBase::motionTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( motionTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setMotionTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScalerBase::outputTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( outputTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setOutputTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setOutputTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScalerBase::exposureTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( exposureTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setExposureTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setExposureTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::preExposure() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( preExposure ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setPreExposure( float preExposure )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setPreExposure_ ), preExposure );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::jitterOffsetX() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( jitterOffsetX ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setJitterOffsetX( float offset )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setJitterOffsetX_ ), offset );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::jitterOffsetY() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( jitterOffsetY ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setJitterOffsetY( float offset )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setJitterOffsetY_ ), offset );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::motionVectorScaleX() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( motionVectorScaleX ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setMotionVectorScaleX( float scale )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionVectorScaleX_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::motionVectorScaleY() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( motionVectorScaleY ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setMotionVectorScaleY( float scale )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setMotionVectorScaleY_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScalerBase::reactiveMaskTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( reactiveMaskTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setReactiveMaskTexture( MTL::Texture* reactiveMaskTexture )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setReactiveMaskTexture_ ), reactiveMaskTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScalerBase::reactiveTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( reactiveTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerBase::reset() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( reset ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setReset( bool reset )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setReset_ ), reset );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerBase::isDepthReversed() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isDepthReversed ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setDepthReversed( bool depthReversed )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setDepthReversed_ ), depthReversed );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerBase::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerBase::depthTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( depthTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerBase::motionTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( motionTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerBase::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerBase::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerBase::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerBase::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerBase::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::inputContentMinScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMinScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerBase::inputContentMaxScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMaxScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Fence* MTLFX::TemporalScalerBase::fence() const
{
return Object::sendMessage< MTL::Fence* >( this, _MTLFX_PRIVATE_SEL( fence ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerBase::setFence( MTL::Fence* pFence )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( setFence_ ), pFence );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer )
{
Object::sendMessage< void >( this, _MTLFX_PRIVATE_SEL( encodeToCommandBuffer_ ), pCommandBuffer );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,271 +0,0 @@
#!/usr/bin/env python3
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
#
# SingleHeader/MakeSingleHeader.py
#
# Copyright 2020-2024 Apple Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
import argparse
import datetime
import logging
import os
import re
import subprocess
import sys
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
class HeaderPrefix( object ):
__template = ( '//\n'
'// {file}\n'
'//\n'
'// {meta_data}\n'
'//\n'
'// Copyright 2020-2024 Apple Inc.\n'
'//\n'
'// Licensed under the Apache License, Version 2.0 (the "License");\n'
'// you may not use this file except in compliance with the License.\n'
'// You may obtain a copy of the License at\n'
'//\n'
'// http://www.apache.org/licenses/LICENSE-2.0\n'
'//\n'
'// Unless required by applicable law or agreed to in writing, software\n'
'// distributed under the License is distributed on an "AS IS" BASIS,\n'
'// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'
'// See the License for the specific language governing permissions and\n'
'// limitations under the License.\n'
'//\n'
'\n' )
__template_commit = 'Autogenerated from commit {commit}.'
__template_date = 'Autogenerated on %B %d, %Y.'
def __init__( self, file ):
self.__file = file
def __str__( self ):
return self.__template.format( file = self.__file, meta_data = self.__meta_data_string() )
def __get_commit_hash( self ):
git_commit_hash = None
try:
git_dir = os.path.dirname( os.path.realpath( __file__ ) )
proc = subprocess.Popen( [ 'git', 'rev-parse', 'HEAD' ], cwd = git_dir, stdout = subprocess.PIPE, stderr = subprocess.PIPE )
git_commit_hash = proc.stdout.read().decode( 'utf-8', 'replace' ).strip()
except:
logging.error( 'Failed to determine git commit hash!' )
pass
return git_commit_hash
def __get_commit_string( self ):
meta_data = None
git_commit_hash = self.__get_commit_hash()
if git_commit_hash:
meta_data = self.__template_commit.format( commit = git_commit_hash )
return meta_data
def __get_date_string( self ):
today = datetime.date.today()
return today.strftime( self.__template_date )
def __meta_data_string( self ):
meta_data = self.__get_commit_string()
if not meta_data:
meta_data = self.__get_date_string()
return meta_data
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
class SingleHeader( object ):
__pragma_once = '#pragma once\n\n'
def __init__( self ):
self.__header_paths = list()
def __str__( self ):
return self.process()
def append( self, header_path ):
self.__header_paths.append( header_path )
def process( self ):
out_header = self.__pragma_once
self.__included_headers = set()
self.__base_path = list()
for header_path in self.__header_paths:
out_header += self.__process_header( header_path )
return self.__strip_empty_lines( out_header )
def __read_header( self, path ):
path = os.path.realpath( path )
try:
f = open( path, 'r' )
except:
raise RuntimeError( 'Failed to open file \"' + path + '\" for read!' )
return f.read()
def __strip_pragma_once( self, header ):
return re.sub( '\\s*#pragma once\s*\\/\\/-*\\n', '', header )
def __strip_comments( self, header ):
return re.sub( '^//.*\\n', '', header, flags = re.MULTILINE )
def __strip_empty_lines( self, header ):
return re.sub( '\\n\\n+', '\\n\\n', header, flags = re.MULTILINE )
def __substitute_include_directive( self, match ):
header_path = match.group( 'HEADER_PATH' )
logging.info( '\tSubstituting \"' + header_path + '\"...' )
return self.__process_header( os.path.join( self.__base_path[-1], header_path ) )
def __process_include_directives( self, header ):
return re.sub( '^\\s*#include\\s\\"(?P<HEADER_PATH>\\S*)\\"', self.__substitute_include_directive, header, flags = re.MULTILINE )
def __process_foundation_directives( self, header ):
if header.find("#include <Foundation/Foundation.hpp>") != -1:
logging.info( '\tSubstituting <Foundation/Foundation.hpp>...' )
return header.replace("#include <Foundation/Foundation.hpp>", self.__process_header( os.path.join( self.__base_path[-1], "../Foundation/Foundation.hpp" ) ) )
return header
def __process_header( self, header_path ):
out_header = ''
header_path = os.path.realpath( header_path )
if not header_path in self.__included_headers:
logging.info( 'Processing \"' + header_path + '\"...' )
self.__base_path.append( os.path.dirname( header_path ) )
self.__included_headers.add( header_path )
out_header = self.__read_header( header_path )
out_header = self.__strip_pragma_once( out_header )
out_header = self.__strip_comments( out_header )
out_header = self.__process_include_directives( out_header )
out_header = self.__process_foundation_directives( out_header )
self.__base_path.pop()
else:
logging.info( '\tSkipping \"' + header_path + '\"...' )
return out_header
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
def create_argument_parser():
parser = argparse.ArgumentParser()
base_path = os.path.dirname( os.path.realpath( __file__ ) )
output_path = os.path.join( base_path, 'Metal.hpp' )
parser.add_argument( '-o', '--output', dest = 'output_path', metavar = 'PATH', default = output_path, help = 'Output path for the single header file.' )
parser.add_argument( '-v', '--verbose', action = 'store_true', help = 'Show verbose output.' )
parser.add_argument( dest = 'header_paths', metavar = 'HEADER_FILE', nargs='+', help = 'Input header file.' )
return parser
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
def parse_arguments():
parser = create_argument_parser()
args = parser.parse_args()
if args.verbose:
logging.getLogger().setLevel( logging.INFO )
else:
logging.getLogger().setLevel( logging.ERROR )
return args
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
def make_header( args ):
prefix = HeaderPrefix( os.path.basename( args.output_path ) )
header = SingleHeader()
for header_path in args.header_paths:
header.append( header_path )
return str( prefix ) + str( header )
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
def make_dir( path ):
try:
if not os.path.exists( path ):
os.makedirs( path )
except os.error:
pass
except:
raise
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
def write_header( args, content ):
path = os.path.realpath( args.output_path )
logging.info( 'Writing \"' + path + '\"...' )
make_dir( os.path.dirname( path ) )
try:
f = open( path, 'w' )
except:
raise RuntimeError( 'Failed to open file \"' + path + '\" for write!' )
f.write( content )
#--------------------------------------------------------------------------------------------------------------------------------------------------------------
if __name__ == '__main__':
result = -1
try:
if sys.getdefaultencoding().lower() == 'ascii':
reload( sys )
sys.setdefaultencoding( 'utf-8' )
args = parse_arguments()
header = make_header( args )
write_header( args, header )
result = 0
except ( KeyboardInterrupt, SystemExit ):
pass
except:
raise
sys.exit( result )
#--------------------------------------------------------------------------------------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -1,93 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4Archive.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class ComputePipelineState;
class RenderPipelineState;
}
namespace MTL4
{
class BinaryFunction;
class BinaryFunctionDescriptor;
class ComputePipelineDescriptor;
class PipelineDescriptor;
class PipelineStageDynamicLinkingDescriptor;
class RenderPipelineDynamicLinkingDescriptor;
class Archive : public NS::Referencing<Archive>
{
public:
NS::String* label() const;
BinaryFunction* newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, NS::Error** error);
MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, NS::Error** error);
MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, NS::Error** error);
MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, NS::Error** error);
MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, NS::Error** error);
void setLabel(const NS::String* label);
};
}
_MTL_INLINE NS::String* MTL4::Archive::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::BinaryFunction* MTL4::Archive::newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<MTL4::BinaryFunction*>(this, _MTL_PRIVATE_SEL(newBinaryFunctionWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE MTL::ComputePipelineState* MTL4::Archive::newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE MTL::ComputePipelineState* MTL4::Archive::newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, NS::Error** error)
{
return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_dynamicLinkingDescriptor_error_), descriptor, dynamicLinkingDescriptor, error);
}
_MTL_INLINE MTL::RenderPipelineState* MTL4::Archive::newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE MTL::RenderPipelineState* MTL4::Archive::newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, NS::Error** error)
{
return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_dynamicLinkingDescriptor_error_), descriptor, dynamicLinkingDescriptor, error);
}
_MTL_INLINE void MTL4::Archive::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}

View File

@@ -1,187 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4ArgumentTable.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLGPUAddress.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
namespace MTL
{
class Device;
}
namespace MTL4
{
class ArgumentTableDescriptor : public NS::Copying<ArgumentTableDescriptor>
{
public:
static ArgumentTableDescriptor* alloc();
ArgumentTableDescriptor* init();
bool initializeBindings() const;
NS::String* label() const;
NS::UInteger maxBufferBindCount() const;
NS::UInteger maxSamplerStateBindCount() const;
NS::UInteger maxTextureBindCount() const;
void setInitializeBindings(bool initializeBindings);
void setLabel(const NS::String* label);
void setMaxBufferBindCount(NS::UInteger maxBufferBindCount);
void setMaxSamplerStateBindCount(NS::UInteger maxSamplerStateBindCount);
void setMaxTextureBindCount(NS::UInteger maxTextureBindCount);
void setSupportAttributeStrides(bool supportAttributeStrides);
bool supportAttributeStrides() const;
};
class ArgumentTable : public NS::Referencing<ArgumentTable>
{
public:
MTL::Device* device() const;
NS::String* label() const;
void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex);
void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex);
void setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex);
void setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex);
void setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex);
};
}
_MTL_INLINE MTL4::ArgumentTableDescriptor* MTL4::ArgumentTableDescriptor::alloc()
{
return NS::Object::alloc<MTL4::ArgumentTableDescriptor>(_MTL_PRIVATE_CLS(MTL4ArgumentTableDescriptor));
}
_MTL_INLINE MTL4::ArgumentTableDescriptor* MTL4::ArgumentTableDescriptor::init()
{
return NS::Object::init<MTL4::ArgumentTableDescriptor>();
}
_MTL_INLINE bool MTL4::ArgumentTableDescriptor::initializeBindings() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(initializeBindings));
}
_MTL_INLINE NS::String* MTL4::ArgumentTableDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxBufferBindCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxBufferBindCount));
}
_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxSamplerStateBindCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxSamplerStateBindCount));
}
_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxTextureBindCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTextureBindCount));
}
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setInitializeBindings(bool initializeBindings)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInitializeBindings_), initializeBindings);
}
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxBufferBindCount(NS::UInteger maxBufferBindCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxBufferBindCount_), maxBufferBindCount);
}
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxSamplerStateBindCount(NS::UInteger maxSamplerStateBindCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxSamplerStateBindCount_), maxSamplerStateBindCount);
}
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxTextureBindCount(NS::UInteger maxTextureBindCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTextureBindCount_), maxTextureBindCount);
}
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setSupportAttributeStrides(bool supportAttributeStrides)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAttributeStrides_), supportAttributeStrides);
}
_MTL_INLINE bool MTL4::ArgumentTableDescriptor::supportAttributeStrides() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAttributeStrides));
}
_MTL_INLINE MTL::Device* MTL4::ArgumentTable::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::String* MTL4::ArgumentTable::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::ArgumentTable::setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAddress_atIndex_), gpuAddress, bindingIndex);
}
_MTL_INLINE void MTL4::ArgumentTable::setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAddress_attributeStride_atIndex_), gpuAddress, stride, bindingIndex);
}
_MTL_INLINE void MTL4::ArgumentTable::setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResource_atBufferIndex_), resourceID, bindingIndex);
}
_MTL_INLINE void MTL4::ArgumentTable::setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), resourceID, bindingIndex);
}
_MTL_INLINE void MTL4::ArgumentTable::setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), resourceID, bindingIndex);
}

View File

@@ -1,50 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4BinaryFunction.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLLibrary.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class BinaryFunction : public NS::Referencing<BinaryFunction>
{
public:
MTL::FunctionType functionType() const;
NS::String* name() const;
};
}
_MTL_INLINE MTL::FunctionType MTL4::BinaryFunction::functionType() const
{
return Object::sendMessage<MTL::FunctionType>(this, _MTL_PRIVATE_SEL(functionType));
}
_MTL_INLINE NS::String* MTL4::BinaryFunction::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}

View File

@@ -1,97 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4BinaryFunctionDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class BinaryFunctionDescriptor;
class FunctionDescriptor;
_MTL_OPTIONS(NS::UInteger, BinaryFunctionOptions) {
BinaryFunctionOptionNone = 0,
BinaryFunctionOptionPipelineIndependent = 1 << 1,
};
class BinaryFunctionDescriptor : public NS::Copying<BinaryFunctionDescriptor>
{
public:
static BinaryFunctionDescriptor* alloc();
FunctionDescriptor* functionDescriptor() const;
BinaryFunctionDescriptor* init();
NS::String* name() const;
BinaryFunctionOptions options() const;
void setFunctionDescriptor(const MTL4::FunctionDescriptor* functionDescriptor);
void setName(const NS::String* name);
void setOptions(MTL4::BinaryFunctionOptions options);
};
}
_MTL_INLINE MTL4::BinaryFunctionDescriptor* MTL4::BinaryFunctionDescriptor::alloc()
{
return NS::Object::alloc<MTL4::BinaryFunctionDescriptor>(_MTL_PRIVATE_CLS(MTL4BinaryFunctionDescriptor));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::BinaryFunctionDescriptor::functionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(functionDescriptor));
}
_MTL_INLINE MTL4::BinaryFunctionDescriptor* MTL4::BinaryFunctionDescriptor::init()
{
return NS::Object::init<MTL4::BinaryFunctionDescriptor>();
}
_MTL_INLINE NS::String* MTL4::BinaryFunctionDescriptor::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE MTL4::BinaryFunctionOptions MTL4::BinaryFunctionDescriptor::options() const
{
return Object::sendMessage<MTL4::BinaryFunctionOptions>(this, _MTL_PRIVATE_SEL(options));
}
_MTL_INLINE void MTL4::BinaryFunctionDescriptor::setFunctionDescriptor(const MTL4::FunctionDescriptor* functionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionDescriptor_), functionDescriptor);
}
_MTL_INLINE void MTL4::BinaryFunctionDescriptor::setName(const NS::String* name)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
}
_MTL_INLINE void MTL4::BinaryFunctionDescriptor::setOptions(MTL4::BinaryFunctionOptions options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
}

View File

@@ -1,100 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CommandAllocator.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <cstdint>
namespace MTL
{
class Device;
}
namespace MTL4
{
class CommandAllocatorDescriptor : public NS::Copying<CommandAllocatorDescriptor>
{
public:
static CommandAllocatorDescriptor* alloc();
CommandAllocatorDescriptor* init();
NS::String* label() const;
void setLabel(const NS::String* label);
};
class CommandAllocator : public NS::Referencing<CommandAllocator>
{
public:
uint64_t allocatedSize();
MTL::Device* device() const;
NS::String* label() const;
void reset();
};
}
_MTL_INLINE MTL4::CommandAllocatorDescriptor* MTL4::CommandAllocatorDescriptor::alloc()
{
return NS::Object::alloc<MTL4::CommandAllocatorDescriptor>(_MTL_PRIVATE_CLS(MTL4CommandAllocatorDescriptor));
}
_MTL_INLINE MTL4::CommandAllocatorDescriptor* MTL4::CommandAllocatorDescriptor::init()
{
return NS::Object::init<MTL4::CommandAllocatorDescriptor>();
}
_MTL_INLINE NS::String* MTL4::CommandAllocatorDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::CommandAllocatorDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE uint64_t MTL4::CommandAllocator::allocatedSize()
{
return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(allocatedSize));
}
_MTL_INLINE MTL::Device* MTL4::CommandAllocator::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::String* MTL4::CommandAllocator::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::CommandAllocator::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}

View File

@@ -1,193 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CommandBuffer.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4RenderCommandEncoder.hpp"
#include "MTLAccelerationStructureTypes.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class CommandAllocator;
class CommandBufferOptions;
class ComputeCommandEncoder;
class CounterHeap;
class MachineLearningCommandEncoder;
class RenderCommandEncoder;
class RenderPassDescriptor;
}
namespace MTL
{
class Device;
class Fence;
class LogState;
class ResidencySet;
}
namespace MTL4
{
class CommandBufferOptions : public NS::Copying<CommandBufferOptions>
{
public:
static CommandBufferOptions* alloc();
CommandBufferOptions* init();
MTL::LogState* logState() const;
void setLogState(const MTL::LogState* logState);
};
class CommandBuffer : public NS::Referencing<CommandBuffer>
{
public:
void beginCommandBuffer(const MTL4::CommandAllocator* allocator);
void beginCommandBuffer(const MTL4::CommandAllocator* allocator, const MTL4::CommandBufferOptions* options);
ComputeCommandEncoder* computeCommandEncoder();
MTL::Device* device() const;
void endCommandBuffer();
NS::String* label() const;
MachineLearningCommandEncoder* machineLearningCommandEncoder();
void popDebugGroup();
void pushDebugGroup(const NS::String* string);
RenderCommandEncoder* renderCommandEncoder(const MTL4::RenderPassDescriptor* descriptor);
RenderCommandEncoder* renderCommandEncoder(const MTL4::RenderPassDescriptor* descriptor, MTL4::RenderEncoderOptions options);
void resolveCounterHeap(const MTL4::CounterHeap* counterHeap, NS::Range range, const MTL4::BufferRange bufferRange, const MTL::Fence* fenceToWait, const MTL::Fence* fenceToUpdate);
void setLabel(const NS::String* label);
void useResidencySet(const MTL::ResidencySet* residencySet);
void useResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
void writeTimestampIntoHeap(const MTL4::CounterHeap* counterHeap, NS::UInteger index);
};
}
_MTL_INLINE MTL4::CommandBufferOptions* MTL4::CommandBufferOptions::alloc()
{
return NS::Object::alloc<MTL4::CommandBufferOptions>(_MTL_PRIVATE_CLS(MTL4CommandBufferOptions));
}
_MTL_INLINE MTL4::CommandBufferOptions* MTL4::CommandBufferOptions::init()
{
return NS::Object::init<MTL4::CommandBufferOptions>();
}
_MTL_INLINE MTL::LogState* MTL4::CommandBufferOptions::logState() const
{
return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));
}
_MTL_INLINE void MTL4::CommandBufferOptions::setLogState(const MTL::LogState* logState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);
}
_MTL_INLINE void MTL4::CommandBuffer::beginCommandBuffer(const MTL4::CommandAllocator* allocator)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(beginCommandBufferWithAllocator_), allocator);
}
_MTL_INLINE void MTL4::CommandBuffer::beginCommandBuffer(const MTL4::CommandAllocator* allocator, const MTL4::CommandBufferOptions* options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(beginCommandBufferWithAllocator_options_), allocator, options);
}
_MTL_INLINE MTL4::ComputeCommandEncoder* MTL4::CommandBuffer::computeCommandEncoder()
{
return Object::sendMessage<MTL4::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoder));
}
_MTL_INLINE MTL::Device* MTL4::CommandBuffer::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE void MTL4::CommandBuffer::endCommandBuffer()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endCommandBuffer));
}
_MTL_INLINE NS::String* MTL4::CommandBuffer::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::MachineLearningCommandEncoder* MTL4::CommandBuffer::machineLearningCommandEncoder()
{
return Object::sendMessage<MTL4::MachineLearningCommandEncoder*>(this, _MTL_PRIVATE_SEL(machineLearningCommandEncoder));
}
_MTL_INLINE void MTL4::CommandBuffer::popDebugGroup()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
}
_MTL_INLINE void MTL4::CommandBuffer::pushDebugGroup(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
}
_MTL_INLINE MTL4::RenderCommandEncoder* MTL4::CommandBuffer::renderCommandEncoder(const MTL4::RenderPassDescriptor* descriptor)
{
return Object::sendMessage<MTL4::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoderWithDescriptor_), descriptor);
}
_MTL_INLINE MTL4::RenderCommandEncoder* MTL4::CommandBuffer::renderCommandEncoder(const MTL4::RenderPassDescriptor* descriptor, MTL4::RenderEncoderOptions options)
{
return Object::sendMessage<MTL4::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoderWithDescriptor_options_), descriptor, options);
}
_MTL_INLINE void MTL4::CommandBuffer::resolveCounterHeap(const MTL4::CounterHeap* counterHeap, NS::Range range, const MTL4::BufferRange bufferRange, const MTL::Fence* fenceToWait, const MTL::Fence* fenceToUpdate)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resolveCounterHeap_withRange_intoBuffer_waitFence_updateFence_), counterHeap, range, bufferRange, fenceToWait, fenceToUpdate);
}
_MTL_INLINE void MTL4::CommandBuffer::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::CommandBuffer::useResidencySet(const MTL::ResidencySet* residencySet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResidencySet_), residencySet);
}
_MTL_INLINE void MTL4::CommandBuffer::useResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResidencySets_count_), residencySets, count);
}
_MTL_INLINE void MTL4::CommandBuffer::writeTimestampIntoHeap(const MTL4::CounterHeap* counterHeap, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeTimestampIntoHeap_atIndex_), counterHeap, index);
}

View File

@@ -1,134 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLCommandEncoder.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class CommandBuffer;
}
namespace MTL
{
class Fence;
}
namespace MTL4
{
_MTL_OPTIONS(NS::UInteger, VisibilityOptions) {
VisibilityOptionNone = 0,
VisibilityOptionDevice = 1,
VisibilityOptionResourceAlias = 1 << 1,
};
class CommandEncoder : public NS::Referencing<CommandEncoder>
{
public:
void barrierAfterEncoderStages(MTL::Stages afterEncoderStages, MTL::Stages beforeEncoderStages, MTL4::VisibilityOptions visibilityOptions);
void barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages, MTL4::VisibilityOptions visibilityOptions);
void barrierAfterStages(MTL::Stages afterStages, MTL::Stages beforeQueueStages, MTL4::VisibilityOptions visibilityOptions);
CommandBuffer* commandBuffer() const;
void endEncoding();
void insertDebugSignpost(const NS::String* string);
NS::String* label() const;
void popDebugGroup();
void pushDebugGroup(const NS::String* string);
void setLabel(const NS::String* label);
void updateFence(const MTL::Fence* fence, MTL::Stages afterEncoderStages);
void waitForFence(const MTL::Fence* fence, MTL::Stages beforeEncoderStages);
};
}
_MTL_INLINE void MTL4::CommandEncoder::barrierAfterEncoderStages(MTL::Stages afterEncoderStages, MTL::Stages beforeEncoderStages, MTL4::VisibilityOptions visibilityOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions_), afterEncoderStages, beforeEncoderStages, visibilityOptions);
}
_MTL_INLINE void MTL4::CommandEncoder::barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages, MTL4::VisibilityOptions visibilityOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterQueueStages_beforeStages_visibilityOptions_), afterQueueStages, beforeStages, visibilityOptions);
}
_MTL_INLINE void MTL4::CommandEncoder::barrierAfterStages(MTL::Stages afterStages, MTL::Stages beforeQueueStages, MTL4::VisibilityOptions visibilityOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterStages_beforeQueueStages_visibilityOptions_), afterStages, beforeQueueStages, visibilityOptions);
}
_MTL_INLINE MTL4::CommandBuffer* MTL4::CommandEncoder::commandBuffer() const
{
return Object::sendMessage<MTL4::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
}
_MTL_INLINE void MTL4::CommandEncoder::endEncoding()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
}
_MTL_INLINE void MTL4::CommandEncoder::insertDebugSignpost(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
}
_MTL_INLINE NS::String* MTL4::CommandEncoder::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::CommandEncoder::popDebugGroup()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
}
_MTL_INLINE void MTL4::CommandEncoder::pushDebugGroup(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
}
_MTL_INLINE void MTL4::CommandEncoder::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::CommandEncoder::updateFence(const MTL::Fence* fence, MTL::Stages afterEncoderStages)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_afterEncoderStages_), fence, afterEncoderStages);
}
_MTL_INLINE void MTL4::CommandEncoder::waitForFence(const MTL::Fence* fence, MTL::Stages beforeEncoderStages)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_beforeEncoderStages_), fence, beforeEncoderStages);
}

View File

@@ -1,283 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CommandQueue.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4CommitFeedback.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLResourceStateCommandEncoder.hpp"
#include "MTLTypes.hpp"
#include <cstdint>
#include <dispatch/dispatch.h>
namespace MTL
{
class Buffer;
class Device;
class Drawable;
class Event;
class Heap;
class ResidencySet;
class Texture;
}
namespace MTL4
{
class CommandBuffer;
class CommandQueueDescriptor;
class CommitOptions;
struct CopySparseBufferMappingOperation;
struct CopySparseTextureMappingOperation;
struct UpdateSparseBufferMappingOperation;
struct UpdateSparseTextureMappingOperation;
_MTL_ENUM(NS::Integer, CommandQueueError) {
CommandQueueErrorNone = 0,
CommandQueueErrorTimeout = 1,
CommandQueueErrorNotPermitted = 2,
CommandQueueErrorOutOfMemory = 3,
CommandQueueErrorDeviceRemoved = 4,
CommandQueueErrorAccessRevoked = 5,
CommandQueueErrorInternal = 6,
};
struct UpdateSparseTextureMappingOperation
{
MTL::SparseTextureMappingMode mode;
MTL::Region textureRegion;
NS::UInteger textureLevel;
NS::UInteger textureSlice;
NS::UInteger heapOffset;
} _MTL_PACKED;
struct CopySparseTextureMappingOperation
{
MTL::Region sourceRegion;
NS::UInteger sourceLevel;
NS::UInteger sourceSlice;
MTL::Origin destinationOrigin;
NS::UInteger destinationLevel;
NS::UInteger destinationSlice;
} _MTL_PACKED;
struct UpdateSparseBufferMappingOperation
{
MTL::SparseTextureMappingMode mode;
NS::Range bufferRange;
NS::UInteger heapOffset;
} _MTL_PACKED;
struct CopySparseBufferMappingOperation
{
NS::Range sourceRange;
NS::UInteger destinationOffset;
} _MTL_PACKED;
class CommitOptions : public NS::Referencing<CommitOptions>
{
public:
void addFeedbackHandler(const MTL4::CommitFeedbackHandler block);
void addFeedbackHandler(const MTL4::CommitFeedbackHandlerFunction& function);
static CommitOptions* alloc();
CommitOptions* init();
};
class CommandQueueDescriptor : public NS::Copying<CommandQueueDescriptor>
{
public:
static CommandQueueDescriptor* alloc();
dispatch_queue_t feedbackQueue() const;
CommandQueueDescriptor* init();
NS::String* label() const;
void setFeedbackQueue(const dispatch_queue_t feedbackQueue);
void setLabel(const NS::String* label);
};
class CommandQueue : public NS::Referencing<CommandQueue>
{
public:
void addResidencySet(const MTL::ResidencySet* residencySet);
void addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
void commit(const MTL4::CommandBuffer* const commandBuffers[], NS::UInteger count);
void commit(const MTL4::CommandBuffer* const commandBuffers[], NS::UInteger count, const MTL4::CommitOptions* options);
void copyBufferMappingsFromBuffer(const MTL::Buffer* sourceBuffer, const MTL::Buffer* destinationBuffer, const MTL4::CopySparseBufferMappingOperation* operations, NS::UInteger count);
void copyTextureMappingsFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture, const MTL4::CopySparseTextureMappingOperation* operations, NS::UInteger count);
MTL::Device* device() const;
NS::String* label() const;
void removeResidencySet(const MTL::ResidencySet* residencySet);
void removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
void signalDrawable(const MTL::Drawable* drawable);
void signalEvent(const MTL::Event* event, uint64_t value);
void updateBufferMappings(const MTL::Buffer* buffer, const MTL::Heap* heap, const MTL4::UpdateSparseBufferMappingOperation* operations, NS::UInteger count);
void updateTextureMappings(const MTL::Texture* texture, const MTL::Heap* heap, const MTL4::UpdateSparseTextureMappingOperation* operations, NS::UInteger count);
void wait(const MTL::Event* event, uint64_t value);
void wait(const MTL::Drawable* drawable);
};
}
_MTL_INLINE void MTL4::CommitOptions::addFeedbackHandler(const MTL4::CommitFeedbackHandler block)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addFeedbackHandler_), block);
}
_MTL_INLINE void MTL4::CommitOptions::addFeedbackHandler(const MTL4::CommitFeedbackHandlerFunction& function)
{
__block MTL4::CommitFeedbackHandlerFunction blockFunction = function;
addFeedbackHandler(^(MTL4::CommitFeedback* pFeedback) { blockFunction(pFeedback); });
}
_MTL_INLINE MTL4::CommitOptions* MTL4::CommitOptions::alloc()
{
return NS::Object::alloc<MTL4::CommitOptions>(_MTL_PRIVATE_CLS(MTL4CommitOptions));
}
_MTL_INLINE MTL4::CommitOptions* MTL4::CommitOptions::init()
{
return NS::Object::init<MTL4::CommitOptions>();
}
_MTL_INLINE MTL4::CommandQueueDescriptor* MTL4::CommandQueueDescriptor::alloc()
{
return NS::Object::alloc<MTL4::CommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTL4CommandQueueDescriptor));
}
_MTL_INLINE dispatch_queue_t MTL4::CommandQueueDescriptor::feedbackQueue() const
{
return Object::sendMessage<dispatch_queue_t>(this, _MTL_PRIVATE_SEL(feedbackQueue));
}
_MTL_INLINE MTL4::CommandQueueDescriptor* MTL4::CommandQueueDescriptor::init()
{
return NS::Object::init<MTL4::CommandQueueDescriptor>();
}
_MTL_INLINE NS::String* MTL4::CommandQueueDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::CommandQueueDescriptor::setFeedbackQueue(const dispatch_queue_t feedbackQueue)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFeedbackQueue_), feedbackQueue);
}
_MTL_INLINE void MTL4::CommandQueueDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::CommandQueue::addResidencySet(const MTL::ResidencySet* residencySet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySet_), residencySet);
}
_MTL_INLINE void MTL4::CommandQueue::addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySets_count_), residencySets, count);
}
_MTL_INLINE void MTL4::CommandQueue::commit(const MTL4::CommandBuffer* const commandBuffers[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit_count_), commandBuffers, count);
}
_MTL_INLINE void MTL4::CommandQueue::commit(const MTL4::CommandBuffer* const commandBuffers[], NS::UInteger count, const MTL4::CommitOptions* options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit_count_options_), commandBuffers, count, options);
}
_MTL_INLINE void MTL4::CommandQueue::copyBufferMappingsFromBuffer(const MTL::Buffer* sourceBuffer, const MTL::Buffer* destinationBuffer, const MTL4::CopySparseBufferMappingOperation* operations, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyBufferMappingsFromBuffer_toBuffer_operations_count_), sourceBuffer, destinationBuffer, operations, count);
}
_MTL_INLINE void MTL4::CommandQueue::copyTextureMappingsFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture, const MTL4::CopySparseTextureMappingOperation* operations, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyTextureMappingsFromTexture_toTexture_operations_count_), sourceTexture, destinationTexture, operations, count);
}
_MTL_INLINE MTL::Device* MTL4::CommandQueue::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::String* MTL4::CommandQueue::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::CommandQueue::removeResidencySet(const MTL::ResidencySet* residencySet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySet_), residencySet);
}
_MTL_INLINE void MTL4::CommandQueue::removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySets_count_), residencySets, count);
}
_MTL_INLINE void MTL4::CommandQueue::signalDrawable(const MTL::Drawable* drawable)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(signalDrawable_), drawable);
}
_MTL_INLINE void MTL4::CommandQueue::signalEvent(const MTL::Event* event, uint64_t value)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(signalEvent_value_), event, value);
}
_MTL_INLINE void MTL4::CommandQueue::updateBufferMappings(const MTL::Buffer* buffer, const MTL::Heap* heap, const MTL4::UpdateSparseBufferMappingOperation* operations, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateBufferMappings_heap_operations_count_), buffer, heap, operations, count);
}
_MTL_INLINE void MTL4::CommandQueue::updateTextureMappings(const MTL::Texture* texture, const MTL::Heap* heap, const MTL4::UpdateSparseTextureMappingOperation* operations, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateTextureMappings_heap_operations_count_), texture, heap, operations, count);
}
_MTL_INLINE void MTL4::CommandQueue::wait(const MTL::Event* event, uint64_t value)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForEvent_value_), event, value);
}
_MTL_INLINE void MTL4::CommandQueue::wait(const MTL::Drawable* drawable)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForDrawable_), drawable);
}

View File

@@ -1,62 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CommitFeedback.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <CoreFoundation/CoreFoundation.h>
#include <functional>
namespace MTL4
{
class CommitFeedback;
using CommitFeedbackHandler = void (^)(MTL4::CommitFeedback*);
using CommitFeedbackHandlerFunction = std::function<void(MTL4::CommitFeedback*)>;
class CommitFeedback : public NS::Referencing<CommitFeedback>
{
public:
CFTimeInterval GPUEndTime() const;
CFTimeInterval GPUStartTime() const;
NS::Error* error() const;
};
}
_MTL_INLINE CFTimeInterval MTL4::CommitFeedback::GPUEndTime() const
{
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUEndTime));
}
_MTL_INLINE CFTimeInterval MTL4::CommitFeedback::GPUStartTime() const
{
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUStartTime));
}
_MTL_INLINE NS::Error* MTL4::CommitFeedback::error() const
{
return Object::sendMessage<NS::Error*>(this, _MTL_PRIVATE_SEL(error));
}

View File

@@ -1,345 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4Compiler.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLDevice.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <functional>
namespace MTL4
{
class BinaryFunction;
class BinaryFunctionDescriptor;
class CompilerDescriptor;
class CompilerTask;
class CompilerTaskOptions;
class ComputePipelineDescriptor;
class LibraryDescriptor;
class MachineLearningPipelineDescriptor;
class MachineLearningPipelineState;
class PipelineDataSetSerializer;
class PipelineDescriptor;
class PipelineStageDynamicLinkingDescriptor;
class RenderPipelineDynamicLinkingDescriptor;
}
namespace MTL
{
class ComputePipelineState;
class Device;
class DynamicLibrary;
class Library;
class RenderPipelineState;
using NewDynamicLibraryCompletionHandler = void (^)(MTL::DynamicLibrary*, NS::Error*);
using NewDynamicLibraryCompletionHandlerFunction = std::function<void(MTL::DynamicLibrary*, NS::Error*)>;
}
namespace MTL4
{
using NewComputePipelineStateCompletionHandler = void (^)(MTL::ComputePipelineState*, NS::Error*);
using NewComputePipelineStateCompletionHandlerFunction = std::function<void(MTL::ComputePipelineState*, NS::Error*)>;
using NewRenderPipelineStateCompletionHandler = void (^)(MTL::RenderPipelineState*, NS::Error*);
using NewRenderPipelineStateCompletionHandlerFunction = std::function<void(MTL::RenderPipelineState*, NS::Error*)>;
using NewBinaryFunctionCompletionHandler = void (^)(MTL4::BinaryFunction*, NS::Error*);
using NewBinaryFunctionCompletionHandlerFunction = std::function<void(MTL4::BinaryFunction*, NS::Error*)>;
using NewMachineLearningPipelineStateCompletionHandler = void (^)(MTL4::MachineLearningPipelineState*, NS::Error*);
using NewMachineLearningPipelineStateCompletionHandlerFunction = std::function<void(MTL4::MachineLearningPipelineState*, NS::Error*)>;
class CompilerDescriptor : public NS::Copying<CompilerDescriptor>
{
public:
static CompilerDescriptor* alloc();
CompilerDescriptor* init();
NS::String* label() const;
PipelineDataSetSerializer* pipelineDataSetSerializer() const;
void setLabel(const NS::String* label);
void setPipelineDataSetSerializer(const MTL4::PipelineDataSetSerializer* pipelineDataSetSerializer);
};
class CompilerTaskOptions : public NS::Copying<CompilerTaskOptions>
{
public:
static CompilerTaskOptions* alloc();
CompilerTaskOptions* init();
NS::Array* lookupArchives() const;
void setLookupArchives(const NS::Array* lookupArchives);
};
class Compiler : public NS::Referencing<Compiler>
{
public:
MTL::Device* device() const;
NS::String* label() const;
BinaryFunction* newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);
CompilerTask* newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL4::NewBinaryFunctionCompletionHandler completionHandler);
MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);
MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);
CompilerTask* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewComputePipelineStateCompletionHandler completionHandler);
CompilerTask* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewComputePipelineStateCompletionHandler completionHandler);
CompilerTask* newComputePipelineState(const MTL4::ComputePipelineDescriptor* pDescriptor, const MTL4::CompilerTaskOptions* options, const MTL4::NewComputePipelineStateCompletionHandlerFunction& function);
MTL::DynamicLibrary* newDynamicLibrary(const MTL::Library* library, NS::Error** error);
MTL::DynamicLibrary* newDynamicLibrary(const NS::URL* url, NS::Error** error);
CompilerTask* newDynamicLibrary(const MTL::Library* library, const MTL::NewDynamicLibraryCompletionHandler completionHandler);
CompilerTask* newDynamicLibrary(const NS::URL* url, const MTL::NewDynamicLibraryCompletionHandler completionHandler);
CompilerTask* newDynamicLibrary(const MTL::Library* pLibrary, const MTL::NewDynamicLibraryCompletionHandlerFunction& function);
CompilerTask* newDynamicLibrary(const NS::URL* pURL, const MTL::NewDynamicLibraryCompletionHandlerFunction& function);
MTL::Library* newLibrary(const MTL4::LibraryDescriptor* descriptor, NS::Error** error);
CompilerTask* newLibrary(const MTL4::LibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler);
CompilerTask* newLibrary(const MTL4::LibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& function);
MachineLearningPipelineState* newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* descriptor, NS::Error** error);
CompilerTask* newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* descriptor, const MTL4::NewMachineLearningPipelineStateCompletionHandler completionHandler);
CompilerTask* newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* pDescriptor, const MTL4::NewMachineLearningPipelineStateCompletionHandlerFunction& function);
MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);
MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);
CompilerTask* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);
CompilerTask* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);
CompilerTask* newRenderPipelineState(const MTL4::PipelineDescriptor* pDescriptor, const MTL4::CompilerTaskOptions* options, const MTL4::NewRenderPipelineStateCompletionHandlerFunction& function);
MTL::RenderPipelineState* newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* descriptor, const MTL::RenderPipelineState* pipeline, NS::Error** error);
CompilerTask* newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* descriptor, const MTL::RenderPipelineState* pipeline, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);
CompilerTask* newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* pDescriptor, const MTL::RenderPipelineState* pPipeline, const MTL4::NewRenderPipelineStateCompletionHandlerFunction& function);
PipelineDataSetSerializer* pipelineDataSetSerializer() const;
};
}
_MTL_INLINE MTL4::CompilerDescriptor* MTL4::CompilerDescriptor::alloc()
{
return NS::Object::alloc<MTL4::CompilerDescriptor>(_MTL_PRIVATE_CLS(MTL4CompilerDescriptor));
}
_MTL_INLINE MTL4::CompilerDescriptor* MTL4::CompilerDescriptor::init()
{
return NS::Object::init<MTL4::CompilerDescriptor>();
}
_MTL_INLINE NS::String* MTL4::CompilerDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::PipelineDataSetSerializer* MTL4::CompilerDescriptor::pipelineDataSetSerializer() const
{
return Object::sendMessage<MTL4::PipelineDataSetSerializer*>(this, _MTL_PRIVATE_SEL(pipelineDataSetSerializer));
}
_MTL_INLINE void MTL4::CompilerDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::CompilerDescriptor::setPipelineDataSetSerializer(const MTL4::PipelineDataSetSerializer* pipelineDataSetSerializer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPipelineDataSetSerializer_), pipelineDataSetSerializer);
}
_MTL_INLINE MTL4::CompilerTaskOptions* MTL4::CompilerTaskOptions::alloc()
{
return NS::Object::alloc<MTL4::CompilerTaskOptions>(_MTL_PRIVATE_CLS(MTL4CompilerTaskOptions));
}
_MTL_INLINE MTL4::CompilerTaskOptions* MTL4::CompilerTaskOptions::init()
{
return NS::Object::init<MTL4::CompilerTaskOptions>();
}
_MTL_INLINE NS::Array* MTL4::CompilerTaskOptions::lookupArchives() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(lookupArchives));
}
_MTL_INLINE void MTL4::CompilerTaskOptions::setLookupArchives(const NS::Array* lookupArchives)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLookupArchives_), lookupArchives);
}
_MTL_INLINE MTL::Device* MTL4::Compiler::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::String* MTL4::Compiler::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::BinaryFunction* MTL4::Compiler::newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error)
{
return Object::sendMessage<MTL4::BinaryFunction*>(this, _MTL_PRIVATE_SEL(newBinaryFunctionWithDescriptor_compilerTaskOptions_error_), descriptor, compilerTaskOptions, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL4::NewBinaryFunctionCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newBinaryFunctionWithDescriptor_compilerTaskOptions_completionHandler_), descriptor, compilerTaskOptions, completionHandler);
}
_MTL_INLINE MTL::ComputePipelineState* MTL4::Compiler::newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error)
{
return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_compilerTaskOptions_error_), descriptor, compilerTaskOptions, error);
}
_MTL_INLINE MTL::ComputePipelineState* MTL4::Compiler::newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error)
{
return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_error_), descriptor, dynamicLinkingDescriptor, compilerTaskOptions, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewComputePipelineStateCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_compilerTaskOptions_completionHandler_), descriptor, compilerTaskOptions, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewComputePipelineStateCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_completionHandler_), descriptor, dynamicLinkingDescriptor, compilerTaskOptions, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newComputePipelineState(const MTL4::ComputePipelineDescriptor* pDescriptor, const MTL4::CompilerTaskOptions* options, const MTL4::NewComputePipelineStateCompletionHandlerFunction& function)
{
__block MTL4::NewComputePipelineStateCompletionHandlerFunction blockFunction = function;
return newComputePipelineState(pDescriptor, options, ^(MTL::ComputePipelineState* pPipeline, NS::Error* pError) { blockFunction(pPipeline, pError); });
}
_MTL_INLINE MTL::DynamicLibrary* MTL4::Compiler::newDynamicLibrary(const MTL::Library* library, NS::Error** error)
{
return Object::sendMessage<MTL::DynamicLibrary*>(this, _MTL_PRIVATE_SEL(newDynamicLibrary_error_), library, error);
}
_MTL_INLINE MTL::DynamicLibrary* MTL4::Compiler::newDynamicLibrary(const NS::URL* url, NS::Error** error)
{
return Object::sendMessage<MTL::DynamicLibrary*>(this, _MTL_PRIVATE_SEL(newDynamicLibraryWithURL_error_), url, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newDynamicLibrary(const MTL::Library* library, const MTL::NewDynamicLibraryCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newDynamicLibrary_completionHandler_), library, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newDynamicLibrary(const NS::URL* url, const MTL::NewDynamicLibraryCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newDynamicLibraryWithURL_completionHandler_), url, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newDynamicLibrary(const MTL::Library* pLibrary, const MTL::NewDynamicLibraryCompletionHandlerFunction& function)
{
__block MTL::NewDynamicLibraryCompletionHandlerFunction blockFunction = function;
return newDynamicLibrary(pLibrary, ^(MTL::DynamicLibrary* pLibraryRef, NS::Error* pError) { blockFunction(pLibraryRef, pError); });
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newDynamicLibrary(const NS::URL* pURL, const MTL::NewDynamicLibraryCompletionHandlerFunction& function)
{
__block MTL::NewDynamicLibraryCompletionHandlerFunction blockFunction = function;
return newDynamicLibrary(pURL, ^(MTL::DynamicLibrary* pLibrary, NS::Error* pError) { blockFunction(pLibrary, pError); });
}
_MTL_INLINE MTL::Library* MTL4::Compiler::newLibrary(const MTL4::LibraryDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newLibrary(const MTL4::LibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newLibraryWithDescriptor_completionHandler_), descriptor, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newLibrary(const MTL4::LibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& function)
{
__block MTL::NewLibraryCompletionHandlerFunction blockFunction = function;
return newLibrary(pDescriptor, ^(MTL::Library* pLibrary, NS::Error* pError) { blockFunction(pLibrary, pError); });
}
_MTL_INLINE MTL4::MachineLearningPipelineState* MTL4::Compiler::newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<MTL4::MachineLearningPipelineState*>(this, _MTL_PRIVATE_SEL(newMachineLearningPipelineStateWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* descriptor, const MTL4::NewMachineLearningPipelineStateCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newMachineLearningPipelineStateWithDescriptor_completionHandler_), descriptor, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* pDescriptor, const MTL4::NewMachineLearningPipelineStateCompletionHandlerFunction& function)
{
__block MTL4::NewMachineLearningPipelineStateCompletionHandlerFunction blockFunction = function;
return newMachineLearningPipelineState(pDescriptor, ^(MTL4::MachineLearningPipelineState* pPipeline, NS::Error* pError) { blockFunction(pPipeline, pError); });
}
_MTL_INLINE MTL::RenderPipelineState* MTL4::Compiler::newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error)
{
return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_compilerTaskOptions_error_), descriptor, compilerTaskOptions, error);
}
_MTL_INLINE MTL::RenderPipelineState* MTL4::Compiler::newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error)
{
return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_error_), descriptor, dynamicLinkingDescriptor, compilerTaskOptions, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewRenderPipelineStateCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_compilerTaskOptions_completionHandler_), descriptor, compilerTaskOptions, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewRenderPipelineStateCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_completionHandler_), descriptor, dynamicLinkingDescriptor, compilerTaskOptions, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newRenderPipelineState(const MTL4::PipelineDescriptor* pDescriptor, const MTL4::CompilerTaskOptions* options, const MTL4::NewRenderPipelineStateCompletionHandlerFunction& function)
{
__block MTL4::NewRenderPipelineStateCompletionHandlerFunction blockFunction = function;
return newRenderPipelineState(pDescriptor, options, ^(MTL::RenderPipelineState* pPipeline, NS::Error* pError) { blockFunction(pPipeline, pError); });
}
_MTL_INLINE MTL::RenderPipelineState* MTL4::Compiler::newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* descriptor, const MTL::RenderPipelineState* pipeline, NS::Error** error)
{
return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateBySpecializationWithDescriptor_pipeline_error_), descriptor, pipeline, error);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* descriptor, const MTL::RenderPipelineState* pipeline, const MTL::NewRenderPipelineStateCompletionHandler completionHandler)
{
return Object::sendMessage<MTL4::CompilerTask*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateBySpecializationWithDescriptor_pipeline_completionHandler_), descriptor, pipeline, completionHandler);
}
_MTL_INLINE MTL4::CompilerTask* MTL4::Compiler::newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* pDescriptor, const MTL::RenderPipelineState* pPipeline, const MTL4::NewRenderPipelineStateCompletionHandlerFunction& function)
{
__block MTL4::NewRenderPipelineStateCompletionHandlerFunction blockFunction = function;
return newRenderPipelineStateBySpecialization(pDescriptor, pPipeline, ^(MTL::RenderPipelineState* pPipelineRef, NS::Error* pError) { blockFunction(pPipelineRef, pError); });
}
_MTL_INLINE MTL4::PipelineDataSetSerializer* MTL4::Compiler::pipelineDataSetSerializer() const
{
return Object::sendMessage<MTL4::PipelineDataSetSerializer*>(this, _MTL_PRIVATE_SEL(pipelineDataSetSerializer));
}

View File

@@ -1,63 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CompilerTask.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class Compiler;
_MTL_ENUM(NS::Integer, CompilerTaskStatus) {
CompilerTaskStatusNone = 0,
CompilerTaskStatusScheduled = 1,
CompilerTaskStatusCompiling = 2,
CompilerTaskStatusFinished = 3,
};
class CompilerTask : public NS::Referencing<CompilerTask>
{
public:
Compiler* compiler() const;
CompilerTaskStatus status() const;
void waitUntilCompleted();
};
}
_MTL_INLINE MTL4::Compiler* MTL4::CompilerTask::compiler() const
{
return Object::sendMessage<MTL4::Compiler*>(this, _MTL_PRIVATE_SEL(compiler));
}
_MTL_INLINE MTL4::CompilerTaskStatus MTL4::CompilerTask::status() const
{
return Object::sendMessage<MTL4::CompilerTaskStatus>(this, _MTL_PRIVATE_SEL(status));
}
_MTL_INLINE void MTL4::CompilerTask::waitUntilCompleted()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilCompleted));
}

View File

@@ -1,300 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4ComputeCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4CommandEncoder.hpp"
#include "MTL4Counters.hpp"
#include "MTLAccelerationStructure.hpp"
#include "MTLAccelerationStructureTypes.hpp"
#include "MTLBlitCommandEncoder.hpp"
#include "MTLCommandEncoder.hpp"
#include "MTLDefines.hpp"
#include "MTLGPUAddress.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
#include <cstdint>
namespace MTL4
{
class AccelerationStructureDescriptor;
class ArgumentTable;
class CounterHeap;
}
namespace MTL
{
class AccelerationStructure;
class Buffer;
class ComputePipelineState;
class IndirectCommandBuffer;
class Tensor;
class TensorExtents;
class Texture;
}
namespace MTL4
{
class ComputeCommandEncoder : public NS::Referencing<ComputeCommandEncoder, CommandEncoder>
{
public:
void buildAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL4::BufferRange scratchBuffer);
void copyAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure);
void copyAndCompactAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure);
void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size);
void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options);
void copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions);
void copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options);
void copyIndirectCommandBuffer(const MTL::IndirectCommandBuffer* source, NS::Range sourceRange, const MTL::IndirectCommandBuffer* destination, NS::UInteger destinationIndex);
void dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);
void dispatchThreadgroups(MTL::GPUAddress indirectBuffer, MTL::Size threadsPerThreadgroup);
void dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);
void dispatchThreads(MTL::GPUAddress indirectBuffer);
void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);
void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, MTL::GPUAddress indirectRangeBuffer);
void fillBuffer(const MTL::Buffer* buffer, NS::Range range, uint8_t value);
void generateMipmaps(const MTL::Texture* texture);
void optimizeContentsForCPUAccess(const MTL::Texture* texture);
void optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);
void optimizeContentsForGPUAccess(const MTL::Texture* texture);
void optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);
void optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range range);
void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL4::BufferRange scratchBuffer);
void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL4::BufferRange scratchBuffer, MTL::AccelerationStructureRefitOptions options);
void resetCommandsInBuffer(const MTL::IndirectCommandBuffer* buffer, NS::Range range);
void setArgumentTable(const MTL4::ArgumentTable* argumentTable);
void setComputePipelineState(const MTL::ComputePipelineState* state);
void setImageblockWidth(NS::UInteger width, NS::UInteger height);
void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
MTL::Stages stages();
void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL4::BufferRange buffer);
void writeTimestamp(MTL4::TimestampGranularity granularity, const MTL4::CounterHeap* counterHeap, NS::UInteger index);
};
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::buildAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL4::BufferRange scratchBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(buildAccelerationStructure_descriptor_scratchBuffer_), accelerationStructure, descriptor, scratchBuffer);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyAccelerationStructure_toAccelerationStructure_), sourceAccelerationStructure, destinationAccelerationStructure);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyAndCompactAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyAndCompactAccelerationStructure_toAccelerationStructure_), sourceAccelerationStructure, destinationAccelerationStructure);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size_), sourceBuffer, sourceOffset, destinationBuffer, destinationOffset, size);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceBuffer, sourceOffset, sourceBytesPerRow, sourceBytesPerImage, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options_), sourceBuffer, sourceOffset, sourceBytesPerRow, sourceBytesPerImage, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin, options);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTensor_sourceOrigin_sourceDimensions_toTensor_destinationOrigin_destinationDimensions_), sourceTensor, sourceOrigin, sourceDimensions, destinationTensor, destinationOrigin, destinationDimensions);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_toTexture_), sourceTexture, destinationTexture);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount_), sourceTexture, sourceSlice, sourceLevel, destinationTexture, destinationSlice, destinationLevel, sliceCount, levelCount);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationBuffer, destinationOffset, destinationBytesPerRow, destinationBytesPerImage);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationBuffer, destinationOffset, destinationBytesPerRow, destinationBytesPerImage, options);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::copyIndirectCommandBuffer(const MTL::IndirectCommandBuffer* source, NS::Range sourceRange, const MTL::IndirectCommandBuffer* destination, NS::UInteger destinationIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyIndirectCommandBuffer_sourceRange_destination_destinationIndex_), source, sourceRange, destination, destinationIndex);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroups_threadsPerThreadgroup_), threadgroupsPerGrid, threadsPerThreadgroup);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::dispatchThreadgroups(MTL::GPUAddress indirectBuffer, MTL::Size threadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroupsWithIndirectBuffer_threadsPerThreadgroup_), indirectBuffer, threadsPerThreadgroup);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreads_threadsPerThreadgroup_), threadsPerGrid, threadsPerThreadgroup);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::dispatchThreads(MTL::GPUAddress indirectBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadsWithIndirectBuffer_), indirectBuffer);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_withRange_), indirectCommandBuffer, executionRange);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, MTL::GPUAddress indirectRangeBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_indirectBuffer_), indirectCommandbuffer, indirectRangeBuffer);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::fillBuffer(const MTL::Buffer* buffer, NS::Range range, uint8_t value)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(fillBuffer_range_value_), buffer, range, value);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::generateMipmaps(const MTL::Texture* texture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(generateMipmapsForTexture_), texture);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_), texture);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_slice_level_), texture, slice, level);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_), texture);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_slice_level_), texture, slice, level);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeIndirectCommandBuffer_withRange_), indirectCommandBuffer, range);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL4::BufferRange scratchBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL4::BufferRange scratchBuffer, MTL::AccelerationStructureRefitOptions options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_options_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer, options);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::resetCommandsInBuffer(const MTL::IndirectCommandBuffer* buffer, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetCommandsInBuffer_withRange_), buffer, range);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::setArgumentTable(const MTL4::ArgumentTable* argumentTable)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentTable_), argumentTable);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::setComputePipelineState(const MTL::ComputePipelineState* state)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_), state);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::setImageblockWidth(NS::UInteger width, NS::UInteger height)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockWidth_height_), width, height);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_atIndex_), length, index);
}
_MTL_INLINE MTL::Stages MTL4::ComputeCommandEncoder::stages()
{
return Object::sendMessage<MTL::Stages>(this, _MTL_PRIVATE_SEL(stages));
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL4::BufferRange buffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeCompactedAccelerationStructureSize_toBuffer_), accelerationStructure, buffer);
}
_MTL_INLINE void MTL4::ComputeCommandEncoder::writeTimestamp(MTL4::TimestampGranularity granularity, const MTL4::CounterHeap* counterHeap, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeTimestampWithGranularity_intoHeap_atIndex_), granularity, counterHeap, index);
}

View File

@@ -1,158 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4ComputePipeline.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4PipelineState.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
namespace MTL4
{
class ComputePipelineDescriptor;
class FunctionDescriptor;
class StaticLinkingDescriptor;
class ComputePipelineDescriptor : public NS::Copying<ComputePipelineDescriptor, PipelineDescriptor>
{
public:
static ComputePipelineDescriptor* alloc();
FunctionDescriptor* computeFunctionDescriptor() const;
ComputePipelineDescriptor* init();
NS::UInteger maxTotalThreadsPerThreadgroup() const;
MTL::Size requiredThreadsPerThreadgroup() const;
void reset();
void setComputeFunctionDescriptor(const MTL4::FunctionDescriptor* computeFunctionDescriptor);
void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
void setRequiredThreadsPerThreadgroup(MTL::Size requiredThreadsPerThreadgroup);
void setStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* staticLinkingDescriptor);
void setSupportBinaryLinking(bool supportBinaryLinking);
void setSupportIndirectCommandBuffers(MTL4::IndirectCommandBufferSupportState supportIndirectCommandBuffers);
void setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth);
StaticLinkingDescriptor* staticLinkingDescriptor() const;
bool supportBinaryLinking() const;
IndirectCommandBufferSupportState supportIndirectCommandBuffers() const;
bool threadGroupSizeIsMultipleOfThreadExecutionWidth() const;
};
}
_MTL_INLINE MTL4::ComputePipelineDescriptor* MTL4::ComputePipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL4::ComputePipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4ComputePipelineDescriptor));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::ComputePipelineDescriptor::computeFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(computeFunctionDescriptor));
}
_MTL_INLINE MTL4::ComputePipelineDescriptor* MTL4::ComputePipelineDescriptor::init()
{
return NS::Object::init<MTL4::ComputePipelineDescriptor>();
}
_MTL_INLINE NS::UInteger MTL4::ComputePipelineDescriptor::maxTotalThreadsPerThreadgroup() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
}
_MTL_INLINE MTL::Size MTL4::ComputePipelineDescriptor::requiredThreadsPerThreadgroup() const
{
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(requiredThreadsPerThreadgroup));
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setComputeFunctionDescriptor(const MTL4::FunctionDescriptor* computeFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputeFunctionDescriptor_), computeFunctionDescriptor);
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setRequiredThreadsPerThreadgroup(MTL::Size requiredThreadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRequiredThreadsPerThreadgroup_), requiredThreadsPerThreadgroup);
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* staticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStaticLinkingDescriptor_), staticLinkingDescriptor);
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setSupportBinaryLinking(bool supportBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportBinaryLinking_), supportBinaryLinking);
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setSupportIndirectCommandBuffers(MTL4::IndirectCommandBufferSupportState supportIndirectCommandBuffers)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
}
_MTL_INLINE void MTL4::ComputePipelineDescriptor::setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadGroupSizeIsMultipleOfThreadExecutionWidth_), threadGroupSizeIsMultipleOfThreadExecutionWidth);
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::ComputePipelineDescriptor::staticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(staticLinkingDescriptor));
}
_MTL_INLINE bool MTL4::ComputePipelineDescriptor::supportBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportBinaryLinking));
}
_MTL_INLINE MTL4::IndirectCommandBufferSupportState MTL4::ComputePipelineDescriptor::supportIndirectCommandBuffers() const
{
return Object::sendMessage<MTL4::IndirectCommandBufferSupportState>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
}
_MTL_INLINE bool MTL4::ComputePipelineDescriptor::threadGroupSizeIsMultipleOfThreadExecutionWidth() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(threadGroupSizeIsMultipleOfThreadExecutionWidth));
}

View File

@@ -1,138 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4Counters.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <cstdint>
#include <cstdint>
namespace MTL4
{
class CounterHeapDescriptor;
_MTL_ENUM(NS::Integer, CounterHeapType) {
CounterHeapTypeInvalid,
CounterHeapTypeTimestamp,
};
_MTL_ENUM(NS::Integer, TimestampGranularity) {
TimestampGranularityRelaxed = 0,
TimestampGranularityPrecise = 1,
};
struct TimestampHeapEntry
{
uint64_t timestamp;
} _MTL_PACKED;
class CounterHeapDescriptor : public NS::Copying<CounterHeapDescriptor>
{
public:
static CounterHeapDescriptor* alloc();
NS::UInteger count() const;
CounterHeapDescriptor* init();
void setCount(NS::UInteger count);
void setType(MTL4::CounterHeapType type);
CounterHeapType type() const;
};
class CounterHeap : public NS::Referencing<CounterHeap>
{
public:
NS::UInteger count() const;
void invalidateCounterRange(NS::Range range);
NS::String* label() const;
NS::Data* resolveCounterRange(NS::Range range);
void setLabel(const NS::String* label);
CounterHeapType type() const;
};
}
_MTL_INLINE MTL4::CounterHeapDescriptor* MTL4::CounterHeapDescriptor::alloc()
{
return NS::Object::alloc<MTL4::CounterHeapDescriptor>(_MTL_PRIVATE_CLS(MTL4CounterHeapDescriptor));
}
_MTL_INLINE NS::UInteger MTL4::CounterHeapDescriptor::count() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(count));
}
_MTL_INLINE MTL4::CounterHeapDescriptor* MTL4::CounterHeapDescriptor::init()
{
return NS::Object::init<MTL4::CounterHeapDescriptor>();
}
_MTL_INLINE void MTL4::CounterHeapDescriptor::setCount(NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCount_), count);
}
_MTL_INLINE void MTL4::CounterHeapDescriptor::setType(MTL4::CounterHeapType type)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
}
_MTL_INLINE MTL4::CounterHeapType MTL4::CounterHeapDescriptor::type() const
{
return Object::sendMessage<MTL4::CounterHeapType>(this, _MTL_PRIVATE_SEL(type));
}
_MTL_INLINE NS::UInteger MTL4::CounterHeap::count() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(count));
}
_MTL_INLINE void MTL4::CounterHeap::invalidateCounterRange(NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(invalidateCounterRange_), range);
}
_MTL_INLINE NS::String* MTL4::CounterHeap::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE NS::Data* MTL4::CounterHeap::resolveCounterRange(NS::Range range)
{
return Object::sendMessage<NS::Data*>(this, _MTL_PRIVATE_SEL(resolveCounterRange_), range);
}
_MTL_INLINE void MTL4::CounterHeap::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE MTL4::CounterHeapType MTL4::CounterHeap::type() const
{
return Object::sendMessage<MTL4::CounterHeapType>(this, _MTL_PRIVATE_SEL(type));
}

View File

@@ -1,49 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal//MTL4FunctionDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class FunctionDescriptor;
class FunctionDescriptor : public NS::Copying<FunctionDescriptor>
{
public:
static FunctionDescriptor* alloc();
FunctionDescriptor* init();
};
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::FunctionDescriptor::alloc()
{
return NS::Object::alloc<MTL4::FunctionDescriptor>(_MTL_PRIVATE_CLS(MTL4FunctionDescriptor));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::FunctionDescriptor::init()
{
return NS::Object::init<MTL4::FunctionDescriptor>();
}

View File

@@ -1,98 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4LibraryDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class LibraryDescriptor;
}
namespace MTL
{
class CompileOptions;
}
namespace MTL4
{
class LibraryDescriptor : public NS::Copying<LibraryDescriptor>
{
public:
static LibraryDescriptor* alloc();
LibraryDescriptor* init();
NS::String* name() const;
MTL::CompileOptions* options() const;
void setName(const NS::String* name);
void setOptions(const MTL::CompileOptions* options);
void setSource(const NS::String* source);
NS::String* source() const;
};
}
_MTL_INLINE MTL4::LibraryDescriptor* MTL4::LibraryDescriptor::alloc()
{
return NS::Object::alloc<MTL4::LibraryDescriptor>(_MTL_PRIVATE_CLS(MTL4LibraryDescriptor));
}
_MTL_INLINE MTL4::LibraryDescriptor* MTL4::LibraryDescriptor::init()
{
return NS::Object::init<MTL4::LibraryDescriptor>();
}
_MTL_INLINE NS::String* MTL4::LibraryDescriptor::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE MTL::CompileOptions* MTL4::LibraryDescriptor::options() const
{
return Object::sendMessage<MTL::CompileOptions*>(this, _MTL_PRIVATE_SEL(options));
}
_MTL_INLINE void MTL4::LibraryDescriptor::setName(const NS::String* name)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
}
_MTL_INLINE void MTL4::LibraryDescriptor::setOptions(const MTL::CompileOptions* options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
}
_MTL_INLINE void MTL4::LibraryDescriptor::setSource(const NS::String* source)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSource_), source);
}
_MTL_INLINE NS::String* MTL4::LibraryDescriptor::source() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(source));
}

View File

@@ -1,86 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4LibraryFunctionDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4FunctionDescriptor.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class LibraryFunctionDescriptor;
}
namespace MTL
{
class Library;
}
namespace MTL4
{
class LibraryFunctionDescriptor : public NS::Copying<LibraryFunctionDescriptor, FunctionDescriptor>
{
public:
static LibraryFunctionDescriptor* alloc();
LibraryFunctionDescriptor* init();
MTL::Library* library() const;
NS::String* name() const;
void setLibrary(const MTL::Library* library);
void setName(const NS::String* name);
};
}
_MTL_INLINE MTL4::LibraryFunctionDescriptor* MTL4::LibraryFunctionDescriptor::alloc()
{
return NS::Object::alloc<MTL4::LibraryFunctionDescriptor>(_MTL_PRIVATE_CLS(MTL4LibraryFunctionDescriptor));
}
_MTL_INLINE MTL4::LibraryFunctionDescriptor* MTL4::LibraryFunctionDescriptor::init()
{
return NS::Object::init<MTL4::LibraryFunctionDescriptor>();
}
_MTL_INLINE MTL::Library* MTL4::LibraryFunctionDescriptor::library() const
{
return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(library));
}
_MTL_INLINE NS::String* MTL4::LibraryFunctionDescriptor::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE void MTL4::LibraryFunctionDescriptor::setLibrary(const MTL::Library* library)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLibrary_), library);
}
_MTL_INLINE void MTL4::LibraryFunctionDescriptor::setName(const NS::String* name)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
}

View File

@@ -1,204 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4LinkingDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class PipelineStageDynamicLinkingDescriptor;
class RenderPipelineDynamicLinkingDescriptor;
class StaticLinkingDescriptor;
class StaticLinkingDescriptor : public NS::Copying<StaticLinkingDescriptor>
{
public:
static StaticLinkingDescriptor* alloc();
NS::Array* functionDescriptors() const;
NS::Dictionary* groups() const;
StaticLinkingDescriptor* init();
NS::Array* privateFunctionDescriptors() const;
void setFunctionDescriptors(const NS::Array* functionDescriptors);
void setGroups(const NS::Dictionary* groups);
void setPrivateFunctionDescriptors(const NS::Array* privateFunctionDescriptors);
};
class PipelineStageDynamicLinkingDescriptor : public NS::Copying<PipelineStageDynamicLinkingDescriptor>
{
public:
static PipelineStageDynamicLinkingDescriptor* alloc();
NS::Array* binaryLinkedFunctions() const;
PipelineStageDynamicLinkingDescriptor* init();
NS::UInteger maxCallStackDepth() const;
NS::Array* preloadedLibraries() const;
void setBinaryLinkedFunctions(const NS::Array* binaryLinkedFunctions);
void setMaxCallStackDepth(NS::UInteger maxCallStackDepth);
void setPreloadedLibraries(const NS::Array* preloadedLibraries);
};
class RenderPipelineDynamicLinkingDescriptor : public NS::Copying<RenderPipelineDynamicLinkingDescriptor>
{
public:
static RenderPipelineDynamicLinkingDescriptor* alloc();
PipelineStageDynamicLinkingDescriptor* fragmentLinkingDescriptor() const;
RenderPipelineDynamicLinkingDescriptor* init();
PipelineStageDynamicLinkingDescriptor* meshLinkingDescriptor() const;
PipelineStageDynamicLinkingDescriptor* objectLinkingDescriptor() const;
PipelineStageDynamicLinkingDescriptor* tileLinkingDescriptor() const;
PipelineStageDynamicLinkingDescriptor* vertexLinkingDescriptor() const;
};
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::StaticLinkingDescriptor::alloc()
{
return NS::Object::alloc<MTL4::StaticLinkingDescriptor>(_MTL_PRIVATE_CLS(MTL4StaticLinkingDescriptor));
}
_MTL_INLINE NS::Array* MTL4::StaticLinkingDescriptor::functionDescriptors() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionDescriptors));
}
_MTL_INLINE NS::Dictionary* MTL4::StaticLinkingDescriptor::groups() const
{
return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(groups));
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::StaticLinkingDescriptor::init()
{
return NS::Object::init<MTL4::StaticLinkingDescriptor>();
}
_MTL_INLINE NS::Array* MTL4::StaticLinkingDescriptor::privateFunctionDescriptors() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(privateFunctionDescriptors));
}
_MTL_INLINE void MTL4::StaticLinkingDescriptor::setFunctionDescriptors(const NS::Array* functionDescriptors)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionDescriptors_), functionDescriptors);
}
_MTL_INLINE void MTL4::StaticLinkingDescriptor::setGroups(const NS::Dictionary* groups)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setGroups_), groups);
}
_MTL_INLINE void MTL4::StaticLinkingDescriptor::setPrivateFunctionDescriptors(const NS::Array* privateFunctionDescriptors)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrivateFunctionDescriptors_), privateFunctionDescriptors);
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::PipelineStageDynamicLinkingDescriptor::alloc()
{
return NS::Object::alloc<MTL4::PipelineStageDynamicLinkingDescriptor>(_MTL_PRIVATE_CLS(MTL4PipelineStageDynamicLinkingDescriptor));
}
_MTL_INLINE NS::Array* MTL4::PipelineStageDynamicLinkingDescriptor::binaryLinkedFunctions() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryLinkedFunctions));
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::PipelineStageDynamicLinkingDescriptor::init()
{
return NS::Object::init<MTL4::PipelineStageDynamicLinkingDescriptor>();
}
_MTL_INLINE NS::UInteger MTL4::PipelineStageDynamicLinkingDescriptor::maxCallStackDepth() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCallStackDepth));
}
_MTL_INLINE NS::Array* MTL4::PipelineStageDynamicLinkingDescriptor::preloadedLibraries() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(preloadedLibraries));
}
_MTL_INLINE void MTL4::PipelineStageDynamicLinkingDescriptor::setBinaryLinkedFunctions(const NS::Array* binaryLinkedFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryLinkedFunctions_), binaryLinkedFunctions);
}
_MTL_INLINE void MTL4::PipelineStageDynamicLinkingDescriptor::setMaxCallStackDepth(NS::UInteger maxCallStackDepth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCallStackDepth_), maxCallStackDepth);
}
_MTL_INLINE void MTL4::PipelineStageDynamicLinkingDescriptor::setPreloadedLibraries(const NS::Array* preloadedLibraries)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreloadedLibraries_), preloadedLibraries);
}
_MTL_INLINE MTL4::RenderPipelineDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::alloc()
{
return NS::Object::alloc<MTL4::RenderPipelineDynamicLinkingDescriptor>(_MTL_PRIVATE_CLS(MTL4RenderPipelineDynamicLinkingDescriptor));
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::fragmentLinkingDescriptor() const
{
return Object::sendMessage<MTL4::PipelineStageDynamicLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(fragmentLinkingDescriptor));
}
_MTL_INLINE MTL4::RenderPipelineDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::init()
{
return NS::Object::init<MTL4::RenderPipelineDynamicLinkingDescriptor>();
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::meshLinkingDescriptor() const
{
return Object::sendMessage<MTL4::PipelineStageDynamicLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(meshLinkingDescriptor));
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::objectLinkingDescriptor() const
{
return Object::sendMessage<MTL4::PipelineStageDynamicLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(objectLinkingDescriptor));
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::tileLinkingDescriptor() const
{
return Object::sendMessage<MTL4::PipelineStageDynamicLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(tileLinkingDescriptor));
}
_MTL_INLINE MTL4::PipelineStageDynamicLinkingDescriptor* MTL4::RenderPipelineDynamicLinkingDescriptor::vertexLinkingDescriptor() const
{
return Object::sendMessage<MTL4::PipelineStageDynamicLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(vertexLinkingDescriptor));
}

View File

@@ -1,66 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4MachineLearningCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4CommandEncoder.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class ArgumentTable;
class MachineLearningPipelineState;
}
namespace MTL
{
class Heap;
}
namespace MTL4
{
class MachineLearningCommandEncoder : public NS::Referencing<MachineLearningCommandEncoder, CommandEncoder>
{
public:
void dispatchNetwork(const MTL::Heap* heap);
void setArgumentTable(const MTL4::ArgumentTable* argumentTable);
void setPipelineState(const MTL4::MachineLearningPipelineState* pipelineState);
};
}
_MTL_INLINE void MTL4::MachineLearningCommandEncoder::dispatchNetwork(const MTL::Heap* heap)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchNetworkWithIntermediatesHeap_), heap);
}
_MTL_INLINE void MTL4::MachineLearningCommandEncoder::setArgumentTable(const MTL4::ArgumentTable* argumentTable)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentTable_), argumentTable);
}
_MTL_INLINE void MTL4::MachineLearningCommandEncoder::setPipelineState(const MTL4::MachineLearningPipelineState* pipelineState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPipelineState_), pipelineState);
}

View File

@@ -1,172 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4MachineLearningPipeline.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4PipelineState.hpp"
#include "MTLAllocation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class FunctionDescriptor;
class MachineLearningPipelineDescriptor;
class MachineLearningPipelineReflection;
}
namespace MTL
{
class Device;
class TensorExtents;
}
namespace MTL4
{
class MachineLearningPipelineDescriptor : public NS::Copying<MachineLearningPipelineDescriptor, PipelineDescriptor>
{
public:
static MachineLearningPipelineDescriptor* alloc();
MachineLearningPipelineDescriptor* init();
MTL::TensorExtents* inputDimensionsAtBufferIndex(NS::Integer bufferIndex);
NS::String* label() const;
FunctionDescriptor* machineLearningFunctionDescriptor() const;
void reset();
void setInputDimensions(const MTL::TensorExtents* dimensions, NS::Integer bufferIndex);
void setInputDimensions(const NS::Array* dimensions, NS::Range range);
void setLabel(const NS::String* label);
void setMachineLearningFunctionDescriptor(const MTL4::FunctionDescriptor* machineLearningFunctionDescriptor);
};
class MachineLearningPipelineReflection : public NS::Referencing<MachineLearningPipelineReflection>
{
public:
static MachineLearningPipelineReflection* alloc();
NS::Array* bindings() const;
MachineLearningPipelineReflection* init();
};
class MachineLearningPipelineState : public NS::Referencing<MachineLearningPipelineState, MTL::Allocation>
{
public:
MTL::Device* device() const;
NS::UInteger intermediatesHeapSize() const;
NS::String* label() const;
MachineLearningPipelineReflection* reflection() const;
};
}
_MTL_INLINE MTL4::MachineLearningPipelineDescriptor* MTL4::MachineLearningPipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL4::MachineLearningPipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4MachineLearningPipelineDescriptor));
}
_MTL_INLINE MTL4::MachineLearningPipelineDescriptor* MTL4::MachineLearningPipelineDescriptor::init()
{
return NS::Object::init<MTL4::MachineLearningPipelineDescriptor>();
}
_MTL_INLINE MTL::TensorExtents* MTL4::MachineLearningPipelineDescriptor::inputDimensionsAtBufferIndex(NS::Integer bufferIndex)
{
return Object::sendMessage<MTL::TensorExtents*>(this, _MTL_PRIVATE_SEL(inputDimensionsAtBufferIndex_), bufferIndex);
}
_MTL_INLINE NS::String* MTL4::MachineLearningPipelineDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::MachineLearningPipelineDescriptor::machineLearningFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(machineLearningFunctionDescriptor));
}
_MTL_INLINE void MTL4::MachineLearningPipelineDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::MachineLearningPipelineDescriptor::setInputDimensions(const MTL::TensorExtents* dimensions, NS::Integer bufferIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInputDimensions_atBufferIndex_), dimensions, bufferIndex);
}
_MTL_INLINE void MTL4::MachineLearningPipelineDescriptor::setInputDimensions(const NS::Array* dimensions, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInputDimensions_withRange_), dimensions, range);
}
_MTL_INLINE void MTL4::MachineLearningPipelineDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::MachineLearningPipelineDescriptor::setMachineLearningFunctionDescriptor(const MTL4::FunctionDescriptor* machineLearningFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMachineLearningFunctionDescriptor_), machineLearningFunctionDescriptor);
}
_MTL_INLINE MTL4::MachineLearningPipelineReflection* MTL4::MachineLearningPipelineReflection::alloc()
{
return NS::Object::alloc<MTL4::MachineLearningPipelineReflection>(_MTL_PRIVATE_CLS(MTL4MachineLearningPipelineReflection));
}
_MTL_INLINE NS::Array* MTL4::MachineLearningPipelineReflection::bindings() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(bindings));
}
_MTL_INLINE MTL4::MachineLearningPipelineReflection* MTL4::MachineLearningPipelineReflection::init()
{
return NS::Object::init<MTL4::MachineLearningPipelineReflection>();
}
_MTL_INLINE MTL::Device* MTL4::MachineLearningPipelineState::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::UInteger MTL4::MachineLearningPipelineState::intermediatesHeapSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(intermediatesHeapSize));
}
_MTL_INLINE NS::String* MTL4::MachineLearningPipelineState::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::MachineLearningPipelineReflection* MTL4::MachineLearningPipelineState::reflection() const
{
return Object::sendMessage<MTL4::MachineLearningPipelineReflection*>(this, _MTL_PRIVATE_SEL(reflection));
}

View File

@@ -1,413 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4MeshRenderPipeline.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4PipelineState.hpp"
#include "MTL4RenderPipeline.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
namespace MTL4
{
class FunctionDescriptor;
class MeshRenderPipelineDescriptor;
class RenderPipelineColorAttachmentDescriptorArray;
class StaticLinkingDescriptor;
class MeshRenderPipelineDescriptor : public NS::Copying<MeshRenderPipelineDescriptor, PipelineDescriptor>
{
public:
static MeshRenderPipelineDescriptor* alloc();
AlphaToCoverageState alphaToCoverageState() const;
AlphaToOneState alphaToOneState() const;
LogicalToPhysicalColorAttachmentMappingState colorAttachmentMappingState() const;
RenderPipelineColorAttachmentDescriptorArray* colorAttachments() const;
FunctionDescriptor* fragmentFunctionDescriptor() const;
StaticLinkingDescriptor* fragmentStaticLinkingDescriptor() const;
MeshRenderPipelineDescriptor* init();
bool isRasterizationEnabled() const;
NS::UInteger maxTotalThreadgroupsPerMeshGrid() const;
NS::UInteger maxTotalThreadsPerMeshThreadgroup() const;
NS::UInteger maxTotalThreadsPerObjectThreadgroup() const;
NS::UInteger maxVertexAmplificationCount() const;
FunctionDescriptor* meshFunctionDescriptor() const;
StaticLinkingDescriptor* meshStaticLinkingDescriptor() const;
bool meshThreadgroupSizeIsMultipleOfThreadExecutionWidth() const;
FunctionDescriptor* objectFunctionDescriptor() const;
StaticLinkingDescriptor* objectStaticLinkingDescriptor() const;
bool objectThreadgroupSizeIsMultipleOfThreadExecutionWidth() const;
NS::UInteger payloadMemoryLength() const;
NS::UInteger rasterSampleCount() const;
[[deprecated("please use isRasterizationEnabled instead")]]
bool rasterizationEnabled() const;
MTL::Size requiredThreadsPerMeshThreadgroup() const;
MTL::Size requiredThreadsPerObjectThreadgroup() const;
void reset();
void setAlphaToCoverageState(MTL4::AlphaToCoverageState alphaToCoverageState);
void setAlphaToOneState(MTL4::AlphaToOneState alphaToOneState);
void setColorAttachmentMappingState(MTL4::LogicalToPhysicalColorAttachmentMappingState colorAttachmentMappingState);
void setFragmentFunctionDescriptor(const MTL4::FunctionDescriptor* fragmentFunctionDescriptor);
void setFragmentStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* fragmentStaticLinkingDescriptor);
void setMaxTotalThreadgroupsPerMeshGrid(NS::UInteger maxTotalThreadgroupsPerMeshGrid);
void setMaxTotalThreadsPerMeshThreadgroup(NS::UInteger maxTotalThreadsPerMeshThreadgroup);
void setMaxTotalThreadsPerObjectThreadgroup(NS::UInteger maxTotalThreadsPerObjectThreadgroup);
void setMaxVertexAmplificationCount(NS::UInteger maxVertexAmplificationCount);
void setMeshFunctionDescriptor(const MTL4::FunctionDescriptor* meshFunctionDescriptor);
void setMeshStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* meshStaticLinkingDescriptor);
void setMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth(bool meshThreadgroupSizeIsMultipleOfThreadExecutionWidth);
void setObjectFunctionDescriptor(const MTL4::FunctionDescriptor* objectFunctionDescriptor);
void setObjectStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* objectStaticLinkingDescriptor);
void setObjectThreadgroupSizeIsMultipleOfThreadExecutionWidth(bool objectThreadgroupSizeIsMultipleOfThreadExecutionWidth);
void setPayloadMemoryLength(NS::UInteger payloadMemoryLength);
void setRasterSampleCount(NS::UInteger rasterSampleCount);
void setRasterizationEnabled(bool rasterizationEnabled);
void setRequiredThreadsPerMeshThreadgroup(MTL::Size requiredThreadsPerMeshThreadgroup);
void setRequiredThreadsPerObjectThreadgroup(MTL::Size requiredThreadsPerObjectThreadgroup);
void setSupportFragmentBinaryLinking(bool supportFragmentBinaryLinking);
void setSupportIndirectCommandBuffers(MTL4::IndirectCommandBufferSupportState supportIndirectCommandBuffers);
void setSupportMeshBinaryLinking(bool supportMeshBinaryLinking);
void setSupportObjectBinaryLinking(bool supportObjectBinaryLinking);
bool supportFragmentBinaryLinking() const;
IndirectCommandBufferSupportState supportIndirectCommandBuffers() const;
bool supportMeshBinaryLinking() const;
bool supportObjectBinaryLinking() const;
};
}
_MTL_INLINE MTL4::MeshRenderPipelineDescriptor* MTL4::MeshRenderPipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL4::MeshRenderPipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4MeshRenderPipelineDescriptor));
}
_MTL_INLINE MTL4::AlphaToCoverageState MTL4::MeshRenderPipelineDescriptor::alphaToCoverageState() const
{
return Object::sendMessage<MTL4::AlphaToCoverageState>(this, _MTL_PRIVATE_SEL(alphaToCoverageState));
}
_MTL_INLINE MTL4::AlphaToOneState MTL4::MeshRenderPipelineDescriptor::alphaToOneState() const
{
return Object::sendMessage<MTL4::AlphaToOneState>(this, _MTL_PRIVATE_SEL(alphaToOneState));
}
_MTL_INLINE MTL4::LogicalToPhysicalColorAttachmentMappingState MTL4::MeshRenderPipelineDescriptor::colorAttachmentMappingState() const
{
return Object::sendMessage<MTL4::LogicalToPhysicalColorAttachmentMappingState>(this, _MTL_PRIVATE_SEL(colorAttachmentMappingState));
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptorArray* MTL4::MeshRenderPipelineDescriptor::colorAttachments() const
{
return Object::sendMessage<MTL4::RenderPipelineColorAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(colorAttachments));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::MeshRenderPipelineDescriptor::fragmentFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(fragmentFunctionDescriptor));
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::MeshRenderPipelineDescriptor::fragmentStaticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(fragmentStaticLinkingDescriptor));
}
_MTL_INLINE MTL4::MeshRenderPipelineDescriptor* MTL4::MeshRenderPipelineDescriptor::init()
{
return NS::Object::init<MTL4::MeshRenderPipelineDescriptor>();
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::isRasterizationEnabled() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRasterizationEnabled));
}
_MTL_INLINE NS::UInteger MTL4::MeshRenderPipelineDescriptor::maxTotalThreadgroupsPerMeshGrid() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadgroupsPerMeshGrid));
}
_MTL_INLINE NS::UInteger MTL4::MeshRenderPipelineDescriptor::maxTotalThreadsPerMeshThreadgroup() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerMeshThreadgroup));
}
_MTL_INLINE NS::UInteger MTL4::MeshRenderPipelineDescriptor::maxTotalThreadsPerObjectThreadgroup() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerObjectThreadgroup));
}
_MTL_INLINE NS::UInteger MTL4::MeshRenderPipelineDescriptor::maxVertexAmplificationCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxVertexAmplificationCount));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::MeshRenderPipelineDescriptor::meshFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(meshFunctionDescriptor));
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::MeshRenderPipelineDescriptor::meshStaticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(meshStaticLinkingDescriptor));
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::meshThreadgroupSizeIsMultipleOfThreadExecutionWidth() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(meshThreadgroupSizeIsMultipleOfThreadExecutionWidth));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::MeshRenderPipelineDescriptor::objectFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(objectFunctionDescriptor));
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::MeshRenderPipelineDescriptor::objectStaticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(objectStaticLinkingDescriptor));
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::objectThreadgroupSizeIsMultipleOfThreadExecutionWidth() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(objectThreadgroupSizeIsMultipleOfThreadExecutionWidth));
}
_MTL_INLINE NS::UInteger MTL4::MeshRenderPipelineDescriptor::payloadMemoryLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(payloadMemoryLength));
}
_MTL_INLINE NS::UInteger MTL4::MeshRenderPipelineDescriptor::rasterSampleCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(rasterSampleCount));
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::rasterizationEnabled() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRasterizationEnabled));
}
_MTL_INLINE MTL::Size MTL4::MeshRenderPipelineDescriptor::requiredThreadsPerMeshThreadgroup() const
{
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(requiredThreadsPerMeshThreadgroup));
}
_MTL_INLINE MTL::Size MTL4::MeshRenderPipelineDescriptor::requiredThreadsPerObjectThreadgroup() const
{
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(requiredThreadsPerObjectThreadgroup));
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setAlphaToCoverageState(MTL4::AlphaToCoverageState alphaToCoverageState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAlphaToCoverageState_), alphaToCoverageState);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setAlphaToOneState(MTL4::AlphaToOneState alphaToOneState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAlphaToOneState_), alphaToOneState);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setColorAttachmentMappingState(MTL4::LogicalToPhysicalColorAttachmentMappingState colorAttachmentMappingState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorAttachmentMappingState_), colorAttachmentMappingState);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setFragmentFunctionDescriptor(const MTL4::FunctionDescriptor* fragmentFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentFunctionDescriptor_), fragmentFunctionDescriptor);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setFragmentStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* fragmentStaticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentStaticLinkingDescriptor_), fragmentStaticLinkingDescriptor);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMaxTotalThreadgroupsPerMeshGrid(NS::UInteger maxTotalThreadgroupsPerMeshGrid)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadgroupsPerMeshGrid_), maxTotalThreadgroupsPerMeshGrid);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMaxTotalThreadsPerMeshThreadgroup(NS::UInteger maxTotalThreadsPerMeshThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerMeshThreadgroup_), maxTotalThreadsPerMeshThreadgroup);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMaxTotalThreadsPerObjectThreadgroup(NS::UInteger maxTotalThreadsPerObjectThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerObjectThreadgroup_), maxTotalThreadsPerObjectThreadgroup);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMaxVertexAmplificationCount(NS::UInteger maxVertexAmplificationCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxVertexAmplificationCount_), maxVertexAmplificationCount);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMeshFunctionDescriptor(const MTL4::FunctionDescriptor* meshFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMeshFunctionDescriptor_), meshFunctionDescriptor);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMeshStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* meshStaticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMeshStaticLinkingDescriptor_), meshStaticLinkingDescriptor);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth(bool meshThreadgroupSizeIsMultipleOfThreadExecutionWidth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth_), meshThreadgroupSizeIsMultipleOfThreadExecutionWidth);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setObjectFunctionDescriptor(const MTL4::FunctionDescriptor* objectFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectFunctionDescriptor_), objectFunctionDescriptor);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setObjectStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* objectStaticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectStaticLinkingDescriptor_), objectStaticLinkingDescriptor);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setObjectThreadgroupSizeIsMultipleOfThreadExecutionWidth(bool objectThreadgroupSizeIsMultipleOfThreadExecutionWidth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectThreadgroupSizeIsMultipleOfThreadExecutionWidth_), objectThreadgroupSizeIsMultipleOfThreadExecutionWidth);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setPayloadMemoryLength(NS::UInteger payloadMemoryLength)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPayloadMemoryLength_), payloadMemoryLength);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setRasterSampleCount(NS::UInteger rasterSampleCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterSampleCount_), rasterSampleCount);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setRasterizationEnabled(bool rasterizationEnabled)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterizationEnabled_), rasterizationEnabled);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setRequiredThreadsPerMeshThreadgroup(MTL::Size requiredThreadsPerMeshThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRequiredThreadsPerMeshThreadgroup_), requiredThreadsPerMeshThreadgroup);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setRequiredThreadsPerObjectThreadgroup(MTL::Size requiredThreadsPerObjectThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRequiredThreadsPerObjectThreadgroup_), requiredThreadsPerObjectThreadgroup);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setSupportFragmentBinaryLinking(bool supportFragmentBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportFragmentBinaryLinking_), supportFragmentBinaryLinking);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setSupportIndirectCommandBuffers(MTL4::IndirectCommandBufferSupportState supportIndirectCommandBuffers)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setSupportMeshBinaryLinking(bool supportMeshBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportMeshBinaryLinking_), supportMeshBinaryLinking);
}
_MTL_INLINE void MTL4::MeshRenderPipelineDescriptor::setSupportObjectBinaryLinking(bool supportObjectBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportObjectBinaryLinking_), supportObjectBinaryLinking);
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::supportFragmentBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportFragmentBinaryLinking));
}
_MTL_INLINE MTL4::IndirectCommandBufferSupportState MTL4::MeshRenderPipelineDescriptor::supportIndirectCommandBuffers() const
{
return Object::sendMessage<MTL4::IndirectCommandBufferSupportState>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::supportMeshBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportMeshBinaryLinking));
}
_MTL_INLINE bool MTL4::MeshRenderPipelineDescriptor::supportObjectBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportObjectBinaryLinking));
}

View File

@@ -1,85 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4PipelineDataSetSerializer.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class PipelineDataSetSerializerDescriptor;
_MTL_OPTIONS(NS::UInteger, PipelineDataSetSerializerConfiguration) {
PipelineDataSetSerializerConfigurationCaptureDescriptors = 1,
PipelineDataSetSerializerConfigurationCaptureBinaries = 1 << 1,
};
class PipelineDataSetSerializerDescriptor : public NS::Copying<PipelineDataSetSerializerDescriptor>
{
public:
static PipelineDataSetSerializerDescriptor* alloc();
PipelineDataSetSerializerConfiguration configuration() const;
PipelineDataSetSerializerDescriptor* init();
void setConfiguration(MTL4::PipelineDataSetSerializerConfiguration configuration);
};
class PipelineDataSetSerializer : public NS::Referencing<PipelineDataSetSerializer>
{
public:
bool serializeAsArchiveAndFlushToURL(const NS::URL* url, NS::Error** error);
NS::Data* serializeAsPipelinesScript(NS::Error** error);
};
}
_MTL_INLINE MTL4::PipelineDataSetSerializerDescriptor* MTL4::PipelineDataSetSerializerDescriptor::alloc()
{
return NS::Object::alloc<MTL4::PipelineDataSetSerializerDescriptor>(_MTL_PRIVATE_CLS(MTL4PipelineDataSetSerializerDescriptor));
}
_MTL_INLINE MTL4::PipelineDataSetSerializerConfiguration MTL4::PipelineDataSetSerializerDescriptor::configuration() const
{
return Object::sendMessage<MTL4::PipelineDataSetSerializerConfiguration>(this, _MTL_PRIVATE_SEL(configuration));
}
_MTL_INLINE MTL4::PipelineDataSetSerializerDescriptor* MTL4::PipelineDataSetSerializerDescriptor::init()
{
return NS::Object::init<MTL4::PipelineDataSetSerializerDescriptor>();
}
_MTL_INLINE void MTL4::PipelineDataSetSerializerDescriptor::setConfiguration(MTL4::PipelineDataSetSerializerConfiguration configuration)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConfiguration_), configuration);
}
_MTL_INLINE bool MTL4::PipelineDataSetSerializer::serializeAsArchiveAndFlushToURL(const NS::URL* url, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(serializeAsArchiveAndFlushToURL_error_), url, error);
}
_MTL_INLINE NS::Data* MTL4::PipelineDataSetSerializer::serializeAsPipelinesScript(NS::Error** error)
{
return Object::sendMessage<NS::Data*>(this, _MTL_PRIVATE_SEL(serializeAsPipelinesScriptWithError_), error);
}

View File

@@ -1,150 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4PipelineState.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPipeline.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class PipelineDescriptor;
class PipelineOptions;
_MTL_ENUM(NS::Integer, AlphaToOneState) {
AlphaToOneStateDisabled = 0,
AlphaToOneStateEnabled = 1,
};
_MTL_ENUM(NS::Integer, AlphaToCoverageState) {
AlphaToCoverageStateDisabled = 0,
AlphaToCoverageStateEnabled = 1,
};
_MTL_ENUM(NS::Integer, BlendState) {
BlendStateDisabled = 0,
BlendStateEnabled = 1,
BlendStateUnspecialized = 2,
};
_MTL_ENUM(NS::Integer, IndirectCommandBufferSupportState) {
IndirectCommandBufferSupportStateDisabled = 0,
IndirectCommandBufferSupportStateEnabled = 1,
};
_MTL_OPTIONS(NS::UInteger, ShaderReflection) {
ShaderReflectionNone = 0,
ShaderReflectionBindingInfo = 1,
ShaderReflectionBufferTypeInfo = 1 << 1,
};
class PipelineOptions : public NS::Copying<PipelineOptions>
{
public:
static PipelineOptions* alloc();
PipelineOptions* init();
void setShaderReflection(MTL4::ShaderReflection shaderReflection);
void setShaderValidation(MTL::ShaderValidation shaderValidation);
ShaderReflection shaderReflection() const;
MTL::ShaderValidation shaderValidation() const;
};
class PipelineDescriptor : public NS::Copying<PipelineDescriptor>
{
public:
static PipelineDescriptor* alloc();
PipelineDescriptor* init();
NS::String* label() const;
PipelineOptions* options() const;
void setLabel(const NS::String* label);
void setOptions(const MTL4::PipelineOptions* options);
};
}
_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineOptions::alloc()
{
return NS::Object::alloc<MTL4::PipelineOptions>(_MTL_PRIVATE_CLS(MTL4PipelineOptions));
}
_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineOptions::init()
{
return NS::Object::init<MTL4::PipelineOptions>();
}
_MTL_INLINE void MTL4::PipelineOptions::setShaderReflection(MTL4::ShaderReflection shaderReflection)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderReflection_), shaderReflection);
}
_MTL_INLINE void MTL4::PipelineOptions::setShaderValidation(MTL::ShaderValidation shaderValidation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderValidation_), shaderValidation);
}
_MTL_INLINE MTL4::ShaderReflection MTL4::PipelineOptions::shaderReflection() const
{
return Object::sendMessage<MTL4::ShaderReflection>(this, _MTL_PRIVATE_SEL(shaderReflection));
}
_MTL_INLINE MTL::ShaderValidation MTL4::PipelineOptions::shaderValidation() const
{
return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));
}
_MTL_INLINE MTL4::PipelineDescriptor* MTL4::PipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL4::PipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4PipelineDescriptor));
}
_MTL_INLINE MTL4::PipelineDescriptor* MTL4::PipelineDescriptor::init()
{
return NS::Object::init<MTL4::PipelineDescriptor>();
}
_MTL_INLINE NS::String* MTL4::PipelineDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineDescriptor::options() const
{
return Object::sendMessage<MTL4::PipelineOptions*>(this, _MTL_PRIVATE_SEL(options));
}
_MTL_INLINE void MTL4::PipelineDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::PipelineDescriptor::setOptions(const MTL4::PipelineOptions* options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
}

View File

@@ -1,340 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4RenderCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4CommandEncoder.hpp"
#include "MTL4Counters.hpp"
#include "MTLArgument.hpp"
#include "MTLDefines.hpp"
#include "MTLGPUAddress.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLRenderCommandEncoder.hpp"
#include "MTLRenderPass.hpp"
#include "MTLTypes.hpp"
#include <cstdint>
namespace MTL4
{
class ArgumentTable;
class CounterHeap;
}
namespace MTL
{
class DepthStencilState;
class IndirectCommandBuffer;
class LogicalToPhysicalColorAttachmentMap;
class RenderPipelineState;
struct ScissorRect;
struct VertexAmplificationViewMapping;
struct Viewport;
}
namespace MTL4
{
_MTL_OPTIONS(NS::UInteger, RenderEncoderOptions) {
RenderEncoderOptionNone = 0,
RenderEncoderOptionSuspending = 1,
RenderEncoderOptionResuming = 1 << 1,
};
class RenderCommandEncoder : public NS::Referencing<RenderCommandEncoder, CommandEncoder>
{
public:
void dispatchThreadsPerTile(MTL::Size threadsPerTile);
void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength);
void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, NS::UInteger instanceCount);
void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance);
void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, MTL::GPUAddress indirectBuffer);
void drawMeshThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);
void drawMeshThreadgroups(MTL::GPUAddress indirectBuffer, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);
void drawMeshThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);
void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount);
void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount);
void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance);
void drawPrimitives(MTL::PrimitiveType primitiveType, MTL::GPUAddress indirectBuffer);
void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);
void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, MTL::GPUAddress indirectRangeBuffer);
void setArgumentTable(const MTL4::ArgumentTable* argumentTable, MTL::RenderStages stages);
void setBlendColor(float red, float green, float blue, float alpha);
void setColorAttachmentMap(const MTL::LogicalToPhysicalColorAttachmentMap* mapping);
void setColorStoreAction(MTL::StoreAction storeAction, NS::UInteger colorAttachmentIndex);
void setCullMode(MTL::CullMode cullMode);
void setDepthBias(float depthBias, float slopeScale, float clamp);
void setDepthClipMode(MTL::DepthClipMode depthClipMode);
void setDepthStencilState(const MTL::DepthStencilState* depthStencilState);
void setDepthStoreAction(MTL::StoreAction storeAction);
void setDepthTestBounds(float minBound, float maxBound);
void setFrontFacingWinding(MTL::Winding frontFacingWinding);
void setObjectThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
void setRenderPipelineState(const MTL::RenderPipelineState* pipelineState);
void setScissorRect(MTL::ScissorRect rect);
void setScissorRects(const MTL::ScissorRect* scissorRects, NS::UInteger count);
void setStencilReferenceValue(uint32_t referenceValue);
void setStencilReferenceValues(uint32_t frontReferenceValue, uint32_t backReferenceValue);
void setStencilStoreAction(MTL::StoreAction storeAction);
void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger offset, NS::UInteger index);
void setTriangleFillMode(MTL::TriangleFillMode fillMode);
void setVertexAmplificationCount(NS::UInteger count, const MTL::VertexAmplificationViewMapping* viewMappings);
void setViewport(MTL::Viewport viewport);
void setViewports(const MTL::Viewport* viewports, NS::UInteger count);
void setVisibilityResultMode(MTL::VisibilityResultMode mode, NS::UInteger offset);
NS::UInteger tileHeight() const;
NS::UInteger tileWidth() const;
void writeTimestamp(MTL4::TimestampGranularity granularity, MTL::RenderStages stage, const MTL4::CounterHeap* counterHeap, NS::UInteger index);
};
}
_MTL_INLINE void MTL4::RenderCommandEncoder::dispatchThreadsPerTile(MTL::Size threadsPerTile)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadsPerTile_), threadsPerTile);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_), primitiveType, indexCount, indexType, indexBuffer, indexBufferLength);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, NS::UInteger instanceCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount_), primitiveType, indexCount, indexType, indexBuffer, indexBufferLength, instanceCount);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferLength_instanceCount_baseVertex_baseInstance_), primitiveType, indexCount, indexType, indexBuffer, indexBufferLength, instanceCount, baseVertex, baseInstance);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawIndexedPrimitives(MTL::PrimitiveType primitiveType, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, MTL::GPUAddress indirectBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPrimitives_indexType_indexBuffer_indexBufferLength_indirectBuffer_), primitiveType, indexType, indexBuffer, indexBufferLength, indirectBuffer);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawMeshThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup_), threadgroupsPerGrid, threadsPerObjectThreadgroup, threadsPerMeshThreadgroup);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawMeshThreadgroups(MTL::GPUAddress indirectBuffer, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawMeshThreadgroupsWithIndirectBuffer_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup_), indirectBuffer, threadsPerObjectThreadgroup, threadsPerMeshThreadgroup);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawMeshThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup_), threadsPerGrid, threadsPerObjectThreadgroup, threadsPerMeshThreadgroup);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPrimitives_vertexStart_vertexCount_), primitiveType, vertexStart, vertexCount);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPrimitives_vertexStart_vertexCount_instanceCount_), primitiveType, vertexStart, vertexCount, instanceCount);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance_), primitiveType, vertexStart, vertexCount, instanceCount, baseInstance);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::drawPrimitives(MTL::PrimitiveType primitiveType, MTL::GPUAddress indirectBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPrimitives_indirectBuffer_), primitiveType, indirectBuffer);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_withRange_), indirectCommandBuffer, executionRange);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, MTL::GPUAddress indirectRangeBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_indirectBuffer_), indirectCommandBuffer, indirectRangeBuffer);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setArgumentTable(const MTL4::ArgumentTable* argumentTable, MTL::RenderStages stages)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentTable_atStages_), argumentTable, stages);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setBlendColor(float red, float green, float blue, float alpha)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBlendColorRed_green_blue_alpha_), red, green, blue, alpha);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setColorAttachmentMap(const MTL::LogicalToPhysicalColorAttachmentMap* mapping)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorAttachmentMap_), mapping);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setColorStoreAction(MTL::StoreAction storeAction, NS::UInteger colorAttachmentIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorStoreAction_atIndex_), storeAction, colorAttachmentIndex);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setCullMode(MTL::CullMode cullMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCullMode_), cullMode);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setDepthBias(float depthBias, float slopeScale, float clamp)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthBias_slopeScale_clamp_), depthBias, slopeScale, clamp);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setDepthClipMode(MTL::DepthClipMode depthClipMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthClipMode_), depthClipMode);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setDepthStencilState(const MTL::DepthStencilState* depthStencilState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilState_), depthStencilState);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setDepthStoreAction(MTL::StoreAction storeAction)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStoreAction_), storeAction);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setDepthTestBounds(float minBound, float maxBound)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthTestMinBound_maxBound_), minBound, maxBound);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setFrontFacingWinding(MTL::Winding frontFacingWinding)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFrontFacingWinding_), frontFacingWinding);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setObjectThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectThreadgroupMemoryLength_atIndex_), length, index);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setRenderPipelineState(const MTL::RenderPipelineState* pipelineState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_), pipelineState);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setScissorRect(MTL::ScissorRect rect)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setScissorRect_), rect);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setScissorRects(const MTL::ScissorRect* scissorRects, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setScissorRects_count_), scissorRects, count);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setStencilReferenceValue(uint32_t referenceValue)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilReferenceValue_), referenceValue);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setStencilReferenceValues(uint32_t frontReferenceValue, uint32_t backReferenceValue)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilFrontReferenceValue_backReferenceValue_), frontReferenceValue, backReferenceValue);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setStencilStoreAction(MTL::StoreAction storeAction)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilStoreAction_), storeAction);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger offset, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_offset_atIndex_), length, offset, index);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setTriangleFillMode(MTL::TriangleFillMode fillMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTriangleFillMode_), fillMode);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setVertexAmplificationCount(NS::UInteger count, const MTL::VertexAmplificationViewMapping* viewMappings)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexAmplificationCount_viewMappings_), count, viewMappings);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setViewport(MTL::Viewport viewport)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setViewport_), viewport);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setViewports(const MTL::Viewport* viewports, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setViewports_count_), viewports, count);
}
_MTL_INLINE void MTL4::RenderCommandEncoder::setVisibilityResultMode(MTL::VisibilityResultMode mode, NS::UInteger offset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibilityResultMode_offset_), mode, offset);
}
_MTL_INLINE NS::UInteger MTL4::RenderCommandEncoder::tileHeight() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(tileHeight));
}
_MTL_INLINE NS::UInteger MTL4::RenderCommandEncoder::tileWidth() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(tileWidth));
}
_MTL_INLINE void MTL4::RenderCommandEncoder::writeTimestamp(MTL4::TimestampGranularity granularity, MTL::RenderStages stage, const MTL4::CounterHeap* counterHeap, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeTimestampWithGranularity_afterStage_intoHeap_atIndex_), granularity, stage, counterHeap, index);
}

View File

@@ -1,280 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4RenderPass.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLRenderPass.hpp"
namespace MTL4
{
class RenderPassDescriptor;
}
namespace MTL
{
class Buffer;
class RasterizationRateMap;
class RenderPassColorAttachmentDescriptorArray;
class RenderPassDepthAttachmentDescriptor;
class RenderPassStencilAttachmentDescriptor;
struct SamplePosition;
}
namespace MTL4
{
class RenderPassDescriptor : public NS::Copying<RenderPassDescriptor>
{
public:
static RenderPassDescriptor* alloc();
MTL::RenderPassColorAttachmentDescriptorArray* colorAttachments() const;
NS::UInteger defaultRasterSampleCount() const;
MTL::RenderPassDepthAttachmentDescriptor* depthAttachment() const;
NS::UInteger getSamplePositions(MTL::SamplePosition* positions, NS::UInteger count);
NS::UInteger imageblockSampleLength() const;
RenderPassDescriptor* init();
MTL::RasterizationRateMap* rasterizationRateMap() const;
NS::UInteger renderTargetArrayLength() const;
NS::UInteger renderTargetHeight() const;
NS::UInteger renderTargetWidth() const;
void setDefaultRasterSampleCount(NS::UInteger defaultRasterSampleCount);
void setDepthAttachment(const MTL::RenderPassDepthAttachmentDescriptor* depthAttachment);
void setImageblockSampleLength(NS::UInteger imageblockSampleLength);
void setRasterizationRateMap(const MTL::RasterizationRateMap* rasterizationRateMap);
void setRenderTargetArrayLength(NS::UInteger renderTargetArrayLength);
void setRenderTargetHeight(NS::UInteger renderTargetHeight);
void setRenderTargetWidth(NS::UInteger renderTargetWidth);
void setSamplePositions(const MTL::SamplePosition* positions, NS::UInteger count);
void setStencilAttachment(const MTL::RenderPassStencilAttachmentDescriptor* stencilAttachment);
void setSupportColorAttachmentMapping(bool supportColorAttachmentMapping);
void setThreadgroupMemoryLength(NS::UInteger threadgroupMemoryLength);
void setTileHeight(NS::UInteger tileHeight);
void setTileWidth(NS::UInteger tileWidth);
void setVisibilityResultBuffer(const MTL::Buffer* visibilityResultBuffer);
void setVisibilityResultType(MTL::VisibilityResultType visibilityResultType);
MTL::RenderPassStencilAttachmentDescriptor* stencilAttachment() const;
bool supportColorAttachmentMapping() const;
NS::UInteger threadgroupMemoryLength() const;
NS::UInteger tileHeight() const;
NS::UInteger tileWidth() const;
MTL::Buffer* visibilityResultBuffer() const;
MTL::VisibilityResultType visibilityResultType() const;
};
}
_MTL_INLINE MTL4::RenderPassDescriptor* MTL4::RenderPassDescriptor::alloc()
{
return NS::Object::alloc<MTL4::RenderPassDescriptor>(_MTL_PRIVATE_CLS(MTL4RenderPassDescriptor));
}
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptorArray* MTL4::RenderPassDescriptor::colorAttachments() const
{
return Object::sendMessage<MTL::RenderPassColorAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(colorAttachments));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::defaultRasterSampleCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(defaultRasterSampleCount));
}
_MTL_INLINE MTL::RenderPassDepthAttachmentDescriptor* MTL4::RenderPassDescriptor::depthAttachment() const
{
return Object::sendMessage<MTL::RenderPassDepthAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(depthAttachment));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::getSamplePositions(MTL::SamplePosition* positions, NS::UInteger count)
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(getSamplePositions_count_), positions, count);
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::imageblockSampleLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(imageblockSampleLength));
}
_MTL_INLINE MTL4::RenderPassDescriptor* MTL4::RenderPassDescriptor::init()
{
return NS::Object::init<MTL4::RenderPassDescriptor>();
}
_MTL_INLINE MTL::RasterizationRateMap* MTL4::RenderPassDescriptor::rasterizationRateMap() const
{
return Object::sendMessage<MTL::RasterizationRateMap*>(this, _MTL_PRIVATE_SEL(rasterizationRateMap));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::renderTargetArrayLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(renderTargetArrayLength));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::renderTargetHeight() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(renderTargetHeight));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::renderTargetWidth() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(renderTargetWidth));
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setDefaultRasterSampleCount(NS::UInteger defaultRasterSampleCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDefaultRasterSampleCount_), defaultRasterSampleCount);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setDepthAttachment(const MTL::RenderPassDepthAttachmentDescriptor* depthAttachment)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthAttachment_), depthAttachment);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setImageblockSampleLength(NS::UInteger imageblockSampleLength)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockSampleLength_), imageblockSampleLength);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setRasterizationRateMap(const MTL::RasterizationRateMap* rasterizationRateMap)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterizationRateMap_), rasterizationRateMap);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setRenderTargetArrayLength(NS::UInteger renderTargetArrayLength)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderTargetArrayLength_), renderTargetArrayLength);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setRenderTargetHeight(NS::UInteger renderTargetHeight)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderTargetHeight_), renderTargetHeight);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setRenderTargetWidth(NS::UInteger renderTargetWidth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderTargetWidth_), renderTargetWidth);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setSamplePositions(const MTL::SamplePosition* positions, NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplePositions_count_), positions, count);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setStencilAttachment(const MTL::RenderPassStencilAttachmentDescriptor* stencilAttachment)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilAttachment_), stencilAttachment);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setSupportColorAttachmentMapping(bool supportColorAttachmentMapping)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportColorAttachmentMapping_), supportColorAttachmentMapping);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setThreadgroupMemoryLength(NS::UInteger threadgroupMemoryLength)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_), threadgroupMemoryLength);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setTileHeight(NS::UInteger tileHeight)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTileHeight_), tileHeight);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setTileWidth(NS::UInteger tileWidth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTileWidth_), tileWidth);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setVisibilityResultBuffer(const MTL::Buffer* visibilityResultBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibilityResultBuffer_), visibilityResultBuffer);
}
_MTL_INLINE void MTL4::RenderPassDescriptor::setVisibilityResultType(MTL::VisibilityResultType visibilityResultType)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibilityResultType_), visibilityResultType);
}
_MTL_INLINE MTL::RenderPassStencilAttachmentDescriptor* MTL4::RenderPassDescriptor::stencilAttachment() const
{
return Object::sendMessage<MTL::RenderPassStencilAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(stencilAttachment));
}
_MTL_INLINE bool MTL4::RenderPassDescriptor::supportColorAttachmentMapping() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportColorAttachmentMapping));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::threadgroupMemoryLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryLength));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::tileHeight() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(tileHeight));
}
_MTL_INLINE NS::UInteger MTL4::RenderPassDescriptor::tileWidth() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(tileWidth));
}
_MTL_INLINE MTL::Buffer* MTL4::RenderPassDescriptor::visibilityResultBuffer() const
{
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(visibilityResultBuffer));
}
_MTL_INLINE MTL::VisibilityResultType MTL4::RenderPassDescriptor::visibilityResultType() const
{
return Object::sendMessage<MTL::VisibilityResultType>(this, _MTL_PRIVATE_SEL(visibilityResultType));
}

View File

@@ -1,587 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4RenderPipeline.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4PipelineState.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPixelFormat.hpp"
#include "MTLPrivate.hpp"
#include "MTLRenderPipeline.hpp"
namespace MTL4
{
class FunctionDescriptor;
class RenderPipelineBinaryFunctionsDescriptor;
class RenderPipelineColorAttachmentDescriptor;
class RenderPipelineColorAttachmentDescriptorArray;
class RenderPipelineDescriptor;
class StaticLinkingDescriptor;
}
namespace MTL
{
class VertexDescriptor;
}
namespace MTL4
{
_MTL_ENUM(NS::Integer, LogicalToPhysicalColorAttachmentMappingState) {
LogicalToPhysicalColorAttachmentMappingStateIdentity = 0,
LogicalToPhysicalColorAttachmentMappingStateInherited = 1,
};
class RenderPipelineColorAttachmentDescriptor : public NS::Copying<RenderPipelineColorAttachmentDescriptor>
{
public:
static RenderPipelineColorAttachmentDescriptor* alloc();
MTL::BlendOperation alphaBlendOperation() const;
BlendState blendingState() const;
MTL::BlendFactor destinationAlphaBlendFactor() const;
MTL::BlendFactor destinationRGBBlendFactor() const;
RenderPipelineColorAttachmentDescriptor* init();
MTL::PixelFormat pixelFormat() const;
void reset();
MTL::BlendOperation rgbBlendOperation() const;
void setAlphaBlendOperation(MTL::BlendOperation alphaBlendOperation);
void setBlendingState(MTL4::BlendState blendingState);
void setDestinationAlphaBlendFactor(MTL::BlendFactor destinationAlphaBlendFactor);
void setDestinationRGBBlendFactor(MTL::BlendFactor destinationRGBBlendFactor);
void setPixelFormat(MTL::PixelFormat pixelFormat);
void setRgbBlendOperation(MTL::BlendOperation rgbBlendOperation);
void setSourceAlphaBlendFactor(MTL::BlendFactor sourceAlphaBlendFactor);
void setSourceRGBBlendFactor(MTL::BlendFactor sourceRGBBlendFactor);
void setWriteMask(MTL::ColorWriteMask writeMask);
MTL::BlendFactor sourceAlphaBlendFactor() const;
MTL::BlendFactor sourceRGBBlendFactor() const;
MTL::ColorWriteMask writeMask() const;
};
class RenderPipelineColorAttachmentDescriptorArray : public NS::Copying<RenderPipelineColorAttachmentDescriptorArray>
{
public:
static RenderPipelineColorAttachmentDescriptorArray* alloc();
RenderPipelineColorAttachmentDescriptorArray* init();
RenderPipelineColorAttachmentDescriptor* object(NS::UInteger attachmentIndex);
void reset();
void setObject(const MTL4::RenderPipelineColorAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
};
class RenderPipelineBinaryFunctionsDescriptor : public NS::Copying<RenderPipelineBinaryFunctionsDescriptor>
{
public:
static RenderPipelineBinaryFunctionsDescriptor* alloc();
NS::Array* fragmentAdditionalBinaryFunctions() const;
RenderPipelineBinaryFunctionsDescriptor* init();
NS::Array* meshAdditionalBinaryFunctions() const;
NS::Array* objectAdditionalBinaryFunctions() const;
void reset();
void setFragmentAdditionalBinaryFunctions(const NS::Array* fragmentAdditionalBinaryFunctions);
void setMeshAdditionalBinaryFunctions(const NS::Array* meshAdditionalBinaryFunctions);
void setObjectAdditionalBinaryFunctions(const NS::Array* objectAdditionalBinaryFunctions);
void setTileAdditionalBinaryFunctions(const NS::Array* tileAdditionalBinaryFunctions);
void setVertexAdditionalBinaryFunctions(const NS::Array* vertexAdditionalBinaryFunctions);
NS::Array* tileAdditionalBinaryFunctions() const;
NS::Array* vertexAdditionalBinaryFunctions() const;
};
class RenderPipelineDescriptor : public NS::Copying<RenderPipelineDescriptor, PipelineDescriptor>
{
public:
static RenderPipelineDescriptor* alloc();
AlphaToCoverageState alphaToCoverageState() const;
AlphaToOneState alphaToOneState() const;
LogicalToPhysicalColorAttachmentMappingState colorAttachmentMappingState() const;
RenderPipelineColorAttachmentDescriptorArray* colorAttachments() const;
FunctionDescriptor* fragmentFunctionDescriptor() const;
StaticLinkingDescriptor* fragmentStaticLinkingDescriptor() const;
RenderPipelineDescriptor* init();
MTL::PrimitiveTopologyClass inputPrimitiveTopology() const;
bool isRasterizationEnabled() const;
NS::UInteger maxVertexAmplificationCount() const;
NS::UInteger rasterSampleCount() const;
[[deprecated("please use isRasterizationEnabled instead")]]
bool rasterizationEnabled() const;
void reset();
void setAlphaToCoverageState(MTL4::AlphaToCoverageState alphaToCoverageState);
void setAlphaToOneState(MTL4::AlphaToOneState alphaToOneState);
void setColorAttachmentMappingState(MTL4::LogicalToPhysicalColorAttachmentMappingState colorAttachmentMappingState);
void setFragmentFunctionDescriptor(const MTL4::FunctionDescriptor* fragmentFunctionDescriptor);
void setFragmentStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* fragmentStaticLinkingDescriptor);
void setInputPrimitiveTopology(MTL::PrimitiveTopologyClass inputPrimitiveTopology);
void setMaxVertexAmplificationCount(NS::UInteger maxVertexAmplificationCount);
void setRasterSampleCount(NS::UInteger rasterSampleCount);
void setRasterizationEnabled(bool rasterizationEnabled);
void setSupportFragmentBinaryLinking(bool supportFragmentBinaryLinking);
void setSupportIndirectCommandBuffers(MTL4::IndirectCommandBufferSupportState supportIndirectCommandBuffers);
void setSupportVertexBinaryLinking(bool supportVertexBinaryLinking);
void setVertexDescriptor(const MTL::VertexDescriptor* vertexDescriptor);
void setVertexFunctionDescriptor(const MTL4::FunctionDescriptor* vertexFunctionDescriptor);
void setVertexStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* vertexStaticLinkingDescriptor);
bool supportFragmentBinaryLinking() const;
IndirectCommandBufferSupportState supportIndirectCommandBuffers() const;
bool supportVertexBinaryLinking() const;
MTL::VertexDescriptor* vertexDescriptor() const;
FunctionDescriptor* vertexFunctionDescriptor() const;
StaticLinkingDescriptor* vertexStaticLinkingDescriptor() const;
};
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptor* MTL4::RenderPipelineColorAttachmentDescriptor::alloc()
{
return NS::Object::alloc<MTL4::RenderPipelineColorAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTL4RenderPipelineColorAttachmentDescriptor));
}
_MTL_INLINE MTL::BlendOperation MTL4::RenderPipelineColorAttachmentDescriptor::alphaBlendOperation() const
{
return Object::sendMessage<MTL::BlendOperation>(this, _MTL_PRIVATE_SEL(alphaBlendOperation));
}
_MTL_INLINE MTL4::BlendState MTL4::RenderPipelineColorAttachmentDescriptor::blendingState() const
{
return Object::sendMessage<MTL4::BlendState>(this, _MTL_PRIVATE_SEL(blendingState));
}
_MTL_INLINE MTL::BlendFactor MTL4::RenderPipelineColorAttachmentDescriptor::destinationAlphaBlendFactor() const
{
return Object::sendMessage<MTL::BlendFactor>(this, _MTL_PRIVATE_SEL(destinationAlphaBlendFactor));
}
_MTL_INLINE MTL::BlendFactor MTL4::RenderPipelineColorAttachmentDescriptor::destinationRGBBlendFactor() const
{
return Object::sendMessage<MTL::BlendFactor>(this, _MTL_PRIVATE_SEL(destinationRGBBlendFactor));
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptor* MTL4::RenderPipelineColorAttachmentDescriptor::init()
{
return NS::Object::init<MTL4::RenderPipelineColorAttachmentDescriptor>();
}
_MTL_INLINE MTL::PixelFormat MTL4::RenderPipelineColorAttachmentDescriptor::pixelFormat() const
{
return Object::sendMessage<MTL::PixelFormat>(this, _MTL_PRIVATE_SEL(pixelFormat));
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE MTL::BlendOperation MTL4::RenderPipelineColorAttachmentDescriptor::rgbBlendOperation() const
{
return Object::sendMessage<MTL::BlendOperation>(this, _MTL_PRIVATE_SEL(rgbBlendOperation));
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setAlphaBlendOperation(MTL::BlendOperation alphaBlendOperation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAlphaBlendOperation_), alphaBlendOperation);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setBlendingState(MTL4::BlendState blendingState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBlendingState_), blendingState);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setDestinationAlphaBlendFactor(MTL::BlendFactor destinationAlphaBlendFactor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDestinationAlphaBlendFactor_), destinationAlphaBlendFactor);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setDestinationRGBBlendFactor(MTL::BlendFactor destinationRGBBlendFactor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDestinationRGBBlendFactor_), destinationRGBBlendFactor);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setPixelFormat(MTL::PixelFormat pixelFormat)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPixelFormat_), pixelFormat);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setRgbBlendOperation(MTL::BlendOperation rgbBlendOperation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRgbBlendOperation_), rgbBlendOperation);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setSourceAlphaBlendFactor(MTL::BlendFactor sourceAlphaBlendFactor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSourceAlphaBlendFactor_), sourceAlphaBlendFactor);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setSourceRGBBlendFactor(MTL::BlendFactor sourceRGBBlendFactor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSourceRGBBlendFactor_), sourceRGBBlendFactor);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptor::setWriteMask(MTL::ColorWriteMask writeMask)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setWriteMask_), writeMask);
}
_MTL_INLINE MTL::BlendFactor MTL4::RenderPipelineColorAttachmentDescriptor::sourceAlphaBlendFactor() const
{
return Object::sendMessage<MTL::BlendFactor>(this, _MTL_PRIVATE_SEL(sourceAlphaBlendFactor));
}
_MTL_INLINE MTL::BlendFactor MTL4::RenderPipelineColorAttachmentDescriptor::sourceRGBBlendFactor() const
{
return Object::sendMessage<MTL::BlendFactor>(this, _MTL_PRIVATE_SEL(sourceRGBBlendFactor));
}
_MTL_INLINE MTL::ColorWriteMask MTL4::RenderPipelineColorAttachmentDescriptor::writeMask() const
{
return Object::sendMessage<MTL::ColorWriteMask>(this, _MTL_PRIVATE_SEL(writeMask));
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptorArray* MTL4::RenderPipelineColorAttachmentDescriptorArray::alloc()
{
return NS::Object::alloc<MTL4::RenderPipelineColorAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTL4RenderPipelineColorAttachmentDescriptorArray));
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptorArray* MTL4::RenderPipelineColorAttachmentDescriptorArray::init()
{
return NS::Object::init<MTL4::RenderPipelineColorAttachmentDescriptorArray>();
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptor* MTL4::RenderPipelineColorAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
{
return Object::sendMessage<MTL4::RenderPipelineColorAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptorArray::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::RenderPipelineColorAttachmentDescriptorArray::setObject(const MTL4::RenderPipelineColorAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
}
_MTL_INLINE MTL4::RenderPipelineBinaryFunctionsDescriptor* MTL4::RenderPipelineBinaryFunctionsDescriptor::alloc()
{
return NS::Object::alloc<MTL4::RenderPipelineBinaryFunctionsDescriptor>(_MTL_PRIVATE_CLS(MTL4RenderPipelineBinaryFunctionsDescriptor));
}
_MTL_INLINE NS::Array* MTL4::RenderPipelineBinaryFunctionsDescriptor::fragmentAdditionalBinaryFunctions() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(fragmentAdditionalBinaryFunctions));
}
_MTL_INLINE MTL4::RenderPipelineBinaryFunctionsDescriptor* MTL4::RenderPipelineBinaryFunctionsDescriptor::init()
{
return NS::Object::init<MTL4::RenderPipelineBinaryFunctionsDescriptor>();
}
_MTL_INLINE NS::Array* MTL4::RenderPipelineBinaryFunctionsDescriptor::meshAdditionalBinaryFunctions() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(meshAdditionalBinaryFunctions));
}
_MTL_INLINE NS::Array* MTL4::RenderPipelineBinaryFunctionsDescriptor::objectAdditionalBinaryFunctions() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(objectAdditionalBinaryFunctions));
}
_MTL_INLINE void MTL4::RenderPipelineBinaryFunctionsDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::RenderPipelineBinaryFunctionsDescriptor::setFragmentAdditionalBinaryFunctions(const NS::Array* fragmentAdditionalBinaryFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentAdditionalBinaryFunctions_), fragmentAdditionalBinaryFunctions);
}
_MTL_INLINE void MTL4::RenderPipelineBinaryFunctionsDescriptor::setMeshAdditionalBinaryFunctions(const NS::Array* meshAdditionalBinaryFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMeshAdditionalBinaryFunctions_), meshAdditionalBinaryFunctions);
}
_MTL_INLINE void MTL4::RenderPipelineBinaryFunctionsDescriptor::setObjectAdditionalBinaryFunctions(const NS::Array* objectAdditionalBinaryFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectAdditionalBinaryFunctions_), objectAdditionalBinaryFunctions);
}
_MTL_INLINE void MTL4::RenderPipelineBinaryFunctionsDescriptor::setTileAdditionalBinaryFunctions(const NS::Array* tileAdditionalBinaryFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTileAdditionalBinaryFunctions_), tileAdditionalBinaryFunctions);
}
_MTL_INLINE void MTL4::RenderPipelineBinaryFunctionsDescriptor::setVertexAdditionalBinaryFunctions(const NS::Array* vertexAdditionalBinaryFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexAdditionalBinaryFunctions_), vertexAdditionalBinaryFunctions);
}
_MTL_INLINE NS::Array* MTL4::RenderPipelineBinaryFunctionsDescriptor::tileAdditionalBinaryFunctions() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(tileAdditionalBinaryFunctions));
}
_MTL_INLINE NS::Array* MTL4::RenderPipelineBinaryFunctionsDescriptor::vertexAdditionalBinaryFunctions() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(vertexAdditionalBinaryFunctions));
}
_MTL_INLINE MTL4::RenderPipelineDescriptor* MTL4::RenderPipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL4::RenderPipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4RenderPipelineDescriptor));
}
_MTL_INLINE MTL4::AlphaToCoverageState MTL4::RenderPipelineDescriptor::alphaToCoverageState() const
{
return Object::sendMessage<MTL4::AlphaToCoverageState>(this, _MTL_PRIVATE_SEL(alphaToCoverageState));
}
_MTL_INLINE MTL4::AlphaToOneState MTL4::RenderPipelineDescriptor::alphaToOneState() const
{
return Object::sendMessage<MTL4::AlphaToOneState>(this, _MTL_PRIVATE_SEL(alphaToOneState));
}
_MTL_INLINE MTL4::LogicalToPhysicalColorAttachmentMappingState MTL4::RenderPipelineDescriptor::colorAttachmentMappingState() const
{
return Object::sendMessage<MTL4::LogicalToPhysicalColorAttachmentMappingState>(this, _MTL_PRIVATE_SEL(colorAttachmentMappingState));
}
_MTL_INLINE MTL4::RenderPipelineColorAttachmentDescriptorArray* MTL4::RenderPipelineDescriptor::colorAttachments() const
{
return Object::sendMessage<MTL4::RenderPipelineColorAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(colorAttachments));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::RenderPipelineDescriptor::fragmentFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(fragmentFunctionDescriptor));
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::RenderPipelineDescriptor::fragmentStaticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(fragmentStaticLinkingDescriptor));
}
_MTL_INLINE MTL4::RenderPipelineDescriptor* MTL4::RenderPipelineDescriptor::init()
{
return NS::Object::init<MTL4::RenderPipelineDescriptor>();
}
_MTL_INLINE MTL::PrimitiveTopologyClass MTL4::RenderPipelineDescriptor::inputPrimitiveTopology() const
{
return Object::sendMessage<MTL::PrimitiveTopologyClass>(this, _MTL_PRIVATE_SEL(inputPrimitiveTopology));
}
_MTL_INLINE bool MTL4::RenderPipelineDescriptor::isRasterizationEnabled() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRasterizationEnabled));
}
_MTL_INLINE NS::UInteger MTL4::RenderPipelineDescriptor::maxVertexAmplificationCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxVertexAmplificationCount));
}
_MTL_INLINE NS::UInteger MTL4::RenderPipelineDescriptor::rasterSampleCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(rasterSampleCount));
}
_MTL_INLINE bool MTL4::RenderPipelineDescriptor::rasterizationEnabled() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRasterizationEnabled));
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setAlphaToCoverageState(MTL4::AlphaToCoverageState alphaToCoverageState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAlphaToCoverageState_), alphaToCoverageState);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setAlphaToOneState(MTL4::AlphaToOneState alphaToOneState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAlphaToOneState_), alphaToOneState);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setColorAttachmentMappingState(MTL4::LogicalToPhysicalColorAttachmentMappingState colorAttachmentMappingState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorAttachmentMappingState_), colorAttachmentMappingState);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setFragmentFunctionDescriptor(const MTL4::FunctionDescriptor* fragmentFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentFunctionDescriptor_), fragmentFunctionDescriptor);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setFragmentStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* fragmentStaticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentStaticLinkingDescriptor_), fragmentStaticLinkingDescriptor);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setInputPrimitiveTopology(MTL::PrimitiveTopologyClass inputPrimitiveTopology)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInputPrimitiveTopology_), inputPrimitiveTopology);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setMaxVertexAmplificationCount(NS::UInteger maxVertexAmplificationCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxVertexAmplificationCount_), maxVertexAmplificationCount);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setRasterSampleCount(NS::UInteger rasterSampleCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterSampleCount_), rasterSampleCount);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setRasterizationEnabled(bool rasterizationEnabled)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterizationEnabled_), rasterizationEnabled);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setSupportFragmentBinaryLinking(bool supportFragmentBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportFragmentBinaryLinking_), supportFragmentBinaryLinking);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setSupportIndirectCommandBuffers(MTL4::IndirectCommandBufferSupportState supportIndirectCommandBuffers)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setSupportVertexBinaryLinking(bool supportVertexBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportVertexBinaryLinking_), supportVertexBinaryLinking);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setVertexDescriptor(const MTL::VertexDescriptor* vertexDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexDescriptor_), vertexDescriptor);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setVertexFunctionDescriptor(const MTL4::FunctionDescriptor* vertexFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexFunctionDescriptor_), vertexFunctionDescriptor);
}
_MTL_INLINE void MTL4::RenderPipelineDescriptor::setVertexStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* vertexStaticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexStaticLinkingDescriptor_), vertexStaticLinkingDescriptor);
}
_MTL_INLINE bool MTL4::RenderPipelineDescriptor::supportFragmentBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportFragmentBinaryLinking));
}
_MTL_INLINE MTL4::IndirectCommandBufferSupportState MTL4::RenderPipelineDescriptor::supportIndirectCommandBuffers() const
{
return Object::sendMessage<MTL4::IndirectCommandBufferSupportState>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
}
_MTL_INLINE bool MTL4::RenderPipelineDescriptor::supportVertexBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportVertexBinaryLinking));
}
_MTL_INLINE MTL::VertexDescriptor* MTL4::RenderPipelineDescriptor::vertexDescriptor() const
{
return Object::sendMessage<MTL::VertexDescriptor*>(this, _MTL_PRIVATE_SEL(vertexDescriptor));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::RenderPipelineDescriptor::vertexFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(vertexFunctionDescriptor));
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::RenderPipelineDescriptor::vertexStaticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(vertexStaticLinkingDescriptor));
}

View File

@@ -1,100 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4SpecializedFunctionDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4FunctionDescriptor.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class FunctionDescriptor;
class SpecializedFunctionDescriptor;
}
namespace MTL
{
class FunctionConstantValues;
}
namespace MTL4
{
class SpecializedFunctionDescriptor : public NS::Copying<SpecializedFunctionDescriptor, FunctionDescriptor>
{
public:
static SpecializedFunctionDescriptor* alloc();
MTL::FunctionConstantValues* constantValues() const;
FunctionDescriptor* functionDescriptor() const;
SpecializedFunctionDescriptor* init();
void setConstantValues(const MTL::FunctionConstantValues* constantValues);
void setFunctionDescriptor(const MTL4::FunctionDescriptor* functionDescriptor);
void setSpecializedName(const NS::String* specializedName);
NS::String* specializedName() const;
};
}
_MTL_INLINE MTL4::SpecializedFunctionDescriptor* MTL4::SpecializedFunctionDescriptor::alloc()
{
return NS::Object::alloc<MTL4::SpecializedFunctionDescriptor>(_MTL_PRIVATE_CLS(MTL4SpecializedFunctionDescriptor));
}
_MTL_INLINE MTL::FunctionConstantValues* MTL4::SpecializedFunctionDescriptor::constantValues() const
{
return Object::sendMessage<MTL::FunctionConstantValues*>(this, _MTL_PRIVATE_SEL(constantValues));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::SpecializedFunctionDescriptor::functionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(functionDescriptor));
}
_MTL_INLINE MTL4::SpecializedFunctionDescriptor* MTL4::SpecializedFunctionDescriptor::init()
{
return NS::Object::init<MTL4::SpecializedFunctionDescriptor>();
}
_MTL_INLINE void MTL4::SpecializedFunctionDescriptor::setConstantValues(const MTL::FunctionConstantValues* constantValues)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_), constantValues);
}
_MTL_INLINE void MTL4::SpecializedFunctionDescriptor::setFunctionDescriptor(const MTL4::FunctionDescriptor* functionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionDescriptor_), functionDescriptor);
}
_MTL_INLINE void MTL4::SpecializedFunctionDescriptor::setSpecializedName(const NS::String* specializedName)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSpecializedName_), specializedName);
}
_MTL_INLINE NS::String* MTL4::SpecializedFunctionDescriptor::specializedName() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(specializedName));
}

View File

@@ -1,86 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4StitchedFunctionDescriptor.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4FunctionDescriptor.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class StitchedFunctionDescriptor;
}
namespace MTL
{
class FunctionStitchingGraph;
}
namespace MTL4
{
class StitchedFunctionDescriptor : public NS::Copying<StitchedFunctionDescriptor, FunctionDescriptor>
{
public:
static StitchedFunctionDescriptor* alloc();
NS::Array* functionDescriptors() const;
MTL::FunctionStitchingGraph* functionGraph() const;
StitchedFunctionDescriptor* init();
void setFunctionDescriptors(const NS::Array* functionDescriptors);
void setFunctionGraph(const MTL::FunctionStitchingGraph* functionGraph);
};
}
_MTL_INLINE MTL4::StitchedFunctionDescriptor* MTL4::StitchedFunctionDescriptor::alloc()
{
return NS::Object::alloc<MTL4::StitchedFunctionDescriptor>(_MTL_PRIVATE_CLS(MTL4StitchedFunctionDescriptor));
}
_MTL_INLINE NS::Array* MTL4::StitchedFunctionDescriptor::functionDescriptors() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionDescriptors));
}
_MTL_INLINE MTL::FunctionStitchingGraph* MTL4::StitchedFunctionDescriptor::functionGraph() const
{
return Object::sendMessage<MTL::FunctionStitchingGraph*>(this, _MTL_PRIVATE_SEL(functionGraph));
}
_MTL_INLINE MTL4::StitchedFunctionDescriptor* MTL4::StitchedFunctionDescriptor::init()
{
return NS::Object::init<MTL4::StitchedFunctionDescriptor>();
}
_MTL_INLINE void MTL4::StitchedFunctionDescriptor::setFunctionDescriptors(const NS::Array* functionDescriptors)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionDescriptors_), functionDescriptors);
}
_MTL_INLINE void MTL4::StitchedFunctionDescriptor::setFunctionGraph(const MTL::FunctionStitchingGraph* functionGraph)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionGraph_), functionGraph);
}

View File

@@ -1,173 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4TileRenderPipeline.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTL4PipelineState.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
namespace MTL4
{
class FunctionDescriptor;
class StaticLinkingDescriptor;
class TileRenderPipelineDescriptor;
}
namespace MTL
{
class TileRenderPipelineColorAttachmentDescriptorArray;
}
namespace MTL4
{
class TileRenderPipelineDescriptor : public NS::Copying<TileRenderPipelineDescriptor, PipelineDescriptor>
{
public:
static TileRenderPipelineDescriptor* alloc();
MTL::TileRenderPipelineColorAttachmentDescriptorArray* colorAttachments() const;
TileRenderPipelineDescriptor* init();
NS::UInteger maxTotalThreadsPerThreadgroup() const;
NS::UInteger rasterSampleCount() const;
MTL::Size requiredThreadsPerThreadgroup() const;
void reset();
void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
void setRasterSampleCount(NS::UInteger rasterSampleCount);
void setRequiredThreadsPerThreadgroup(MTL::Size requiredThreadsPerThreadgroup);
void setStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* staticLinkingDescriptor);
void setSupportBinaryLinking(bool supportBinaryLinking);
void setThreadgroupSizeMatchesTileSize(bool threadgroupSizeMatchesTileSize);
void setTileFunctionDescriptor(const MTL4::FunctionDescriptor* tileFunctionDescriptor);
StaticLinkingDescriptor* staticLinkingDescriptor() const;
bool supportBinaryLinking() const;
bool threadgroupSizeMatchesTileSize() const;
FunctionDescriptor* tileFunctionDescriptor() const;
};
}
_MTL_INLINE MTL4::TileRenderPipelineDescriptor* MTL4::TileRenderPipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL4::TileRenderPipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4TileRenderPipelineDescriptor));
}
_MTL_INLINE MTL::TileRenderPipelineColorAttachmentDescriptorArray* MTL4::TileRenderPipelineDescriptor::colorAttachments() const
{
return Object::sendMessage<MTL::TileRenderPipelineColorAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(colorAttachments));
}
_MTL_INLINE MTL4::TileRenderPipelineDescriptor* MTL4::TileRenderPipelineDescriptor::init()
{
return NS::Object::init<MTL4::TileRenderPipelineDescriptor>();
}
_MTL_INLINE NS::UInteger MTL4::TileRenderPipelineDescriptor::maxTotalThreadsPerThreadgroup() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
}
_MTL_INLINE NS::UInteger MTL4::TileRenderPipelineDescriptor::rasterSampleCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(rasterSampleCount));
}
_MTL_INLINE MTL::Size MTL4::TileRenderPipelineDescriptor::requiredThreadsPerThreadgroup() const
{
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(requiredThreadsPerThreadgroup));
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setRasterSampleCount(NS::UInteger rasterSampleCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterSampleCount_), rasterSampleCount);
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setRequiredThreadsPerThreadgroup(MTL::Size requiredThreadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRequiredThreadsPerThreadgroup_), requiredThreadsPerThreadgroup);
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setStaticLinkingDescriptor(const MTL4::StaticLinkingDescriptor* staticLinkingDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStaticLinkingDescriptor_), staticLinkingDescriptor);
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setSupportBinaryLinking(bool supportBinaryLinking)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportBinaryLinking_), supportBinaryLinking);
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setThreadgroupSizeMatchesTileSize(bool threadgroupSizeMatchesTileSize)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupSizeMatchesTileSize_), threadgroupSizeMatchesTileSize);
}
_MTL_INLINE void MTL4::TileRenderPipelineDescriptor::setTileFunctionDescriptor(const MTL4::FunctionDescriptor* tileFunctionDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTileFunctionDescriptor_), tileFunctionDescriptor);
}
_MTL_INLINE MTL4::StaticLinkingDescriptor* MTL4::TileRenderPipelineDescriptor::staticLinkingDescriptor() const
{
return Object::sendMessage<MTL4::StaticLinkingDescriptor*>(this, _MTL_PRIVATE_SEL(staticLinkingDescriptor));
}
_MTL_INLINE bool MTL4::TileRenderPipelineDescriptor::supportBinaryLinking() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportBinaryLinking));
}
_MTL_INLINE bool MTL4::TileRenderPipelineDescriptor::threadgroupSizeMatchesTileSize() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(threadgroupSizeMatchesTileSize));
}
_MTL_INLINE MTL4::FunctionDescriptor* MTL4::TileRenderPipelineDescriptor::tileFunctionDescriptor() const
{
return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(tileFunctionDescriptor));
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,260 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLAccelerationStructureCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLAccelerationStructure.hpp"
#include "MTLCommandEncoder.hpp"
#include "MTLDataType.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class AccelerationStructure;
class AccelerationStructureDescriptor;
class AccelerationStructurePassDescriptor;
class AccelerationStructurePassSampleBufferAttachmentDescriptor;
class AccelerationStructurePassSampleBufferAttachmentDescriptorArray;
class Buffer;
class CounterSampleBuffer;
class Fence;
class Heap;
class Resource;
class AccelerationStructureCommandEncoder : public NS::Referencing<AccelerationStructureCommandEncoder, CommandEncoder>
{
public:
void buildAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);
void copyAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure);
void copyAndCompactAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure);
void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);
void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset, MTL::AccelerationStructureRefitOptions options);
void sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
void updateFence(const MTL::Fence* fence);
void useHeap(const MTL::Heap* heap);
void useHeaps(const MTL::Heap* const heaps[], NS::UInteger count);
void useResource(const MTL::Resource* resource, MTL::ResourceUsage usage);
void useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);
void waitForFence(const MTL::Fence* fence);
void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset);
void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset, MTL::DataType sizeDataType);
};
class AccelerationStructurePassSampleBufferAttachmentDescriptor : public NS::Copying<AccelerationStructurePassSampleBufferAttachmentDescriptor>
{
public:
static AccelerationStructurePassSampleBufferAttachmentDescriptor* alloc();
NS::UInteger endOfEncoderSampleIndex() const;
AccelerationStructurePassSampleBufferAttachmentDescriptor* init();
CounterSampleBuffer* sampleBuffer() const;
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
void setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer);
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
NS::UInteger startOfEncoderSampleIndex() const;
};
class AccelerationStructurePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<AccelerationStructurePassSampleBufferAttachmentDescriptorArray>
{
public:
static AccelerationStructurePassSampleBufferAttachmentDescriptorArray* alloc();
AccelerationStructurePassSampleBufferAttachmentDescriptorArray* init();
AccelerationStructurePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
void setObject(const MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
};
class AccelerationStructurePassDescriptor : public NS::Copying<AccelerationStructurePassDescriptor>
{
public:
static AccelerationStructurePassDescriptor* accelerationStructurePassDescriptor();
static AccelerationStructurePassDescriptor* alloc();
AccelerationStructurePassDescriptor* init();
AccelerationStructurePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
};
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::buildAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(buildAccelerationStructure_descriptor_scratchBuffer_scratchBufferOffset_), accelerationStructure, descriptor, scratchBuffer, scratchBufferOffset);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::copyAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyAccelerationStructure_toAccelerationStructure_), sourceAccelerationStructure, destinationAccelerationStructure);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::copyAndCompactAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyAndCompactAccelerationStructure_toAccelerationStructure_), sourceAccelerationStructure, destinationAccelerationStructure);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer, scratchBufferOffset);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset, MTL::AccelerationStructureRefitOptions options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_options_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer, scratchBufferOffset, options);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleCountersInBuffer_atSampleIndex_withBarrier_), sampleBuffer, sampleIndex, barrier);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::updateFence(const MTL::Fence* fence)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useHeap(const MTL::Heap* heap)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeap_), heap);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useHeaps(const MTL::Heap* const heaps[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeaps_count_), heaps, count);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useResource(const MTL::Resource* resource, MTL::ResourceUsage usage)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResource_usage_), resource, usage);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResources_count_usage_), resources, count, usage);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::waitForFence(const MTL::Fence* fence)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeCompactedAccelerationStructureSize_toBuffer_offset_), accelerationStructure, buffer, offset);
}
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset, MTL::DataType sizeDataType)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeCompactedAccelerationStructureSize_toBuffer_offset_sizeDataType_), accelerationStructure, buffer, offset, sizeDataType);
}
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::alloc()
{
return NS::Object::alloc<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassSampleBufferAttachmentDescriptor));
}
_MTL_INLINE NS::UInteger MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
}
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::init()
{
return NS::Object::init<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor>();
}
_MTL_INLINE MTL::CounterSampleBuffer* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::sampleBuffer() const
{
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
}
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
}
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
}
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
}
_MTL_INLINE NS::UInteger MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
}
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::alloc()
{
return NS::Object::alloc<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray));
}
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::init()
{
return NS::Object::init<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray>();
}
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
{
return Object::sendMessage<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
}
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
}
_MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::accelerationStructurePassDescriptor()
{
return Object::sendMessage<MTL::AccelerationStructurePassDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassDescriptor), _MTL_PRIVATE_SEL(accelerationStructurePassDescriptor));
}
_MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::alloc()
{
return NS::Object::alloc<MTL::AccelerationStructurePassDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassDescriptor));
}
_MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::init()
{
return NS::Object::init<MTL::AccelerationStructurePassDescriptor>();
}
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassDescriptor::sampleBufferAttachments() const
{
return Object::sendMessage<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
}

View File

@@ -1,292 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLAccelerationStructureTypes.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLDefines.hpp"
#include "MTLPrivate.hpp"
#include "MTLResource.hpp"
#include "MTLStageInputOutputDescriptor.hpp"
#include "../Foundation/Foundation.hpp"
#include <cstdint>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnested-anon-types"
struct PackedFloat3
{
PackedFloat3();
PackedFloat3(float x, float y, float z);
float& operator[](int idx);
float operator[](int idx) const;
union
{
struct
{
float x;
float y;
float z;
};
float elements[3];
};
} _MTL_PACKED;
#pragma clang diagnostic pop
struct PackedFloat4x3
{
PackedFloat4x3();
PackedFloat4x3(const PackedFloat3& col0, const PackedFloat3& col1, const PackedFloat3& col2, const PackedFloat3& col3);
PackedFloat3& operator[](int idx);
const PackedFloat3& operator[](int idx) const;
PackedFloat3 columns[4];
} _MTL_PACKED;
struct AxisAlignedBoundingBox
{
AxisAlignedBoundingBox();
AxisAlignedBoundingBox(PackedFloat3 p);
AxisAlignedBoundingBox(PackedFloat3 min, PackedFloat3 max);
PackedFloat3 min;
PackedFloat3 max;
} _MTL_PACKED;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnested-anon-types"
struct PackedFloatQuaternion
{
PackedFloatQuaternion();
PackedFloatQuaternion(float x, float y, float z, float w);
float& operator[](int idx);
const float& operator[](int idx) const;
union
{
struct
{
float x;
float y;
float z;
float w;
};
float elements[4];
};
} _MTL_PACKED;
#pragma clang diagnostic pop
struct ComponentTransform
{
PackedFloat3 scale;
PackedFloat3 shear;
PackedFloat3 pivot;
PackedFloatQuaternion rotation;
PackedFloat3 translation;
} _MTL_PACKED;
}
namespace MTL4
{
struct BufferRange
{
BufferRange() = default;
BufferRange(uint64_t bufferAddress);
BufferRange(uint64_t bufferAddress, uint64_t length);
static MTL4::BufferRange Make(uint64_t bufferAddress, uint64_t length);
uint64_t bufferAddress;
uint64_t length;
} _MTL_PACKED;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloat3::PackedFloat3()
: x(0.0f)
, y(0.0f)
, z(0.0f)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloat3::PackedFloat3(float _x, float _y, float _z)
: x(_x)
, y(_y)
, z(_z)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE float& MTL::PackedFloat3::operator[](int idx)
{
return elements[idx];
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE float MTL::PackedFloat3::operator[](int idx) const
{
return elements[idx];
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloat4x3::PackedFloat4x3()
{
columns[0] = PackedFloat3(0.0f, 0.0f, 0.0f);
columns[1] = PackedFloat3(0.0f, 0.0f, 0.0f);
columns[2] = PackedFloat3(0.0f, 0.0f, 0.0f);
columns[3] = PackedFloat3(0.0f, 0.0f, 0.0f);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloat4x3::PackedFloat4x3(const PackedFloat3& col0, const PackedFloat3& col1, const PackedFloat3& col2, const PackedFloat3& col3)
{
columns[0] = col0;
columns[1] = col1;
columns[2] = col2;
columns[3] = col3;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloat3& MTL::PackedFloat4x3::operator[](int idx)
{
return columns[idx];
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE const MTL::PackedFloat3& MTL::PackedFloat4x3::operator[](int idx) const
{
return columns[idx];
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#if __apple_build_version__ > 16000026
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnan-infinity-disabled"
#endif // __apple_build_version__ > 16000026
_MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox()
: min(INFINITY, INFINITY, INFINITY)
, max(-INFINITY, -INFINITY, -INFINITY)
{
}
#if __apple_build_version__ > 16000026
#pragma clang diagnostic pop
#endif // if __apple_build_version__ > 16000026
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox(PackedFloat3 p)
: min(p)
, max(p)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox(PackedFloat3 _min, PackedFloat3 _max)
: min(_min)
, max(_max)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloatQuaternion::PackedFloatQuaternion()
: x(0.0f)
, y(0.0f)
, z(0.0f)
, w(0.0f)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::PackedFloatQuaternion::PackedFloatQuaternion(float x, float y, float z, float w)
: x(x)
, y(y)
, z(z)
, w(w)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE float& MTL::PackedFloatQuaternion::operator[](int idx)
{
return elements[idx];
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE const float& MTL::PackedFloatQuaternion::operator[](int idx) const
{
return elements[idx];
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL4::BufferRange::BufferRange(uint64_t bufferAddress)
: bufferAddress(bufferAddress)
, length(-1)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL4::BufferRange::BufferRange(uint64_t bufferAddress, uint64_t length)
: bufferAddress(bufferAddress)
, length(length)
{
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL4::BufferRange MTL4::BufferRange::Make(uint64_t bufferAddress, uint64_t length)
{
return MTL4::BufferRange(bufferAddress, length);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,40 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLAllocation.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class Allocation : public NS::Referencing<Allocation>
{
public:
NS::UInteger allocatedSize() const;
};
}
_MTL_INLINE NS::UInteger MTL::Allocation::allocatedSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(allocatedSize));
}

View File

@@ -1,787 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLArgument.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDataType.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTensor.hpp"
#include "MTLTexture.hpp"
namespace MTL
{
class Argument;
class ArrayType;
class PointerType;
class StructMember;
class StructType;
class TensorExtents;
class TensorReferenceType;
class TextureReferenceType;
class Type;
_MTL_ENUM(NS::UInteger, IndexType) {
IndexTypeUInt16 = 0,
IndexTypeUInt32 = 1,
};
_MTL_ENUM(NS::Integer, BindingType) {
BindingTypeBuffer = 0,
BindingTypeThreadgroupMemory = 1,
BindingTypeTexture = 2,
BindingTypeSampler = 3,
BindingTypeImageblockData = 16,
BindingTypeImageblock = 17,
BindingTypeVisibleFunctionTable = 24,
BindingTypePrimitiveAccelerationStructure = 25,
BindingTypeInstanceAccelerationStructure = 26,
BindingTypeIntersectionFunctionTable = 27,
BindingTypeObjectPayload = 34,
BindingTypeTensor = 37,
};
_MTL_ENUM(NS::UInteger, ArgumentType) {
ArgumentTypeBuffer = 0,
ArgumentTypeThreadgroupMemory = 1,
ArgumentTypeTexture = 2,
ArgumentTypeSampler = 3,
ArgumentTypeImageblockData = 16,
ArgumentTypeImageblock = 17,
ArgumentTypeVisibleFunctionTable = 24,
ArgumentTypePrimitiveAccelerationStructure = 25,
ArgumentTypeInstanceAccelerationStructure = 26,
ArgumentTypeIntersectionFunctionTable = 27,
};
_MTL_ENUM(NS::UInteger, BindingAccess) {
BindingAccessReadOnly = 0,
BindingAccessReadWrite = 1,
BindingAccessWriteOnly = 2,
ArgumentAccessReadOnly = 0,
ArgumentAccessReadWrite = 1,
ArgumentAccessWriteOnly = 2,
};
class Type : public NS::Referencing<Type>
{
public:
static Type* alloc();
DataType dataType() const;
Type* init();
};
class StructMember : public NS::Referencing<StructMember>
{
public:
static StructMember* alloc();
NS::UInteger argumentIndex() const;
ArrayType* arrayType();
DataType dataType() const;
StructMember* init();
NS::String* name() const;
NS::UInteger offset() const;
PointerType* pointerType();
StructType* structType();
TensorReferenceType* tensorReferenceType();
TextureReferenceType* textureReferenceType();
};
class StructType : public NS::Referencing<StructType, Type>
{
public:
static StructType* alloc();
StructType* init();
StructMember* memberByName(const NS::String* name);
NS::Array* members() const;
};
class ArrayType : public NS::Referencing<ArrayType, Type>
{
public:
static ArrayType* alloc();
NS::UInteger argumentIndexStride() const;
NS::UInteger arrayLength() const;
ArrayType* elementArrayType();
PointerType* elementPointerType();
StructType* elementStructType();
TensorReferenceType* elementTensorReferenceType();
TextureReferenceType* elementTextureReferenceType();
DataType elementType() const;
ArrayType* init();
NS::UInteger stride() const;
};
class PointerType : public NS::Referencing<PointerType, Type>
{
public:
BindingAccess access() const;
NS::UInteger alignment() const;
static PointerType* alloc();
NS::UInteger dataSize() const;
ArrayType* elementArrayType();
bool elementIsArgumentBuffer() const;
StructType* elementStructType();
DataType elementType() const;
PointerType* init();
};
class TextureReferenceType : public NS::Referencing<TextureReferenceType, Type>
{
public:
BindingAccess access() const;
static TextureReferenceType* alloc();
TextureReferenceType* init();
bool isDepthTexture() const;
DataType textureDataType() const;
TextureType textureType() const;
};
class TensorReferenceType : public NS::Referencing<TensorReferenceType, Type>
{
public:
BindingAccess access() const;
static TensorReferenceType* alloc();
TensorExtents* dimensions() const;
DataType indexType() const;
TensorReferenceType* init();
TensorDataType tensorDataType() const;
};
class Argument : public NS::Referencing<Argument>
{
public:
BindingAccess access() const;
[[deprecated("please use isActive instead")]]
bool active() const;
static Argument* alloc();
NS::UInteger arrayLength() const;
NS::UInteger bufferAlignment() const;
NS::UInteger bufferDataSize() const;
DataType bufferDataType() const;
PointerType* bufferPointerType() const;
StructType* bufferStructType() const;
NS::UInteger index() const;
Argument* init();
bool isActive() const;
bool isDepthTexture() const;
NS::String* name() const;
DataType textureDataType() const;
TextureType textureType() const;
NS::UInteger threadgroupMemoryAlignment() const;
NS::UInteger threadgroupMemoryDataSize() const;
ArgumentType type() const;
};
class Binding : public NS::Referencing<Binding>
{
public:
BindingAccess access() const;
[[deprecated("please use isArgument instead")]]
bool argument() const;
NS::UInteger index() const;
bool isArgument() const;
bool isUsed() const;
NS::String* name() const;
BindingType type() const;
[[deprecated("please use isUsed instead")]]
bool used() const;
};
class BufferBinding : public NS::Referencing<BufferBinding, Binding>
{
public:
NS::UInteger bufferAlignment() const;
NS::UInteger bufferDataSize() const;
DataType bufferDataType() const;
PointerType* bufferPointerType() const;
StructType* bufferStructType() const;
};
class ThreadgroupBinding : public NS::Referencing<ThreadgroupBinding, Binding>
{
public:
NS::UInteger threadgroupMemoryAlignment() const;
NS::UInteger threadgroupMemoryDataSize() const;
};
class TextureBinding : public NS::Referencing<TextureBinding, Binding>
{
public:
NS::UInteger arrayLength() const;
[[deprecated("please use isDepthTexture instead")]]
bool depthTexture() const;
bool isDepthTexture() const;
DataType textureDataType() const;
TextureType textureType() const;
};
class ObjectPayloadBinding : public NS::Referencing<ObjectPayloadBinding, Binding>
{
public:
NS::UInteger objectPayloadAlignment() const;
NS::UInteger objectPayloadDataSize() const;
};
class TensorBinding : public NS::Referencing<TensorBinding, Binding>
{
public:
TensorExtents* dimensions() const;
DataType indexType() const;
TensorDataType tensorDataType() const;
};
}
_MTL_INLINE MTL::Type* MTL::Type::alloc()
{
return NS::Object::alloc<MTL::Type>(_MTL_PRIVATE_CLS(MTLType));
}
_MTL_INLINE MTL::DataType MTL::Type::dataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
}
_MTL_INLINE MTL::Type* MTL::Type::init()
{
return NS::Object::init<MTL::Type>();
}
_MTL_INLINE MTL::StructMember* MTL::StructMember::alloc()
{
return NS::Object::alloc<MTL::StructMember>(_MTL_PRIVATE_CLS(MTLStructMember));
}
_MTL_INLINE NS::UInteger MTL::StructMember::argumentIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndex));
}
_MTL_INLINE MTL::ArrayType* MTL::StructMember::arrayType()
{
return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(arrayType));
}
_MTL_INLINE MTL::DataType MTL::StructMember::dataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
}
_MTL_INLINE MTL::StructMember* MTL::StructMember::init()
{
return NS::Object::init<MTL::StructMember>();
}
_MTL_INLINE NS::String* MTL::StructMember::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE NS::UInteger MTL::StructMember::offset() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(offset));
}
_MTL_INLINE MTL::PointerType* MTL::StructMember::pointerType()
{
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(pointerType));
}
_MTL_INLINE MTL::StructType* MTL::StructMember::structType()
{
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(structType));
}
_MTL_INLINE MTL::TensorReferenceType* MTL::StructMember::tensorReferenceType()
{
return Object::sendMessage<MTL::TensorReferenceType*>(this, _MTL_PRIVATE_SEL(tensorReferenceType));
}
_MTL_INLINE MTL::TextureReferenceType* MTL::StructMember::textureReferenceType()
{
return Object::sendMessage<MTL::TextureReferenceType*>(this, _MTL_PRIVATE_SEL(textureReferenceType));
}
_MTL_INLINE MTL::StructType* MTL::StructType::alloc()
{
return NS::Object::alloc<MTL::StructType>(_MTL_PRIVATE_CLS(MTLStructType));
}
_MTL_INLINE MTL::StructType* MTL::StructType::init()
{
return NS::Object::init<MTL::StructType>();
}
_MTL_INLINE MTL::StructMember* MTL::StructType::memberByName(const NS::String* name)
{
return Object::sendMessage<MTL::StructMember*>(this, _MTL_PRIVATE_SEL(memberByName_), name);
}
_MTL_INLINE NS::Array* MTL::StructType::members() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(members));
}
_MTL_INLINE MTL::ArrayType* MTL::ArrayType::alloc()
{
return NS::Object::alloc<MTL::ArrayType>(_MTL_PRIVATE_CLS(MTLArrayType));
}
_MTL_INLINE NS::UInteger MTL::ArrayType::argumentIndexStride() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndexStride));
}
_MTL_INLINE NS::UInteger MTL::ArrayType::arrayLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
}
_MTL_INLINE MTL::ArrayType* MTL::ArrayType::elementArrayType()
{
return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(elementArrayType));
}
_MTL_INLINE MTL::PointerType* MTL::ArrayType::elementPointerType()
{
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(elementPointerType));
}
_MTL_INLINE MTL::StructType* MTL::ArrayType::elementStructType()
{
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(elementStructType));
}
_MTL_INLINE MTL::TensorReferenceType* MTL::ArrayType::elementTensorReferenceType()
{
return Object::sendMessage<MTL::TensorReferenceType*>(this, _MTL_PRIVATE_SEL(elementTensorReferenceType));
}
_MTL_INLINE MTL::TextureReferenceType* MTL::ArrayType::elementTextureReferenceType()
{
return Object::sendMessage<MTL::TextureReferenceType*>(this, _MTL_PRIVATE_SEL(elementTextureReferenceType));
}
_MTL_INLINE MTL::DataType MTL::ArrayType::elementType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(elementType));
}
_MTL_INLINE MTL::ArrayType* MTL::ArrayType::init()
{
return NS::Object::init<MTL::ArrayType>();
}
_MTL_INLINE NS::UInteger MTL::ArrayType::stride() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(stride));
}
_MTL_INLINE MTL::BindingAccess MTL::PointerType::access() const
{
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
}
_MTL_INLINE NS::UInteger MTL::PointerType::alignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));
}
_MTL_INLINE MTL::PointerType* MTL::PointerType::alloc()
{
return NS::Object::alloc<MTL::PointerType>(_MTL_PRIVATE_CLS(MTLPointerType));
}
_MTL_INLINE NS::UInteger MTL::PointerType::dataSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(dataSize));
}
_MTL_INLINE MTL::ArrayType* MTL::PointerType::elementArrayType()
{
return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(elementArrayType));
}
_MTL_INLINE bool MTL::PointerType::elementIsArgumentBuffer() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(elementIsArgumentBuffer));
}
_MTL_INLINE MTL::StructType* MTL::PointerType::elementStructType()
{
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(elementStructType));
}
_MTL_INLINE MTL::DataType MTL::PointerType::elementType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(elementType));
}
_MTL_INLINE MTL::PointerType* MTL::PointerType::init()
{
return NS::Object::init<MTL::PointerType>();
}
_MTL_INLINE MTL::BindingAccess MTL::TextureReferenceType::access() const
{
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
}
_MTL_INLINE MTL::TextureReferenceType* MTL::TextureReferenceType::alloc()
{
return NS::Object::alloc<MTL::TextureReferenceType>(_MTL_PRIVATE_CLS(MTLTextureReferenceType));
}
_MTL_INLINE MTL::TextureReferenceType* MTL::TextureReferenceType::init()
{
return NS::Object::init<MTL::TextureReferenceType>();
}
_MTL_INLINE bool MTL::TextureReferenceType::isDepthTexture() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
}
_MTL_INLINE MTL::DataType MTL::TextureReferenceType::textureDataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
}
_MTL_INLINE MTL::TextureType MTL::TextureReferenceType::textureType() const
{
return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
}
_MTL_INLINE MTL::BindingAccess MTL::TensorReferenceType::access() const
{
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
}
_MTL_INLINE MTL::TensorReferenceType* MTL::TensorReferenceType::alloc()
{
return NS::Object::alloc<MTL::TensorReferenceType>(_MTL_PRIVATE_CLS(MTLTensorReferenceType));
}
_MTL_INLINE MTL::TensorExtents* MTL::TensorReferenceType::dimensions() const
{
return Object::sendMessage<MTL::TensorExtents*>(this, _MTL_PRIVATE_SEL(dimensions));
}
_MTL_INLINE MTL::DataType MTL::TensorReferenceType::indexType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(indexType));
}
_MTL_INLINE MTL::TensorReferenceType* MTL::TensorReferenceType::init()
{
return NS::Object::init<MTL::TensorReferenceType>();
}
_MTL_INLINE MTL::TensorDataType MTL::TensorReferenceType::tensorDataType() const
{
return Object::sendMessage<MTL::TensorDataType>(this, _MTL_PRIVATE_SEL(tensorDataType));
}
_MTL_INLINE MTL::BindingAccess MTL::Argument::access() const
{
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
}
_MTL_INLINE bool MTL::Argument::active() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
}
_MTL_INLINE MTL::Argument* MTL::Argument::alloc()
{
return NS::Object::alloc<MTL::Argument>(_MTL_PRIVATE_CLS(MTLArgument));
}
_MTL_INLINE NS::UInteger MTL::Argument::arrayLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
}
_MTL_INLINE NS::UInteger MTL::Argument::bufferAlignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferAlignment));
}
_MTL_INLINE NS::UInteger MTL::Argument::bufferDataSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferDataSize));
}
_MTL_INLINE MTL::DataType MTL::Argument::bufferDataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(bufferDataType));
}
_MTL_INLINE MTL::PointerType* MTL::Argument::bufferPointerType() const
{
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(bufferPointerType));
}
_MTL_INLINE MTL::StructType* MTL::Argument::bufferStructType() const
{
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(bufferStructType));
}
_MTL_INLINE NS::UInteger MTL::Argument::index() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
}
_MTL_INLINE MTL::Argument* MTL::Argument::init()
{
return NS::Object::init<MTL::Argument>();
}
_MTL_INLINE bool MTL::Argument::isActive() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
}
_MTL_INLINE bool MTL::Argument::isDepthTexture() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
}
_MTL_INLINE NS::String* MTL::Argument::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE MTL::DataType MTL::Argument::textureDataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
}
_MTL_INLINE MTL::TextureType MTL::Argument::textureType() const
{
return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
}
_MTL_INLINE NS::UInteger MTL::Argument::threadgroupMemoryAlignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryAlignment));
}
_MTL_INLINE NS::UInteger MTL::Argument::threadgroupMemoryDataSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryDataSize));
}
_MTL_INLINE MTL::ArgumentType MTL::Argument::type() const
{
return Object::sendMessage<MTL::ArgumentType>(this, _MTL_PRIVATE_SEL(type));
}
_MTL_INLINE MTL::BindingAccess MTL::Binding::access() const
{
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
}
_MTL_INLINE bool MTL::Binding::argument() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isArgument));
}
_MTL_INLINE NS::UInteger MTL::Binding::index() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
}
_MTL_INLINE bool MTL::Binding::isArgument() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isArgument));
}
_MTL_INLINE bool MTL::Binding::isUsed() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isUsed));
}
_MTL_INLINE NS::String* MTL::Binding::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE MTL::BindingType MTL::Binding::type() const
{
return Object::sendMessage<MTL::BindingType>(this, _MTL_PRIVATE_SEL(type));
}
_MTL_INLINE bool MTL::Binding::used() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isUsed));
}
_MTL_INLINE NS::UInteger MTL::BufferBinding::bufferAlignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferAlignment));
}
_MTL_INLINE NS::UInteger MTL::BufferBinding::bufferDataSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferDataSize));
}
_MTL_INLINE MTL::DataType MTL::BufferBinding::bufferDataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(bufferDataType));
}
_MTL_INLINE MTL::PointerType* MTL::BufferBinding::bufferPointerType() const
{
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(bufferPointerType));
}
_MTL_INLINE MTL::StructType* MTL::BufferBinding::bufferStructType() const
{
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(bufferStructType));
}
_MTL_INLINE NS::UInteger MTL::ThreadgroupBinding::threadgroupMemoryAlignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryAlignment));
}
_MTL_INLINE NS::UInteger MTL::ThreadgroupBinding::threadgroupMemoryDataSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryDataSize));
}
_MTL_INLINE NS::UInteger MTL::TextureBinding::arrayLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
}
_MTL_INLINE bool MTL::TextureBinding::depthTexture() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
}
_MTL_INLINE bool MTL::TextureBinding::isDepthTexture() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
}
_MTL_INLINE MTL::DataType MTL::TextureBinding::textureDataType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
}
_MTL_INLINE MTL::TextureType MTL::TextureBinding::textureType() const
{
return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
}
_MTL_INLINE NS::UInteger MTL::ObjectPayloadBinding::objectPayloadAlignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(objectPayloadAlignment));
}
_MTL_INLINE NS::UInteger MTL::ObjectPayloadBinding::objectPayloadDataSize() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(objectPayloadDataSize));
}
_MTL_INLINE MTL::TensorExtents* MTL::TensorBinding::dimensions() const
{
return Object::sendMessage<MTL::TensorExtents*>(this, _MTL_PRIVATE_SEL(dimensions));
}
_MTL_INLINE MTL::DataType MTL::TensorBinding::indexType() const
{
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(indexType));
}
_MTL_INLINE MTL::TensorDataType MTL::TensorBinding::tensorDataType() const
{
return Object::sendMessage<MTL::TensorDataType>(this, _MTL_PRIVATE_SEL(tensorDataType));
}

View File

@@ -1,235 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLArgumentEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLDepthStencil.hpp"
namespace MTL
{
class AccelerationStructure;
class ArgumentEncoder;
class Buffer;
class ComputePipelineState;
class Device;
class IndirectCommandBuffer;
class IntersectionFunctionTable;
class RenderPipelineState;
class SamplerState;
class Texture;
class VisibleFunctionTable;
static const NS::UInteger AttributeStrideStatic = NS::UIntegerMax;
class ArgumentEncoder : public NS::Referencing<ArgumentEncoder>
{
public:
NS::UInteger alignment() const;
void* constantData(NS::UInteger index);
Device* device() const;
NS::UInteger encodedLength() const;
NS::String* label() const;
ArgumentEncoder* newArgumentEncoder(NS::UInteger index);
void setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index);
void setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset);
void setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement);
void setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);
void setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
void setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index);
void setComputePipelineStates(const MTL::ComputePipelineState* const pipelines[], NS::Range range);
void setDepthStencilState(const MTL::DepthStencilState* depthStencilState, NS::UInteger index);
void setDepthStencilStates(const MTL::DepthStencilState* const depthStencilStates[], NS::Range range);
void setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index);
void setIndirectCommandBuffers(const MTL::IndirectCommandBuffer* const buffers[], NS::Range range);
void setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index);
void setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);
void setLabel(const NS::String* label);
void setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index);
void setRenderPipelineStates(const MTL::RenderPipelineState* const pipelines[], NS::Range range);
void setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);
void setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);
void setTexture(const MTL::Texture* texture, NS::UInteger index);
void setTextures(const MTL::Texture* const textures[], NS::Range range);
void setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index);
void setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);
};
}
_MTL_INLINE NS::UInteger MTL::ArgumentEncoder::alignment() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));
}
_MTL_INLINE void* MTL::ArgumentEncoder::constantData(NS::UInteger index)
{
return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(constantDataAtIndex_), index);
}
_MTL_INLINE MTL::Device* MTL::ArgumentEncoder::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::UInteger MTL::ArgumentEncoder::encodedLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(encodedLength));
}
_MTL_INLINE NS::String* MTL::ArgumentEncoder::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL::ArgumentEncoder* MTL::ArgumentEncoder::newArgumentEncoder(NS::UInteger index)
{
return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderForBufferAtIndex_), index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atIndex_), accelerationStructure, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_offset_), argumentBuffer, offset);
}
_MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_startOffset_arrayElement_), argumentBuffer, startOffset, arrayElement);
}
_MTL_INLINE void MTL::ArgumentEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_atIndex_), pipeline, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineStates(const MTL::ComputePipelineState* const pipelines[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineStates_withRange_), pipelines, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setDepthStencilState(const MTL::DepthStencilState* depthStencilState, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilState_atIndex_), depthStencilState, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setDepthStencilStates(const MTL::DepthStencilState* const depthStencilStates[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilStates_withRange_), depthStencilStates, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffer_atIndex_), indirectCommandBuffer, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffers(const MTL::IndirectCommandBuffer* const buffers[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffers_withRange_), buffers, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atIndex_), intersectionFunctionTable, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTables_withRange_), intersectionFunctionTables, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_atIndex_), pipeline, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineStates(const MTL::RenderPipelineState* const pipelines[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineStates_withRange_), pipelines, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_withRange_), samplers, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setTextures(const MTL::Texture* const textures[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextures_withRange_), textures, range);
}
_MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atIndex_), visibleFunctionTable, index);
}
_MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withRange_), visibleFunctionTables, range);
}

View File

@@ -1,152 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLBinaryArchive.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class BinaryArchiveDescriptor;
class ComputePipelineDescriptor;
class Device;
class FunctionDescriptor;
class Library;
class MeshRenderPipelineDescriptor;
class RenderPipelineDescriptor;
class StitchedLibraryDescriptor;
class TileRenderPipelineDescriptor;
_MTL_ENUM(NS::UInteger, BinaryArchiveError) {
BinaryArchiveErrorNone = 0,
BinaryArchiveErrorInvalidFile = 1,
BinaryArchiveErrorUnexpectedElement = 2,
BinaryArchiveErrorCompilationFailure = 3,
BinaryArchiveErrorInternalError = 4,
};
_MTL_CONST(NS::ErrorDomain, BinaryArchiveDomain);
class BinaryArchiveDescriptor : public NS::Copying<BinaryArchiveDescriptor>
{
public:
static BinaryArchiveDescriptor* alloc();
BinaryArchiveDescriptor* init();
void setUrl(const NS::URL* url);
NS::URL* url() const;
};
class BinaryArchive : public NS::Referencing<BinaryArchive>
{
public:
bool addComputePipelineFunctions(const MTL::ComputePipelineDescriptor* descriptor, NS::Error** error);
bool addFunction(const MTL::FunctionDescriptor* descriptor, const MTL::Library* library, NS::Error** error);
bool addLibrary(const MTL::StitchedLibraryDescriptor* descriptor, NS::Error** error);
bool addMeshRenderPipelineFunctions(const MTL::MeshRenderPipelineDescriptor* descriptor, NS::Error** error);
bool addRenderPipelineFunctions(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error);
bool addTileRenderPipelineFunctions(const MTL::TileRenderPipelineDescriptor* descriptor, NS::Error** error);
Device* device() const;
NS::String* label() const;
bool serializeToURL(const NS::URL* url, NS::Error** error);
void setLabel(const NS::String* label);
};
}
_MTL_PRIVATE_DEF_CONST(NS::ErrorDomain, BinaryArchiveDomain);
_MTL_INLINE MTL::BinaryArchiveDescriptor* MTL::BinaryArchiveDescriptor::alloc()
{
return NS::Object::alloc<MTL::BinaryArchiveDescriptor>(_MTL_PRIVATE_CLS(MTLBinaryArchiveDescriptor));
}
_MTL_INLINE MTL::BinaryArchiveDescriptor* MTL::BinaryArchiveDescriptor::init()
{
return NS::Object::init<MTL::BinaryArchiveDescriptor>();
}
_MTL_INLINE void MTL::BinaryArchiveDescriptor::setUrl(const NS::URL* url)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setUrl_), url);
}
_MTL_INLINE NS::URL* MTL::BinaryArchiveDescriptor::url() const
{
return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(url));
}
_MTL_INLINE bool MTL::BinaryArchive::addComputePipelineFunctions(const MTL::ComputePipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addComputePipelineFunctionsWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE bool MTL::BinaryArchive::addFunction(const MTL::FunctionDescriptor* descriptor, const MTL::Library* library, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addFunctionWithDescriptor_library_error_), descriptor, library, error);
}
_MTL_INLINE bool MTL::BinaryArchive::addLibrary(const MTL::StitchedLibraryDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addLibraryWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE bool MTL::BinaryArchive::addMeshRenderPipelineFunctions(const MTL::MeshRenderPipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addMeshRenderPipelineFunctionsWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE bool MTL::BinaryArchive::addRenderPipelineFunctions(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addRenderPipelineFunctionsWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE bool MTL::BinaryArchive::addTileRenderPipelineFunctions(const MTL::TileRenderPipelineDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addTileRenderPipelineFunctionsWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE MTL::Device* MTL::BinaryArchive::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::String* MTL::BinaryArchive::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE bool MTL::BinaryArchive::serializeToURL(const NS::URL* url, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(serializeToURL_error_), url, error);
}
_MTL_INLINE void MTL::BinaryArchive::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}

View File

@@ -1,226 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLBlitCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLCommandEncoder.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
#include <cstdint>
namespace MTL
{
class Buffer;
class CounterSampleBuffer;
class Fence;
class IndirectCommandBuffer;
class Resource;
class Tensor;
class TensorExtents;
class Texture;
_MTL_OPTIONS(NS::UInteger, BlitOption) {
BlitOptionNone = 0,
BlitOptionDepthFromDepthStencil = 1,
BlitOptionStencilFromDepthStencil = 1 << 1,
BlitOptionRowLinearPVRTC = 1 << 2,
};
class BlitCommandEncoder : public NS::Referencing<BlitCommandEncoder, CommandEncoder>
{
public:
void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options);
void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size);
void copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options);
void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount);
void copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture);
void copyIndirectCommandBuffer(const MTL::IndirectCommandBuffer* source, NS::Range sourceRange, const MTL::IndirectCommandBuffer* destination, NS::UInteger destinationIndex);
void fillBuffer(const MTL::Buffer* buffer, NS::Range range, uint8_t value);
void generateMipmaps(const MTL::Texture* texture);
void getTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice, bool resetCounters, const MTL::Buffer* countersBuffer, NS::UInteger countersBufferOffset);
void optimizeContentsForCPUAccess(const MTL::Texture* texture);
void optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);
void optimizeContentsForGPUAccess(const MTL::Texture* texture);
void optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);
void optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range range);
void resetCommandsInBuffer(const MTL::IndirectCommandBuffer* buffer, NS::Range range);
void resetTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice);
void resolveCounters(const MTL::CounterSampleBuffer* sampleBuffer, NS::Range range, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset);
void sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
void synchronizeResource(const MTL::Resource* resource);
void synchronizeTexture(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);
void updateFence(const MTL::Fence* fence);
void waitForFence(const MTL::Fence* fence);
};
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceBuffer, sourceOffset, sourceBytesPerRow, sourceBytesPerImage, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options_), sourceBuffer, sourceOffset, sourceBytesPerRow, sourceBytesPerImage, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin, options);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size_), sourceBuffer, sourceOffset, destinationBuffer, destinationOffset, size);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTensor_sourceOrigin_sourceDimensions_toTensor_destinationOrigin_destinationDimensions_), sourceTensor, sourceOrigin, sourceDimensions, destinationTensor, destinationOrigin, destinationDimensions);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationBuffer, destinationOffset, destinationBytesPerRow, destinationBytesPerImage);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationBuffer, destinationOffset, destinationBytesPerRow, destinationBytesPerImage, options);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount_), sourceTexture, sourceSlice, sourceLevel, destinationTexture, destinationSlice, destinationLevel, sliceCount, levelCount);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_toTexture_), sourceTexture, destinationTexture);
}
_MTL_INLINE void MTL::BlitCommandEncoder::copyIndirectCommandBuffer(const MTL::IndirectCommandBuffer* source, NS::Range sourceRange, const MTL::IndirectCommandBuffer* destination, NS::UInteger destinationIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyIndirectCommandBuffer_sourceRange_destination_destinationIndex_), source, sourceRange, destination, destinationIndex);
}
_MTL_INLINE void MTL::BlitCommandEncoder::fillBuffer(const MTL::Buffer* buffer, NS::Range range, uint8_t value)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(fillBuffer_range_value_), buffer, range, value);
}
_MTL_INLINE void MTL::BlitCommandEncoder::generateMipmaps(const MTL::Texture* texture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(generateMipmapsForTexture_), texture);
}
_MTL_INLINE void MTL::BlitCommandEncoder::getTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice, bool resetCounters, const MTL::Buffer* countersBuffer, NS::UInteger countersBufferOffset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset_), texture, region, mipLevel, slice, resetCounters, countersBuffer, countersBufferOffset);
}
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_), texture);
}
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_slice_level_), texture, slice, level);
}
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_), texture);
}
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_slice_level_), texture, slice, level);
}
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeIndirectCommandBuffer_withRange_), indirectCommandBuffer, range);
}
_MTL_INLINE void MTL::BlitCommandEncoder::resetCommandsInBuffer(const MTL::IndirectCommandBuffer* buffer, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetCommandsInBuffer_withRange_), buffer, range);
}
_MTL_INLINE void MTL::BlitCommandEncoder::resetTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetTextureAccessCounters_region_mipLevel_slice_), texture, region, mipLevel, slice);
}
_MTL_INLINE void MTL::BlitCommandEncoder::resolveCounters(const MTL::CounterSampleBuffer* sampleBuffer, NS::Range range, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resolveCounters_inRange_destinationBuffer_destinationOffset_), sampleBuffer, range, destinationBuffer, destinationOffset);
}
_MTL_INLINE void MTL::BlitCommandEncoder::sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleCountersInBuffer_atSampleIndex_withBarrier_), sampleBuffer, sampleIndex, barrier);
}
_MTL_INLINE void MTL::BlitCommandEncoder::synchronizeResource(const MTL::Resource* resource)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(synchronizeResource_), resource);
}
_MTL_INLINE void MTL::BlitCommandEncoder::synchronizeTexture(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(synchronizeTexture_slice_level_), texture, slice, level);
}
_MTL_INLINE void MTL::BlitCommandEncoder::updateFence(const MTL::Fence* fence)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
}
_MTL_INLINE void MTL::BlitCommandEncoder::waitForFence(const MTL::Fence* fence)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
}

View File

@@ -1,154 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLBlitPass.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class BlitPassDescriptor;
class BlitPassSampleBufferAttachmentDescriptor;
class BlitPassSampleBufferAttachmentDescriptorArray;
class CounterSampleBuffer;
class BlitPassSampleBufferAttachmentDescriptor : public NS::Copying<BlitPassSampleBufferAttachmentDescriptor>
{
public:
static BlitPassSampleBufferAttachmentDescriptor* alloc();
NS::UInteger endOfEncoderSampleIndex() const;
BlitPassSampleBufferAttachmentDescriptor* init();
CounterSampleBuffer* sampleBuffer() const;
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
void setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer);
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
NS::UInteger startOfEncoderSampleIndex() const;
};
class BlitPassSampleBufferAttachmentDescriptorArray : public NS::Referencing<BlitPassSampleBufferAttachmentDescriptorArray>
{
public:
static BlitPassSampleBufferAttachmentDescriptorArray* alloc();
BlitPassSampleBufferAttachmentDescriptorArray* init();
BlitPassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
void setObject(const MTL::BlitPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
};
class BlitPassDescriptor : public NS::Copying<BlitPassDescriptor>
{
public:
static BlitPassDescriptor* alloc();
static BlitPassDescriptor* blitPassDescriptor();
BlitPassDescriptor* init();
BlitPassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
};
}
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptor::alloc()
{
return NS::Object::alloc<MTL::BlitPassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLBlitPassSampleBufferAttachmentDescriptor));
}
_MTL_INLINE NS::UInteger MTL::BlitPassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
}
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptor::init()
{
return NS::Object::init<MTL::BlitPassSampleBufferAttachmentDescriptor>();
}
_MTL_INLINE MTL::CounterSampleBuffer* MTL::BlitPassSampleBufferAttachmentDescriptor::sampleBuffer() const
{
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
}
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
}
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
}
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
}
_MTL_INLINE NS::UInteger MTL::BlitPassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
}
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassSampleBufferAttachmentDescriptorArray::alloc()
{
return NS::Object::alloc<MTL::BlitPassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLBlitPassSampleBufferAttachmentDescriptorArray));
}
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassSampleBufferAttachmentDescriptorArray::init()
{
return NS::Object::init<MTL::BlitPassSampleBufferAttachmentDescriptorArray>();
}
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
{
return Object::sendMessage<MTL::BlitPassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
}
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptorArray::setObject(const MTL::BlitPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
}
_MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::alloc()
{
return NS::Object::alloc<MTL::BlitPassDescriptor>(_MTL_PRIVATE_CLS(MTLBlitPassDescriptor));
}
_MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::blitPassDescriptor()
{
return Object::sendMessage<MTL::BlitPassDescriptor*>(_MTL_PRIVATE_CLS(MTLBlitPassDescriptor), _MTL_PRIVATE_SEL(blitPassDescriptor));
}
_MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::init()
{
return NS::Object::init<MTL::BlitPassDescriptor>();
}
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassDescriptor::sampleBufferAttachments() const
{
return Object::sendMessage<MTL::BlitPassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
}

View File

@@ -1,119 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLBuffer.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLGPUAddress.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLResource.hpp"
namespace MTL
{
class Buffer;
class Device;
class Tensor;
class TensorDescriptor;
class Texture;
class TextureDescriptor;
class Buffer : public NS::Referencing<Buffer, Resource>
{
public:
void addDebugMarker(const NS::String* marker, NS::Range range);
void* contents();
void didModifyRange(NS::Range range);
GPUAddress gpuAddress() const;
NS::UInteger length() const;
Buffer* newRemoteBufferViewForDevice(const MTL::Device* device);
Tensor* newTensor(const MTL::TensorDescriptor* descriptor, NS::UInteger offset, NS::Error** error);
Texture* newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset, NS::UInteger bytesPerRow);
Buffer* remoteStorageBuffer() const;
void removeAllDebugMarkers();
BufferSparseTier sparseBufferTier() const;
};
}
_MTL_INLINE void MTL::Buffer::addDebugMarker(const NS::String* marker, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addDebugMarker_range_), marker, range);
}
_MTL_INLINE void* MTL::Buffer::contents()
{
return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(contents));
}
_MTL_INLINE void MTL::Buffer::didModifyRange(NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(didModifyRange_), range);
}
_MTL_INLINE MTL::GPUAddress MTL::Buffer::gpuAddress() const
{
return Object::sendMessage<MTL::GPUAddress>(this, _MTL_PRIVATE_SEL(gpuAddress));
}
_MTL_INLINE NS::UInteger MTL::Buffer::length() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(length));
}
_MTL_INLINE MTL::Buffer* MTL::Buffer::newRemoteBufferViewForDevice(const MTL::Device* device)
{
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newRemoteBufferViewForDevice_), device);
}
_MTL_INLINE MTL::Tensor* MTL::Buffer::newTensor(const MTL::TensorDescriptor* descriptor, NS::UInteger offset, NS::Error** error)
{
return Object::sendMessage<MTL::Tensor*>(this, _MTL_PRIVATE_SEL(newTensorWithDescriptor_offset_error_), descriptor, offset, error);
}
_MTL_INLINE MTL::Texture* MTL::Buffer::newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset, NS::UInteger bytesPerRow)
{
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_offset_bytesPerRow_), descriptor, offset, bytesPerRow);
}
_MTL_INLINE MTL::Buffer* MTL::Buffer::remoteStorageBuffer() const
{
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(remoteStorageBuffer));
}
_MTL_INLINE void MTL::Buffer::removeAllDebugMarkers()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeAllDebugMarkers));
}
_MTL_INLINE MTL::BufferSparseTier MTL::Buffer::sparseBufferTier() const
{
return Object::sendMessage<MTL::BufferSparseTier>(this, _MTL_PRIVATE_SEL(sparseBufferTier));
}

View File

@@ -1,217 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLCaptureManager.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class CaptureDescriptor;
class CaptureManager;
class CaptureScope;
class CommandQueue;
class Device;
}
namespace MTL4
{
class CommandQueue;
}
namespace MTL
{
_MTL_ENUM(NS::Integer, CaptureError) {
CaptureErrorNotSupported = 1,
CaptureErrorAlreadyCapturing = 2,
CaptureErrorInvalidDescriptor = 3,
};
_MTL_ENUM(NS::Integer, CaptureDestination) {
CaptureDestinationDeveloperTools = 1,
CaptureDestinationGPUTraceDocument = 2,
};
class CaptureDescriptor : public NS::Copying<CaptureDescriptor>
{
public:
static CaptureDescriptor* alloc();
NS::Object* captureObject() const;
CaptureDestination destination() const;
CaptureDescriptor* init();
NS::URL* outputURL() const;
void setCaptureObject(NS::Object* captureObject);
void setDestination(MTL::CaptureDestination destination);
void setOutputURL(const NS::URL* outputURL);
};
class CaptureManager : public NS::Referencing<CaptureManager>
{
public:
static CaptureManager* alloc();
CaptureScope* defaultCaptureScope() const;
CaptureManager* init();
bool isCapturing() const;
CaptureScope* newCaptureScope(const MTL::Device* device);
CaptureScope* newCaptureScope(const MTL::CommandQueue* commandQueue);
CaptureScope* newCaptureScope(const MTL4::CommandQueue* commandQueue);
void setDefaultCaptureScope(const MTL::CaptureScope* defaultCaptureScope);
static CaptureManager* sharedCaptureManager();
bool startCapture(const MTL::CaptureDescriptor* descriptor, NS::Error** error);
void startCapture(const MTL::Device* device);
void startCapture(const MTL::CommandQueue* commandQueue);
void startCapture(const MTL::CaptureScope* captureScope);
void stopCapture();
bool supportsDestination(MTL::CaptureDestination destination);
};
}
_MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::alloc()
{
return NS::Object::alloc<MTL::CaptureDescriptor>(_MTL_PRIVATE_CLS(MTLCaptureDescriptor));
}
_MTL_INLINE NS::Object* MTL::CaptureDescriptor::captureObject() const
{
return Object::sendMessage<NS::Object*>(this, _MTL_PRIVATE_SEL(captureObject));
}
_MTL_INLINE MTL::CaptureDestination MTL::CaptureDescriptor::destination() const
{
return Object::sendMessage<MTL::CaptureDestination>(this, _MTL_PRIVATE_SEL(destination));
}
_MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::init()
{
return NS::Object::init<MTL::CaptureDescriptor>();
}
_MTL_INLINE NS::URL* MTL::CaptureDescriptor::outputURL() const
{
return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(outputURL));
}
_MTL_INLINE void MTL::CaptureDescriptor::setCaptureObject(NS::Object* captureObject)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCaptureObject_), captureObject);
}
_MTL_INLINE void MTL::CaptureDescriptor::setDestination(MTL::CaptureDestination destination)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDestination_), destination);
}
_MTL_INLINE void MTL::CaptureDescriptor::setOutputURL(const NS::URL* outputURL)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputURL_), outputURL);
}
_MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::alloc()
{
return NS::Object::alloc<MTL::CaptureManager>(_MTL_PRIVATE_CLS(MTLCaptureManager));
}
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::defaultCaptureScope() const
{
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(defaultCaptureScope));
}
_MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::init()
{
return NS::Object::init<MTL::CaptureManager>();
}
_MTL_INLINE bool MTL::CaptureManager::isCapturing() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isCapturing));
}
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::Device* device)
{
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithDevice_), device);
}
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::CommandQueue* commandQueue)
{
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithCommandQueue_), commandQueue);
}
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL4::CommandQueue* commandQueue)
{
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithMTL4CommandQueue_), commandQueue);
}
_MTL_INLINE void MTL::CaptureManager::setDefaultCaptureScope(const MTL::CaptureScope* defaultCaptureScope)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDefaultCaptureScope_), defaultCaptureScope);
}
_MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::sharedCaptureManager()
{
return Object::sendMessage<MTL::CaptureManager*>(_MTL_PRIVATE_CLS(MTLCaptureManager), _MTL_PRIVATE_SEL(sharedCaptureManager));
}
_MTL_INLINE bool MTL::CaptureManager::startCapture(const MTL::CaptureDescriptor* descriptor, NS::Error** error)
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(startCaptureWithDescriptor_error_), descriptor, error);
}
_MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::Device* device)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithDevice_), device);
}
_MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CommandQueue* commandQueue)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithCommandQueue_), commandQueue);
}
_MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CaptureScope* captureScope)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithScope_), captureScope);
}
_MTL_INLINE void MTL::CaptureManager::stopCapture()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(stopCapture));
}
_MTL_INLINE bool MTL::CaptureManager::supportsDestination(MTL::CaptureDestination destination)
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsDestination_), destination);
}

View File

@@ -1,91 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLCaptureScope.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLDefines.hpp"
#include "MTLPrivate.hpp"
#include "../Foundation/Foundation.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTL
{
class CaptureScope : public NS::Referencing<CaptureScope>
{
public:
class Device* device() const;
NS::String* label() const;
void setLabel(const NS::String* pLabel);
class CommandQueue* commandQueue() const;
void beginScope();
void endScope();
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::Device* MTL::CaptureScope::device() const
{
return Object::sendMessage<Device*>(this, _MTL_PRIVATE_SEL(device));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE NS::String* MTL::CaptureScope::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE void MTL::CaptureScope::setLabel(const NS::String* pLabel)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), pLabel);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE MTL::CommandQueue* MTL::CaptureScope::commandQueue() const
{
return Object::sendMessage<CommandQueue*>(this, _MTL_PRIVATE_SEL(commandQueue));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE void MTL::CaptureScope::beginScope()
{
return Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(beginScope));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTL_INLINE void MTL::CaptureScope::endScope()
{
return Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endScope));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,464 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLCommandBuffer.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include <CoreFoundation/CoreFoundation.h>
#include <cstdint>
#include <functional>
namespace MTL
{
class AccelerationStructureCommandEncoder;
class AccelerationStructurePassDescriptor;
class BlitCommandEncoder;
class BlitPassDescriptor;
class CommandBuffer;
class CommandBufferDescriptor;
class CommandQueue;
class ComputeCommandEncoder;
class ComputePassDescriptor;
class Device;
class Drawable;
class Event;
class LogContainer;
class LogState;
class ParallelRenderCommandEncoder;
class RenderCommandEncoder;
class RenderPassDescriptor;
class ResidencySet;
class ResourceStateCommandEncoder;
class ResourceStatePassDescriptor;
_MTL_ENUM(NS::UInteger, CommandBufferStatus) {
CommandBufferStatusNotEnqueued = 0,
CommandBufferStatusEnqueued = 1,
CommandBufferStatusCommitted = 2,
CommandBufferStatusScheduled = 3,
CommandBufferStatusCompleted = 4,
CommandBufferStatusError = 5,
};
_MTL_ENUM(NS::UInteger, CommandBufferError) {
CommandBufferErrorNone = 0,
CommandBufferErrorInternal = 1,
CommandBufferErrorTimeout = 2,
CommandBufferErrorPageFault = 3,
CommandBufferErrorBlacklisted = 4,
CommandBufferErrorAccessRevoked = 4,
CommandBufferErrorNotPermitted = 7,
CommandBufferErrorOutOfMemory = 8,
CommandBufferErrorInvalidResource = 9,
CommandBufferErrorMemoryless = 10,
CommandBufferErrorDeviceRemoved = 11,
CommandBufferErrorStackOverflow = 12,
};
_MTL_ENUM(NS::Integer, CommandEncoderErrorState) {
CommandEncoderErrorStateUnknown = 0,
CommandEncoderErrorStateCompleted = 1,
CommandEncoderErrorStateAffected = 2,
CommandEncoderErrorStatePending = 3,
CommandEncoderErrorStateFaulted = 4,
};
_MTL_ENUM(NS::UInteger, DispatchType) {
DispatchTypeSerial = 0,
DispatchTypeConcurrent = 1,
};
_MTL_OPTIONS(NS::UInteger, CommandBufferErrorOption) {
CommandBufferErrorOptionNone = 0,
CommandBufferErrorOptionEncoderExecutionStatus = 1,
};
using CommandBufferHandler = void (^)(CommandBuffer*);
using HandlerFunction = std::function<void(CommandBuffer*)>;
class CommandBufferDescriptor : public NS::Copying<CommandBufferDescriptor>
{
public:
static CommandBufferDescriptor* alloc();
CommandBufferErrorOption errorOptions() const;
CommandBufferDescriptor* init();
LogState* logState() const;
bool retainedReferences() const;
void setErrorOptions(MTL::CommandBufferErrorOption errorOptions);
void setLogState(const MTL::LogState* logState);
void setRetainedReferences(bool retainedReferences);
};
class CommandBufferEncoderInfo : public NS::Referencing<CommandBufferEncoderInfo>
{
public:
NS::Array* debugSignposts() const;
CommandEncoderErrorState errorState() const;
NS::String* label() const;
};
class CommandBuffer : public NS::Referencing<CommandBuffer>
{
public:
CFTimeInterval GPUEndTime() const;
CFTimeInterval GPUStartTime() const;
AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder();
AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder(const MTL::AccelerationStructurePassDescriptor* descriptor);
void addCompletedHandler(const MTL::CommandBufferHandler block);
void addCompletedHandler(const MTL::HandlerFunction& function);
void addScheduledHandler(const MTL::CommandBufferHandler block);
void addScheduledHandler(const MTL::HandlerFunction& function);
BlitCommandEncoder* blitCommandEncoder();
BlitCommandEncoder* blitCommandEncoder(const MTL::BlitPassDescriptor* blitPassDescriptor);
CommandQueue* commandQueue() const;
void commit();
ComputeCommandEncoder* computeCommandEncoder(const MTL::ComputePassDescriptor* computePassDescriptor);
ComputeCommandEncoder* computeCommandEncoder();
ComputeCommandEncoder* computeCommandEncoder(MTL::DispatchType dispatchType);
Device* device() const;
void encodeSignalEvent(const MTL::Event* event, uint64_t value);
void encodeWait(const MTL::Event* event, uint64_t value);
void enqueue();
NS::Error* error() const;
CommandBufferErrorOption errorOptions() const;
CFTimeInterval kernelEndTime() const;
CFTimeInterval kernelStartTime() const;
NS::String* label() const;
LogContainer* logs() const;
ParallelRenderCommandEncoder* parallelRenderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor);
void popDebugGroup();
void presentDrawable(const MTL::Drawable* drawable);
void presentDrawableAfterMinimumDuration(const MTL::Drawable* drawable, CFTimeInterval duration);
void presentDrawableAtTime(const MTL::Drawable* drawable, CFTimeInterval presentationTime);
void pushDebugGroup(const NS::String* string);
RenderCommandEncoder* renderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor);
ResourceStateCommandEncoder* resourceStateCommandEncoder();
ResourceStateCommandEncoder* resourceStateCommandEncoder(const MTL::ResourceStatePassDescriptor* resourceStatePassDescriptor);
bool retainedReferences() const;
void setLabel(const NS::String* label);
CommandBufferStatus status() const;
void useResidencySet(const MTL::ResidencySet* residencySet);
void useResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
void waitUntilCompleted();
void waitUntilScheduled();
};
}
_MTL_INLINE MTL::CommandBufferDescriptor* MTL::CommandBufferDescriptor::alloc()
{
return NS::Object::alloc<MTL::CommandBufferDescriptor>(_MTL_PRIVATE_CLS(MTLCommandBufferDescriptor));
}
_MTL_INLINE MTL::CommandBufferErrorOption MTL::CommandBufferDescriptor::errorOptions() const
{
return Object::sendMessage<MTL::CommandBufferErrorOption>(this, _MTL_PRIVATE_SEL(errorOptions));
}
_MTL_INLINE MTL::CommandBufferDescriptor* MTL::CommandBufferDescriptor::init()
{
return NS::Object::init<MTL::CommandBufferDescriptor>();
}
_MTL_INLINE MTL::LogState* MTL::CommandBufferDescriptor::logState() const
{
return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));
}
_MTL_INLINE bool MTL::CommandBufferDescriptor::retainedReferences() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(retainedReferences));
}
_MTL_INLINE void MTL::CommandBufferDescriptor::setErrorOptions(MTL::CommandBufferErrorOption errorOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setErrorOptions_), errorOptions);
}
_MTL_INLINE void MTL::CommandBufferDescriptor::setLogState(const MTL::LogState* logState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);
}
_MTL_INLINE void MTL::CommandBufferDescriptor::setRetainedReferences(bool retainedReferences)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRetainedReferences_), retainedReferences);
}
_MTL_INLINE NS::Array* MTL::CommandBufferEncoderInfo::debugSignposts() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(debugSignposts));
}
_MTL_INLINE MTL::CommandEncoderErrorState MTL::CommandBufferEncoderInfo::errorState() const
{
return Object::sendMessage<MTL::CommandEncoderErrorState>(this, _MTL_PRIVATE_SEL(errorState));
}
_MTL_INLINE NS::String* MTL::CommandBufferEncoderInfo::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::GPUEndTime() const
{
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUEndTime));
}
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::GPUStartTime() const
{
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUStartTime));
}
_MTL_INLINE MTL::AccelerationStructureCommandEncoder* MTL::CommandBuffer::accelerationStructureCommandEncoder()
{
return Object::sendMessage<MTL::AccelerationStructureCommandEncoder*>(this, _MTL_PRIVATE_SEL(accelerationStructureCommandEncoder));
}
_MTL_INLINE MTL::AccelerationStructureCommandEncoder* MTL::CommandBuffer::accelerationStructureCommandEncoder(const MTL::AccelerationStructurePassDescriptor* descriptor)
{
return Object::sendMessage<MTL::AccelerationStructureCommandEncoder*>(this, _MTL_PRIVATE_SEL(accelerationStructureCommandEncoderWithDescriptor_), descriptor);
}
_MTL_INLINE void MTL::CommandBuffer::addCompletedHandler(const MTL::CommandBufferHandler block)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addCompletedHandler_), block);
}
_MTL_INLINE void MTL::CommandBuffer::addCompletedHandler(const MTL::HandlerFunction& function)
{
__block HandlerFunction blockFunction = function;
addCompletedHandler(^(MTL::CommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
}
_MTL_INLINE void MTL::CommandBuffer::addScheduledHandler(const MTL::CommandBufferHandler block)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addScheduledHandler_), block);
}
_MTL_INLINE void MTL::CommandBuffer::addScheduledHandler(const MTL::HandlerFunction& function)
{
__block HandlerFunction blockFunction = function;
addScheduledHandler(^(MTL::CommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
}
_MTL_INLINE MTL::BlitCommandEncoder* MTL::CommandBuffer::blitCommandEncoder()
{
return Object::sendMessage<MTL::BlitCommandEncoder*>(this, _MTL_PRIVATE_SEL(blitCommandEncoder));
}
_MTL_INLINE MTL::BlitCommandEncoder* MTL::CommandBuffer::blitCommandEncoder(const MTL::BlitPassDescriptor* blitPassDescriptor)
{
return Object::sendMessage<MTL::BlitCommandEncoder*>(this, _MTL_PRIVATE_SEL(blitCommandEncoderWithDescriptor_), blitPassDescriptor);
}
_MTL_INLINE MTL::CommandQueue* MTL::CommandBuffer::commandQueue() const
{
return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(commandQueue));
}
_MTL_INLINE void MTL::CommandBuffer::commit()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit));
}
_MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder(const MTL::ComputePassDescriptor* computePassDescriptor)
{
return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoderWithDescriptor_), computePassDescriptor);
}
_MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder()
{
return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoder));
}
_MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder(MTL::DispatchType dispatchType)
{
return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoderWithDispatchType_), dispatchType);
}
_MTL_INLINE MTL::Device* MTL::CommandBuffer::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE void MTL::CommandBuffer::encodeSignalEvent(const MTL::Event* event, uint64_t value)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(encodeSignalEvent_value_), event, value);
}
_MTL_INLINE void MTL::CommandBuffer::encodeWait(const MTL::Event* event, uint64_t value)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(encodeWaitForEvent_value_), event, value);
}
_MTL_INLINE void MTL::CommandBuffer::enqueue()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueue));
}
_MTL_INLINE NS::Error* MTL::CommandBuffer::error() const
{
return Object::sendMessage<NS::Error*>(this, _MTL_PRIVATE_SEL(error));
}
_MTL_INLINE MTL::CommandBufferErrorOption MTL::CommandBuffer::errorOptions() const
{
return Object::sendMessage<MTL::CommandBufferErrorOption>(this, _MTL_PRIVATE_SEL(errorOptions));
}
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::kernelEndTime() const
{
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(kernelEndTime));
}
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::kernelStartTime() const
{
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(kernelStartTime));
}
_MTL_INLINE NS::String* MTL::CommandBuffer::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL::LogContainer* MTL::CommandBuffer::logs() const
{
return Object::sendMessage<MTL::LogContainer*>(this, _MTL_PRIVATE_SEL(logs));
}
_MTL_INLINE MTL::ParallelRenderCommandEncoder* MTL::CommandBuffer::parallelRenderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor)
{
return Object::sendMessage<MTL::ParallelRenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(parallelRenderCommandEncoderWithDescriptor_), renderPassDescriptor);
}
_MTL_INLINE void MTL::CommandBuffer::popDebugGroup()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
}
_MTL_INLINE void MTL::CommandBuffer::presentDrawable(const MTL::Drawable* drawable)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_), drawable);
}
_MTL_INLINE void MTL::CommandBuffer::presentDrawableAfterMinimumDuration(const MTL::Drawable* drawable, CFTimeInterval duration)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_afterMinimumDuration_), drawable, duration);
}
_MTL_INLINE void MTL::CommandBuffer::presentDrawableAtTime(const MTL::Drawable* drawable, CFTimeInterval presentationTime)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_atTime_), drawable, presentationTime);
}
_MTL_INLINE void MTL::CommandBuffer::pushDebugGroup(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
}
_MTL_INLINE MTL::RenderCommandEncoder* MTL::CommandBuffer::renderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor)
{
return Object::sendMessage<MTL::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoderWithDescriptor_), renderPassDescriptor);
}
_MTL_INLINE MTL::ResourceStateCommandEncoder* MTL::CommandBuffer::resourceStateCommandEncoder()
{
return Object::sendMessage<MTL::ResourceStateCommandEncoder*>(this, _MTL_PRIVATE_SEL(resourceStateCommandEncoder));
}
_MTL_INLINE MTL::ResourceStateCommandEncoder* MTL::CommandBuffer::resourceStateCommandEncoder(const MTL::ResourceStatePassDescriptor* resourceStatePassDescriptor)
{
return Object::sendMessage<MTL::ResourceStateCommandEncoder*>(this, _MTL_PRIVATE_SEL(resourceStateCommandEncoderWithDescriptor_), resourceStatePassDescriptor);
}
_MTL_INLINE bool MTL::CommandBuffer::retainedReferences() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(retainedReferences));
}
_MTL_INLINE void MTL::CommandBuffer::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE MTL::CommandBufferStatus MTL::CommandBuffer::status() const
{
return Object::sendMessage<MTL::CommandBufferStatus>(this, _MTL_PRIVATE_SEL(status));
}
_MTL_INLINE void MTL::CommandBuffer::useResidencySet(const MTL::ResidencySet* residencySet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResidencySet_), residencySet);
}
_MTL_INLINE void MTL::CommandBuffer::useResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResidencySets_count_), residencySets, count);
}
_MTL_INLINE void MTL::CommandBuffer::waitUntilCompleted()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilCompleted));
}
_MTL_INLINE void MTL::CommandBuffer::waitUntilScheduled()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilScheduled));
}

View File

@@ -1,117 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class Device;
_MTL_OPTIONS(NS::UInteger, ResourceUsage) {
ResourceUsageRead = 1,
ResourceUsageWrite = 1 << 1,
ResourceUsageSample = 1 << 2,
};
_MTL_OPTIONS(NS::UInteger, BarrierScope) {
BarrierScopeBuffers = 1,
BarrierScopeTextures = 1 << 1,
BarrierScopeRenderTargets = 1 << 2,
};
_MTL_OPTIONS(NS::UInteger, Stages) {
StageVertex = 1,
StageFragment = 1 << 1,
StageTile = 1 << 2,
StageObject = 1 << 3,
StageMesh = 1 << 4,
StageResourceState = 1 << 26,
StageDispatch = 1 << 27,
StageBlit = 1 << 28,
StageAccelerationStructure = 1 << 29,
StageMachineLearning = 1 << 30,
StageAll = 9223372036854775807,
};
class CommandEncoder : public NS::Referencing<CommandEncoder>
{
public:
void barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages);
Device* device() const;
void endEncoding();
void insertDebugSignpost(const NS::String* string);
NS::String* label() const;
void popDebugGroup();
void pushDebugGroup(const NS::String* string);
void setLabel(const NS::String* label);
};
}
_MTL_INLINE void MTL::CommandEncoder::barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterQueueStages_beforeStages_), afterQueueStages, beforeStages);
}
_MTL_INLINE MTL::Device* MTL::CommandEncoder::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE void MTL::CommandEncoder::endEncoding()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
}
_MTL_INLINE void MTL::CommandEncoder::insertDebugSignpost(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
}
_MTL_INLINE NS::String* MTL::CommandEncoder::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL::CommandEncoder::popDebugGroup()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
}
_MTL_INLINE void MTL::CommandEncoder::pushDebugGroup(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
}
_MTL_INLINE void MTL::CommandEncoder::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}

View File

@@ -1,158 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLCommandQueue.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class CommandBuffer;
class CommandBufferDescriptor;
class CommandQueueDescriptor;
class Device;
class LogState;
class ResidencySet;
class CommandQueue : public NS::Referencing<CommandQueue>
{
public:
void addResidencySet(const MTL::ResidencySet* residencySet);
void addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
CommandBuffer* commandBuffer();
CommandBuffer* commandBuffer(const MTL::CommandBufferDescriptor* descriptor);
CommandBuffer* commandBufferWithUnretainedReferences();
Device* device() const;
void insertDebugCaptureBoundary();
NS::String* label() const;
void removeResidencySet(const MTL::ResidencySet* residencySet);
void removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
void setLabel(const NS::String* label);
};
class CommandQueueDescriptor : public NS::Copying<CommandQueueDescriptor>
{
public:
static CommandQueueDescriptor* alloc();
CommandQueueDescriptor* init();
LogState* logState() const;
NS::UInteger maxCommandBufferCount() const;
void setLogState(const MTL::LogState* logState);
void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount);
};
}
_MTL_INLINE void MTL::CommandQueue::addResidencySet(const MTL::ResidencySet* residencySet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySet_), residencySet);
}
_MTL_INLINE void MTL::CommandQueue::addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySets_count_), residencySets, count);
}
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer()
{
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
}
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer(const MTL::CommandBufferDescriptor* descriptor)
{
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithDescriptor_), descriptor);
}
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBufferWithUnretainedReferences()
{
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));
}
_MTL_INLINE MTL::Device* MTL::CommandQueue::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE void MTL::CommandQueue::insertDebugCaptureBoundary()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugCaptureBoundary));
}
_MTL_INLINE NS::String* MTL::CommandQueue::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL::CommandQueue::removeResidencySet(const MTL::ResidencySet* residencySet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySet_), residencySet);
}
_MTL_INLINE void MTL::CommandQueue::removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySets_count_), residencySets, count);
}
_MTL_INLINE void MTL::CommandQueue::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::alloc()
{
return NS::Object::alloc<MTL::CommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLCommandQueueDescriptor));
}
_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::init()
{
return NS::Object::init<MTL::CommandQueueDescriptor>();
}
_MTL_INLINE MTL::LogState* MTL::CommandQueueDescriptor::logState() const
{
return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));
}
_MTL_INLINE NS::UInteger MTL::CommandQueueDescriptor::maxCommandBufferCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount));
}
_MTL_INLINE void MTL::CommandQueueDescriptor::setLogState(const MTL::LogState* logState)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);
}
_MTL_INLINE void MTL::CommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount);
}

View File

@@ -1,324 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLComputeCommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLCommandBuffer.hpp"
#include "MTLCommandEncoder.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
#include <cstdint>
namespace MTL
{
class AccelerationStructure;
class Buffer;
class ComputePipelineState;
class CounterSampleBuffer;
class Fence;
class Heap;
class IndirectCommandBuffer;
class IntersectionFunctionTable;
class Resource;
class SamplerState;
class Texture;
class VisibleFunctionTable;
struct DispatchThreadgroupsIndirectArguments
{
uint32_t threadgroupsPerGrid[3];
} _MTL_PACKED;
struct DispatchThreadsIndirectArguments
{
uint32_t threadsPerGrid[3];
uint32_t threadsPerThreadgroup[3];
} _MTL_PACKED;
struct StageInRegionIndirectArguments
{
uint32_t stageInOrigin[3];
uint32_t stageInSize[3];
} _MTL_PACKED;
class ComputeCommandEncoder : public NS::Referencing<ComputeCommandEncoder, CommandEncoder>
{
public:
void dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);
void dispatchThreadgroups(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerThreadgroup);
void dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);
DispatchType dispatchType() const;
void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);
void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, const MTL::Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset);
void memoryBarrier(MTL::BarrierScope scope);
void memoryBarrier(const MTL::Resource* const resources[], NS::UInteger count);
void sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
void setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger bufferIndex);
void setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);
void setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
void setBufferOffset(NS::UInteger offset, NS::UInteger index);
void setBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
void setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
void setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range);
void setBytes(const void* bytes, NS::UInteger length, NS::UInteger index);
void setBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index);
void setComputePipelineState(const MTL::ComputePipelineState* state);
void setImageblockWidth(NS::UInteger width, NS::UInteger height);
void setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger bufferIndex);
void setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);
void setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);
void setSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);
void setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);
void setSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);
void setStageInRegion(MTL::Region region);
void setStageInRegion(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);
void setTexture(const MTL::Texture* texture, NS::UInteger index);
void setTextures(const MTL::Texture* const textures[], NS::Range range);
void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
void setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger bufferIndex);
void setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);
void updateFence(const MTL::Fence* fence);
void useHeap(const MTL::Heap* heap);
void useHeaps(const MTL::Heap* const heaps[], NS::UInteger count);
void useResource(const MTL::Resource* resource, MTL::ResourceUsage usage);
void useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);
void waitForFence(const MTL::Fence* fence);
};
}
_MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroups_threadsPerThreadgroup_), threadgroupsPerGrid, threadsPerThreadgroup);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreadgroups(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroupsWithIndirectBuffer_indirectBufferOffset_threadsPerThreadgroup_), indirectBuffer, indirectBufferOffset, threadsPerThreadgroup);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreads_threadsPerThreadgroup_), threadsPerGrid, threadsPerThreadgroup);
}
_MTL_INLINE MTL::DispatchType MTL::ComputeCommandEncoder::dispatchType() const
{
return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));
}
_MTL_INLINE void MTL::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_withRange_), indirectCommandBuffer, executionRange);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, const MTL::Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_indirectBuffer_indirectBufferOffset_), indirectCommandbuffer, indirectRangeBuffer, indirectBufferOffset);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::memoryBarrier(MTL::BarrierScope scope)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(memoryBarrierWithScope_), scope);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::memoryBarrier(const MTL::Resource* const resources[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(memoryBarrierWithResources_count_), resources, count);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleCountersInBuffer_atSampleIndex_withBarrier_), sampleBuffer, sampleIndex, barrier);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger bufferIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atBufferIndex_), accelerationStructure, bufferIndex);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_attributeStride_atIndex_), buffer, offset, stride, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBufferOffset(NS::UInteger offset, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferOffset_atIndex_), offset, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferOffset_attributeStride_atIndex_), offset, stride, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_attributeStrides_withRange_), buffers, offsets, strides, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBytes(const void* bytes, NS::UInteger length, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBytes_length_atIndex_), bytes, length, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBytes_length_attributeStride_atIndex_), bytes, length, stride, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setComputePipelineState(const MTL::ComputePipelineState* state)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_), state);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setImageblockWidth(NS::UInteger width, NS::UInteger height)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockWidth_height_), width, height);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger bufferIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atBufferIndex_), intersectionFunctionTable, bufferIndex);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTables_withBufferRange_), intersectionFunctionTables, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_lodMinClamp_lodMaxClamp_atIndex_), sampler, lodMinClamp, lodMaxClamp, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_withRange_), samplers, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_lodMinClamps_lodMaxClamps_withRange_), samplers, lodMinClamps, lodMaxClamps, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setStageInRegion(MTL::Region region)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegion_), region);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setStageInRegion(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegionWithIndirectBuffer_indirectBufferOffset_), indirectBuffer, indirectBufferOffset);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setTextures(const MTL::Texture* const textures[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextures_withRange_), textures, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_atIndex_), length, index);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger bufferIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atBufferIndex_), visibleFunctionTable, bufferIndex);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withBufferRange_), visibleFunctionTables, range);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::updateFence(const MTL::Fence* fence)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::useHeap(const MTL::Heap* heap)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeap_), heap);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::useHeaps(const MTL::Heap* const heaps[], NS::UInteger count)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeaps_count_), heaps, count);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::useResource(const MTL::Resource* resource, MTL::ResourceUsage usage)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResource_usage_), resource, usage);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResources_count_usage_), resources, count, usage);
}
_MTL_INLINE void MTL::ComputeCommandEncoder::waitForFence(const MTL::Fence* fence)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
}

View File

@@ -1,169 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLComputePass.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLCommandBuffer.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
class ComputePassDescriptor;
class ComputePassSampleBufferAttachmentDescriptor;
class ComputePassSampleBufferAttachmentDescriptorArray;
class CounterSampleBuffer;
class ComputePassSampleBufferAttachmentDescriptor : public NS::Copying<ComputePassSampleBufferAttachmentDescriptor>
{
public:
static ComputePassSampleBufferAttachmentDescriptor* alloc();
NS::UInteger endOfEncoderSampleIndex() const;
ComputePassSampleBufferAttachmentDescriptor* init();
CounterSampleBuffer* sampleBuffer() const;
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
void setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer);
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
NS::UInteger startOfEncoderSampleIndex() const;
};
class ComputePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<ComputePassSampleBufferAttachmentDescriptorArray>
{
public:
static ComputePassSampleBufferAttachmentDescriptorArray* alloc();
ComputePassSampleBufferAttachmentDescriptorArray* init();
ComputePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
void setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
};
class ComputePassDescriptor : public NS::Copying<ComputePassDescriptor>
{
public:
static ComputePassDescriptor* alloc();
static ComputePassDescriptor* computePassDescriptor();
DispatchType dispatchType() const;
ComputePassDescriptor* init();
ComputePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
void setDispatchType(MTL::DispatchType dispatchType);
};
}
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::alloc()
{
return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptor));
}
_MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
}
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::init()
{
return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptor>();
}
_MTL_INLINE MTL::CounterSampleBuffer* MTL::ComputePassSampleBufferAttachmentDescriptor::sampleBuffer() const
{
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
}
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
}
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
}
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
}
_MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
}
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::alloc()
{
return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptorArray));
}
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::init()
{
return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptorArray>();
}
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
{
return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
}
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
}
_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::alloc()
{
return NS::Object::alloc<MTL::ComputePassDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor));
}
_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::computePassDescriptor()
{
return Object::sendMessage<MTL::ComputePassDescriptor*>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor), _MTL_PRIVATE_SEL(computePassDescriptor));
}
_MTL_INLINE MTL::DispatchType MTL::ComputePassDescriptor::dispatchType() const
{
return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));
}
_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::init()
{
return NS::Object::init<MTL::ComputePassDescriptor>();
}
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassDescriptor::sampleBufferAttachments() const
{
return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
}
_MTL_INLINE void MTL::ComputePassDescriptor::setDispatchType(MTL::DispatchType dispatchType)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDispatchType_), dispatchType);
}

View File

@@ -1,439 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLComputePipeline.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLAllocation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPipeline.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
namespace MTL
{
class ComputePipelineDescriptor;
class ComputePipelineReflection;
class ComputePipelineState;
class Device;
class Function;
class FunctionHandle;
class IntersectionFunctionTable;
class IntersectionFunctionTableDescriptor;
class LinkedFunctions;
class PipelineBufferDescriptorArray;
class StageInputOutputDescriptor;
class VisibleFunctionTable;
class VisibleFunctionTableDescriptor;
}
namespace MTL4
{
class BinaryFunction;
}
namespace MTL
{
class ComputePipelineReflection : public NS::Referencing<ComputePipelineReflection>
{
public:
static ComputePipelineReflection* alloc();
NS::Array* arguments() const;
NS::Array* bindings() const;
ComputePipelineReflection* init();
};
class ComputePipelineDescriptor : public NS::Copying<ComputePipelineDescriptor>
{
public:
static ComputePipelineDescriptor* alloc();
NS::Array* binaryArchives() const;
PipelineBufferDescriptorArray* buffers() const;
Function* computeFunction() const;
ComputePipelineDescriptor* init();
NS::Array* insertLibraries() const;
NS::String* label() const;
LinkedFunctions* linkedFunctions() const;
NS::UInteger maxCallStackDepth() const;
NS::UInteger maxTotalThreadsPerThreadgroup() const;
NS::Array* preloadedLibraries() const;
Size requiredThreadsPerThreadgroup() const;
void reset();
void setBinaryArchives(const NS::Array* binaryArchives);
void setComputeFunction(const MTL::Function* computeFunction);
void setInsertLibraries(const NS::Array* insertLibraries);
void setLabel(const NS::String* label);
void setLinkedFunctions(const MTL::LinkedFunctions* linkedFunctions);
void setMaxCallStackDepth(NS::UInteger maxCallStackDepth);
void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
void setPreloadedLibraries(const NS::Array* preloadedLibraries);
void setRequiredThreadsPerThreadgroup(MTL::Size requiredThreadsPerThreadgroup);
void setShaderValidation(MTL::ShaderValidation shaderValidation);
void setStageInputDescriptor(const MTL::StageInputOutputDescriptor* stageInputDescriptor);
void setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions);
void setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers);
void setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth);
ShaderValidation shaderValidation() const;
StageInputOutputDescriptor* stageInputDescriptor() const;
bool supportAddingBinaryFunctions() const;
bool supportIndirectCommandBuffers() const;
bool threadGroupSizeIsMultipleOfThreadExecutionWidth() const;
};
class ComputePipelineState : public NS::Referencing<ComputePipelineState, Allocation>
{
public:
Device* device() const;
FunctionHandle* functionHandle(const NS::String* name);
FunctionHandle* functionHandle(const MTL4::BinaryFunction* function);
FunctionHandle* functionHandle(const MTL::Function* function);
ResourceID gpuResourceID() const;
NS::UInteger imageblockMemoryLength(MTL::Size imageblockDimensions);
NS::String* label() const;
NS::UInteger maxTotalThreadsPerThreadgroup() const;
ComputePipelineState* newComputePipelineStateWithBinaryFunctions(const NS::Array* additionalBinaryFunctions, NS::Error** error);
ComputePipelineState* newComputePipelineState(const NS::Array* functions, NS::Error** error);
IntersectionFunctionTable* newIntersectionFunctionTable(const MTL::IntersectionFunctionTableDescriptor* descriptor);
VisibleFunctionTable* newVisibleFunctionTable(const MTL::VisibleFunctionTableDescriptor* descriptor);
ComputePipelineReflection* reflection() const;
Size requiredThreadsPerThreadgroup() const;
ShaderValidation shaderValidation() const;
NS::UInteger staticThreadgroupMemoryLength() const;
bool supportIndirectCommandBuffers() const;
NS::UInteger threadExecutionWidth() const;
};
}
_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::alloc()
{
return NS::Object::alloc<MTL::ComputePipelineReflection>(_MTL_PRIVATE_CLS(MTLComputePipelineReflection));
}
_MTL_INLINE NS::Array* MTL::ComputePipelineReflection::arguments() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
}
_MTL_INLINE NS::Array* MTL::ComputePipelineReflection::bindings() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(bindings));
}
_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::init()
{
return NS::Object::init<MTL::ComputePipelineReflection>();
}
_MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::alloc()
{
return NS::Object::alloc<MTL::ComputePipelineDescriptor>(_MTL_PRIVATE_CLS(MTLComputePipelineDescriptor));
}
_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::binaryArchives() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
}
_MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::ComputePipelineDescriptor::buffers() const
{
return Object::sendMessage<MTL::PipelineBufferDescriptorArray*>(this, _MTL_PRIVATE_SEL(buffers));
}
_MTL_INLINE MTL::Function* MTL::ComputePipelineDescriptor::computeFunction() const
{
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(computeFunction));
}
_MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::init()
{
return NS::Object::init<MTL::ComputePipelineDescriptor>();
}
_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::insertLibraries() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(insertLibraries));
}
_MTL_INLINE NS::String* MTL::ComputePipelineDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE MTL::LinkedFunctions* MTL::ComputePipelineDescriptor::linkedFunctions() const
{
return Object::sendMessage<MTL::LinkedFunctions*>(this, _MTL_PRIVATE_SEL(linkedFunctions));
}
_MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxCallStackDepth() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCallStackDepth));
}
_MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxTotalThreadsPerThreadgroup() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
}
_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::preloadedLibraries() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(preloadedLibraries));
}
_MTL_INLINE MTL::Size MTL::ComputePipelineDescriptor::requiredThreadsPerThreadgroup() const
{
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(requiredThreadsPerThreadgroup));
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::reset()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setComputeFunction(const MTL::Function* computeFunction)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputeFunction_), computeFunction);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setInsertLibraries(const NS::Array* insertLibraries)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInsertLibraries_), insertLibraries);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setLinkedFunctions(const MTL::LinkedFunctions* linkedFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLinkedFunctions_), linkedFunctions);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxCallStackDepth(NS::UInteger maxCallStackDepth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCallStackDepth_), maxCallStackDepth);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setPreloadedLibraries(const NS::Array* preloadedLibraries)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreloadedLibraries_), preloadedLibraries);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setRequiredThreadsPerThreadgroup(MTL::Size requiredThreadsPerThreadgroup)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRequiredThreadsPerThreadgroup_), requiredThreadsPerThreadgroup);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setShaderValidation(MTL::ShaderValidation shaderValidation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderValidation_), shaderValidation);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setStageInputDescriptor(const MTL::StageInputOutputDescriptor* stageInputDescriptor)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInputDescriptor_), stageInputDescriptor);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAddingBinaryFunctions_), supportAddingBinaryFunctions);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
}
_MTL_INLINE void MTL::ComputePipelineDescriptor::setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadGroupSizeIsMultipleOfThreadExecutionWidth_), threadGroupSizeIsMultipleOfThreadExecutionWidth);
}
_MTL_INLINE MTL::ShaderValidation MTL::ComputePipelineDescriptor::shaderValidation() const
{
return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));
}
_MTL_INLINE MTL::StageInputOutputDescriptor* MTL::ComputePipelineDescriptor::stageInputDescriptor() const
{
return Object::sendMessage<MTL::StageInputOutputDescriptor*>(this, _MTL_PRIVATE_SEL(stageInputDescriptor));
}
_MTL_INLINE bool MTL::ComputePipelineDescriptor::supportAddingBinaryFunctions() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAddingBinaryFunctions));
}
_MTL_INLINE bool MTL::ComputePipelineDescriptor::supportIndirectCommandBuffers() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
}
_MTL_INLINE bool MTL::ComputePipelineDescriptor::threadGroupSizeIsMultipleOfThreadExecutionWidth() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(threadGroupSizeIsMultipleOfThreadExecutionWidth));
}
_MTL_INLINE MTL::Device* MTL::ComputePipelineState::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE MTL::FunctionHandle* MTL::ComputePipelineState::functionHandle(const NS::String* name)
{
return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithName_), name);
}
_MTL_INLINE MTL::FunctionHandle* MTL::ComputePipelineState::functionHandle(const MTL4::BinaryFunction* function)
{
return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithBinaryFunction_), function);
}
_MTL_INLINE MTL::FunctionHandle* MTL::ComputePipelineState::functionHandle(const MTL::Function* function)
{
return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithFunction_), function);
}
_MTL_INLINE MTL::ResourceID MTL::ComputePipelineState::gpuResourceID() const
{
return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
}
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::imageblockMemoryLength(MTL::Size imageblockDimensions)
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(imageblockMemoryLengthForDimensions_), imageblockDimensions);
}
_MTL_INLINE NS::String* MTL::ComputePipelineState::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::maxTotalThreadsPerThreadgroup() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
}
_MTL_INLINE MTL::ComputePipelineState* MTL::ComputePipelineState::newComputePipelineStateWithBinaryFunctions(const NS::Array* additionalBinaryFunctions, NS::Error** error)
{
return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithBinaryFunctions_error_), additionalBinaryFunctions, error);
}
_MTL_INLINE MTL::ComputePipelineState* MTL::ComputePipelineState::newComputePipelineState(const NS::Array* functions, NS::Error** error)
{
return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithAdditionalBinaryFunctions_error_), functions, error);
}
_MTL_INLINE MTL::IntersectionFunctionTable* MTL::ComputePipelineState::newIntersectionFunctionTable(const MTL::IntersectionFunctionTableDescriptor* descriptor)
{
return Object::sendMessage<MTL::IntersectionFunctionTable*>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionTableWithDescriptor_), descriptor);
}
_MTL_INLINE MTL::VisibleFunctionTable* MTL::ComputePipelineState::newVisibleFunctionTable(const MTL::VisibleFunctionTableDescriptor* descriptor)
{
return Object::sendMessage<MTL::VisibleFunctionTable*>(this, _MTL_PRIVATE_SEL(newVisibleFunctionTableWithDescriptor_), descriptor);
}
_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineState::reflection() const
{
return Object::sendMessage<MTL::ComputePipelineReflection*>(this, _MTL_PRIVATE_SEL(reflection));
}
_MTL_INLINE MTL::Size MTL::ComputePipelineState::requiredThreadsPerThreadgroup() const
{
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(requiredThreadsPerThreadgroup));
}
_MTL_INLINE MTL::ShaderValidation MTL::ComputePipelineState::shaderValidation() const
{
return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));
}
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::staticThreadgroupMemoryLength() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(staticThreadgroupMemoryLength));
}
_MTL_INLINE bool MTL::ComputePipelineState::supportIndirectCommandBuffers() const
{
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
}
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::threadExecutionWidth() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadExecutionWidth));
}

View File

@@ -1,243 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLCounters.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLResource.hpp"
#include <cstdint>
namespace MTL
{
class CounterSampleBufferDescriptor;
class CounterSet;
class Device;
_MTL_ENUM(NS::Integer, CounterSampleBufferError) {
CounterSampleBufferErrorOutOfMemory = 0,
CounterSampleBufferErrorInvalid = 1,
CounterSampleBufferErrorInternal = 2,
};
using CommonCounter = NS::String*;
using CommonCounterSet = NS::String*;
static const NS::UInteger CounterErrorValue = static_cast<NS::UInteger>(~0ULL);
static const NS::UInteger CounterDontSample = static_cast<NS::UInteger>(-1);
_MTL_CONST(NS::ErrorDomain, CounterErrorDomain);
_MTL_CONST(CommonCounter, CommonCounterTimestamp);
_MTL_CONST(CommonCounter, CommonCounterTessellationInputPatches);
_MTL_CONST(CommonCounter, CommonCounterVertexInvocations);
_MTL_CONST(CommonCounter, CommonCounterPostTessellationVertexInvocations);
_MTL_CONST(CommonCounter, CommonCounterClipperInvocations);
_MTL_CONST(CommonCounter, CommonCounterClipperPrimitivesOut);
_MTL_CONST(CommonCounter, CommonCounterFragmentInvocations);
_MTL_CONST(CommonCounter, CommonCounterFragmentsPassed);
_MTL_CONST(CommonCounter, CommonCounterComputeKernelInvocations);
_MTL_CONST(CommonCounter, CommonCounterTotalCycles);
_MTL_CONST(CommonCounter, CommonCounterVertexCycles);
_MTL_CONST(CommonCounter, CommonCounterTessellationCycles);
_MTL_CONST(CommonCounter, CommonCounterPostTessellationVertexCycles);
_MTL_CONST(CommonCounter, CommonCounterFragmentCycles);
_MTL_CONST(CommonCounter, CommonCounterRenderTargetWriteCycles);
_MTL_CONST(CommonCounterSet, CommonCounterSetTimestamp);
_MTL_CONST(CommonCounterSet, CommonCounterSetStageUtilization);
_MTL_CONST(CommonCounterSet, CommonCounterSetStatistic);
struct CounterResultTimestamp
{
uint64_t timestamp;
} _MTL_PACKED;
struct CounterResultStageUtilization
{
uint64_t totalCycles;
uint64_t vertexCycles;
uint64_t tessellationCycles;
uint64_t postTessellationVertexCycles;
uint64_t fragmentCycles;
uint64_t renderTargetCycles;
} _MTL_PACKED;
struct CounterResultStatistic
{
uint64_t tessellationInputPatches;
uint64_t vertexInvocations;
uint64_t postTessellationVertexInvocations;
uint64_t clipperInvocations;
uint64_t clipperPrimitivesOut;
uint64_t fragmentInvocations;
uint64_t fragmentsPassed;
uint64_t computeKernelInvocations;
} _MTL_PACKED;
class Counter : public NS::Referencing<Counter>
{
public:
NS::String* name() const;
};
class CounterSet : public NS::Referencing<CounterSet>
{
public:
NS::Array* counters() const;
NS::String* name() const;
};
class CounterSampleBufferDescriptor : public NS::Copying<CounterSampleBufferDescriptor>
{
public:
static CounterSampleBufferDescriptor* alloc();
CounterSet* counterSet() const;
CounterSampleBufferDescriptor* init();
NS::String* label() const;
NS::UInteger sampleCount() const;
void setCounterSet(const MTL::CounterSet* counterSet);
void setLabel(const NS::String* label);
void setSampleCount(NS::UInteger sampleCount);
void setStorageMode(MTL::StorageMode storageMode);
StorageMode storageMode() const;
};
class CounterSampleBuffer : public NS::Referencing<CounterSampleBuffer>
{
public:
Device* device() const;
NS::String* label() const;
NS::Data* resolveCounterRange(NS::Range range);
NS::UInteger sampleCount() const;
};
}
_MTL_PRIVATE_DEF_CONST(NS::ErrorDomain, CounterErrorDomain);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterTimestamp);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterTessellationInputPatches);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterVertexInvocations);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterPostTessellationVertexInvocations);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterClipperInvocations);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterClipperPrimitivesOut);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterFragmentInvocations);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterFragmentsPassed);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterComputeKernelInvocations);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterTotalCycles);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterVertexCycles);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterTessellationCycles);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterPostTessellationVertexCycles);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterFragmentCycles);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounter, CommonCounterRenderTargetWriteCycles);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounterSet, CommonCounterSetTimestamp);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounterSet, CommonCounterSetStageUtilization);
_MTL_PRIVATE_DEF_CONST(MTL::CommonCounterSet, CommonCounterSetStatistic);
_MTL_INLINE NS::String* MTL::Counter::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE NS::Array* MTL::CounterSet::counters() const
{
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(counters));
}
_MTL_INLINE NS::String* MTL::CounterSet::name() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
}
_MTL_INLINE MTL::CounterSampleBufferDescriptor* MTL::CounterSampleBufferDescriptor::alloc()
{
return NS::Object::alloc<MTL::CounterSampleBufferDescriptor>(_MTL_PRIVATE_CLS(MTLCounterSampleBufferDescriptor));
}
_MTL_INLINE MTL::CounterSet* MTL::CounterSampleBufferDescriptor::counterSet() const
{
return Object::sendMessage<MTL::CounterSet*>(this, _MTL_PRIVATE_SEL(counterSet));
}
_MTL_INLINE MTL::CounterSampleBufferDescriptor* MTL::CounterSampleBufferDescriptor::init()
{
return NS::Object::init<MTL::CounterSampleBufferDescriptor>();
}
_MTL_INLINE NS::String* MTL::CounterSampleBufferDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE NS::UInteger MTL::CounterSampleBufferDescriptor::sampleCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sampleCount));
}
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setCounterSet(const MTL::CounterSet* counterSet)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCounterSet_), counterSet);
}
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setSampleCount(NS::UInteger sampleCount)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleCount_), sampleCount);
}
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setStorageMode(MTL::StorageMode storageMode)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
}
_MTL_INLINE MTL::StorageMode MTL::CounterSampleBufferDescriptor::storageMode() const
{
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
}
_MTL_INLINE MTL::Device* MTL::CounterSampleBuffer::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE NS::String* MTL::CounterSampleBuffer::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE NS::Data* MTL::CounterSampleBuffer::resolveCounterRange(NS::Range range)
{
return Object::sendMessage<NS::Data*>(this, _MTL_PRIVATE_SEL(resolveCounterRange_), range);
}
_MTL_INLINE NS::UInteger MTL::CounterSampleBuffer::sampleCount() const
{
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sampleCount));
}

View File

@@ -1,129 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLDataType.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL
{
_MTL_ENUM(NS::UInteger, DataType) {
DataTypeNone = 0,
DataTypeStruct = 1,
DataTypeArray = 2,
DataTypeFloat = 3,
DataTypeFloat2 = 4,
DataTypeFloat3 = 5,
DataTypeFloat4 = 6,
DataTypeFloat2x2 = 7,
DataTypeFloat2x3 = 8,
DataTypeFloat2x4 = 9,
DataTypeFloat3x2 = 10,
DataTypeFloat3x3 = 11,
DataTypeFloat3x4 = 12,
DataTypeFloat4x2 = 13,
DataTypeFloat4x3 = 14,
DataTypeFloat4x4 = 15,
DataTypeHalf = 16,
DataTypeHalf2 = 17,
DataTypeHalf3 = 18,
DataTypeHalf4 = 19,
DataTypeHalf2x2 = 20,
DataTypeHalf2x3 = 21,
DataTypeHalf2x4 = 22,
DataTypeHalf3x2 = 23,
DataTypeHalf3x3 = 24,
DataTypeHalf3x4 = 25,
DataTypeHalf4x2 = 26,
DataTypeHalf4x3 = 27,
DataTypeHalf4x4 = 28,
DataTypeInt = 29,
DataTypeInt2 = 30,
DataTypeInt3 = 31,
DataTypeInt4 = 32,
DataTypeUInt = 33,
DataTypeUInt2 = 34,
DataTypeUInt3 = 35,
DataTypeUInt4 = 36,
DataTypeShort = 37,
DataTypeShort2 = 38,
DataTypeShort3 = 39,
DataTypeShort4 = 40,
DataTypeUShort = 41,
DataTypeUShort2 = 42,
DataTypeUShort3 = 43,
DataTypeUShort4 = 44,
DataTypeChar = 45,
DataTypeChar2 = 46,
DataTypeChar3 = 47,
DataTypeChar4 = 48,
DataTypeUChar = 49,
DataTypeUChar2 = 50,
DataTypeUChar3 = 51,
DataTypeUChar4 = 52,
DataTypeBool = 53,
DataTypeBool2 = 54,
DataTypeBool3 = 55,
DataTypeBool4 = 56,
DataTypeTexture = 58,
DataTypeSampler = 59,
DataTypePointer = 60,
DataTypeR8Unorm = 62,
DataTypeR8Snorm = 63,
DataTypeR16Unorm = 64,
DataTypeR16Snorm = 65,
DataTypeRG8Unorm = 66,
DataTypeRG8Snorm = 67,
DataTypeRG16Unorm = 68,
DataTypeRG16Snorm = 69,
DataTypeRGBA8Unorm = 70,
DataTypeRGBA8Unorm_sRGB = 71,
DataTypeRGBA8Snorm = 72,
DataTypeRGBA16Unorm = 73,
DataTypeRGBA16Snorm = 74,
DataTypeRGB10A2Unorm = 75,
DataTypeRG11B10Float = 76,
DataTypeRGB9E5Float = 77,
DataTypeRenderPipeline = 78,
DataTypeComputePipeline = 79,
DataTypeIndirectCommandBuffer = 80,
DataTypeLong = 81,
DataTypeLong2 = 82,
DataTypeLong3 = 83,
DataTypeLong4 = 84,
DataTypeULong = 85,
DataTypeULong2 = 86,
DataTypeULong3 = 87,
DataTypeULong4 = 88,
DataTypeVisibleFunctionTable = 115,
DataTypeIntersectionFunctionTable = 116,
DataTypePrimitiveAccelerationStructure = 117,
DataTypeInstanceAccelerationStructure = 118,
DataTypeBFloat = 121,
DataTypeBFloat2 = 122,
DataTypeBFloat3 = 123,
DataTypeBFloat4 = 124,
DataTypeDepthStencilState = 139,
DataTypeTensor = 140,
};
}

View File

@@ -1,41 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLDefines.hpp
//
// Copyright 2020-2024 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "../Foundation/NSDefines.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _MTL_EXPORT _NS_EXPORT
#define _MTL_EXTERN _NS_EXTERN
#define _MTL_INLINE _NS_INLINE
#define _MTL_PACKED _NS_PACKED
#define _MTL_CONST(type, name) _NS_CONST(type, name)
#define _MTL_ENUM(type, name) _NS_ENUM(type, name)
#define _MTL_OPTIONS(type, name) _NS_OPTIONS(type, name)
#define _MTL_VALIDATE_SIZE(ns, name) _NS_VALIDATE_SIZE(ns, name)
#define _MTL_VALIDATE_ENUM(ns, name) _NS_VALIDATE_ENUM(ns, name)
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -1,277 +0,0 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTLDepthStencil.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
#include "MTLTypes.hpp"
#include <cstdint>
namespace MTL
{
class DepthStencilDescriptor;
class Device;
class StencilDescriptor;
_MTL_ENUM(NS::UInteger, CompareFunction) {
CompareFunctionNever = 0,
CompareFunctionLess = 1,
CompareFunctionEqual = 2,
CompareFunctionLessEqual = 3,
CompareFunctionGreater = 4,
CompareFunctionNotEqual = 5,
CompareFunctionGreaterEqual = 6,
CompareFunctionAlways = 7,
};
_MTL_ENUM(NS::UInteger, StencilOperation) {
StencilOperationKeep = 0,
StencilOperationZero = 1,
StencilOperationReplace = 2,
StencilOperationIncrementClamp = 3,
StencilOperationDecrementClamp = 4,
StencilOperationInvert = 5,
StencilOperationIncrementWrap = 6,
StencilOperationDecrementWrap = 7,
};
class StencilDescriptor : public NS::Copying<StencilDescriptor>
{
public:
static StencilDescriptor* alloc();
StencilOperation depthFailureOperation() const;
StencilOperation depthStencilPassOperation() const;
StencilDescriptor* init();
uint32_t readMask() const;
void setDepthFailureOperation(MTL::StencilOperation depthFailureOperation);
void setDepthStencilPassOperation(MTL::StencilOperation depthStencilPassOperation);
void setReadMask(uint32_t readMask);
void setStencilCompareFunction(MTL::CompareFunction stencilCompareFunction);
void setStencilFailureOperation(MTL::StencilOperation stencilFailureOperation);
void setWriteMask(uint32_t writeMask);
CompareFunction stencilCompareFunction() const;
StencilOperation stencilFailureOperation() const;
uint32_t writeMask() const;
};
class DepthStencilDescriptor : public NS::Copying<DepthStencilDescriptor>
{
public:
static DepthStencilDescriptor* alloc();
StencilDescriptor* backFaceStencil() const;
CompareFunction depthCompareFunction() const;
[[deprecated("please use isDepthWriteEnabled instead")]]
bool depthWriteEnabled() const;
StencilDescriptor* frontFaceStencil() const;
DepthStencilDescriptor* init();
bool isDepthWriteEnabled() const;
NS::String* label() const;
void setBackFaceStencil(const MTL::StencilDescriptor* backFaceStencil);
void setDepthCompareFunction(MTL::CompareFunction depthCompareFunction);
void setDepthWriteEnabled(bool depthWriteEnabled);
void setFrontFaceStencil(const MTL::StencilDescriptor* frontFaceStencil);
void setLabel(const NS::String* label);
};
class DepthStencilState : public NS::Referencing<DepthStencilState>
{
public:
Device* device() const;
ResourceID gpuResourceID() const;
NS::String* label() const;
};
}
_MTL_INLINE MTL::StencilDescriptor* MTL::StencilDescriptor::alloc()
{
return NS::Object::alloc<MTL::StencilDescriptor>(_MTL_PRIVATE_CLS(MTLStencilDescriptor));
}
_MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::depthFailureOperation() const
{
return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(depthFailureOperation));
}
_MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::depthStencilPassOperation() const
{
return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(depthStencilPassOperation));
}
_MTL_INLINE MTL::StencilDescriptor* MTL::StencilDescriptor::init()
{
return NS::Object::init<MTL::StencilDescriptor>();
}
_MTL_INLINE uint32_t MTL::StencilDescriptor::readMask() const
{
return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(readMask));
}
_MTL_INLINE void MTL::StencilDescriptor::setDepthFailureOperation(MTL::StencilOperation depthFailureOperation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthFailureOperation_), depthFailureOperation);
}
_MTL_INLINE void MTL::StencilDescriptor::setDepthStencilPassOperation(MTL::StencilOperation depthStencilPassOperation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilPassOperation_), depthStencilPassOperation);
}
_MTL_INLINE void MTL::StencilDescriptor::setReadMask(uint32_t readMask)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setReadMask_), readMask);
}
_MTL_INLINE void MTL::StencilDescriptor::setStencilCompareFunction(MTL::CompareFunction stencilCompareFunction)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilCompareFunction_), stencilCompareFunction);
}
_MTL_INLINE void MTL::StencilDescriptor::setStencilFailureOperation(MTL::StencilOperation stencilFailureOperation)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilFailureOperation_), stencilFailureOperation);
}
_MTL_INLINE void MTL::StencilDescriptor::setWriteMask(uint32_t writeMask)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setWriteMask_), writeMask);
}
_MTL_INLINE MTL::CompareFunction MTL::StencilDescriptor::stencilCompareFunction() const
{
return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(stencilCompareFunction));
}
_MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::stencilFailureOperation() const
{
return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(stencilFailureOperation));
}
_MTL_INLINE uint32_t MTL::StencilDescriptor::writeMask() const
{
return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(writeMask));
}
_MTL_INLINE MTL::DepthStencilDescriptor* MTL::DepthStencilDescriptor::alloc()
{
return NS::Object::alloc<MTL::DepthStencilDescriptor>(_MTL_PRIVATE_CLS(MTLDepthStencilDescriptor));
}
_MTL_INLINE MTL::StencilDescriptor* MTL::DepthStencilDescriptor::backFaceStencil() const
{
return Object::sendMessage<MTL::StencilDescriptor*>(this, _MTL_PRIVATE_SEL(backFaceStencil));
}
_MTL_INLINE MTL::CompareFunction MTL::DepthStencilDescriptor::depthCompareFunction() const
{
return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(depthCompareFunction));
}
_MTL_INLINE bool MTL::DepthStencilDescriptor::depthWriteEnabled() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthWriteEnabled));
}
_MTL_INLINE MTL::StencilDescriptor* MTL::DepthStencilDescriptor::frontFaceStencil() const
{
return Object::sendMessage<MTL::StencilDescriptor*>(this, _MTL_PRIVATE_SEL(frontFaceStencil));
}
_MTL_INLINE MTL::DepthStencilDescriptor* MTL::DepthStencilDescriptor::init()
{
return NS::Object::init<MTL::DepthStencilDescriptor>();
}
_MTL_INLINE bool MTL::DepthStencilDescriptor::isDepthWriteEnabled() const
{
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthWriteEnabled));
}
_MTL_INLINE NS::String* MTL::DepthStencilDescriptor::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL::DepthStencilDescriptor::setBackFaceStencil(const MTL::StencilDescriptor* backFaceStencil)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBackFaceStencil_), backFaceStencil);
}
_MTL_INLINE void MTL::DepthStencilDescriptor::setDepthCompareFunction(MTL::CompareFunction depthCompareFunction)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthCompareFunction_), depthCompareFunction);
}
_MTL_INLINE void MTL::DepthStencilDescriptor::setDepthWriteEnabled(bool depthWriteEnabled)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthWriteEnabled_), depthWriteEnabled);
}
_MTL_INLINE void MTL::DepthStencilDescriptor::setFrontFaceStencil(const MTL::StencilDescriptor* frontFaceStencil)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFrontFaceStencil_), frontFaceStencil);
}
_MTL_INLINE void MTL::DepthStencilDescriptor::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE MTL::Device* MTL::DepthStencilState::device() const
{
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
}
_MTL_INLINE MTL::ResourceID MTL::DepthStencilState::gpuResourceID() const
{
return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
}
_MTL_INLINE NS::String* MTL::DepthStencilState::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More