mirror of
https://github.com/rt64/rt64.git
synced 2025-12-05 01:00:13 +00:00
Add Metal Support (#9)
Co-authored-by: Isaac Marovitz <isaacryu@icloud.com> Co-authored-by: tanmaysachan <tnmysachan@gmail.com> Co-authored-by: Dario <dariosamo@gmail.com>
This commit is contained in:
10
.github/workflows/validate.yml
vendored
10
.github/workflows/validate.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
type: [ Debug, Release ]
|
||||
os: [ ubuntu-latest, windows-latest]
|
||||
os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] # macos-13 is Intel and macos-14 is Apple Silicon
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -49,6 +49,14 @@ jobs:
|
||||
sudo make install
|
||||
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
|
||||
echo ::endgroup::
|
||||
- uses: pkgxdev/setup@v1
|
||||
if: runner.os == 'macOS'
|
||||
with:
|
||||
+: zlib.net
|
||||
- name: Install macOS Dependencies
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install ninja sdl2
|
||||
- name: Configure Developer Command Prompt
|
||||
if: runner.os == 'Windows'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -46,6 +46,9 @@
|
||||
[submodule "src/contrib/nativefiledialog-extended"]
|
||||
path = src/contrib/nativefiledialog-extended
|
||||
url = https://github.com/btzy/nativefiledialog-extended
|
||||
[submodule "src/contrib/spirv-cross"]
|
||||
path = src/contrib/spirv-cross
|
||||
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
||||
[submodule "src/contrib/ddspp"]
|
||||
path = src/contrib/ddspp
|
||||
url = https://github.com/redorav/ddspp.git
|
||||
|
||||
140
CMakeLists.txt
140
CMakeLists.txt
@@ -1,8 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(rt64)
|
||||
project(rt64 LANGUAGES C CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
if (APPLE)
|
||||
enable_language(OBJC OBJCXX)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
|
||||
endif()
|
||||
|
||||
option(RT64_STATIC "Build RT64 as a static library" OFF)
|
||||
|
||||
option(RT64_BUILD_EXAMPLES "Build examples for RT64" OFF)
|
||||
@@ -41,22 +46,24 @@ if (WIN32)
|
||||
# Dependencies that must be next to the DLL.
|
||||
configure_file("${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxcompiler.dll" "dxcompiler.dll" COPYONLY)
|
||||
configure_file("${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxil.dll" "dxil.dll" COPYONLY)
|
||||
elseif (APPLE)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
# find zlib and include in dyld path
|
||||
find_library(ZLIB_LIBRARY NAMES z)
|
||||
get_filename_component(ZLIB_PATH ${ZLIB_LIBRARY} DIRECTORY)
|
||||
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64:${ZLIB_PATH}" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc-macos")
|
||||
set (SPIRVCROSS "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/spirv-cross/lib/x64:$ENV{DYLD_LIBRARY_PATH}" "${PROJECT_SOURCE_DIR}/src/contrib/spirv-cross/bin/x64/spirv-cross")
|
||||
else()
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/arm64:${ZLIB_PATH}" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/arm64/dxc-macos")
|
||||
set (SPIRVCROSS "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/spirv-cross/lib/arm64:$ENV{DYLD_LIBRARY_PATH}" "${PROJECT_SOURCE_DIR}/src/contrib/spirv-cross/bin/arm64/spirv-cross")
|
||||
endif()
|
||||
else()
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
if (APPLE)
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc")
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc")
|
||||
endif()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc-linux")
|
||||
else()
|
||||
if (APPLE)
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/arm64/dxc-macos")
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/arm64/dxc-linux")
|
||||
endif()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/arm64/dxc-linux")
|
||||
endif()
|
||||
|
||||
message(STATUS "DXC: ${DXC}")
|
||||
endif()
|
||||
|
||||
set(ZSTD_LEGACY_SUPPORT OFF)
|
||||
@@ -119,6 +126,26 @@ function(build_shader_dxil_impl TARGETOBJ FILENAME TARGET_NAME OUTNAME)
|
||||
target_sources(${TARGETOBJ} PRIVATE ${OUTNAME}.dxil.c)
|
||||
endfunction()
|
||||
|
||||
function(build_shader_msl_impl TARGETOBJ FILENAME TARGET_NAME OUTNAME)
|
||||
add_custom_command(OUTPUT ${OUTNAME}.spv
|
||||
COMMAND ${DXC} ${DXC_SPV_OPTS} ${ARGN} ${FILENAME} /Fo ${OUTNAME}.spv
|
||||
DEPENDS ${FILENAME})
|
||||
add_custom_command(OUTPUT ${OUTNAME}.metal
|
||||
COMMAND spirv_cross_msl ${OUTNAME}.spv ${OUTNAME}.metal
|
||||
DEPENDS ${OUTNAME}.spv spirv_cross_msl)
|
||||
add_custom_command(OUTPUT ${OUTNAME}.ir
|
||||
COMMAND xcrun -sdk macosx metal -o ${OUTNAME}.ir -c ${OUTNAME}.metal $<$<CONFIG:Debug>:-frecord-sources>
|
||||
DEPENDS ${OUTNAME}.metal)
|
||||
add_custom_command(OUTPUT ${OUTNAME}.metallib
|
||||
COMMAND xcrun -sdk macosx metallib ${OUTNAME}.ir -o ${OUTNAME}.metallib
|
||||
DEPENDS ${OUTNAME}.ir)
|
||||
add_custom_command(OUTPUT ${OUTNAME}.metal.c
|
||||
COMMAND file_to_c ${OUTNAME}.metallib ${TARGET_NAME}BlobMSL ${OUTNAME}.metal.c ${OUTNAME}.metal.h
|
||||
DEPENDS ${OUTNAME}.metallib file_to_c
|
||||
BYPRODUCTS ${OUTNAME}.metal.h)
|
||||
target_sources(${TARGETOBJ} PRIVATE ${OUTNAME}.metal.c)
|
||||
endfunction()
|
||||
|
||||
function(build_shader TARGETOBJ SHADERNAME OPTIONS)
|
||||
set(FILENAME "${PROJECT_SOURCE_DIR}/${SHADERNAME}")
|
||||
if (${ARGC} GREATER 3)
|
||||
@@ -138,6 +165,10 @@ function(build_shader TARGETOBJ SHADERNAME OPTIONS)
|
||||
if (WIN32)
|
||||
build_shader_dxil_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endif()
|
||||
# Compile Metal shader binaries if building on macOS
|
||||
if (APPLE)
|
||||
build_shader_msl_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endif()
|
||||
build_shader_spirv_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endfunction()
|
||||
|
||||
@@ -178,6 +209,24 @@ function(build_shader_spirv TARGETOBJ SHADERNAME OPTIONS)
|
||||
build_shader_spirv_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endfunction()
|
||||
|
||||
function(build_shader_msl TARGETOBJ SHADERNAME OPTIONS)
|
||||
set(FILENAME "${PROJECT_SOURCE_DIR}/${SHADERNAME}")
|
||||
if (${ARGC} GREATER 3)
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${ARGV3}")
|
||||
else()
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${SHADERNAME}")
|
||||
endif()
|
||||
# Get any optional compiler args passed to this function
|
||||
if (${ARGC} GREATER 4)
|
||||
set(EXTRA_ARGS "${ARGN}")
|
||||
list(REMOVE_AT EXTRA_ARGS 0)
|
||||
endif()
|
||||
cmake_path(GET OUTNAME STEM TARGET_NAME)
|
||||
cmake_path(GET OUTNAME PARENT_PATH OUTPUT_DIR)
|
||||
file(MAKE_DIRECTORY ${OUTPUT_DIR})
|
||||
build_shader_msl_impl(${TARGETOBJ} ${FILENAME} ${TARGET_NAME} ${OUTNAME} ${OPTIONS} ${EXTRA_ARGS})
|
||||
endfunction()
|
||||
|
||||
function(preprocess_shader TARGETOBJ SHADERNAME)
|
||||
set(FILENAME "${PROJECT_SOURCE_DIR}/${SHADERNAME}")
|
||||
set(OUTNAME "${CMAKE_BINARY_DIR}/${SHADERNAME}")
|
||||
@@ -204,22 +253,24 @@ function(build_vertex_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_VS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_pixel_shader_spirv TARGETOBJ SHADERNAME)
|
||||
function(build_pixel_shader_spec_constants TARGETOBJ SHADERNAME)
|
||||
build_shader_spirv(${TARGETOBJ} ${SHADERNAME} "${DXC_PS_OPTS}" ${ARGN})
|
||||
if (APPLE)
|
||||
build_shader_msl(${TARGETOBJ} ${SHADERNAME} "${DXC_PS_OPTS}" ${ARGN})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(build_vertex_shader_spirv TARGETOBJ SHADERNAME)
|
||||
function(build_vertex_shader_spec_constants TARGETOBJ SHADERNAME)
|
||||
build_shader_spirv(${TARGETOBJ} ${SHADERNAME} "${DXC_VS_OPTS}" ${ARGN})
|
||||
if (APPLE)
|
||||
build_shader_msl(${TARGETOBJ} ${SHADERNAME} "${DXC_VS_OPTS}" ${ARGN})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(build_compute_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_CS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_geo_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_GS_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(build_ray_shader TARGETOBJ SHADERNAME)
|
||||
build_shader(${TARGETOBJ} ${SHADERNAME} "${DXC_RT_OPTS}" ${ARGN})
|
||||
endfunction()
|
||||
@@ -390,6 +441,18 @@ target_link_libraries(rt64 libzstd_static)
|
||||
add_subdirectory(src/tools/texture_hasher)
|
||||
add_subdirectory(src/tools/texture_packer)
|
||||
|
||||
# Add any Apple-specific source files and libraries
|
||||
if (APPLE)
|
||||
add_subdirectory(src/tools/spirv_cross_msl)
|
||||
|
||||
target_sources(rt64 PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src/metal/rt64_metal.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/apple/rt64_apple.mm"
|
||||
)
|
||||
target_include_directories(rt64 PRIVATE "${PROJECT_SOURCE_DIR}/src/contrib/metal-cpp")
|
||||
target_link_libraries(rt64 "-framework Metal -framework QuartzCore -framework CoreGraphics")
|
||||
endif()
|
||||
|
||||
# Add any Windows-specific source files and libraries
|
||||
if (WIN32)
|
||||
target_sources(rt64 PRIVATE
|
||||
@@ -429,15 +492,15 @@ endif()
|
||||
|
||||
build_pixel_shader( rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSDynamic.hlsl" "-D DYNAMIC_RENDER_PARAMS")
|
||||
build_pixel_shader( rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSDynamicMS.hlsl" "-D DYNAMIC_RENDER_PARAMS" "-D MULTISAMPLING")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstant.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlat.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantDepth.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D OUTPUT_DEPTH")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantDepthMS.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D OUTPUT_DEPTH" "-D MULTISAMPLING")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlatDepth.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR" "-D OUTPUT_DEPTH")
|
||||
build_pixel_shader_spirv(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlatDepthMS.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR" "-D OUTPUT_DEPTH" "-D MULTISAMPLING")
|
||||
build_pixel_shader_spec_constants(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstant.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS")
|
||||
build_pixel_shader_spec_constants(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlat.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR")
|
||||
build_pixel_shader_spec_constants(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantDepth.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D OUTPUT_DEPTH")
|
||||
build_pixel_shader_spec_constants(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantDepthMS.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D OUTPUT_DEPTH" "-D MULTISAMPLING")
|
||||
build_pixel_shader_spec_constants(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlatDepth.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR" "-D OUTPUT_DEPTH")
|
||||
build_pixel_shader_spec_constants(rt64 "src/shaders/RasterPS.hlsl" "src/shaders/RasterPSSpecConstantFlatDepthMS.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR" "-D OUTPUT_DEPTH" "-D MULTISAMPLING")
|
||||
build_vertex_shader( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSDynamic.hlsl" "-D DYNAMIC_RENDER_PARAMS")
|
||||
build_vertex_shader_spirv( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSSpecConstant.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS")
|
||||
build_vertex_shader_spirv( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSSpecConstantFlat.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR")
|
||||
build_vertex_shader_spec_constants( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSSpecConstant.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS")
|
||||
build_vertex_shader_spec_constants( rt64 "src/shaders/RasterVS.hlsl" "src/shaders/RasterVSSpecConstantFlat.hlsl" "-D SPEC_CONSTANT_RENDER_PARAMS" "-D VERTEX_FLAT_COLOR")
|
||||
build_compute_shader(rt64 "src/shaders/FbChangesClearCS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/FbChangesDrawColorPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/FbChangesDrawDepthPS.hlsl")
|
||||
@@ -477,8 +540,6 @@ build_pixel_shader( rt64 "src/shaders/VideoInterfacePS.hlsl" "src/shaders/Video
|
||||
build_pixel_shader( rt64 "src/shaders/VideoInterfacePS.hlsl" "src/shaders/VideoInterfacePSPixel.hlsl" "-D PIXEL_ANTIALIASING")
|
||||
build_vertex_shader( rt64 "src/shaders/FullScreenVS.hlsl")
|
||||
build_vertex_shader( rt64 "src/shaders/Im3DVS.hlsl")
|
||||
build_geo_shader( rt64 "src/shaders/Im3DGSPoints.hlsl")
|
||||
build_geo_shader( rt64 "src/shaders/Im3DGSLines.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/ComposePS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/DebugPS.hlsl")
|
||||
build_pixel_shader( rt64 "src/shaders/Im3DPS.hlsl")
|
||||
@@ -490,12 +551,29 @@ if (RT64_BUILD_EXAMPLES)
|
||||
add_executable(rhi_test "examples/rt64_render_interface.cpp" "examples/rhi_test.cpp")
|
||||
target_link_libraries(rhi_test rt64)
|
||||
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestPS.hlsl")
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestSpecPS.hlsl")
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestColorPS.hlsl")
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestDecalPS.hlsl")
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestTextureBindfulPS.hlsl")
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestTextureBindlessPS.hlsl")
|
||||
build_vertex_shader( rhi_test "examples/shaders/RenderInterfaceTestVS.hlsl")
|
||||
build_compute_shader(rhi_test "examples/shaders/RenderInterfaceTestCS.hlsl")
|
||||
build_ray_shader( rhi_test "examples/shaders/RenderInterfaceTestRT.hlsl")
|
||||
build_compute_shader(rhi_test "examples/shaders/RenderInterfaceTestAsyncCS.hlsl")
|
||||
if (NOT APPLE)
|
||||
# TODO: Enable when RT is added to Metal.
|
||||
build_ray_shader(rhi_test "examples/shaders/RenderInterfaceTestRT.hlsl")
|
||||
endif()
|
||||
build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestPostPS.hlsl")
|
||||
build_vertex_shader( rhi_test "examples/shaders/RenderInterfaceTestPostVS.hlsl")
|
||||
|
||||
target_include_directories(rhi_test PRIVATE ${CMAKE_BINARY_DIR}/examples)
|
||||
|
||||
if (APPLE)
|
||||
set_property (TARGET rhi_test APPEND_STRING PROPERTY
|
||||
COMPILE_FLAGS "-fobjc-arc")
|
||||
set_target_properties(rhi_test PROPERTIES
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-"
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_SOURCE_DIR}/rt64.entitlements
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -3,19 +3,31 @@
|
||||
namespace RT64 {
|
||||
extern std::unique_ptr<RenderInterface> CreateD3D12Interface();
|
||||
extern std::unique_ptr<RenderInterface> CreateVulkanInterface();
|
||||
extern std::unique_ptr<RenderInterface> CreateMetalInterface();
|
||||
}
|
||||
|
||||
std::unique_ptr<RT64::RenderInterface> CreateRenderInterface() {
|
||||
#if defined(_WIN32)
|
||||
const bool useVulkan = true; // Or derive this from configuration or runtime check.
|
||||
if (!useVulkan) {
|
||||
return RT64::CreateD3D12Interface();
|
||||
}
|
||||
// Fallback to Vulkan if D3D12 is not chosen or available.
|
||||
return RT64::CreateVulkanInterface();
|
||||
#elif defined(__APPLE__)
|
||||
const bool useMVK = false; // Or derive this from configuration or runtime check.
|
||||
if (useMVK) {
|
||||
return RT64::CreateVulkanInterface();
|
||||
}
|
||||
|
||||
return RT64::CreateMetalInterface();
|
||||
#else
|
||||
return RT64::CreateVulkanInterface();
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::unique_ptr<RT64::RenderInterface> renderInterface = RT64::CreateVulkanInterface();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows only: Can also use D3D12.
|
||||
const bool useVulkan = true;
|
||||
if (!useVulkan) {
|
||||
renderInterface = RT64::CreateD3D12Interface();
|
||||
}
|
||||
#endif
|
||||
|
||||
auto renderInterface = CreateRenderInterface();
|
||||
// Execute a blocking test that creates a window and draws some geometry to test the render interface.
|
||||
RT64::RenderInterfaceTest(renderInterface.get());
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
52
examples/shaders/RenderInterfaceTestAsyncCS.hlsl
Normal file
52
examples/shaders/RenderInterfaceTestAsyncCS.hlsl
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
struct CustomStruct {
|
||||
float3 point3D;
|
||||
float2 size2D;
|
||||
};
|
||||
|
||||
struct Constants {
|
||||
float Value;
|
||||
};
|
||||
|
||||
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
||||
RWBuffer<float> gOutput : register(u1);
|
||||
RWStructuredBuffer<CustomStruct> gStructuredBase : register(u2);
|
||||
RWStructuredBuffer<CustomStruct> gStructuredOffset : register(u3);
|
||||
RWByteAddressBuffer gByteAddress : register(u4);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void CSMain(uint coord : SV_DispatchThreadID) {
|
||||
// Test formatted buffer (read/write)
|
||||
float sqrtValue = sqrt(gConstants.Value);
|
||||
gOutput[0] = sqrtValue;
|
||||
|
||||
// Test structured buffer base view (read/write)
|
||||
CustomStruct data = gStructuredBase[0];
|
||||
gOutput[1] = data.point3D.x + data.point3D.y + data.point3D.z +
|
||||
data.size2D.x + data.size2D.y;
|
||||
|
||||
// Increment all values by 1 for next frame
|
||||
data.point3D += 1.0;
|
||||
data.size2D += 1.0;
|
||||
gStructuredBase[0] = data;
|
||||
|
||||
// Test structured buffer offset view
|
||||
CustomStruct offsetData = gStructuredOffset[0]; // test will offset view
|
||||
gOutput[2] = offsetData.point3D.x + offsetData.point3D.y + offsetData.point3D.z +
|
||||
offsetData.size2D.x + offsetData.size2D.y;
|
||||
|
||||
// Increment all values by 1 for next frame
|
||||
offsetData.point3D += 1.0;
|
||||
offsetData.size2D += 1.0;
|
||||
gStructuredOffset[0] = offsetData;
|
||||
|
||||
// Test byte address buffer (read/write)
|
||||
float rawValue = asfloat(gByteAddress.Load(16));
|
||||
gOutput[3] = rawValue;
|
||||
|
||||
// Write incremented value back
|
||||
gByteAddress.Store(16, asuint(rawValue + 1.0));
|
||||
}
|
||||
21
examples/shaders/RenderInterfaceTestColorPS.hlsl
Normal file
21
examples/shaders/RenderInterfaceTestColorPS.hlsl
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
struct Constants {
|
||||
float4 colorAdd;
|
||||
uint textureIndex;
|
||||
};
|
||||
|
||||
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD0) : SV_TARGET {
|
||||
float4 gradientColor = float4(uv, 1.0f, 0.5f);
|
||||
|
||||
// Check if colorAdd has any non-zero components
|
||||
if (length(gConstants.colorAdd) > 0.001f) {
|
||||
return gConstants.colorAdd;
|
||||
}
|
||||
|
||||
return gradientColor;
|
||||
}
|
||||
14
examples/shaders/RenderInterfaceTestDecalPS.hlsl
Normal file
14
examples/shaders/RenderInterfaceTestDecalPS.hlsl
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
Texture2DMS<float> gDepth : register(t0);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in uint sampleIndex : SV_SampleIndex, in float2 uv : TEXCOORD0) : SV_TARGET {
|
||||
float depth = gDepth.Load(floor(pos.xy), sampleIndex);
|
||||
if (abs(pos.z - depth) > 1e-6f) {
|
||||
discard;
|
||||
}
|
||||
|
||||
return float4(1.0f, uv, 1.0f);
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
Texture2D<float4> gTexture : register(t1);
|
||||
SamplerState gSampler : register(s2);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD) : SV_TARGET {
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD0) : SV_TARGET {
|
||||
float4 result = float4(gTexture.SampleLevel(gSampler, uv, 0).rgb, 1.0f);
|
||||
return result;
|
||||
}
|
||||
7
examples/shaders/RenderInterfaceTestSpecPS.hlsl
Normal file
7
examples/shaders/RenderInterfaceTestSpecPS.hlsl
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
[[vk::constant_id(0)]] const uint useRed = 0;
|
||||
|
||||
float4 PSMain() : SV_TARGET {
|
||||
return useRed ? float4(1.0, 0.0, 0.0, 1.0) // Red if true
|
||||
: float4(0.0, 1.0, 0.0, 1.0); // Green if false
|
||||
}
|
||||
18
examples/shaders/RenderInterfaceTestTextureBindfulPS.hlsl
Normal file
18
examples/shaders/RenderInterfaceTestTextureBindfulPS.hlsl
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
struct Constants {
|
||||
float4 colorAdd;
|
||||
};
|
||||
|
||||
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
||||
|
||||
SamplerState gSampler : register(s1);
|
||||
Texture2D<float4> gTexture : register(t2);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD0) : SV_TARGET {
|
||||
float4 result = float4(gTexture.SampleLevel(gSampler, uv, 0).rgb, 1.0f);
|
||||
result += gConstants.colorAdd;
|
||||
return result;
|
||||
}
|
||||
@@ -10,10 +10,10 @@ struct Constants {
|
||||
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
||||
|
||||
SamplerState gSampler : register(s1);
|
||||
Texture2D<float4> gTexture[] : register(t2);
|
||||
Texture2D<float4> gTextures[2048] : register(t2);
|
||||
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD) : SV_TARGET {
|
||||
float4 result = float4(gTexture[NonUniformResourceIndex(gConstants.textureIndex)].SampleLevel(gSampler, uv, 0).rgb, 1.0f);
|
||||
float4 PSMain(in float4 pos : SV_Position, in float2 uv : TEXCOORD0) : SV_TARGET {
|
||||
float4 result = float4(gTextures[NonUniformResourceIndex(gConstants.textureIndex)].SampleLevel(gSampler, uv, 0).rgb, 1.0f);
|
||||
result += gConstants.colorAdd;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// RT64
|
||||
//
|
||||
|
||||
void VSMain(in float2 vertexPos : POSITION, in float2 vertexUV : TEXCOORD, out float4 pos : SV_POSITION, out float2 uv : TEXCOORD) {
|
||||
pos = float4(vertexPos, 1.0f, 1.0f);
|
||||
void VSMain(in float2 vertexPos : POSITION, in float2 vertexUV : TEXCOORD0, out float4 pos : SV_POSITION, out float2 uv : TEXCOORD0) {
|
||||
pos = float4(vertexPos, 0.5f, 1.0f);
|
||||
uv = vertexUV;
|
||||
}
|
||||
8
rt64.entitlements
Normal file
8
rt64.entitlements
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
38
src/apple/rt64_apple.h
Normal file
38
src/apple/rt64_apple.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// RT64
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
struct CocoaWindowAttributes {
|
||||
int x, y;
|
||||
int width, height;
|
||||
};
|
||||
|
||||
const char* GetHomeDirectory();
|
||||
|
||||
class CocoaWindow {
|
||||
private:
|
||||
void* windowHandle;
|
||||
CocoaWindowAttributes cachedAttributes;
|
||||
std::atomic<int> cachedRefreshRate;
|
||||
mutable std::mutex attributesMutex;
|
||||
|
||||
void updateWindowAttributesInternal(bool forceSync = false);
|
||||
void updateRefreshRateInternal(bool forceSync = false);
|
||||
public:
|
||||
CocoaWindow(void* window);
|
||||
~CocoaWindow();
|
||||
|
||||
// Get cached window attributes, may trigger async update
|
||||
void getWindowAttributes(CocoaWindowAttributes* attributes) const;
|
||||
|
||||
// Get cached refresh rate, may trigger async update
|
||||
int getRefreshRate() const;
|
||||
|
||||
// Toggle fullscreen
|
||||
void toggleFullscreen();
|
||||
};
|
||||
126
src/apple/rt64_apple.mm
Normal file
126
src/apple/rt64_apple.mm
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "rt64_apple.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
const char* GetHomeDirectory() {
|
||||
return strdup([NSHomeDirectory() UTF8String]);
|
||||
}
|
||||
|
||||
// MARK: - CocoaWindow
|
||||
|
||||
CocoaWindow::CocoaWindow(void* window)
|
||||
: windowHandle(window), cachedRefreshRate(0) {
|
||||
cachedAttributes = {0, 0, 0, 0};
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
NSRect contentFrame = [[nsWindow contentView] frame];
|
||||
cachedAttributes.x = contentFrame.origin.x;
|
||||
cachedAttributes.y = contentFrame.origin.y;
|
||||
cachedAttributes.width = contentFrame.size.width;
|
||||
cachedAttributes.height = contentFrame.size.height;
|
||||
|
||||
NSScreen *screen = [nsWindow screen];
|
||||
if (@available(macOS 12.0, *)) {
|
||||
cachedRefreshRate.store((int)[screen maximumFramesPerSecond]);
|
||||
}
|
||||
} else {
|
||||
updateWindowAttributesInternal(true);
|
||||
updateRefreshRateInternal(true);
|
||||
}
|
||||
}
|
||||
|
||||
CocoaWindow::~CocoaWindow() {}
|
||||
|
||||
void CocoaWindow::updateWindowAttributesInternal(bool forceSync) {
|
||||
auto updateBlock = ^{
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
NSRect contentFrame = [[nsWindow contentView] frame];
|
||||
|
||||
std::lock_guard<std::mutex> lock(attributesMutex);
|
||||
cachedAttributes.x = contentFrame.origin.x;
|
||||
cachedAttributes.y = contentFrame.origin.y;
|
||||
cachedAttributes.width = contentFrame.size.width;
|
||||
cachedAttributes.height = contentFrame.size.height;
|
||||
};
|
||||
|
||||
if (forceSync) {
|
||||
dispatch_sync(dispatch_get_main_queue(), updateBlock);
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), updateBlock);
|
||||
}
|
||||
}
|
||||
|
||||
void CocoaWindow::updateRefreshRateInternal(bool forceSync) {
|
||||
auto updateBlock = ^{
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
NSScreen *screen = [nsWindow screen];
|
||||
if (@available(macOS 12.0, *)) {
|
||||
cachedRefreshRate.store((int)[screen maximumFramesPerSecond]);
|
||||
}
|
||||
};
|
||||
|
||||
if (forceSync) {
|
||||
dispatch_sync(dispatch_get_main_queue(), updateBlock);
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), updateBlock);
|
||||
}
|
||||
}
|
||||
|
||||
void CocoaWindow::getWindowAttributes(CocoaWindowAttributes* attributes) const {
|
||||
if ([NSThread isMainThread]) {
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
NSRect contentFrame = [[nsWindow contentView] frame];
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(attributesMutex);
|
||||
const_cast<CocoaWindow*>(this)->cachedAttributes.x = contentFrame.origin.x;
|
||||
const_cast<CocoaWindow*>(this)->cachedAttributes.y = contentFrame.origin.y;
|
||||
const_cast<CocoaWindow*>(this)->cachedAttributes.width = contentFrame.size.width;
|
||||
const_cast<CocoaWindow*>(this)->cachedAttributes.height = contentFrame.size.height;
|
||||
|
||||
*attributes = cachedAttributes;
|
||||
}
|
||||
} else {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(attributesMutex);
|
||||
*attributes = cachedAttributes;
|
||||
}
|
||||
|
||||
const_cast<CocoaWindow*>(this)->updateWindowAttributesInternal(false);
|
||||
}
|
||||
}
|
||||
|
||||
int CocoaWindow::getRefreshRate() const {
|
||||
if ([NSThread isMainThread]) {
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
NSScreen *screen = [nsWindow screen];
|
||||
|
||||
if (@available(macOS 12.0, *)) {
|
||||
int freshRate = (int)[screen maximumFramesPerSecond];
|
||||
const_cast<CocoaWindow*>(this)->cachedRefreshRate.store(freshRate);
|
||||
return freshRate;
|
||||
}
|
||||
|
||||
return cachedRefreshRate.load();
|
||||
} else {
|
||||
int rate = cachedRefreshRate.load();
|
||||
|
||||
const_cast<CocoaWindow*>(this)->updateRefreshRateInternal(false);
|
||||
|
||||
return rate;
|
||||
}
|
||||
}
|
||||
|
||||
void CocoaWindow::toggleFullscreen() {
|
||||
if ([NSThread isMainThread]) {
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
[nsWindow toggleFullScreen:NULL];
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSWindow *nsWindow = (__bridge NSWindow *)windowHandle;
|
||||
[nsWindow toggleFullScreen:NULL];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,10 @@
|
||||
#define HLSLPP_SCALAR
|
||||
#endif
|
||||
|
||||
// Disable SIMD on Apple Silicon due to UB when compiling with optimizations.
|
||||
|
||||
#if defined(__APPLE__) && defined(__aarch64__)
|
||||
#define HLSLPP_SCALAR
|
||||
#endif
|
||||
|
||||
#include "hlsl++.h"
|
||||
@@ -9,6 +9,8 @@
|
||||
namespace RT64 {
|
||||
#if defined(_WIN32)
|
||||
UserConfiguration::GraphicsAPI UserConfiguration::DefaultGraphicsAPI = UserConfiguration::GraphicsAPI::D3D12;
|
||||
#elif defined(__APPLE__)
|
||||
UserConfiguration::GraphicsAPI UserConfiguration::DefaultGraphicsAPI = UserConfiguration::GraphicsAPI::Metal;
|
||||
#else
|
||||
UserConfiguration::GraphicsAPI UserConfiguration::DefaultGraphicsAPI = UserConfiguration::GraphicsAPI::Vulkan;
|
||||
#endif
|
||||
@@ -147,4 +149,4 @@ namespace RT64 {
|
||||
stream << std::setw(4) << jroot << std::endl;
|
||||
return !stream.bad();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace RT64 {
|
||||
enum class GraphicsAPI {
|
||||
D3D12,
|
||||
Vulkan,
|
||||
Metal,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
@@ -114,7 +115,8 @@ namespace RT64 {
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::GraphicsAPI, {
|
||||
{ UserConfiguration::GraphicsAPI::D3D12, "D3D12" },
|
||||
{ UserConfiguration::GraphicsAPI::Vulkan, "Vulkan" }
|
||||
{ UserConfiguration::GraphicsAPI::Vulkan, "Vulkan" },
|
||||
{ UserConfiguration::GraphicsAPI::Metal, "Metal" }
|
||||
});
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(UserConfiguration::Resolution, {
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
# include <pwd.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <Shlobj.h>
|
||||
#elif defined(__APPLE__)
|
||||
# include "apple/rt64_apple.h"
|
||||
#endif
|
||||
|
||||
namespace RT64 {
|
||||
@@ -30,10 +32,14 @@ namespace RT64 {
|
||||
}
|
||||
|
||||
CoTaskMemFree(knownPath);
|
||||
# elif defined(__linux__)
|
||||
# elif defined(__linux__) || defined(__APPLE__)
|
||||
const char *homeDir = getenv("HOME");
|
||||
if (homeDir == nullptr) {
|
||||
# if defined(__linux__)
|
||||
homeDir = getpwuid(getuid())->pw_dir;
|
||||
# elif defined(__APPLE__)
|
||||
homeDir = GetHomeDirectory();
|
||||
# endif
|
||||
}
|
||||
|
||||
if (homeDir != nullptr) {
|
||||
|
||||
Submodule src/contrib/dxc updated: 9d592dfcb0...cc15e715ee
47
src/contrib/metal-cpp/Foundation/Foundation.hpp
Normal file
47
src/contrib/metal-cpp/Foundation/Foundation.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
124
src/contrib/metal-cpp/Foundation/NSArray.hpp
Normal file
124
src/contrib/metal-cpp/Foundation/NSArray.hpp
Normal file
@@ -0,0 +1,124 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
83
src/contrib/metal-cpp/Foundation/NSAutoreleasePool.hpp
Normal file
83
src/contrib/metal-cpp/Foundation/NSAutoreleasePool.hpp
Normal file
@@ -0,0 +1,83 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
374
src/contrib/metal-cpp/Foundation/NSBundle.hpp
Normal file
374
src/contrib/metal-cpp/Foundation/NSBundle.hpp
Normal file
@@ -0,0 +1,374 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
54
src/contrib/metal-cpp/Foundation/NSData.hpp
Normal file
54
src/contrib/metal-cpp/Foundation/NSData.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
53
src/contrib/metal-cpp/Foundation/NSDate.hpp
Normal file
53
src/contrib/metal-cpp/Foundation/NSDate.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
45
src/contrib/metal-cpp/Foundation/NSDefines.hpp
Normal file
45
src/contrib/metal-cpp/Foundation/NSDefines.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
128
src/contrib/metal-cpp/Foundation/NSDictionary.hpp
Normal file
128
src/contrib/metal-cpp/Foundation/NSDictionary.hpp
Normal file
@@ -0,0 +1,128 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
78
src/contrib/metal-cpp/Foundation/NSEnumerator.hpp
Normal file
78
src/contrib/metal-cpp/Foundation/NSEnumerator.hpp
Normal file
@@ -0,0 +1,78 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
173
src/contrib/metal-cpp/Foundation/NSError.hpp
Normal file
173
src/contrib/metal-cpp/Foundation/NSError.hpp
Normal file
@@ -0,0 +1,173 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
118
src/contrib/metal-cpp/Foundation/NSLock.hpp
Normal file
118
src/contrib/metal-cpp/Foundation/NSLock.hpp
Normal file
@@ -0,0 +1,118 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
110
src/contrib/metal-cpp/Foundation/NSNotification.hpp
Normal file
110
src/contrib/metal-cpp/Foundation/NSNotification.hpp
Normal file
@@ -0,0 +1,110 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
501
src/contrib/metal-cpp/Foundation/NSNumber.hpp
Normal file
501
src/contrib/metal-cpp/Foundation/NSNumber.hpp
Normal file
@@ -0,0 +1,501 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
43
src/contrib/metal-cpp/Foundation/NSObjCRuntime.hpp
Normal file
43
src/contrib/metal-cpp/Foundation/NSObjCRuntime.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
302
src/contrib/metal-cpp/Foundation/NSObject.hpp
Normal file
302
src/contrib/metal-cpp/Foundation/NSObject.hpp
Normal file
@@ -0,0 +1,302 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
531
src/contrib/metal-cpp/Foundation/NSPrivate.hpp
Normal file
531
src/contrib/metal-cpp/Foundation/NSPrivate.hpp
Normal file
@@ -0,0 +1,531 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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_15_0) || defined(__IPHONE_18_0) || defined(__TVOS_18_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
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
386
src/contrib/metal-cpp/Foundation/NSProcessInfo.hpp
Normal file
386
src/contrib/metal-cpp/Foundation/NSProcessInfo.hpp
Normal file
@@ -0,0 +1,386 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
83
src/contrib/metal-cpp/Foundation/NSRange.hpp
Normal file
83
src/contrib/metal-cpp/Foundation/NSRange.hpp
Normal file
@@ -0,0 +1,83 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
87
src/contrib/metal-cpp/Foundation/NSSet.hpp
Normal file
87
src/contrib/metal-cpp/Foundation/NSSet.hpp
Normal file
@@ -0,0 +1,87 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
310
src/contrib/metal-cpp/Foundation/NSSharedPtr.hpp
Normal file
310
src/contrib/metal-cpp/Foundation/NSSharedPtr.hpp
Normal file
@@ -0,0 +1,310 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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();
|
||||
}
|
||||
255
src/contrib/metal-cpp/Foundation/NSString.hpp
Normal file
255
src/contrib/metal-cpp/Foundation/NSString.hpp
Normal file
@@ -0,0 +1,255 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
51
src/contrib/metal-cpp/Foundation/NSTypes.hpp
Normal file
51
src/contrib/metal-cpp/Foundation/NSTypes.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
90
src/contrib/metal-cpp/Foundation/NSURL.hpp
Normal file
90
src/contrib/metal-cpp/Foundation/NSURL.hpp
Normal file
@@ -0,0 +1,90 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
202
src/contrib/metal-cpp/LICENSE.txt
Normal file
202
src/contrib/metal-cpp/LICENSE.txt
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
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.
|
||||
1948
src/contrib/metal-cpp/Metal/MTLAccelerationStructure.hpp
Normal file
1948
src/contrib/metal-cpp/Metal/MTLAccelerationStructure.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,290 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLAccelerationStructureCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLAccelerationStructureCommandEncoder.hpp"
|
||||
#include "MTLArgument.hpp"
|
||||
#include "MTLCommandEncoder.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, AccelerationStructureRefitOptions) {
|
||||
AccelerationStructureRefitOptionVertexData = 1,
|
||||
AccelerationStructureRefitOptionPerPrimitiveData = 2,
|
||||
};
|
||||
|
||||
class AccelerationStructureCommandEncoder : public NS::Referencing<AccelerationStructureCommandEncoder, CommandEncoder>
|
||||
{
|
||||
public:
|
||||
void buildAccelerationStructure(const class AccelerationStructure* accelerationStructure, const class AccelerationStructureDescriptor* descriptor, const class Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);
|
||||
|
||||
void refitAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructureDescriptor* descriptor, const class AccelerationStructure* destinationAccelerationStructure, const class Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);
|
||||
|
||||
void refitAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructureDescriptor* descriptor, const class AccelerationStructure* destinationAccelerationStructure, const class Buffer* scratchBuffer, NS::UInteger scratchBufferOffset, MTL::AccelerationStructureRefitOptions options);
|
||||
|
||||
void copyAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructure* destinationAccelerationStructure);
|
||||
|
||||
void writeCompactedAccelerationStructureSize(const class AccelerationStructure* accelerationStructure, const class Buffer* buffer, NS::UInteger offset);
|
||||
|
||||
void writeCompactedAccelerationStructureSize(const class AccelerationStructure* accelerationStructure, const class Buffer* buffer, NS::UInteger offset, MTL::DataType sizeDataType);
|
||||
|
||||
void copyAndCompactAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructure* destinationAccelerationStructure);
|
||||
|
||||
void updateFence(const class Fence* fence);
|
||||
|
||||
void waitForFence(const class Fence* fence);
|
||||
|
||||
void useResource(const class Resource* resource, MTL::ResourceUsage usage);
|
||||
|
||||
void useResources(const class Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);
|
||||
|
||||
void useHeap(const class Heap* heap);
|
||||
|
||||
void useHeaps(const class Heap* const heaps[], NS::UInteger count);
|
||||
|
||||
void sampleCountersInBuffer(const class CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
|
||||
};
|
||||
|
||||
class AccelerationStructurePassSampleBufferAttachmentDescriptor : public NS::Copying<AccelerationStructurePassSampleBufferAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class AccelerationStructurePassSampleBufferAttachmentDescriptor* alloc();
|
||||
|
||||
class AccelerationStructurePassSampleBufferAttachmentDescriptor* init();
|
||||
|
||||
class CounterSampleBuffer* sampleBuffer() const;
|
||||
void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
|
||||
|
||||
NS::UInteger startOfEncoderSampleIndex() const;
|
||||
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
|
||||
|
||||
NS::UInteger endOfEncoderSampleIndex() const;
|
||||
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
|
||||
};
|
||||
|
||||
class AccelerationStructurePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<AccelerationStructurePassSampleBufferAttachmentDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class AccelerationStructurePassSampleBufferAttachmentDescriptorArray* alloc();
|
||||
|
||||
class AccelerationStructurePassSampleBufferAttachmentDescriptorArray* init();
|
||||
|
||||
class AccelerationStructurePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
|
||||
|
||||
void setObject(const class AccelerationStructurePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
|
||||
};
|
||||
|
||||
class AccelerationStructurePassDescriptor : public NS::Copying<AccelerationStructurePassDescriptor>
|
||||
{
|
||||
public:
|
||||
static class AccelerationStructurePassDescriptor* alloc();
|
||||
|
||||
class AccelerationStructurePassDescriptor* init();
|
||||
|
||||
static class AccelerationStructurePassDescriptor* accelerationStructurePassDescriptor();
|
||||
|
||||
class AccelerationStructurePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// method: buildAccelerationStructure:descriptor:scratchBuffer:scratchBufferOffset:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: refitAccelerationStructure:descriptor:destination: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)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer, scratchBufferOffset);
|
||||
}
|
||||
|
||||
// method: refitAccelerationStructure:descriptor:destination:scratchBuffer:scratchBufferOffset:options:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyAccelerationStructure:toAccelerationStructure:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: writeCompactedAccelerationStructureSize:toBuffer:offset:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: writeCompactedAccelerationStructureSize:toBuffer:offset:sizeDataType:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyAndCompactAccelerationStructure:toAccelerationStructure:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: updateFence:
|
||||
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::updateFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
|
||||
}
|
||||
|
||||
// method: waitForFence:
|
||||
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::waitForFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
|
||||
}
|
||||
|
||||
// method: useResource:usage:
|
||||
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useResource(const MTL::Resource* resource, MTL::ResourceUsage usage)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResource_usage_), resource, usage);
|
||||
}
|
||||
|
||||
// method: useResources:count: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);
|
||||
}
|
||||
|
||||
// method: useHeap:
|
||||
_MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useHeap(const MTL::Heap* heap)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeap_), heap);
|
||||
}
|
||||
|
||||
// method: useHeaps:count:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: sampleCountersInBuffer:atSampleIndex:withBarrier:
|
||||
_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);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassSampleBufferAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: sampleBuffer
|
||||
_MTL_INLINE MTL::CounterSampleBuffer* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::sampleBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
|
||||
}
|
||||
|
||||
// property: startOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// property: endOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::AccelerationStructurePassDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::AccelerationStructurePassDescriptor>();
|
||||
}
|
||||
|
||||
// static method: accelerationStructurePassDescriptor
|
||||
_MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::accelerationStructurePassDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructurePassDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassDescriptor), _MTL_PRIVATE_SEL(accelerationStructurePassDescriptor));
|
||||
}
|
||||
|
||||
// property: sampleBufferAttachments
|
||||
_MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassDescriptor::sampleBufferAttachments() const
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
|
||||
}
|
||||
243
src/contrib/metal-cpp/Metal/MTLAccelerationStructureTypes.hpp
Normal file
243
src/contrib/metal-cpp/Metal/MTLAccelerationStructureTypes.hpp
Normal file
@@ -0,0 +1,243 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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/NSRange.hpp"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
_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];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
_MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox()
|
||||
: min(INFINITY, INFINITY, INFINITY)
|
||||
, max(-INFINITY, -INFINITY, -INFINITY)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
_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];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
43
src/contrib/metal-cpp/Metal/MTLAllocation.hpp
Normal file
43
src/contrib/metal-cpp/Metal/MTLAllocation.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLAllocation.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class Allocation : public NS::Referencing<Allocation>
|
||||
{
|
||||
public:
|
||||
NS::UInteger allocatedSize() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: allocatedSize
|
||||
_MTL_INLINE NS::UInteger MTL::Allocation::allocatedSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(allocatedSize));
|
||||
}
|
||||
848
src/contrib/metal-cpp/Metal/MTLArgument.hpp
Normal file
848
src/contrib/metal-cpp/Metal/MTLArgument.hpp
Normal file
@@ -0,0 +1,848 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLArgument.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLArgument.hpp"
|
||||
#include "MTLTexture.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,
|
||||
};
|
||||
|
||||
_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,
|
||||
};
|
||||
|
||||
_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 class Type* alloc();
|
||||
|
||||
class Type* init();
|
||||
|
||||
MTL::DataType dataType() const;
|
||||
};
|
||||
|
||||
class StructMember : public NS::Referencing<StructMember>
|
||||
{
|
||||
public:
|
||||
static class StructMember* alloc();
|
||||
|
||||
class StructMember* init();
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
NS::UInteger offset() const;
|
||||
|
||||
MTL::DataType dataType() const;
|
||||
|
||||
class StructType* structType();
|
||||
|
||||
class ArrayType* arrayType();
|
||||
|
||||
class TextureReferenceType* textureReferenceType();
|
||||
|
||||
class PointerType* pointerType();
|
||||
|
||||
NS::UInteger argumentIndex() const;
|
||||
};
|
||||
|
||||
class StructType : public NS::Referencing<StructType, Type>
|
||||
{
|
||||
public:
|
||||
static class StructType* alloc();
|
||||
|
||||
class StructType* init();
|
||||
|
||||
NS::Array* members() const;
|
||||
|
||||
class StructMember* memberByName(const NS::String* name);
|
||||
};
|
||||
|
||||
class ArrayType : public NS::Referencing<ArrayType, Type>
|
||||
{
|
||||
public:
|
||||
static class ArrayType* alloc();
|
||||
|
||||
class ArrayType* init();
|
||||
|
||||
MTL::DataType elementType() const;
|
||||
|
||||
NS::UInteger arrayLength() const;
|
||||
|
||||
NS::UInteger stride() const;
|
||||
|
||||
NS::UInteger argumentIndexStride() const;
|
||||
|
||||
class StructType* elementStructType();
|
||||
|
||||
class ArrayType* elementArrayType();
|
||||
|
||||
class TextureReferenceType* elementTextureReferenceType();
|
||||
|
||||
class PointerType* elementPointerType();
|
||||
};
|
||||
|
||||
class PointerType : public NS::Referencing<PointerType, Type>
|
||||
{
|
||||
public:
|
||||
static class PointerType* alloc();
|
||||
|
||||
class PointerType* init();
|
||||
|
||||
MTL::DataType elementType() const;
|
||||
|
||||
MTL::BindingAccess access() const;
|
||||
|
||||
NS::UInteger alignment() const;
|
||||
|
||||
NS::UInteger dataSize() const;
|
||||
|
||||
bool elementIsArgumentBuffer() const;
|
||||
|
||||
class StructType* elementStructType();
|
||||
|
||||
class ArrayType* elementArrayType();
|
||||
};
|
||||
|
||||
class TextureReferenceType : public NS::Referencing<TextureReferenceType, Type>
|
||||
{
|
||||
public:
|
||||
static class TextureReferenceType* alloc();
|
||||
|
||||
class TextureReferenceType* init();
|
||||
|
||||
MTL::DataType textureDataType() const;
|
||||
|
||||
MTL::TextureType textureType() const;
|
||||
|
||||
MTL::BindingAccess access() const;
|
||||
|
||||
bool isDepthTexture() const;
|
||||
};
|
||||
|
||||
class Argument : public NS::Referencing<Argument>
|
||||
{
|
||||
public:
|
||||
static class Argument* alloc();
|
||||
|
||||
class Argument* init();
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
MTL::ArgumentType type() const;
|
||||
|
||||
MTL::BindingAccess access() const;
|
||||
|
||||
NS::UInteger index() const;
|
||||
|
||||
bool active() const;
|
||||
|
||||
NS::UInteger bufferAlignment() const;
|
||||
|
||||
NS::UInteger bufferDataSize() const;
|
||||
|
||||
MTL::DataType bufferDataType() const;
|
||||
|
||||
class StructType* bufferStructType() const;
|
||||
|
||||
class PointerType* bufferPointerType() const;
|
||||
|
||||
NS::UInteger threadgroupMemoryAlignment() const;
|
||||
|
||||
NS::UInteger threadgroupMemoryDataSize() const;
|
||||
|
||||
MTL::TextureType textureType() const;
|
||||
|
||||
MTL::DataType textureDataType() const;
|
||||
|
||||
bool isDepthTexture() const;
|
||||
|
||||
NS::UInteger arrayLength() const;
|
||||
};
|
||||
|
||||
class Binding : public NS::Referencing<Binding>
|
||||
{
|
||||
public:
|
||||
NS::String* name() const;
|
||||
|
||||
MTL::BindingType type() const;
|
||||
|
||||
MTL::BindingAccess access() const;
|
||||
|
||||
NS::UInteger index() const;
|
||||
|
||||
bool used() const;
|
||||
|
||||
bool argument() const;
|
||||
};
|
||||
|
||||
class BufferBinding : public NS::Referencing<BufferBinding, Binding>
|
||||
{
|
||||
public:
|
||||
NS::UInteger bufferAlignment() const;
|
||||
|
||||
NS::UInteger bufferDataSize() const;
|
||||
|
||||
MTL::DataType bufferDataType() const;
|
||||
|
||||
class StructType* bufferStructType() const;
|
||||
|
||||
class PointerType* bufferPointerType() 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:
|
||||
MTL::TextureType textureType() const;
|
||||
|
||||
MTL::DataType textureDataType() const;
|
||||
|
||||
bool depthTexture() const;
|
||||
|
||||
NS::UInteger arrayLength() const;
|
||||
};
|
||||
|
||||
class ObjectPayloadBinding : public NS::Referencing<ObjectPayloadBinding, Binding>
|
||||
{
|
||||
public:
|
||||
NS::UInteger objectPayloadAlignment() const;
|
||||
|
||||
NS::UInteger objectPayloadDataSize() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::Type* MTL::Type::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::Type>(_MTL_PRIVATE_CLS(MTLType));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::Type* MTL::Type::init()
|
||||
{
|
||||
return NS::Object::init<MTL::Type>();
|
||||
}
|
||||
|
||||
// property: dataType
|
||||
_MTL_INLINE MTL::DataType MTL::Type::dataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::StructMember* MTL::StructMember::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::StructMember>(_MTL_PRIVATE_CLS(MTLStructMember));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::StructMember* MTL::StructMember::init()
|
||||
{
|
||||
return NS::Object::init<MTL::StructMember>();
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::StructMember::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: offset
|
||||
_MTL_INLINE NS::UInteger MTL::StructMember::offset() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(offset));
|
||||
}
|
||||
|
||||
// property: dataType
|
||||
_MTL_INLINE MTL::DataType MTL::StructMember::dataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
|
||||
}
|
||||
|
||||
// method: structType
|
||||
_MTL_INLINE MTL::StructType* MTL::StructMember::structType()
|
||||
{
|
||||
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(structType));
|
||||
}
|
||||
|
||||
// method: arrayType
|
||||
_MTL_INLINE MTL::ArrayType* MTL::StructMember::arrayType()
|
||||
{
|
||||
return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(arrayType));
|
||||
}
|
||||
|
||||
// method: textureReferenceType
|
||||
_MTL_INLINE MTL::TextureReferenceType* MTL::StructMember::textureReferenceType()
|
||||
{
|
||||
return Object::sendMessage<MTL::TextureReferenceType*>(this, _MTL_PRIVATE_SEL(textureReferenceType));
|
||||
}
|
||||
|
||||
// method: pointerType
|
||||
_MTL_INLINE MTL::PointerType* MTL::StructMember::pointerType()
|
||||
{
|
||||
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(pointerType));
|
||||
}
|
||||
|
||||
// property: argumentIndex
|
||||
_MTL_INLINE NS::UInteger MTL::StructMember::argumentIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndex));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::StructType* MTL::StructType::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::StructType>(_MTL_PRIVATE_CLS(MTLStructType));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::StructType* MTL::StructType::init()
|
||||
{
|
||||
return NS::Object::init<MTL::StructType>();
|
||||
}
|
||||
|
||||
// property: members
|
||||
_MTL_INLINE NS::Array* MTL::StructType::members() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(members));
|
||||
}
|
||||
|
||||
// method: memberByName:
|
||||
_MTL_INLINE MTL::StructMember* MTL::StructType::memberByName(const NS::String* name)
|
||||
{
|
||||
return Object::sendMessage<MTL::StructMember*>(this, _MTL_PRIVATE_SEL(memberByName_), name);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ArrayType* MTL::ArrayType::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ArrayType>(_MTL_PRIVATE_CLS(MTLArrayType));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ArrayType* MTL::ArrayType::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ArrayType>();
|
||||
}
|
||||
|
||||
// property: elementType
|
||||
_MTL_INLINE MTL::DataType MTL::ArrayType::elementType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(elementType));
|
||||
}
|
||||
|
||||
// property: arrayLength
|
||||
_MTL_INLINE NS::UInteger MTL::ArrayType::arrayLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
|
||||
}
|
||||
|
||||
// property: stride
|
||||
_MTL_INLINE NS::UInteger MTL::ArrayType::stride() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(stride));
|
||||
}
|
||||
|
||||
// property: argumentIndexStride
|
||||
_MTL_INLINE NS::UInteger MTL::ArrayType::argumentIndexStride() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndexStride));
|
||||
}
|
||||
|
||||
// method: elementStructType
|
||||
_MTL_INLINE MTL::StructType* MTL::ArrayType::elementStructType()
|
||||
{
|
||||
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(elementStructType));
|
||||
}
|
||||
|
||||
// method: elementArrayType
|
||||
_MTL_INLINE MTL::ArrayType* MTL::ArrayType::elementArrayType()
|
||||
{
|
||||
return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(elementArrayType));
|
||||
}
|
||||
|
||||
// method: elementTextureReferenceType
|
||||
_MTL_INLINE MTL::TextureReferenceType* MTL::ArrayType::elementTextureReferenceType()
|
||||
{
|
||||
return Object::sendMessage<MTL::TextureReferenceType*>(this, _MTL_PRIVATE_SEL(elementTextureReferenceType));
|
||||
}
|
||||
|
||||
// method: elementPointerType
|
||||
_MTL_INLINE MTL::PointerType* MTL::ArrayType::elementPointerType()
|
||||
{
|
||||
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(elementPointerType));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::PointerType* MTL::PointerType::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::PointerType>(_MTL_PRIVATE_CLS(MTLPointerType));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::PointerType* MTL::PointerType::init()
|
||||
{
|
||||
return NS::Object::init<MTL::PointerType>();
|
||||
}
|
||||
|
||||
// property: elementType
|
||||
_MTL_INLINE MTL::DataType MTL::PointerType::elementType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(elementType));
|
||||
}
|
||||
|
||||
// property: access
|
||||
_MTL_INLINE MTL::BindingAccess MTL::PointerType::access() const
|
||||
{
|
||||
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
|
||||
}
|
||||
|
||||
// property: alignment
|
||||
_MTL_INLINE NS::UInteger MTL::PointerType::alignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));
|
||||
}
|
||||
|
||||
// property: dataSize
|
||||
_MTL_INLINE NS::UInteger MTL::PointerType::dataSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(dataSize));
|
||||
}
|
||||
|
||||
// property: elementIsArgumentBuffer
|
||||
_MTL_INLINE bool MTL::PointerType::elementIsArgumentBuffer() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(elementIsArgumentBuffer));
|
||||
}
|
||||
|
||||
// method: elementStructType
|
||||
_MTL_INLINE MTL::StructType* MTL::PointerType::elementStructType()
|
||||
{
|
||||
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(elementStructType));
|
||||
}
|
||||
|
||||
// method: elementArrayType
|
||||
_MTL_INLINE MTL::ArrayType* MTL::PointerType::elementArrayType()
|
||||
{
|
||||
return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(elementArrayType));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::TextureReferenceType* MTL::TextureReferenceType::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::TextureReferenceType>(_MTL_PRIVATE_CLS(MTLTextureReferenceType));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::TextureReferenceType* MTL::TextureReferenceType::init()
|
||||
{
|
||||
return NS::Object::init<MTL::TextureReferenceType>();
|
||||
}
|
||||
|
||||
// property: textureDataType
|
||||
_MTL_INLINE MTL::DataType MTL::TextureReferenceType::textureDataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
|
||||
}
|
||||
|
||||
// property: textureType
|
||||
_MTL_INLINE MTL::TextureType MTL::TextureReferenceType::textureType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
|
||||
}
|
||||
|
||||
// property: access
|
||||
_MTL_INLINE MTL::BindingAccess MTL::TextureReferenceType::access() const
|
||||
{
|
||||
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
|
||||
}
|
||||
|
||||
// property: isDepthTexture
|
||||
_MTL_INLINE bool MTL::TextureReferenceType::isDepthTexture() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::Argument* MTL::Argument::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::Argument>(_MTL_PRIVATE_CLS(MTLArgument));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::Argument* MTL::Argument::init()
|
||||
{
|
||||
return NS::Object::init<MTL::Argument>();
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::Argument::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::ArgumentType MTL::Argument::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ArgumentType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
// property: access
|
||||
_MTL_INLINE MTL::BindingAccess MTL::Argument::access() const
|
||||
{
|
||||
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
|
||||
}
|
||||
|
||||
// property: index
|
||||
_MTL_INLINE NS::UInteger MTL::Argument::index() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
|
||||
}
|
||||
|
||||
// property: active
|
||||
_MTL_INLINE bool MTL::Argument::active() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
|
||||
}
|
||||
|
||||
// property: bufferAlignment
|
||||
_MTL_INLINE NS::UInteger MTL::Argument::bufferAlignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferAlignment));
|
||||
}
|
||||
|
||||
// property: bufferDataSize
|
||||
_MTL_INLINE NS::UInteger MTL::Argument::bufferDataSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferDataSize));
|
||||
}
|
||||
|
||||
// property: bufferDataType
|
||||
_MTL_INLINE MTL::DataType MTL::Argument::bufferDataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(bufferDataType));
|
||||
}
|
||||
|
||||
// property: bufferStructType
|
||||
_MTL_INLINE MTL::StructType* MTL::Argument::bufferStructType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(bufferStructType));
|
||||
}
|
||||
|
||||
// property: bufferPointerType
|
||||
_MTL_INLINE MTL::PointerType* MTL::Argument::bufferPointerType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(bufferPointerType));
|
||||
}
|
||||
|
||||
// property: threadgroupMemoryAlignment
|
||||
_MTL_INLINE NS::UInteger MTL::Argument::threadgroupMemoryAlignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryAlignment));
|
||||
}
|
||||
|
||||
// property: threadgroupMemoryDataSize
|
||||
_MTL_INLINE NS::UInteger MTL::Argument::threadgroupMemoryDataSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryDataSize));
|
||||
}
|
||||
|
||||
// property: textureType
|
||||
_MTL_INLINE MTL::TextureType MTL::Argument::textureType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
|
||||
}
|
||||
|
||||
// property: textureDataType
|
||||
_MTL_INLINE MTL::DataType MTL::Argument::textureDataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
|
||||
}
|
||||
|
||||
// property: isDepthTexture
|
||||
_MTL_INLINE bool MTL::Argument::isDepthTexture() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
|
||||
}
|
||||
|
||||
// property: arrayLength
|
||||
_MTL_INLINE NS::UInteger MTL::Argument::arrayLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::Binding::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::BindingType MTL::Binding::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::BindingType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
// property: access
|
||||
_MTL_INLINE MTL::BindingAccess MTL::Binding::access() const
|
||||
{
|
||||
return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
|
||||
}
|
||||
|
||||
// property: index
|
||||
_MTL_INLINE NS::UInteger MTL::Binding::index() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
|
||||
}
|
||||
|
||||
// property: used
|
||||
_MTL_INLINE bool MTL::Binding::used() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isUsed));
|
||||
}
|
||||
|
||||
// property: argument
|
||||
_MTL_INLINE bool MTL::Binding::argument() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isArgument));
|
||||
}
|
||||
|
||||
// property: bufferAlignment
|
||||
_MTL_INLINE NS::UInteger MTL::BufferBinding::bufferAlignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferAlignment));
|
||||
}
|
||||
|
||||
// property: bufferDataSize
|
||||
_MTL_INLINE NS::UInteger MTL::BufferBinding::bufferDataSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferDataSize));
|
||||
}
|
||||
|
||||
// property: bufferDataType
|
||||
_MTL_INLINE MTL::DataType MTL::BufferBinding::bufferDataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(bufferDataType));
|
||||
}
|
||||
|
||||
// property: bufferStructType
|
||||
_MTL_INLINE MTL::StructType* MTL::BufferBinding::bufferStructType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(bufferStructType));
|
||||
}
|
||||
|
||||
// property: bufferPointerType
|
||||
_MTL_INLINE MTL::PointerType* MTL::BufferBinding::bufferPointerType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(bufferPointerType));
|
||||
}
|
||||
|
||||
// property: threadgroupMemoryAlignment
|
||||
_MTL_INLINE NS::UInteger MTL::ThreadgroupBinding::threadgroupMemoryAlignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryAlignment));
|
||||
}
|
||||
|
||||
// property: threadgroupMemoryDataSize
|
||||
_MTL_INLINE NS::UInteger MTL::ThreadgroupBinding::threadgroupMemoryDataSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryDataSize));
|
||||
}
|
||||
|
||||
// property: textureType
|
||||
_MTL_INLINE MTL::TextureType MTL::TextureBinding::textureType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
|
||||
}
|
||||
|
||||
// property: textureDataType
|
||||
_MTL_INLINE MTL::DataType MTL::TextureBinding::textureDataType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
|
||||
}
|
||||
|
||||
// property: depthTexture
|
||||
_MTL_INLINE bool MTL::TextureBinding::depthTexture() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
|
||||
}
|
||||
|
||||
// property: arrayLength
|
||||
_MTL_INLINE NS::UInteger MTL::TextureBinding::arrayLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
|
||||
}
|
||||
|
||||
// property: objectPayloadAlignment
|
||||
_MTL_INLINE NS::UInteger MTL::ObjectPayloadBinding::objectPayloadAlignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(objectPayloadAlignment));
|
||||
}
|
||||
|
||||
// property: objectPayloadDataSize
|
||||
_MTL_INLINE NS::UInteger MTL::ObjectPayloadBinding::objectPayloadDataSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(objectPayloadDataSize));
|
||||
}
|
||||
244
src/contrib/metal-cpp/Metal/MTLArgumentEncoder.hpp
Normal file
244
src/contrib/metal-cpp/Metal/MTLArgumentEncoder.hpp
Normal file
@@ -0,0 +1,244 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLArgumentEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
|
||||
static const NS::UInteger AttributeStrideStatic = NS::UIntegerMax;
|
||||
|
||||
class ArgumentEncoder : public NS::Referencing<ArgumentEncoder>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
NS::UInteger encodedLength() const;
|
||||
|
||||
NS::UInteger alignment() const;
|
||||
|
||||
void setArgumentBuffer(const class Buffer* argumentBuffer, NS::UInteger offset);
|
||||
|
||||
void setArgumentBuffer(const class Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement);
|
||||
|
||||
void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
|
||||
|
||||
void setTexture(const class Texture* texture, NS::UInteger index);
|
||||
|
||||
void setTextures(const class Texture* const textures[], NS::Range range);
|
||||
|
||||
void setSamplerState(const class SamplerState* sampler, NS::UInteger index);
|
||||
|
||||
void setSamplerStates(const class SamplerState* const samplers[], NS::Range range);
|
||||
|
||||
void* constantData(NS::UInteger index);
|
||||
|
||||
void setRenderPipelineState(const class RenderPipelineState* pipeline, NS::UInteger index);
|
||||
|
||||
void setRenderPipelineStates(const class RenderPipelineState* const pipelines[], NS::Range range);
|
||||
|
||||
void setComputePipelineState(const class ComputePipelineState* pipeline, NS::UInteger index);
|
||||
|
||||
void setComputePipelineStates(const class ComputePipelineState* const pipelines[], NS::Range range);
|
||||
|
||||
void setIndirectCommandBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index);
|
||||
|
||||
void setIndirectCommandBuffers(const class IndirectCommandBuffer* const buffers[], NS::Range range);
|
||||
|
||||
void setAccelerationStructure(const class AccelerationStructure* accelerationStructure, NS::UInteger index);
|
||||
|
||||
class ArgumentEncoder* newArgumentEncoder(NS::UInteger index);
|
||||
|
||||
void setVisibleFunctionTable(const class VisibleFunctionTable* visibleFunctionTable, NS::UInteger index);
|
||||
|
||||
void setVisibleFunctionTables(const class VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);
|
||||
|
||||
void setIntersectionFunctionTable(const class IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index);
|
||||
|
||||
void setIntersectionFunctionTables(const class IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::ArgumentEncoder::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::ArgumentEncoder::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: encodedLength
|
||||
_MTL_INLINE NS::UInteger MTL::ArgumentEncoder::encodedLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(encodedLength));
|
||||
}
|
||||
|
||||
// property: alignment
|
||||
_MTL_INLINE NS::UInteger MTL::ArgumentEncoder::alignment() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));
|
||||
}
|
||||
|
||||
// method: setArgumentBuffer:offset:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_offset_), argumentBuffer, offset);
|
||||
}
|
||||
|
||||
// method: setArgumentBuffer:startOffset:arrayElement:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBuffer:offset:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBuffers:offsets:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setTexture:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);
|
||||
}
|
||||
|
||||
// method: setTextures:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setSamplerState:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);
|
||||
}
|
||||
|
||||
// method: setSamplerStates:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: constantDataAtIndex:
|
||||
_MTL_INLINE void* MTL::ArgumentEncoder::constantData(NS::UInteger index)
|
||||
{
|
||||
return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(constantDataAtIndex_), index);
|
||||
}
|
||||
|
||||
// method: setRenderPipelineState:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_atIndex_), pipeline, index);
|
||||
}
|
||||
|
||||
// method: setRenderPipelineStates:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setComputePipelineState:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_atIndex_), pipeline, index);
|
||||
}
|
||||
|
||||
// method: setComputePipelineStates:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setIndirectCommandBuffer:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffer_atIndex_), indirectCommandBuffer, index);
|
||||
}
|
||||
|
||||
// method: setIndirectCommandBuffers:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setAccelerationStructure:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atIndex_), accelerationStructure, index);
|
||||
}
|
||||
|
||||
// method: newArgumentEncoderForBufferAtIndex:
|
||||
_MTL_INLINE MTL::ArgumentEncoder* MTL::ArgumentEncoder::newArgumentEncoder(NS::UInteger index)
|
||||
{
|
||||
return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderForBufferAtIndex_), index);
|
||||
}
|
||||
|
||||
// method: setVisibleFunctionTable:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atIndex_), visibleFunctionTable, index);
|
||||
}
|
||||
|
||||
// method: setVisibleFunctionTables:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setIntersectionFunctionTable:atIndex:
|
||||
_MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atIndex_), intersectionFunctionTable, index);
|
||||
}
|
||||
|
||||
// method: setIntersectionFunctionTables:withRange:
|
||||
_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);
|
||||
}
|
||||
159
src/contrib/metal-cpp/Metal/MTLBinaryArchive.hpp
Normal file
159
src/contrib/metal-cpp/Metal/MTLBinaryArchive.hpp
Normal file
@@ -0,0 +1,159 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLBinaryArchive.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_CONST(NS::ErrorDomain, BinaryArchiveDomain);
|
||||
|
||||
_MTL_ENUM(NS::UInteger, BinaryArchiveError) {
|
||||
BinaryArchiveErrorNone = 0,
|
||||
BinaryArchiveErrorInvalidFile = 1,
|
||||
BinaryArchiveErrorUnexpectedElement = 2,
|
||||
BinaryArchiveErrorCompilationFailure = 3,
|
||||
BinaryArchiveErrorInternalError = 4,
|
||||
};
|
||||
|
||||
class BinaryArchiveDescriptor : public NS::Copying<BinaryArchiveDescriptor>
|
||||
{
|
||||
public:
|
||||
static class BinaryArchiveDescriptor* alloc();
|
||||
|
||||
class BinaryArchiveDescriptor* init();
|
||||
|
||||
NS::URL* url() const;
|
||||
void setUrl(const NS::URL* url);
|
||||
};
|
||||
|
||||
class BinaryArchive : public NS::Referencing<BinaryArchive>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
bool addComputePipelineFunctions(const class ComputePipelineDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
bool addRenderPipelineFunctions(const class RenderPipelineDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
bool addTileRenderPipelineFunctions(const class TileRenderPipelineDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
bool addMeshRenderPipelineFunctions(const class MeshRenderPipelineDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
bool addLibrary(const class StitchedLibraryDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
bool serializeToURL(const NS::URL* url, NS::Error** error);
|
||||
|
||||
bool addFunction(const class FunctionDescriptor* descriptor, const class Library* library, NS::Error** error);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_MTL_PRIVATE_DEF_STR(NS::ErrorDomain, BinaryArchiveDomain);
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::BinaryArchiveDescriptor* MTL::BinaryArchiveDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::BinaryArchiveDescriptor>(_MTL_PRIVATE_CLS(MTLBinaryArchiveDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::BinaryArchiveDescriptor* MTL::BinaryArchiveDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::BinaryArchiveDescriptor>();
|
||||
}
|
||||
|
||||
// property: url
|
||||
_MTL_INLINE NS::URL* MTL::BinaryArchiveDescriptor::url() const
|
||||
{
|
||||
return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(url));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::BinaryArchiveDescriptor::setUrl(const NS::URL* url)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setUrl_), url);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::BinaryArchive::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::BinaryArchive::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::BinaryArchive::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// method: addComputePipelineFunctionsWithDescriptor:error:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: addRenderPipelineFunctionsWithDescriptor: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);
|
||||
}
|
||||
|
||||
// method: addTileRenderPipelineFunctionsWithDescriptor: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);
|
||||
}
|
||||
|
||||
// method: addMeshRenderPipelineFunctionsWithDescriptor: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);
|
||||
}
|
||||
|
||||
// method: addLibraryWithDescriptor: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);
|
||||
}
|
||||
|
||||
// method: serializeToURL:error:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: addFunctionWithDescriptor:library: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);
|
||||
}
|
||||
246
src/contrib/metal-cpp/Metal/MTLBlitCommandEncoder.hpp
Normal file
246
src/contrib/metal-cpp/Metal/MTLBlitCommandEncoder.hpp
Normal file
@@ -0,0 +1,246 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLBlitCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLBlitCommandEncoder.hpp"
|
||||
#include "MTLCommandEncoder.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, BlitOption) {
|
||||
BlitOptionNone = 0,
|
||||
BlitOptionDepthFromDepthStencil = 1,
|
||||
BlitOptionStencilFromDepthStencil = 2,
|
||||
BlitOptionRowLinearPVRTC = 4,
|
||||
};
|
||||
|
||||
class BlitCommandEncoder : public NS::Referencing<BlitCommandEncoder, CommandEncoder>
|
||||
{
|
||||
public:
|
||||
void synchronizeResource(const class Resource* resource);
|
||||
|
||||
void synchronizeTexture(const class Texture* texture, NS::UInteger slice, NS::UInteger level);
|
||||
|
||||
void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
|
||||
|
||||
void copyFromBuffer(const class Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
|
||||
|
||||
void copyFromBuffer(const class Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options);
|
||||
|
||||
void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage);
|
||||
|
||||
void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options);
|
||||
|
||||
void generateMipmaps(const class Texture* texture);
|
||||
|
||||
void fillBuffer(const class Buffer* buffer, NS::Range range, uint8_t value);
|
||||
|
||||
void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount);
|
||||
|
||||
void copyFromTexture(const class Texture* sourceTexture, const class Texture* destinationTexture);
|
||||
|
||||
void copyFromBuffer(const class Buffer* sourceBuffer, NS::UInteger sourceOffset, const class Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size);
|
||||
|
||||
void updateFence(const class Fence* fence);
|
||||
|
||||
void waitForFence(const class Fence* fence);
|
||||
|
||||
void getTextureAccessCounters(const class Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice, bool resetCounters, const class Buffer* countersBuffer, NS::UInteger countersBufferOffset);
|
||||
|
||||
void resetTextureAccessCounters(const class Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice);
|
||||
|
||||
void optimizeContentsForGPUAccess(const class Texture* texture);
|
||||
|
||||
void optimizeContentsForGPUAccess(const class Texture* texture, NS::UInteger slice, NS::UInteger level);
|
||||
|
||||
void optimizeContentsForCPUAccess(const class Texture* texture);
|
||||
|
||||
void optimizeContentsForCPUAccess(const class Texture* texture, NS::UInteger slice, NS::UInteger level);
|
||||
|
||||
void resetCommandsInBuffer(const class IndirectCommandBuffer* buffer, NS::Range range);
|
||||
|
||||
void copyIndirectCommandBuffer(const class IndirectCommandBuffer* source, NS::Range sourceRange, const class IndirectCommandBuffer* destination, NS::UInteger destinationIndex);
|
||||
|
||||
void optimizeIndirectCommandBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::Range range);
|
||||
|
||||
void sampleCountersInBuffer(const class CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
|
||||
|
||||
void resolveCounters(const class CounterSampleBuffer* sampleBuffer, NS::Range range, const class Buffer* destinationBuffer, NS::UInteger destinationOffset);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// method: synchronizeResource:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::synchronizeResource(const MTL::Resource* resource)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(synchronizeResource_), resource);
|
||||
}
|
||||
|
||||
// method: synchronizeTexture:slice:level:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture: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::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);
|
||||
}
|
||||
|
||||
// method: copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture: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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
// method: copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer: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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
// method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:options:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: generateMipmapsForTexture:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::generateMipmaps(const MTL::Texture* texture)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(generateMipmapsForTexture_), texture);
|
||||
}
|
||||
|
||||
// method: fillBuffer:range:value:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyFromTexture:toTexture:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: updateFence:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::updateFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
|
||||
}
|
||||
|
||||
// method: waitForFence:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::waitForFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
|
||||
}
|
||||
|
||||
// method: getTextureAccessCounters:region:mipLevel:slice:resetCounters:countersBuffer:countersBufferOffset:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: resetTextureAccessCounters:region:mipLevel:slice:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: optimizeContentsForGPUAccess:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_), texture);
|
||||
}
|
||||
|
||||
// method: optimizeContentsForGPUAccess:slice:level:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: optimizeContentsForCPUAccess:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_), texture);
|
||||
}
|
||||
|
||||
// method: optimizeContentsForCPUAccess:slice:level:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: resetCommandsInBuffer:withRange:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::resetCommandsInBuffer(const MTL::IndirectCommandBuffer* buffer, NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetCommandsInBuffer_withRange_), buffer, range);
|
||||
}
|
||||
|
||||
// method: copyIndirectCommandBuffer:sourceRange:destination:destinationIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: optimizeIndirectCommandBuffer:withRange:
|
||||
_MTL_INLINE void MTL::BlitCommandEncoder::optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeIndirectCommandBuffer_withRange_), indirectCommandBuffer, range);
|
||||
}
|
||||
|
||||
// method: sampleCountersInBuffer:atSampleIndex:withBarrier:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: resolveCounters:inRange:destinationBuffer:destinationOffset:
|
||||
_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);
|
||||
}
|
||||
165
src/contrib/metal-cpp/Metal/MTLBlitPass.hpp
Normal file
165
src/contrib/metal-cpp/Metal/MTLBlitPass.hpp
Normal file
@@ -0,0 +1,165 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLBlitPass.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class BlitPassSampleBufferAttachmentDescriptor : public NS::Copying<BlitPassSampleBufferAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class BlitPassSampleBufferAttachmentDescriptor* alloc();
|
||||
|
||||
class BlitPassSampleBufferAttachmentDescriptor* init();
|
||||
|
||||
class CounterSampleBuffer* sampleBuffer() const;
|
||||
void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
|
||||
|
||||
NS::UInteger startOfEncoderSampleIndex() const;
|
||||
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
|
||||
|
||||
NS::UInteger endOfEncoderSampleIndex() const;
|
||||
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
|
||||
};
|
||||
|
||||
class BlitPassSampleBufferAttachmentDescriptorArray : public NS::Referencing<BlitPassSampleBufferAttachmentDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class BlitPassSampleBufferAttachmentDescriptorArray* alloc();
|
||||
|
||||
class BlitPassSampleBufferAttachmentDescriptorArray* init();
|
||||
|
||||
class BlitPassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
|
||||
|
||||
void setObject(const class BlitPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
|
||||
};
|
||||
|
||||
class BlitPassDescriptor : public NS::Copying<BlitPassDescriptor>
|
||||
{
|
||||
public:
|
||||
static class BlitPassDescriptor* alloc();
|
||||
|
||||
class BlitPassDescriptor* init();
|
||||
|
||||
static class BlitPassDescriptor* blitPassDescriptor();
|
||||
|
||||
class BlitPassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::BlitPassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLBlitPassSampleBufferAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::BlitPassSampleBufferAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: sampleBuffer
|
||||
_MTL_INLINE MTL::CounterSampleBuffer* MTL::BlitPassSampleBufferAttachmentDescriptor::sampleBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
|
||||
}
|
||||
|
||||
// property: startOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::BlitPassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// property: endOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::BlitPassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassSampleBufferAttachmentDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::BlitPassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLBlitPassSampleBufferAttachmentDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassSampleBufferAttachmentDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::BlitPassSampleBufferAttachmentDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::BlitPassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptorArray::setObject(const MTL::BlitPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::BlitPassDescriptor>(_MTL_PRIVATE_CLS(MTLBlitPassDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::BlitPassDescriptor>();
|
||||
}
|
||||
|
||||
// static method: blitPassDescriptor
|
||||
_MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::blitPassDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::BlitPassDescriptor*>(_MTL_PRIVATE_CLS(MTLBlitPassDescriptor), _MTL_PRIVATE_SEL(blitPassDescriptor));
|
||||
}
|
||||
|
||||
// property: sampleBufferAttachments
|
||||
_MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassDescriptor::sampleBufferAttachments() const
|
||||
{
|
||||
return Object::sendMessage<MTL::BlitPassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
|
||||
}
|
||||
109
src/contrib/metal-cpp/Metal/MTLBuffer.hpp
Normal file
109
src/contrib/metal-cpp/Metal/MTLBuffer.hpp
Normal file
@@ -0,0 +1,109 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLBuffer.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLResource.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class Buffer : public NS::Referencing<Buffer, Resource>
|
||||
{
|
||||
public:
|
||||
NS::UInteger length() const;
|
||||
|
||||
void* contents();
|
||||
|
||||
void didModifyRange(NS::Range range);
|
||||
|
||||
class Texture* newTexture(const class TextureDescriptor* descriptor, NS::UInteger offset, NS::UInteger bytesPerRow);
|
||||
|
||||
void addDebugMarker(const NS::String* marker, NS::Range range);
|
||||
|
||||
void removeAllDebugMarkers();
|
||||
|
||||
class Buffer* remoteStorageBuffer() const;
|
||||
|
||||
class Buffer* newRemoteBufferViewForDevice(const class Device* device);
|
||||
|
||||
uint64_t gpuAddress() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: length
|
||||
_MTL_INLINE NS::UInteger MTL::Buffer::length() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(length));
|
||||
}
|
||||
|
||||
// method: contents
|
||||
_MTL_INLINE void* MTL::Buffer::contents()
|
||||
{
|
||||
return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(contents));
|
||||
}
|
||||
|
||||
// method: didModifyRange:
|
||||
_MTL_INLINE void MTL::Buffer::didModifyRange(NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(didModifyRange_), range);
|
||||
}
|
||||
|
||||
// method: newTextureWithDescriptor:offset:bytesPerRow:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: addDebugMarker:range:
|
||||
_MTL_INLINE void MTL::Buffer::addDebugMarker(const NS::String* marker, NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addDebugMarker_range_), marker, range);
|
||||
}
|
||||
|
||||
// method: removeAllDebugMarkers
|
||||
_MTL_INLINE void MTL::Buffer::removeAllDebugMarkers()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeAllDebugMarkers));
|
||||
}
|
||||
|
||||
// property: remoteStorageBuffer
|
||||
_MTL_INLINE MTL::Buffer* MTL::Buffer::remoteStorageBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(remoteStorageBuffer));
|
||||
}
|
||||
|
||||
// method: newRemoteBufferViewForDevice:
|
||||
_MTL_INLINE MTL::Buffer* MTL::Buffer::newRemoteBufferViewForDevice(const MTL::Device* device)
|
||||
{
|
||||
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newRemoteBufferViewForDevice_), device);
|
||||
}
|
||||
|
||||
// property: gpuAddress
|
||||
_MTL_INLINE uint64_t MTL::Buffer::gpuAddress() const
|
||||
{
|
||||
return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(gpuAddress));
|
||||
}
|
||||
220
src/contrib/metal-cpp/Metal/MTLCaptureManager.hpp
Normal file
220
src/contrib/metal-cpp/Metal/MTLCaptureManager.hpp
Normal file
@@ -0,0 +1,220 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLCaptureManager.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLCaptureManager.hpp"
|
||||
|
||||
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 class CaptureDescriptor* alloc();
|
||||
|
||||
class CaptureDescriptor* init();
|
||||
|
||||
id captureObject() const;
|
||||
void setCaptureObject(id captureObject);
|
||||
|
||||
MTL::CaptureDestination destination() const;
|
||||
void setDestination(MTL::CaptureDestination destination);
|
||||
|
||||
NS::URL* outputURL() const;
|
||||
void setOutputURL(const NS::URL* outputURL);
|
||||
};
|
||||
|
||||
class CaptureManager : public NS::Referencing<CaptureManager>
|
||||
{
|
||||
public:
|
||||
static class CaptureManager* alloc();
|
||||
|
||||
static class CaptureManager* sharedCaptureManager();
|
||||
|
||||
MTL::CaptureManager* init();
|
||||
|
||||
class CaptureScope* newCaptureScope(const class Device* device);
|
||||
|
||||
class CaptureScope* newCaptureScope(const class CommandQueue* commandQueue);
|
||||
|
||||
bool supportsDestination(MTL::CaptureDestination destination);
|
||||
|
||||
bool startCapture(const class CaptureDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
void startCapture(const class Device* device);
|
||||
|
||||
void startCapture(const class CommandQueue* commandQueue);
|
||||
|
||||
void startCapture(const class CaptureScope* captureScope);
|
||||
|
||||
void stopCapture();
|
||||
|
||||
class CaptureScope* defaultCaptureScope() const;
|
||||
void setDefaultCaptureScope(const class CaptureScope* defaultCaptureScope);
|
||||
|
||||
bool isCapturing() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::CaptureDescriptor>(_MTL_PRIVATE_CLS(MTLCaptureDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::CaptureDescriptor>();
|
||||
}
|
||||
|
||||
// property: captureObject
|
||||
_MTL_INLINE id MTL::CaptureDescriptor::captureObject() const
|
||||
{
|
||||
return Object::sendMessage<id>(this, _MTL_PRIVATE_SEL(captureObject));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CaptureDescriptor::setCaptureObject(id captureObject)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCaptureObject_), captureObject);
|
||||
}
|
||||
|
||||
// property: destination
|
||||
_MTL_INLINE MTL::CaptureDestination MTL::CaptureDescriptor::destination() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CaptureDestination>(this, _MTL_PRIVATE_SEL(destination));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CaptureDescriptor::setDestination(MTL::CaptureDestination destination)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDestination_), destination);
|
||||
}
|
||||
|
||||
// property: outputURL
|
||||
_MTL_INLINE NS::URL* MTL::CaptureDescriptor::outputURL() const
|
||||
{
|
||||
return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(outputURL));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CaptureDescriptor::setOutputURL(const NS::URL* outputURL)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputURL_), outputURL);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::CaptureManager>(_MTL_PRIVATE_CLS(MTLCaptureManager));
|
||||
}
|
||||
|
||||
// static method: sharedCaptureManager
|
||||
_MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::sharedCaptureManager()
|
||||
{
|
||||
return Object::sendMessage<MTL::CaptureManager*>(_MTL_PRIVATE_CLS(MTLCaptureManager), _MTL_PRIVATE_SEL(sharedCaptureManager));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::init()
|
||||
{
|
||||
return NS::Object::init<MTL::CaptureManager>();
|
||||
}
|
||||
|
||||
// method: newCaptureScopeWithDevice:
|
||||
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::Device* device)
|
||||
{
|
||||
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithDevice_), device);
|
||||
}
|
||||
|
||||
// method: newCaptureScopeWithCommandQueue:
|
||||
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::CommandQueue* commandQueue)
|
||||
{
|
||||
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithCommandQueue_), commandQueue);
|
||||
}
|
||||
|
||||
// method: supportsDestination:
|
||||
_MTL_INLINE bool MTL::CaptureManager::supportsDestination(MTL::CaptureDestination destination)
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsDestination_), destination);
|
||||
}
|
||||
|
||||
// method: startCaptureWithDescriptor:error:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: startCaptureWithDevice:
|
||||
_MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::Device* device)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithDevice_), device);
|
||||
}
|
||||
|
||||
// method: startCaptureWithCommandQueue:
|
||||
_MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CommandQueue* commandQueue)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithCommandQueue_), commandQueue);
|
||||
}
|
||||
|
||||
// method: startCaptureWithScope:
|
||||
_MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CaptureScope* captureScope)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithScope_), captureScope);
|
||||
}
|
||||
|
||||
// method: stopCapture
|
||||
_MTL_INLINE void MTL::CaptureManager::stopCapture()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(stopCapture));
|
||||
}
|
||||
|
||||
// property: defaultCaptureScope
|
||||
_MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::defaultCaptureScope() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(defaultCaptureScope));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CaptureManager::setDefaultCaptureScope(const MTL::CaptureScope* defaultCaptureScope)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDefaultCaptureScope_), defaultCaptureScope);
|
||||
}
|
||||
|
||||
// property: isCapturing
|
||||
_MTL_INLINE bool MTL::CaptureManager::isCapturing() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isCapturing));
|
||||
}
|
||||
92
src/contrib/metal-cpp/Metal/MTLCaptureScope.hpp
Normal file
92
src/contrib/metal-cpp/Metal/MTLCaptureScope.hpp
Normal file
@@ -0,0 +1,92 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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/NSObject.hpp"
|
||||
#include "../Foundation/NSString.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));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
504
src/contrib/metal-cpp/Metal/MTLCommandBuffer.hpp
Normal file
504
src/contrib/metal-cpp/Metal/MTLCommandBuffer.hpp
Normal file
@@ -0,0 +1,504 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLCommandBuffer.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLCommandBuffer.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_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_OPTIONS(NS::UInteger, CommandBufferErrorOption) {
|
||||
CommandBufferErrorOptionNone = 0,
|
||||
CommandBufferErrorOptionEncoderExecutionStatus = 1,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, CommandEncoderErrorState) {
|
||||
CommandEncoderErrorStateUnknown = 0,
|
||||
CommandEncoderErrorStateCompleted = 1,
|
||||
CommandEncoderErrorStateAffected = 2,
|
||||
CommandEncoderErrorStatePending = 3,
|
||||
CommandEncoderErrorStateFaulted = 4,
|
||||
};
|
||||
|
||||
class CommandBufferDescriptor : public NS::Copying<CommandBufferDescriptor>
|
||||
{
|
||||
public:
|
||||
static class CommandBufferDescriptor* alloc();
|
||||
|
||||
class CommandBufferDescriptor* init();
|
||||
|
||||
bool retainedReferences() const;
|
||||
void setRetainedReferences(bool retainedReferences);
|
||||
|
||||
MTL::CommandBufferErrorOption errorOptions() const;
|
||||
void setErrorOptions(MTL::CommandBufferErrorOption errorOptions);
|
||||
|
||||
class LogState* logState() const;
|
||||
void setLogState(const class LogState* logState);
|
||||
};
|
||||
|
||||
class CommandBufferEncoderInfo : public NS::Referencing<CommandBufferEncoderInfo>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
|
||||
NS::Array* debugSignposts() const;
|
||||
|
||||
MTL::CommandEncoderErrorState errorState() const;
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, DispatchType) {
|
||||
DispatchTypeSerial = 0,
|
||||
DispatchTypeConcurrent = 1,
|
||||
};
|
||||
|
||||
class CommandBuffer;
|
||||
|
||||
using CommandBufferHandler = void (^)(CommandBuffer*);
|
||||
|
||||
using HandlerFunction = std::function<void(CommandBuffer*)>;
|
||||
|
||||
class CommandBuffer : public NS::Referencing<CommandBuffer>
|
||||
{
|
||||
public:
|
||||
void addScheduledHandler(const HandlerFunction& function);
|
||||
|
||||
void addCompletedHandler(const HandlerFunction& function);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
class CommandQueue* commandQueue() const;
|
||||
|
||||
bool retainedReferences() const;
|
||||
|
||||
MTL::CommandBufferErrorOption errorOptions() const;
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
CFTimeInterval kernelStartTime() const;
|
||||
|
||||
CFTimeInterval kernelEndTime() const;
|
||||
|
||||
class LogContainer* logs() const;
|
||||
|
||||
CFTimeInterval GPUStartTime() const;
|
||||
|
||||
CFTimeInterval GPUEndTime() const;
|
||||
|
||||
void enqueue();
|
||||
|
||||
void commit();
|
||||
|
||||
void addScheduledHandler(const MTL::CommandBufferHandler block);
|
||||
|
||||
void presentDrawable(const class Drawable* drawable);
|
||||
|
||||
void presentDrawableAtTime(const class Drawable* drawable, CFTimeInterval presentationTime);
|
||||
|
||||
void presentDrawableAfterMinimumDuration(const class Drawable* drawable, CFTimeInterval duration);
|
||||
|
||||
void waitUntilScheduled();
|
||||
|
||||
void addCompletedHandler(const MTL::CommandBufferHandler block);
|
||||
|
||||
void waitUntilCompleted();
|
||||
|
||||
MTL::CommandBufferStatus status() const;
|
||||
|
||||
NS::Error* error() const;
|
||||
|
||||
class BlitCommandEncoder* blitCommandEncoder();
|
||||
|
||||
class RenderCommandEncoder* renderCommandEncoder(const class RenderPassDescriptor* renderPassDescriptor);
|
||||
|
||||
class ComputeCommandEncoder* computeCommandEncoder(const class ComputePassDescriptor* computePassDescriptor);
|
||||
|
||||
class BlitCommandEncoder* blitCommandEncoder(const class BlitPassDescriptor* blitPassDescriptor);
|
||||
|
||||
class ComputeCommandEncoder* computeCommandEncoder();
|
||||
|
||||
class ComputeCommandEncoder* computeCommandEncoder(MTL::DispatchType dispatchType);
|
||||
|
||||
void encodeWait(const class Event* event, uint64_t value);
|
||||
|
||||
void encodeSignalEvent(const class Event* event, uint64_t value);
|
||||
|
||||
class ParallelRenderCommandEncoder* parallelRenderCommandEncoder(const class RenderPassDescriptor* renderPassDescriptor);
|
||||
|
||||
class ResourceStateCommandEncoder* resourceStateCommandEncoder();
|
||||
|
||||
class ResourceStateCommandEncoder* resourceStateCommandEncoder(const class ResourceStatePassDescriptor* resourceStatePassDescriptor);
|
||||
|
||||
class AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder();
|
||||
|
||||
class AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder(const class AccelerationStructurePassDescriptor* descriptor);
|
||||
|
||||
void pushDebugGroup(const NS::String* string);
|
||||
|
||||
void popDebugGroup();
|
||||
|
||||
void useResidencySet(const class ResidencySet* residencySet);
|
||||
|
||||
void useResidencySets(const class ResidencySet* const residencySets[], NS::UInteger count);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::CommandBufferDescriptor* MTL::CommandBufferDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::CommandBufferDescriptor>(_MTL_PRIVATE_CLS(MTLCommandBufferDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::CommandBufferDescriptor* MTL::CommandBufferDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::CommandBufferDescriptor>();
|
||||
}
|
||||
|
||||
// property: retainedReferences
|
||||
_MTL_INLINE bool MTL::CommandBufferDescriptor::retainedReferences() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(retainedReferences));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandBufferDescriptor::setRetainedReferences(bool retainedReferences)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRetainedReferences_), retainedReferences);
|
||||
}
|
||||
|
||||
// property: errorOptions
|
||||
_MTL_INLINE MTL::CommandBufferErrorOption MTL::CommandBufferDescriptor::errorOptions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandBufferErrorOption>(this, _MTL_PRIVATE_SEL(errorOptions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandBufferDescriptor::setErrorOptions(MTL::CommandBufferErrorOption errorOptions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setErrorOptions_), errorOptions);
|
||||
}
|
||||
|
||||
// property: logState
|
||||
_MTL_INLINE MTL::LogState* MTL::CommandBufferDescriptor::logState() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandBufferDescriptor::setLogState(const MTL::LogState* logState)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::CommandBufferEncoderInfo::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: debugSignposts
|
||||
_MTL_INLINE NS::Array* MTL::CommandBufferEncoderInfo::debugSignposts() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(debugSignposts));
|
||||
}
|
||||
|
||||
// property: errorState
|
||||
_MTL_INLINE MTL::CommandEncoderErrorState MTL::CommandBufferEncoderInfo::errorState() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandEncoderErrorState>(this, _MTL_PRIVATE_SEL(errorState));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandBuffer::addScheduledHandler(const HandlerFunction& function)
|
||||
{
|
||||
__block HandlerFunction blockFunction = function;
|
||||
|
||||
addScheduledHandler(^(MTL::CommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandBuffer::addCompletedHandler(const HandlerFunction& function)
|
||||
{
|
||||
__block HandlerFunction blockFunction = function;
|
||||
|
||||
addCompletedHandler(^(MTL::CommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::CommandBuffer::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: commandQueue
|
||||
_MTL_INLINE MTL::CommandQueue* MTL::CommandBuffer::commandQueue() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(commandQueue));
|
||||
}
|
||||
|
||||
// property: retainedReferences
|
||||
_MTL_INLINE bool MTL::CommandBuffer::retainedReferences() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(retainedReferences));
|
||||
}
|
||||
|
||||
// property: errorOptions
|
||||
_MTL_INLINE MTL::CommandBufferErrorOption MTL::CommandBuffer::errorOptions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandBufferErrorOption>(this, _MTL_PRIVATE_SEL(errorOptions));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::CommandBuffer::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandBuffer::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: kernelStartTime
|
||||
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::kernelStartTime() const
|
||||
{
|
||||
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(kernelStartTime));
|
||||
}
|
||||
|
||||
// property: kernelEndTime
|
||||
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::kernelEndTime() const
|
||||
{
|
||||
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(kernelEndTime));
|
||||
}
|
||||
|
||||
// property: logs
|
||||
_MTL_INLINE MTL::LogContainer* MTL::CommandBuffer::logs() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LogContainer*>(this, _MTL_PRIVATE_SEL(logs));
|
||||
}
|
||||
|
||||
// property: GPUStartTime
|
||||
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::GPUStartTime() const
|
||||
{
|
||||
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUStartTime));
|
||||
}
|
||||
|
||||
// property: GPUEndTime
|
||||
_MTL_INLINE CFTimeInterval MTL::CommandBuffer::GPUEndTime() const
|
||||
{
|
||||
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUEndTime));
|
||||
}
|
||||
|
||||
// method: enqueue
|
||||
_MTL_INLINE void MTL::CommandBuffer::enqueue()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueue));
|
||||
}
|
||||
|
||||
// method: commit
|
||||
_MTL_INLINE void MTL::CommandBuffer::commit()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit));
|
||||
}
|
||||
|
||||
// method: addScheduledHandler:
|
||||
_MTL_INLINE void MTL::CommandBuffer::addScheduledHandler(const MTL::CommandBufferHandler block)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addScheduledHandler_), block);
|
||||
}
|
||||
|
||||
// method: presentDrawable:
|
||||
_MTL_INLINE void MTL::CommandBuffer::presentDrawable(const MTL::Drawable* drawable)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_), drawable);
|
||||
}
|
||||
|
||||
// method: presentDrawable:atTime:
|
||||
_MTL_INLINE void MTL::CommandBuffer::presentDrawableAtTime(const MTL::Drawable* drawable, CFTimeInterval presentationTime)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_atTime_), drawable, presentationTime);
|
||||
}
|
||||
|
||||
// method: presentDrawable:afterMinimumDuration:
|
||||
_MTL_INLINE void MTL::CommandBuffer::presentDrawableAfterMinimumDuration(const MTL::Drawable* drawable, CFTimeInterval duration)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_afterMinimumDuration_), drawable, duration);
|
||||
}
|
||||
|
||||
// method: waitUntilScheduled
|
||||
_MTL_INLINE void MTL::CommandBuffer::waitUntilScheduled()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilScheduled));
|
||||
}
|
||||
|
||||
// method: addCompletedHandler:
|
||||
_MTL_INLINE void MTL::CommandBuffer::addCompletedHandler(const MTL::CommandBufferHandler block)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addCompletedHandler_), block);
|
||||
}
|
||||
|
||||
// method: waitUntilCompleted
|
||||
_MTL_INLINE void MTL::CommandBuffer::waitUntilCompleted()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilCompleted));
|
||||
}
|
||||
|
||||
// property: status
|
||||
_MTL_INLINE MTL::CommandBufferStatus MTL::CommandBuffer::status() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandBufferStatus>(this, _MTL_PRIVATE_SEL(status));
|
||||
}
|
||||
|
||||
// property: error
|
||||
_MTL_INLINE NS::Error* MTL::CommandBuffer::error() const
|
||||
{
|
||||
return Object::sendMessage<NS::Error*>(this, _MTL_PRIVATE_SEL(error));
|
||||
}
|
||||
|
||||
// method: blitCommandEncoder
|
||||
_MTL_INLINE MTL::BlitCommandEncoder* MTL::CommandBuffer::blitCommandEncoder()
|
||||
{
|
||||
return Object::sendMessage<MTL::BlitCommandEncoder*>(this, _MTL_PRIVATE_SEL(blitCommandEncoder));
|
||||
}
|
||||
|
||||
// method: renderCommandEncoderWithDescriptor:
|
||||
_MTL_INLINE MTL::RenderCommandEncoder* MTL::CommandBuffer::renderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoderWithDescriptor_), renderPassDescriptor);
|
||||
}
|
||||
|
||||
// method: computeCommandEncoderWithDescriptor:
|
||||
_MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder(const MTL::ComputePassDescriptor* computePassDescriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoderWithDescriptor_), computePassDescriptor);
|
||||
}
|
||||
|
||||
// method: blitCommandEncoderWithDescriptor:
|
||||
_MTL_INLINE MTL::BlitCommandEncoder* MTL::CommandBuffer::blitCommandEncoder(const MTL::BlitPassDescriptor* blitPassDescriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::BlitCommandEncoder*>(this, _MTL_PRIVATE_SEL(blitCommandEncoderWithDescriptor_), blitPassDescriptor);
|
||||
}
|
||||
|
||||
// method: computeCommandEncoder
|
||||
_MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder()
|
||||
{
|
||||
return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoder));
|
||||
}
|
||||
|
||||
// method: computeCommandEncoderWithDispatchType:
|
||||
_MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder(MTL::DispatchType dispatchType)
|
||||
{
|
||||
return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoderWithDispatchType_), dispatchType);
|
||||
}
|
||||
|
||||
// method: encodeWaitForEvent: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);
|
||||
}
|
||||
|
||||
// method: encodeSignalEvent:value:
|
||||
_MTL_INLINE void MTL::CommandBuffer::encodeSignalEvent(const MTL::Event* event, uint64_t value)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(encodeSignalEvent_value_), event, value);
|
||||
}
|
||||
|
||||
// method: parallelRenderCommandEncoderWithDescriptor:
|
||||
_MTL_INLINE MTL::ParallelRenderCommandEncoder* MTL::CommandBuffer::parallelRenderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::ParallelRenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(parallelRenderCommandEncoderWithDescriptor_), renderPassDescriptor);
|
||||
}
|
||||
|
||||
// method: resourceStateCommandEncoder
|
||||
_MTL_INLINE MTL::ResourceStateCommandEncoder* MTL::CommandBuffer::resourceStateCommandEncoder()
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceStateCommandEncoder*>(this, _MTL_PRIVATE_SEL(resourceStateCommandEncoder));
|
||||
}
|
||||
|
||||
// method: resourceStateCommandEncoderWithDescriptor:
|
||||
_MTL_INLINE MTL::ResourceStateCommandEncoder* MTL::CommandBuffer::resourceStateCommandEncoder(const MTL::ResourceStatePassDescriptor* resourceStatePassDescriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceStateCommandEncoder*>(this, _MTL_PRIVATE_SEL(resourceStateCommandEncoderWithDescriptor_), resourceStatePassDescriptor);
|
||||
}
|
||||
|
||||
// method: accelerationStructureCommandEncoder
|
||||
_MTL_INLINE MTL::AccelerationStructureCommandEncoder* MTL::CommandBuffer::accelerationStructureCommandEncoder()
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructureCommandEncoder*>(this, _MTL_PRIVATE_SEL(accelerationStructureCommandEncoder));
|
||||
}
|
||||
|
||||
// method: accelerationStructureCommandEncoderWithDescriptor:
|
||||
_MTL_INLINE MTL::AccelerationStructureCommandEncoder* MTL::CommandBuffer::accelerationStructureCommandEncoder(const MTL::AccelerationStructurePassDescriptor* descriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructureCommandEncoder*>(this, _MTL_PRIVATE_SEL(accelerationStructureCommandEncoderWithDescriptor_), descriptor);
|
||||
}
|
||||
|
||||
// method: pushDebugGroup:
|
||||
_MTL_INLINE void MTL::CommandBuffer::pushDebugGroup(const NS::String* string)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
|
||||
}
|
||||
|
||||
// method: popDebugGroup
|
||||
_MTL_INLINE void MTL::CommandBuffer::popDebugGroup()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
|
||||
}
|
||||
|
||||
// method: useResidencySet:
|
||||
_MTL_INLINE void MTL::CommandBuffer::useResidencySet(const MTL::ResidencySet* residencySet)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResidencySet_), residencySet);
|
||||
}
|
||||
|
||||
// method: useResidencySets:count:
|
||||
_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);
|
||||
}
|
||||
101
src/contrib/metal-cpp/Metal/MTLCommandEncoder.hpp
Normal file
101
src/contrib/metal-cpp/Metal/MTLCommandEncoder.hpp
Normal file
@@ -0,0 +1,101 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, ResourceUsage) {
|
||||
ResourceUsageRead = 1,
|
||||
ResourceUsageWrite = 2,
|
||||
ResourceUsageSample = 4,
|
||||
};
|
||||
|
||||
_MTL_OPTIONS(NS::UInteger, BarrierScope) {
|
||||
BarrierScopeBuffers = 1,
|
||||
BarrierScopeTextures = 2,
|
||||
BarrierScopeRenderTargets = 4,
|
||||
};
|
||||
|
||||
class CommandEncoder : public NS::Referencing<CommandEncoder>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
void endEncoding();
|
||||
|
||||
void insertDebugSignpost(const NS::String* string);
|
||||
|
||||
void pushDebugGroup(const NS::String* string);
|
||||
|
||||
void popDebugGroup();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::CommandEncoder::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::CommandEncoder::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandEncoder::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// method: endEncoding
|
||||
_MTL_INLINE void MTL::CommandEncoder::endEncoding()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
|
||||
}
|
||||
|
||||
// method: insertDebugSignpost:
|
||||
_MTL_INLINE void MTL::CommandEncoder::insertDebugSignpost(const NS::String* string)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
|
||||
}
|
||||
|
||||
// method: pushDebugGroup:
|
||||
_MTL_INLINE void MTL::CommandEncoder::pushDebugGroup(const NS::String* string)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
|
||||
}
|
||||
|
||||
// method: popDebugGroup
|
||||
_MTL_INLINE void MTL::CommandEncoder::popDebugGroup()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
|
||||
}
|
||||
169
src/contrib/metal-cpp/Metal/MTLCommandQueue.hpp
Normal file
169
src/contrib/metal-cpp/Metal/MTLCommandQueue.hpp
Normal file
@@ -0,0 +1,169 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLCommandQueue.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class CommandQueue : public NS::Referencing<CommandQueue>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
class CommandBuffer* commandBuffer();
|
||||
|
||||
class CommandBuffer* commandBuffer(const class CommandBufferDescriptor* descriptor);
|
||||
|
||||
class CommandBuffer* commandBufferWithUnretainedReferences();
|
||||
|
||||
void insertDebugCaptureBoundary();
|
||||
|
||||
void addResidencySet(const class ResidencySet* residencySet);
|
||||
|
||||
void addResidencySets(const class ResidencySet* const residencySets[], NS::UInteger count);
|
||||
|
||||
void removeResidencySet(const class ResidencySet* residencySet);
|
||||
|
||||
void removeResidencySets(const class ResidencySet* const residencySets[], NS::UInteger count);
|
||||
};
|
||||
|
||||
class CommandQueueDescriptor : public NS::Copying<CommandQueueDescriptor>
|
||||
{
|
||||
public:
|
||||
static class CommandQueueDescriptor* alloc();
|
||||
|
||||
class CommandQueueDescriptor* init();
|
||||
|
||||
NS::UInteger maxCommandBufferCount() const;
|
||||
void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount);
|
||||
|
||||
class LogState* logState() const;
|
||||
void setLogState(const class LogState* logState);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::CommandQueue::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandQueue::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::CommandQueue::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// method: commandBuffer
|
||||
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer()
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
|
||||
}
|
||||
|
||||
// method: commandBufferWithDescriptor:
|
||||
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer(const MTL::CommandBufferDescriptor* descriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithDescriptor_), descriptor);
|
||||
}
|
||||
|
||||
// method: commandBufferWithUnretainedReferences
|
||||
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBufferWithUnretainedReferences()
|
||||
{
|
||||
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));
|
||||
}
|
||||
|
||||
// method: insertDebugCaptureBoundary
|
||||
_MTL_INLINE void MTL::CommandQueue::insertDebugCaptureBoundary()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugCaptureBoundary));
|
||||
}
|
||||
|
||||
// method: addResidencySet:
|
||||
_MTL_INLINE void MTL::CommandQueue::addResidencySet(const MTL::ResidencySet* residencySet)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySet_), residencySet);
|
||||
}
|
||||
|
||||
// method: addResidencySets:count:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: removeResidencySet:
|
||||
_MTL_INLINE void MTL::CommandQueue::removeResidencySet(const MTL::ResidencySet* residencySet)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySet_), residencySet);
|
||||
}
|
||||
|
||||
// method: removeResidencySets:count:
|
||||
_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);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::CommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLCommandQueueDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::CommandQueueDescriptor>();
|
||||
}
|
||||
|
||||
// property: maxCommandBufferCount
|
||||
_MTL_INLINE NS::UInteger MTL::CommandQueueDescriptor::maxCommandBufferCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount);
|
||||
}
|
||||
|
||||
// property: logState
|
||||
_MTL_INLINE MTL::LogState* MTL::CommandQueueDescriptor::logState() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CommandQueueDescriptor::setLogState(const MTL::LogState* logState)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);
|
||||
}
|
||||
362
src/contrib/metal-cpp/Metal/MTLComputeCommandEncoder.hpp
Normal file
362
src/contrib/metal-cpp/Metal/MTLComputeCommandEncoder.hpp
Normal file
@@ -0,0 +1,362 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLComputeCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLCommandBuffer.hpp"
|
||||
#include "MTLCommandEncoder.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
struct DispatchThreadgroupsIndirectArguments
|
||||
{
|
||||
uint32_t threadgroupsPerGrid[3];
|
||||
} _MTL_PACKED;
|
||||
|
||||
struct StageInRegionIndirectArguments
|
||||
{
|
||||
uint32_t stageInOrigin[3];
|
||||
uint32_t stageInSize[3];
|
||||
} _MTL_PACKED;
|
||||
|
||||
class ComputeCommandEncoder : public NS::Referencing<ComputeCommandEncoder, CommandEncoder>
|
||||
{
|
||||
public:
|
||||
MTL::DispatchType dispatchType() const;
|
||||
|
||||
void setComputePipelineState(const class ComputePipelineState* state);
|
||||
|
||||
void setBytes(const void* bytes, NS::UInteger length, NS::UInteger index);
|
||||
|
||||
void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setBufferOffset(NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
|
||||
|
||||
void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
|
||||
|
||||
void setBuffers(const class Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range);
|
||||
|
||||
void setBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
|
||||
|
||||
void setBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index);
|
||||
|
||||
void setVisibleFunctionTable(const class VisibleFunctionTable* visibleFunctionTable, NS::UInteger bufferIndex);
|
||||
|
||||
void setVisibleFunctionTables(const class VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);
|
||||
|
||||
void setIntersectionFunctionTable(const class IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger bufferIndex);
|
||||
|
||||
void setIntersectionFunctionTables(const class IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);
|
||||
|
||||
void setAccelerationStructure(const class AccelerationStructure* accelerationStructure, NS::UInteger bufferIndex);
|
||||
|
||||
void setTexture(const class Texture* texture, NS::UInteger index);
|
||||
|
||||
void setTextures(const class Texture* const textures[], NS::Range range);
|
||||
|
||||
void setSamplerState(const class SamplerState* sampler, NS::UInteger index);
|
||||
|
||||
void setSamplerStates(const class SamplerState* const samplers[], NS::Range range);
|
||||
|
||||
void setSamplerState(const class SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);
|
||||
|
||||
void setSamplerStates(const class SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);
|
||||
|
||||
void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
|
||||
|
||||
void setImageblockWidth(NS::UInteger width, NS::UInteger height);
|
||||
|
||||
void setStageInRegion(MTL::Region region);
|
||||
|
||||
void setStageInRegion(const class Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);
|
||||
|
||||
void dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);
|
||||
|
||||
void dispatchThreadgroups(const class Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerThreadgroup);
|
||||
|
||||
void dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);
|
||||
|
||||
void updateFence(const class Fence* fence);
|
||||
|
||||
void waitForFence(const class Fence* fence);
|
||||
|
||||
void useResource(const class Resource* resource, MTL::ResourceUsage usage);
|
||||
|
||||
void useResources(const class Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);
|
||||
|
||||
void useHeap(const class Heap* heap);
|
||||
|
||||
void useHeaps(const class Heap* const heaps[], NS::UInteger count);
|
||||
|
||||
void executeCommandsInBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);
|
||||
|
||||
void executeCommandsInBuffer(const class IndirectCommandBuffer* indirectCommandbuffer, const class Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset);
|
||||
|
||||
void memoryBarrier(MTL::BarrierScope scope);
|
||||
|
||||
void memoryBarrier(const class Resource* const resources[], NS::UInteger count);
|
||||
|
||||
void sampleCountersInBuffer(const class CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: dispatchType
|
||||
_MTL_INLINE MTL::DispatchType MTL::ComputeCommandEncoder::dispatchType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));
|
||||
}
|
||||
|
||||
// method: setComputePipelineState:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setComputePipelineState(const MTL::ComputePipelineState* state)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_), state);
|
||||
}
|
||||
|
||||
// method: setBytes:length:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBuffer:offset:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBufferOffset:atIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setBufferOffset(NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferOffset_atIndex_), offset, index);
|
||||
}
|
||||
|
||||
// method: setBuffers:offsets:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBuffer:offset:attributeStride:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBuffers:offsets:attributeStrides:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBufferOffset:attributeStride:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setBytes:length:attributeStride:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setVisibleFunctionTable:atBufferIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger bufferIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atBufferIndex_), visibleFunctionTable, bufferIndex);
|
||||
}
|
||||
|
||||
// method: setVisibleFunctionTables:withBufferRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setIntersectionFunctionTable:atBufferIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger bufferIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atBufferIndex_), intersectionFunctionTable, bufferIndex);
|
||||
}
|
||||
|
||||
// method: setIntersectionFunctionTables:withBufferRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setAccelerationStructure:atBufferIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger bufferIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atBufferIndex_), accelerationStructure, bufferIndex);
|
||||
}
|
||||
|
||||
// method: setTexture:atIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);
|
||||
}
|
||||
|
||||
// method: setTextures:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setSamplerState:atIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);
|
||||
}
|
||||
|
||||
// method: setSamplerStates:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setSamplerState:lodMinClamp:lodMaxClamp:atIndex:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setSamplerStates:lodMinClamps:lodMaxClamps:withRange:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: setThreadgroupMemoryLength:atIndex:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_atIndex_), length, index);
|
||||
}
|
||||
|
||||
// method: setImageblockWidth:height:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setImageblockWidth(NS::UInteger width, NS::UInteger height)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockWidth_height_), width, height);
|
||||
}
|
||||
|
||||
// method: setStageInRegion:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setStageInRegion(MTL::Region region)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegion_), region);
|
||||
}
|
||||
|
||||
// method: setStageInRegionWithIndirectBuffer:indirectBufferOffset:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::setStageInRegion(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegionWithIndirectBuffer_indirectBufferOffset_), indirectBuffer, indirectBufferOffset);
|
||||
}
|
||||
|
||||
// method: dispatchThreadgroups:threadsPerThreadgroup:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroups_threadsPerThreadgroup_), threadgroupsPerGrid, threadsPerThreadgroup);
|
||||
}
|
||||
|
||||
// method: dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset: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);
|
||||
}
|
||||
|
||||
// method: dispatchThreads:threadsPerThreadgroup:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreads_threadsPerThreadgroup_), threadsPerGrid, threadsPerThreadgroup);
|
||||
}
|
||||
|
||||
// method: updateFence:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::updateFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
|
||||
}
|
||||
|
||||
// method: waitForFence:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::waitForFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
|
||||
}
|
||||
|
||||
// method: useResource:usage:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::useResource(const MTL::Resource* resource, MTL::ResourceUsage usage)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResource_usage_), resource, usage);
|
||||
}
|
||||
|
||||
// method: useResources:count: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);
|
||||
}
|
||||
|
||||
// method: useHeap:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::useHeap(const MTL::Heap* heap)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeap_), heap);
|
||||
}
|
||||
|
||||
// method: useHeaps:count:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: executeCommandsInBuffer:withRange:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_withRange_), indirectCommandBuffer, executionRange);
|
||||
}
|
||||
|
||||
// method: executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: memoryBarrierWithScope:
|
||||
_MTL_INLINE void MTL::ComputeCommandEncoder::memoryBarrier(MTL::BarrierScope scope)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(memoryBarrierWithScope_), scope);
|
||||
}
|
||||
|
||||
// method: memoryBarrierWithResources:count:
|
||||
_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);
|
||||
}
|
||||
|
||||
// method: sampleCountersInBuffer:atSampleIndex:withBarrier:
|
||||
_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);
|
||||
}
|
||||
181
src/contrib/metal-cpp/Metal/MTLComputePass.hpp
Normal file
181
src/contrib/metal-cpp/Metal/MTLComputePass.hpp
Normal file
@@ -0,0 +1,181 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLComputePass.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLCommandBuffer.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class ComputePassSampleBufferAttachmentDescriptor : public NS::Copying<ComputePassSampleBufferAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class ComputePassSampleBufferAttachmentDescriptor* alloc();
|
||||
|
||||
class ComputePassSampleBufferAttachmentDescriptor* init();
|
||||
|
||||
class CounterSampleBuffer* sampleBuffer() const;
|
||||
void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
|
||||
|
||||
NS::UInteger startOfEncoderSampleIndex() const;
|
||||
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
|
||||
|
||||
NS::UInteger endOfEncoderSampleIndex() const;
|
||||
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
|
||||
};
|
||||
|
||||
class ComputePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<ComputePassSampleBufferAttachmentDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class ComputePassSampleBufferAttachmentDescriptorArray* alloc();
|
||||
|
||||
class ComputePassSampleBufferAttachmentDescriptorArray* init();
|
||||
|
||||
class ComputePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
|
||||
|
||||
void setObject(const class ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
|
||||
};
|
||||
|
||||
class ComputePassDescriptor : public NS::Copying<ComputePassDescriptor>
|
||||
{
|
||||
public:
|
||||
static class ComputePassDescriptor* alloc();
|
||||
|
||||
class ComputePassDescriptor* init();
|
||||
|
||||
static class ComputePassDescriptor* computePassDescriptor();
|
||||
|
||||
MTL::DispatchType dispatchType() const;
|
||||
void setDispatchType(MTL::DispatchType dispatchType);
|
||||
|
||||
class ComputePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: sampleBuffer
|
||||
_MTL_INLINE MTL::CounterSampleBuffer* MTL::ComputePassSampleBufferAttachmentDescriptor::sampleBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
|
||||
}
|
||||
|
||||
// property: startOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// property: endOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ComputePassDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ComputePassDescriptor>();
|
||||
}
|
||||
|
||||
// static method: computePassDescriptor
|
||||
_MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::computePassDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::ComputePassDescriptor*>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor), _MTL_PRIVATE_SEL(computePassDescriptor));
|
||||
}
|
||||
|
||||
// property: dispatchType
|
||||
_MTL_INLINE MTL::DispatchType MTL::ComputePassDescriptor::dispatchType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePassDescriptor::setDispatchType(MTL::DispatchType dispatchType)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDispatchType_), dispatchType);
|
||||
}
|
||||
|
||||
// property: sampleBufferAttachments
|
||||
_MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassDescriptor::sampleBufferAttachments() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
|
||||
}
|
||||
396
src/contrib/metal-cpp/Metal/MTLComputePipeline.hpp
Normal file
396
src/contrib/metal-cpp/Metal/MTLComputePipeline.hpp
Normal file
@@ -0,0 +1,396 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLComputePipeline.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLPipeline.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class ComputePipelineReflection : public NS::Referencing<ComputePipelineReflection>
|
||||
{
|
||||
public:
|
||||
static class ComputePipelineReflection* alloc();
|
||||
|
||||
class ComputePipelineReflection* init();
|
||||
|
||||
NS::Array* bindings() const;
|
||||
|
||||
NS::Array* arguments() const;
|
||||
};
|
||||
|
||||
class ComputePipelineDescriptor : public NS::Copying<ComputePipelineDescriptor>
|
||||
{
|
||||
public:
|
||||
static class ComputePipelineDescriptor* alloc();
|
||||
|
||||
class ComputePipelineDescriptor* init();
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Function* computeFunction() const;
|
||||
void setComputeFunction(const class Function* computeFunction);
|
||||
|
||||
bool threadGroupSizeIsMultipleOfThreadExecutionWidth() const;
|
||||
void setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth);
|
||||
|
||||
NS::UInteger maxTotalThreadsPerThreadgroup() const;
|
||||
void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
|
||||
|
||||
class StageInputOutputDescriptor* stageInputDescriptor() const;
|
||||
void setStageInputDescriptor(const class StageInputOutputDescriptor* stageInputDescriptor);
|
||||
|
||||
class PipelineBufferDescriptorArray* buffers() const;
|
||||
|
||||
bool supportIndirectCommandBuffers() const;
|
||||
void setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers);
|
||||
|
||||
NS::Array* insertLibraries() const;
|
||||
void setInsertLibraries(const NS::Array* insertLibraries);
|
||||
|
||||
NS::Array* preloadedLibraries() const;
|
||||
void setPreloadedLibraries(const NS::Array* preloadedLibraries);
|
||||
|
||||
NS::Array* binaryArchives() const;
|
||||
void setBinaryArchives(const NS::Array* binaryArchives);
|
||||
|
||||
void reset();
|
||||
|
||||
class LinkedFunctions* linkedFunctions() const;
|
||||
void setLinkedFunctions(const class LinkedFunctions* linkedFunctions);
|
||||
|
||||
bool supportAddingBinaryFunctions() const;
|
||||
void setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions);
|
||||
|
||||
NS::UInteger maxCallStackDepth() const;
|
||||
void setMaxCallStackDepth(NS::UInteger maxCallStackDepth);
|
||||
|
||||
MTL::ShaderValidation shaderValidation() const;
|
||||
void setShaderValidation(MTL::ShaderValidation shaderValidation);
|
||||
};
|
||||
|
||||
class ComputePipelineState : public NS::Referencing<ComputePipelineState>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
NS::UInteger maxTotalThreadsPerThreadgroup() const;
|
||||
|
||||
NS::UInteger threadExecutionWidth() const;
|
||||
|
||||
NS::UInteger staticThreadgroupMemoryLength() const;
|
||||
|
||||
NS::UInteger imageblockMemoryLength(MTL::Size imageblockDimensions);
|
||||
|
||||
bool supportIndirectCommandBuffers() const;
|
||||
|
||||
MTL::ResourceID gpuResourceID() const;
|
||||
|
||||
class FunctionHandle* functionHandle(const class Function* function);
|
||||
|
||||
class ComputePipelineState* newComputePipelineState(const NS::Array* functions, NS::Error** error);
|
||||
|
||||
class VisibleFunctionTable* newVisibleFunctionTable(const class VisibleFunctionTableDescriptor* descriptor);
|
||||
|
||||
class IntersectionFunctionTable* newIntersectionFunctionTable(const class IntersectionFunctionTableDescriptor* descriptor);
|
||||
|
||||
MTL::ShaderValidation shaderValidation() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ComputePipelineReflection>(_MTL_PRIVATE_CLS(MTLComputePipelineReflection));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ComputePipelineReflection>();
|
||||
}
|
||||
|
||||
// property: bindings
|
||||
_MTL_INLINE NS::Array* MTL::ComputePipelineReflection::bindings() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(bindings));
|
||||
}
|
||||
|
||||
// property: arguments
|
||||
_MTL_INLINE NS::Array* MTL::ComputePipelineReflection::arguments() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ComputePipelineDescriptor>(_MTL_PRIVATE_CLS(MTLComputePipelineDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ComputePipelineDescriptor>();
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::ComputePipelineDescriptor::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: computeFunction
|
||||
_MTL_INLINE MTL::Function* MTL::ComputePipelineDescriptor::computeFunction() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(computeFunction));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setComputeFunction(const MTL::Function* computeFunction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputeFunction_), computeFunction);
|
||||
}
|
||||
|
||||
// property: threadGroupSizeIsMultipleOfThreadExecutionWidth
|
||||
_MTL_INLINE bool MTL::ComputePipelineDescriptor::threadGroupSizeIsMultipleOfThreadExecutionWidth() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(threadGroupSizeIsMultipleOfThreadExecutionWidth));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadGroupSizeIsMultipleOfThreadExecutionWidth_), threadGroupSizeIsMultipleOfThreadExecutionWidth);
|
||||
}
|
||||
|
||||
// property: maxTotalThreadsPerThreadgroup
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxTotalThreadsPerThreadgroup() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
|
||||
}
|
||||
|
||||
// property: stageInputDescriptor
|
||||
_MTL_INLINE MTL::StageInputOutputDescriptor* MTL::ComputePipelineDescriptor::stageInputDescriptor() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StageInputOutputDescriptor*>(this, _MTL_PRIVATE_SEL(stageInputDescriptor));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setStageInputDescriptor(const MTL::StageInputOutputDescriptor* stageInputDescriptor)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInputDescriptor_), stageInputDescriptor);
|
||||
}
|
||||
|
||||
// property: buffers
|
||||
_MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::ComputePipelineDescriptor::buffers() const
|
||||
{
|
||||
return Object::sendMessage<MTL::PipelineBufferDescriptorArray*>(this, _MTL_PRIVATE_SEL(buffers));
|
||||
}
|
||||
|
||||
// property: supportIndirectCommandBuffers
|
||||
_MTL_INLINE bool MTL::ComputePipelineDescriptor::supportIndirectCommandBuffers() const
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
|
||||
}
|
||||
|
||||
// property: insertLibraries
|
||||
_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::insertLibraries() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(insertLibraries));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setInsertLibraries(const NS::Array* insertLibraries)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInsertLibraries_), insertLibraries);
|
||||
}
|
||||
|
||||
// property: preloadedLibraries
|
||||
_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::preloadedLibraries() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(preloadedLibraries));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setPreloadedLibraries(const NS::Array* preloadedLibraries)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreloadedLibraries_), preloadedLibraries);
|
||||
}
|
||||
|
||||
// property: binaryArchives
|
||||
_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::binaryArchives() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
|
||||
}
|
||||
|
||||
// method: reset
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::reset()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
|
||||
}
|
||||
|
||||
// property: linkedFunctions
|
||||
_MTL_INLINE MTL::LinkedFunctions* MTL::ComputePipelineDescriptor::linkedFunctions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LinkedFunctions*>(this, _MTL_PRIVATE_SEL(linkedFunctions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setLinkedFunctions(const MTL::LinkedFunctions* linkedFunctions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLinkedFunctions_), linkedFunctions);
|
||||
}
|
||||
|
||||
// property: supportAddingBinaryFunctions
|
||||
_MTL_INLINE bool MTL::ComputePipelineDescriptor::supportAddingBinaryFunctions() const
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAddingBinaryFunctions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAddingBinaryFunctions_), supportAddingBinaryFunctions);
|
||||
}
|
||||
|
||||
// property: maxCallStackDepth
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxCallStackDepth() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCallStackDepth));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxCallStackDepth(NS::UInteger maxCallStackDepth)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCallStackDepth_), maxCallStackDepth);
|
||||
}
|
||||
|
||||
// property: shaderValidation
|
||||
_MTL_INLINE MTL::ShaderValidation MTL::ComputePipelineDescriptor::shaderValidation() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ComputePipelineDescriptor::setShaderValidation(MTL::ShaderValidation shaderValidation)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderValidation_), shaderValidation);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::ComputePipelineState::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::ComputePipelineState::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: maxTotalThreadsPerThreadgroup
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::maxTotalThreadsPerThreadgroup() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
|
||||
}
|
||||
|
||||
// property: threadExecutionWidth
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::threadExecutionWidth() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadExecutionWidth));
|
||||
}
|
||||
|
||||
// property: staticThreadgroupMemoryLength
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::staticThreadgroupMemoryLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(staticThreadgroupMemoryLength));
|
||||
}
|
||||
|
||||
// method: imageblockMemoryLengthForDimensions:
|
||||
_MTL_INLINE NS::UInteger MTL::ComputePipelineState::imageblockMemoryLength(MTL::Size imageblockDimensions)
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(imageblockMemoryLengthForDimensions_), imageblockDimensions);
|
||||
}
|
||||
|
||||
// property: supportIndirectCommandBuffers
|
||||
_MTL_INLINE bool MTL::ComputePipelineState::supportIndirectCommandBuffers() const
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
|
||||
}
|
||||
|
||||
// property: gpuResourceID
|
||||
_MTL_INLINE MTL::ResourceID MTL::ComputePipelineState::gpuResourceID() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
|
||||
}
|
||||
|
||||
// method: functionHandleWithFunction:
|
||||
_MTL_INLINE MTL::FunctionHandle* MTL::ComputePipelineState::functionHandle(const MTL::Function* function)
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithFunction_), function);
|
||||
}
|
||||
|
||||
// method: newComputePipelineStateWithAdditionalBinaryFunctions: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);
|
||||
}
|
||||
|
||||
// method: newVisibleFunctionTableWithDescriptor:
|
||||
_MTL_INLINE MTL::VisibleFunctionTable* MTL::ComputePipelineState::newVisibleFunctionTable(const MTL::VisibleFunctionTableDescriptor* descriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::VisibleFunctionTable*>(this, _MTL_PRIVATE_SEL(newVisibleFunctionTableWithDescriptor_), descriptor);
|
||||
}
|
||||
|
||||
// method: newIntersectionFunctionTableWithDescriptor:
|
||||
_MTL_INLINE MTL::IntersectionFunctionTable* MTL::ComputePipelineState::newIntersectionFunctionTable(const MTL::IntersectionFunctionTableDescriptor* descriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::IntersectionFunctionTable*>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionTableWithDescriptor_), descriptor);
|
||||
}
|
||||
|
||||
// property: shaderValidation
|
||||
_MTL_INLINE MTL::ShaderValidation MTL::ComputePipelineState::shaderValidation() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));
|
||||
}
|
||||
261
src/contrib/metal-cpp/Metal/MTLCounters.hpp
Normal file
261
src/contrib/metal-cpp/Metal/MTLCounters.hpp
Normal file
@@ -0,0 +1,261 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLCounters.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLResource.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
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;
|
||||
|
||||
_MTL_CONST(NS::ErrorDomain, CounterErrorDomain);
|
||||
|
||||
using CommonCounter = NS::String*;
|
||||
|
||||
_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);
|
||||
|
||||
using CommonCounterSet = NS::String*;
|
||||
|
||||
_MTL_CONST(CommonCounterSet, CommonCounterSetTimestamp);
|
||||
_MTL_CONST(CommonCounterSet, CommonCounterSetStageUtilization);
|
||||
_MTL_CONST(CommonCounterSet, CommonCounterSetStatistic);
|
||||
|
||||
class Counter : public NS::Referencing<Counter>
|
||||
{
|
||||
public:
|
||||
NS::String* name() const;
|
||||
};
|
||||
|
||||
class CounterSet : public NS::Referencing<CounterSet>
|
||||
{
|
||||
public:
|
||||
NS::String* name() const;
|
||||
|
||||
NS::Array* counters() const;
|
||||
};
|
||||
|
||||
class CounterSampleBufferDescriptor : public NS::Copying<CounterSampleBufferDescriptor>
|
||||
{
|
||||
public:
|
||||
static class CounterSampleBufferDescriptor* alloc();
|
||||
|
||||
class CounterSampleBufferDescriptor* init();
|
||||
|
||||
class CounterSet* counterSet() const;
|
||||
void setCounterSet(const class CounterSet* counterSet);
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
MTL::StorageMode storageMode() const;
|
||||
void setStorageMode(MTL::StorageMode storageMode);
|
||||
|
||||
NS::UInteger sampleCount() const;
|
||||
void setSampleCount(NS::UInteger sampleCount);
|
||||
};
|
||||
|
||||
class CounterSampleBuffer : public NS::Referencing<CounterSampleBuffer>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
|
||||
NS::UInteger sampleCount() const;
|
||||
|
||||
NS::Data* resolveCounterRange(NS::Range range);
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, CounterSampleBufferError) {
|
||||
CounterSampleBufferErrorOutOfMemory = 0,
|
||||
CounterSampleBufferErrorInvalid = 1,
|
||||
CounterSampleBufferErrorInternal = 2,
|
||||
};
|
||||
|
||||
static const NS::UInteger CounterErrorValue = static_cast<NS::UInteger>(~0ULL);
|
||||
static const NS::UInteger CounterDontSample = static_cast<NS::UInteger>(-1);
|
||||
|
||||
}
|
||||
|
||||
_MTL_PRIVATE_DEF_STR(NS::ErrorDomain, CounterErrorDomain);
|
||||
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTimestamp);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTessellationInputPatches);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterVertexInvocations);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterPostTessellationVertexInvocations);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterClipperInvocations);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterClipperPrimitivesOut);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterFragmentInvocations);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterFragmentsPassed);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterComputeKernelInvocations);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTotalCycles);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterVertexCycles);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTessellationCycles);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterPostTessellationVertexCycles);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterFragmentCycles);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterRenderTargetWriteCycles);
|
||||
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounterSet, CommonCounterSetTimestamp);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounterSet, CommonCounterSetStageUtilization);
|
||||
_MTL_PRIVATE_DEF_STR(MTL::CommonCounterSet, CommonCounterSetStatistic);
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::Counter::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::CounterSet::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: counters
|
||||
_MTL_INLINE NS::Array* MTL::CounterSet::counters() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(counters));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::CounterSampleBufferDescriptor* MTL::CounterSampleBufferDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::CounterSampleBufferDescriptor>(_MTL_PRIVATE_CLS(MTLCounterSampleBufferDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::CounterSampleBufferDescriptor* MTL::CounterSampleBufferDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::CounterSampleBufferDescriptor>();
|
||||
}
|
||||
|
||||
// property: counterSet
|
||||
_MTL_INLINE MTL::CounterSet* MTL::CounterSampleBufferDescriptor::counterSet() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CounterSet*>(this, _MTL_PRIVATE_SEL(counterSet));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setCounterSet(const MTL::CounterSet* counterSet)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCounterSet_), counterSet);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::CounterSampleBufferDescriptor::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: storageMode
|
||||
_MTL_INLINE MTL::StorageMode MTL::CounterSampleBufferDescriptor::storageMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setStorageMode(MTL::StorageMode storageMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
|
||||
}
|
||||
|
||||
// property: sampleCount
|
||||
_MTL_INLINE NS::UInteger MTL::CounterSampleBufferDescriptor::sampleCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sampleCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CounterSampleBufferDescriptor::setSampleCount(NS::UInteger sampleCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleCount_), sampleCount);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::CounterSampleBuffer::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::CounterSampleBuffer::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: sampleCount
|
||||
_MTL_INLINE NS::UInteger MTL::CounterSampleBuffer::sampleCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sampleCount));
|
||||
}
|
||||
|
||||
// method: resolveCounterRange:
|
||||
_MTL_INLINE NS::Data* MTL::CounterSampleBuffer::resolveCounterRange(NS::Range range)
|
||||
{
|
||||
return Object::sendMessage<NS::Data*>(this, _MTL_PRIVATE_SEL(resolveCounterRange_), range);
|
||||
}
|
||||
41
src/contrib/metal-cpp/Metal/MTLDefines.hpp
Normal file
41
src/contrib/metal-cpp/Metal/MTLDefines.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
269
src/contrib/metal-cpp/Metal/MTLDepthStencil.hpp
Normal file
269
src/contrib/metal-cpp/Metal/MTLDepthStencil.hpp
Normal file
@@ -0,0 +1,269 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLDepthStencil.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLDepthStencil.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_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 class StencilDescriptor* alloc();
|
||||
|
||||
class StencilDescriptor* init();
|
||||
|
||||
MTL::CompareFunction stencilCompareFunction() const;
|
||||
void setStencilCompareFunction(MTL::CompareFunction stencilCompareFunction);
|
||||
|
||||
MTL::StencilOperation stencilFailureOperation() const;
|
||||
void setStencilFailureOperation(MTL::StencilOperation stencilFailureOperation);
|
||||
|
||||
MTL::StencilOperation depthFailureOperation() const;
|
||||
void setDepthFailureOperation(MTL::StencilOperation depthFailureOperation);
|
||||
|
||||
MTL::StencilOperation depthStencilPassOperation() const;
|
||||
void setDepthStencilPassOperation(MTL::StencilOperation depthStencilPassOperation);
|
||||
|
||||
uint32_t readMask() const;
|
||||
void setReadMask(uint32_t readMask);
|
||||
|
||||
uint32_t writeMask() const;
|
||||
void setWriteMask(uint32_t writeMask);
|
||||
};
|
||||
|
||||
class DepthStencilDescriptor : public NS::Copying<DepthStencilDescriptor>
|
||||
{
|
||||
public:
|
||||
static class DepthStencilDescriptor* alloc();
|
||||
|
||||
class DepthStencilDescriptor* init();
|
||||
|
||||
MTL::CompareFunction depthCompareFunction() const;
|
||||
void setDepthCompareFunction(MTL::CompareFunction depthCompareFunction);
|
||||
|
||||
bool depthWriteEnabled() const;
|
||||
void setDepthWriteEnabled(bool depthWriteEnabled);
|
||||
|
||||
class StencilDescriptor* frontFaceStencil() const;
|
||||
void setFrontFaceStencil(const class StencilDescriptor* frontFaceStencil);
|
||||
|
||||
class StencilDescriptor* backFaceStencil() const;
|
||||
void setBackFaceStencil(const class StencilDescriptor* backFaceStencil);
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
};
|
||||
|
||||
class DepthStencilState : public NS::Referencing<DepthStencilState>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
|
||||
class Device* device() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::StencilDescriptor* MTL::StencilDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::StencilDescriptor>(_MTL_PRIVATE_CLS(MTLStencilDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::StencilDescriptor* MTL::StencilDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::StencilDescriptor>();
|
||||
}
|
||||
|
||||
// property: stencilCompareFunction
|
||||
_MTL_INLINE MTL::CompareFunction MTL::StencilDescriptor::stencilCompareFunction() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(stencilCompareFunction));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StencilDescriptor::setStencilCompareFunction(MTL::CompareFunction stencilCompareFunction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilCompareFunction_), stencilCompareFunction);
|
||||
}
|
||||
|
||||
// property: stencilFailureOperation
|
||||
_MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::stencilFailureOperation() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(stencilFailureOperation));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StencilDescriptor::setStencilFailureOperation(MTL::StencilOperation stencilFailureOperation)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilFailureOperation_), stencilFailureOperation);
|
||||
}
|
||||
|
||||
// property: depthFailureOperation
|
||||
_MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::depthFailureOperation() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(depthFailureOperation));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StencilDescriptor::setDepthFailureOperation(MTL::StencilOperation depthFailureOperation)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthFailureOperation_), depthFailureOperation);
|
||||
}
|
||||
|
||||
// property: depthStencilPassOperation
|
||||
_MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::depthStencilPassOperation() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(depthStencilPassOperation));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StencilDescriptor::setDepthStencilPassOperation(MTL::StencilOperation depthStencilPassOperation)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilPassOperation_), depthStencilPassOperation);
|
||||
}
|
||||
|
||||
// property: readMask
|
||||
_MTL_INLINE uint32_t MTL::StencilDescriptor::readMask() const
|
||||
{
|
||||
return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(readMask));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StencilDescriptor::setReadMask(uint32_t readMask)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setReadMask_), readMask);
|
||||
}
|
||||
|
||||
// property: writeMask
|
||||
_MTL_INLINE uint32_t MTL::StencilDescriptor::writeMask() const
|
||||
{
|
||||
return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(writeMask));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StencilDescriptor::setWriteMask(uint32_t writeMask)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setWriteMask_), writeMask);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::DepthStencilDescriptor* MTL::DepthStencilDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::DepthStencilDescriptor>(_MTL_PRIVATE_CLS(MTLDepthStencilDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::DepthStencilDescriptor* MTL::DepthStencilDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::DepthStencilDescriptor>();
|
||||
}
|
||||
|
||||
// property: depthCompareFunction
|
||||
_MTL_INLINE MTL::CompareFunction MTL::DepthStencilDescriptor::depthCompareFunction() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(depthCompareFunction));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::DepthStencilDescriptor::setDepthCompareFunction(MTL::CompareFunction depthCompareFunction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthCompareFunction_), depthCompareFunction);
|
||||
}
|
||||
|
||||
// property: depthWriteEnabled
|
||||
_MTL_INLINE bool MTL::DepthStencilDescriptor::depthWriteEnabled() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthWriteEnabled));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::DepthStencilDescriptor::setDepthWriteEnabled(bool depthWriteEnabled)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthWriteEnabled_), depthWriteEnabled);
|
||||
}
|
||||
|
||||
// property: frontFaceStencil
|
||||
_MTL_INLINE MTL::StencilDescriptor* MTL::DepthStencilDescriptor::frontFaceStencil() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StencilDescriptor*>(this, _MTL_PRIVATE_SEL(frontFaceStencil));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::DepthStencilDescriptor::setFrontFaceStencil(const MTL::StencilDescriptor* frontFaceStencil)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFrontFaceStencil_), frontFaceStencil);
|
||||
}
|
||||
|
||||
// property: backFaceStencil
|
||||
_MTL_INLINE MTL::StencilDescriptor* MTL::DepthStencilDescriptor::backFaceStencil() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StencilDescriptor*>(this, _MTL_PRIVATE_SEL(backFaceStencil));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::DepthStencilDescriptor::setBackFaceStencil(const MTL::StencilDescriptor* backFaceStencil)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBackFaceStencil_), backFaceStencil);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::DepthStencilDescriptor::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::DepthStencilDescriptor::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::DepthStencilState::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::DepthStencilState::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
1453
src/contrib/metal-cpp/Metal/MTLDevice.hpp
Normal file
1453
src/contrib/metal-cpp/Metal/MTLDevice.hpp
Normal file
File diff suppressed because it is too large
Load Diff
99
src/contrib/metal-cpp/Metal/MTLDrawable.hpp
Normal file
99
src/contrib/metal-cpp/Metal/MTLDrawable.hpp
Normal file
@@ -0,0 +1,99 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLDrawable.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <functional>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
using DrawablePresentedHandler = void (^)(class Drawable*);
|
||||
|
||||
using DrawablePresentedHandlerFunction = std::function<void(class Drawable*)>;
|
||||
|
||||
class Drawable : public NS::Referencing<Drawable>
|
||||
{
|
||||
public:
|
||||
void addPresentedHandler(const MTL::DrawablePresentedHandlerFunction& function);
|
||||
|
||||
void present();
|
||||
|
||||
void presentAtTime(CFTimeInterval presentationTime);
|
||||
|
||||
void presentAfterMinimumDuration(CFTimeInterval duration);
|
||||
|
||||
void addPresentedHandler(const MTL::DrawablePresentedHandler block);
|
||||
|
||||
CFTimeInterval presentedTime() const;
|
||||
|
||||
NS::UInteger drawableID() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Drawable::addPresentedHandler(const MTL::DrawablePresentedHandlerFunction& function)
|
||||
{
|
||||
__block DrawablePresentedHandlerFunction blockFunction = function;
|
||||
|
||||
addPresentedHandler(^(Drawable* pDrawable) { blockFunction(pDrawable); });
|
||||
}
|
||||
|
||||
// method: present
|
||||
_MTL_INLINE void MTL::Drawable::present()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(present));
|
||||
}
|
||||
|
||||
// method: presentAtTime:
|
||||
_MTL_INLINE void MTL::Drawable::presentAtTime(CFTimeInterval presentationTime)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentAtTime_), presentationTime);
|
||||
}
|
||||
|
||||
// method: presentAfterMinimumDuration:
|
||||
_MTL_INLINE void MTL::Drawable::presentAfterMinimumDuration(CFTimeInterval duration)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentAfterMinimumDuration_), duration);
|
||||
}
|
||||
|
||||
// method: addPresentedHandler:
|
||||
_MTL_INLINE void MTL::Drawable::addPresentedHandler(const MTL::DrawablePresentedHandler block)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addPresentedHandler_), block);
|
||||
}
|
||||
|
||||
// property: presentedTime
|
||||
_MTL_INLINE CFTimeInterval MTL::Drawable::presentedTime() const
|
||||
{
|
||||
return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(presentedTime));
|
||||
}
|
||||
|
||||
// property: drawableID
|
||||
_MTL_INLINE NS::UInteger MTL::Drawable::drawableID() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(drawableID));
|
||||
}
|
||||
82
src/contrib/metal-cpp/Metal/MTLDynamicLibrary.hpp
Normal file
82
src/contrib/metal-cpp/Metal/MTLDynamicLibrary.hpp
Normal file
@@ -0,0 +1,82 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLDynamicLibrary.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, DynamicLibraryError) {
|
||||
DynamicLibraryErrorNone = 0,
|
||||
DynamicLibraryErrorInvalidFile = 1,
|
||||
DynamicLibraryErrorCompilationFailure = 2,
|
||||
DynamicLibraryErrorUnresolvedInstallName = 3,
|
||||
DynamicLibraryErrorDependencyLoadFailure = 4,
|
||||
DynamicLibraryErrorUnsupported = 5,
|
||||
};
|
||||
|
||||
class DynamicLibrary : public NS::Referencing<DynamicLibrary>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* installName() const;
|
||||
|
||||
bool serializeToURL(const NS::URL* url, NS::Error** error);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::DynamicLibrary::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::DynamicLibrary::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::DynamicLibrary::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: installName
|
||||
_MTL_INLINE NS::String* MTL::DynamicLibrary::installName() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(installName));
|
||||
}
|
||||
|
||||
// method: serializeToURL:error:
|
||||
_MTL_INLINE bool MTL::DynamicLibrary::serializeToURL(const NS::URL* url, NS::Error** error)
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(serializeToURL_error_), url, error);
|
||||
}
|
||||
177
src/contrib/metal-cpp/Metal/MTLEvent.hpp
Normal file
177
src/contrib/metal-cpp/Metal/MTLEvent.hpp
Normal file
@@ -0,0 +1,177 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLEvent.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLEvent.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class Event : public NS::Referencing<Event>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
};
|
||||
|
||||
class SharedEventListener : public NS::Referencing<SharedEventListener>
|
||||
{
|
||||
public:
|
||||
static class SharedEventListener* alloc();
|
||||
|
||||
MTL::SharedEventListener* init();
|
||||
|
||||
MTL::SharedEventListener* init(const dispatch_queue_t dispatchQueue);
|
||||
|
||||
dispatch_queue_t dispatchQueue() const;
|
||||
};
|
||||
|
||||
using SharedEventNotificationBlock = void (^)(class SharedEvent* pEvent, std::uint64_t value);
|
||||
using SharedEventNotificationFunction = std::function<void(class SharedEvent* pEvent, std::uint64_t value)>;
|
||||
|
||||
class SharedEvent : public NS::Referencing<SharedEvent, Event>
|
||||
{
|
||||
public:
|
||||
void notifyListener(const class SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block);
|
||||
void notifyListener(const class SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationFunction& function);
|
||||
|
||||
class SharedEventHandle* newSharedEventHandle();
|
||||
|
||||
bool waitUntilSignaledValue(uint64_t value, uint64_t milliseconds);
|
||||
|
||||
uint64_t signaledValue() const;
|
||||
void setSignaledValue(uint64_t signaledValue);
|
||||
};
|
||||
|
||||
class SharedEventHandle : public NS::SecureCoding<SharedEventHandle>
|
||||
{
|
||||
public:
|
||||
static class SharedEventHandle* alloc();
|
||||
|
||||
class SharedEventHandle* init();
|
||||
|
||||
NS::String* label() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::Event::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::Event::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Event::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::SharedEventListener>(_MTL_PRIVATE_CLS(MTLSharedEventListener));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init()
|
||||
{
|
||||
return NS::Object::init<MTL::SharedEventListener>();
|
||||
}
|
||||
|
||||
// method: initWithDispatchQueue:
|
||||
_MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init(const dispatch_queue_t dispatchQueue)
|
||||
{
|
||||
return Object::sendMessage<MTL::SharedEventListener*>(this, _MTL_PRIVATE_SEL(initWithDispatchQueue_), dispatchQueue);
|
||||
}
|
||||
|
||||
// property: dispatchQueue
|
||||
_MTL_INLINE dispatch_queue_t MTL::SharedEventListener::dispatchQueue() const
|
||||
{
|
||||
return Object::sendMessage<dispatch_queue_t>(this, _MTL_PRIVATE_SEL(dispatchQueue));
|
||||
}
|
||||
|
||||
// method: notifyListener:atValue:block:
|
||||
_MTL_INLINE void MTL::SharedEvent::notifyListener(const MTL::SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(notifyListener_atValue_block_), listener, value, block);
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SharedEvent::notifyListener(const class SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationFunction& function)
|
||||
{
|
||||
__block MTL::SharedEventNotificationFunction callback = function;
|
||||
notifyListener(listener, value, ^void(class SharedEvent* pEvent, std::uint64_t value){
|
||||
callback(pEvent, value);
|
||||
});
|
||||
}
|
||||
|
||||
// method: newSharedEventHandle
|
||||
_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEvent::newSharedEventHandle()
|
||||
{
|
||||
return Object::sendMessage<MTL::SharedEventHandle*>(this, _MTL_PRIVATE_SEL(newSharedEventHandle));
|
||||
}
|
||||
|
||||
// method: waitUntilSignaledValue:timeoutMS:
|
||||
_MTL_INLINE bool MTL::SharedEvent::waitUntilSignaledValue(uint64_t value, uint64_t milliseconds)
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(waitUntilSignaledValue_timeoutMS_), value, milliseconds);
|
||||
}
|
||||
|
||||
// property: signaledValue
|
||||
_MTL_INLINE uint64_t MTL::SharedEvent::signaledValue() const
|
||||
{
|
||||
return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(signaledValue));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SharedEvent::setSignaledValue(uint64_t signaledValue)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSignaledValue_), signaledValue);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::SharedEventHandle>(_MTL_PRIVATE_CLS(MTLSharedEventHandle));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::init()
|
||||
{
|
||||
return NS::Object::init<MTL::SharedEventHandle>();
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::SharedEventHandle::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
57
src/contrib/metal-cpp/Metal/MTLFence.hpp
Normal file
57
src/contrib/metal-cpp/Metal/MTLFence.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLFence.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class Fence : public NS::Referencing<Fence>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::Fence::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::Fence::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Fence::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
85
src/contrib/metal-cpp/Metal/MTLFunctionConstantValues.hpp
Normal file
85
src/contrib/metal-cpp/Metal/MTLFunctionConstantValues.hpp
Normal file
@@ -0,0 +1,85 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLFunctionConstantValues.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLArgument.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class FunctionConstantValues : public NS::Copying<FunctionConstantValues>
|
||||
{
|
||||
public:
|
||||
static class FunctionConstantValues* alloc();
|
||||
|
||||
class FunctionConstantValues* init();
|
||||
|
||||
void setConstantValue(const void* value, MTL::DataType type, NS::UInteger index);
|
||||
|
||||
void setConstantValues(const void* values, MTL::DataType type, NS::Range range);
|
||||
|
||||
void setConstantValue(const void* value, MTL::DataType type, const NS::String* name);
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionConstantValues::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionConstantValues>(_MTL_PRIVATE_CLS(MTLFunctionConstantValues));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionConstantValues::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionConstantValues>();
|
||||
}
|
||||
|
||||
// method: setConstantValue:type:atIndex:
|
||||
_MTL_INLINE void MTL::FunctionConstantValues::setConstantValue(const void* value, MTL::DataType type, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValue_type_atIndex_), value, type, index);
|
||||
}
|
||||
|
||||
// method: setConstantValues:type:withRange:
|
||||
_MTL_INLINE void MTL::FunctionConstantValues::setConstantValues(const void* values, MTL::DataType type, NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_type_withRange_), values, type, range);
|
||||
}
|
||||
|
||||
// method: setConstantValue:type:withName:
|
||||
_MTL_INLINE void MTL::FunctionConstantValues::setConstantValue(const void* value, MTL::DataType type, const NS::String* name)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValue_type_withName_), value, type, name);
|
||||
}
|
||||
|
||||
// method: reset
|
||||
_MTL_INLINE void MTL::FunctionConstantValues::reset()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
|
||||
}
|
||||
159
src/contrib/metal-cpp/Metal/MTLFunctionDescriptor.hpp
Normal file
159
src/contrib/metal-cpp/Metal/MTLFunctionDescriptor.hpp
Normal file
@@ -0,0 +1,159 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLFunctionDescriptor.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLFunctionDescriptor.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, FunctionOptions) {
|
||||
FunctionOptionNone = 0,
|
||||
FunctionOptionCompileToBinary = 1,
|
||||
FunctionOptionStoreFunctionInMetalScript = 2,
|
||||
FunctionOptionStoreFunctionInMetalPipelinesScript = 2,
|
||||
FunctionOptionFailOnBinaryArchiveMiss = 4,
|
||||
};
|
||||
|
||||
class FunctionDescriptor : public NS::Copying<FunctionDescriptor>
|
||||
{
|
||||
public:
|
||||
static class FunctionDescriptor* alloc();
|
||||
|
||||
class FunctionDescriptor* init();
|
||||
|
||||
static class FunctionDescriptor* functionDescriptor();
|
||||
|
||||
NS::String* name() const;
|
||||
void setName(const NS::String* name);
|
||||
|
||||
NS::String* specializedName() const;
|
||||
void setSpecializedName(const NS::String* specializedName);
|
||||
|
||||
class FunctionConstantValues* constantValues() const;
|
||||
void setConstantValues(const class FunctionConstantValues* constantValues);
|
||||
|
||||
MTL::FunctionOptions options() const;
|
||||
void setOptions(MTL::FunctionOptions options);
|
||||
|
||||
NS::Array* binaryArchives() const;
|
||||
void setBinaryArchives(const NS::Array* binaryArchives);
|
||||
};
|
||||
|
||||
class IntersectionFunctionDescriptor : public NS::Copying<IntersectionFunctionDescriptor, MTL::FunctionDescriptor>
|
||||
{
|
||||
public:
|
||||
static class IntersectionFunctionDescriptor* alloc();
|
||||
|
||||
class IntersectionFunctionDescriptor* init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionDescriptor>(_MTL_PRIVATE_CLS(MTLFunctionDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionDescriptor>();
|
||||
}
|
||||
|
||||
// static method: functionDescriptor
|
||||
_MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::functionDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionDescriptor*>(_MTL_PRIVATE_CLS(MTLFunctionDescriptor), _MTL_PRIVATE_SEL(functionDescriptor));
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::FunctionDescriptor::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionDescriptor::setName(const NS::String* name)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
|
||||
}
|
||||
|
||||
// property: specializedName
|
||||
_MTL_INLINE NS::String* MTL::FunctionDescriptor::specializedName() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(specializedName));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionDescriptor::setSpecializedName(const NS::String* specializedName)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSpecializedName_), specializedName);
|
||||
}
|
||||
|
||||
// property: constantValues
|
||||
_MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionDescriptor::constantValues() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionConstantValues*>(this, _MTL_PRIVATE_SEL(constantValues));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionDescriptor::setConstantValues(const MTL::FunctionConstantValues* constantValues)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_), constantValues);
|
||||
}
|
||||
|
||||
// property: options
|
||||
_MTL_INLINE MTL::FunctionOptions MTL::FunctionDescriptor::options() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionOptions>(this, _MTL_PRIVATE_SEL(options));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionDescriptor::setOptions(MTL::FunctionOptions options)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
|
||||
}
|
||||
|
||||
// property: binaryArchives
|
||||
_MTL_INLINE NS::Array* MTL::FunctionDescriptor::binaryArchives() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::IntersectionFunctionDescriptor* MTL::IntersectionFunctionDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::IntersectionFunctionDescriptor>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::IntersectionFunctionDescriptor* MTL::IntersectionFunctionDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::IntersectionFunctionDescriptor>();
|
||||
}
|
||||
61
src/contrib/metal-cpp/Metal/MTLFunctionHandle.hpp
Normal file
61
src/contrib/metal-cpp/Metal/MTLFunctionHandle.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLFunctionHandle.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLLibrary.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class FunctionHandle : public NS::Referencing<FunctionHandle>
|
||||
{
|
||||
public:
|
||||
MTL::FunctionType functionType() const;
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
class Device* device() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: functionType
|
||||
_MTL_INLINE MTL::FunctionType MTL::FunctionHandle::functionType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionType>(this, _MTL_PRIVATE_SEL(functionType));
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::FunctionHandle::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::FunctionHandle::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
114
src/contrib/metal-cpp/Metal/MTLFunctionLog.hpp
Normal file
114
src/contrib/metal-cpp/Metal/MTLFunctionLog.hpp
Normal file
@@ -0,0 +1,114 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLFunctionLog.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLFunctionLog.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, FunctionLogType) {
|
||||
FunctionLogTypeValidation = 0,
|
||||
};
|
||||
|
||||
class LogContainer : public NS::Referencing<LogContainer, NS::FastEnumeration>
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
class FunctionLogDebugLocation : public NS::Referencing<FunctionLogDebugLocation>
|
||||
{
|
||||
public:
|
||||
NS::String* functionName() const;
|
||||
|
||||
NS::URL* URL() const;
|
||||
|
||||
NS::UInteger line() const;
|
||||
|
||||
NS::UInteger column() const;
|
||||
};
|
||||
|
||||
class FunctionLog : public NS::Referencing<FunctionLog>
|
||||
{
|
||||
public:
|
||||
MTL::FunctionLogType type() const;
|
||||
|
||||
NS::String* encoderLabel() const;
|
||||
|
||||
class Function* function() const;
|
||||
|
||||
class FunctionLogDebugLocation* debugLocation() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: functionName
|
||||
_MTL_INLINE NS::String* MTL::FunctionLogDebugLocation::functionName() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(functionName));
|
||||
}
|
||||
|
||||
// property: URL
|
||||
_MTL_INLINE NS::URL* MTL::FunctionLogDebugLocation::URL() const
|
||||
{
|
||||
return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(URL));
|
||||
}
|
||||
|
||||
// property: line
|
||||
_MTL_INLINE NS::UInteger MTL::FunctionLogDebugLocation::line() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(line));
|
||||
}
|
||||
|
||||
// property: column
|
||||
_MTL_INLINE NS::UInteger MTL::FunctionLogDebugLocation::column() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(column));
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::FunctionLogType MTL::FunctionLog::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionLogType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
// property: encoderLabel
|
||||
_MTL_INLINE NS::String* MTL::FunctionLog::encoderLabel() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(encoderLabel));
|
||||
}
|
||||
|
||||
// property: function
|
||||
_MTL_INLINE MTL::Function* MTL::FunctionLog::function() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(function));
|
||||
}
|
||||
|
||||
// property: debugLocation
|
||||
_MTL_INLINE MTL::FunctionLogDebugLocation* MTL::FunctionLog::debugLocation() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionLogDebugLocation*>(this, _MTL_PRIVATE_SEL(debugLocation));
|
||||
}
|
||||
342
src/contrib/metal-cpp/Metal/MTLFunctionStitching.hpp
Normal file
342
src/contrib/metal-cpp/Metal/MTLFunctionStitching.hpp
Normal file
@@ -0,0 +1,342 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLFunctionStitching.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLFunctionStitching.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, StitchedLibraryOptions) {
|
||||
StitchedLibraryOptionNone = 0,
|
||||
StitchedLibraryOptionFailOnBinaryArchiveMiss = 1,
|
||||
StitchedLibraryOptionStoreLibraryInMetalScript = 2,
|
||||
StitchedLibraryOptionStoreLibraryInMetalPipelinesScript = 2
|
||||
};
|
||||
|
||||
class FunctionStitchingAttribute : public NS::Referencing<FunctionStitchingAttribute>
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
class FunctionStitchingAttributeAlwaysInline : public NS::Referencing<FunctionStitchingAttributeAlwaysInline, FunctionStitchingAttribute>
|
||||
{
|
||||
public:
|
||||
static class FunctionStitchingAttributeAlwaysInline* alloc();
|
||||
|
||||
class FunctionStitchingAttributeAlwaysInline* init();
|
||||
};
|
||||
|
||||
class FunctionStitchingNode : public NS::Copying<FunctionStitchingNode>
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
class FunctionStitchingInputNode : public NS::Referencing<FunctionStitchingInputNode, FunctionStitchingNode>
|
||||
{
|
||||
public:
|
||||
static class FunctionStitchingInputNode* alloc();
|
||||
|
||||
class FunctionStitchingInputNode* init();
|
||||
|
||||
NS::UInteger argumentIndex() const;
|
||||
void setArgumentIndex(NS::UInteger argumentIndex);
|
||||
|
||||
MTL::FunctionStitchingInputNode* init(NS::UInteger argument);
|
||||
};
|
||||
|
||||
class FunctionStitchingFunctionNode : public NS::Referencing<FunctionStitchingFunctionNode, FunctionStitchingNode>
|
||||
{
|
||||
public:
|
||||
static class FunctionStitchingFunctionNode* alloc();
|
||||
|
||||
class FunctionStitchingFunctionNode* init();
|
||||
|
||||
NS::String* name() const;
|
||||
void setName(const NS::String* name);
|
||||
|
||||
NS::Array* arguments() const;
|
||||
void setArguments(const NS::Array* arguments);
|
||||
|
||||
NS::Array* controlDependencies() const;
|
||||
void setControlDependencies(const NS::Array* controlDependencies);
|
||||
|
||||
MTL::FunctionStitchingFunctionNode* init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies);
|
||||
};
|
||||
|
||||
class FunctionStitchingGraph : public NS::Copying<FunctionStitchingGraph>
|
||||
{
|
||||
public:
|
||||
static class FunctionStitchingGraph* alloc();
|
||||
|
||||
class FunctionStitchingGraph* init();
|
||||
|
||||
NS::String* functionName() const;
|
||||
void setFunctionName(const NS::String* functionName);
|
||||
|
||||
NS::Array* nodes() const;
|
||||
void setNodes(const NS::Array* nodes);
|
||||
|
||||
class FunctionStitchingFunctionNode* outputNode() const;
|
||||
void setOutputNode(const class FunctionStitchingFunctionNode* outputNode);
|
||||
|
||||
NS::Array* attributes() const;
|
||||
void setAttributes(const NS::Array* attributes);
|
||||
|
||||
MTL::FunctionStitchingGraph* init(const NS::String* functionName, const NS::Array* nodes, const class FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes);
|
||||
};
|
||||
|
||||
class StitchedLibraryDescriptor : public NS::Copying<StitchedLibraryDescriptor>
|
||||
{
|
||||
public:
|
||||
static class StitchedLibraryDescriptor* alloc();
|
||||
|
||||
class StitchedLibraryDescriptor* init();
|
||||
|
||||
NS::Array* functionGraphs() const;
|
||||
void setFunctionGraphs(const NS::Array* functionGraphs);
|
||||
|
||||
NS::Array* functions() const;
|
||||
void setFunctions(const NS::Array* functions);
|
||||
|
||||
NS::Array* binaryArchives() const;
|
||||
void setBinaryArchives(const NS::Array* binaryArchives);
|
||||
|
||||
MTL::StitchedLibraryOptions options() const;
|
||||
void setOptions(MTL::StitchedLibraryOptions options);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionStitchingAttributeAlwaysInline* MTL::FunctionStitchingAttributeAlwaysInline::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionStitchingAttributeAlwaysInline>(_MTL_PRIVATE_CLS(MTLFunctionStitchingAttributeAlwaysInline));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionStitchingAttributeAlwaysInline* MTL::FunctionStitchingAttributeAlwaysInline::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionStitchingAttributeAlwaysInline>();
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionStitchingInputNode>(_MTL_PRIVATE_CLS(MTLFunctionStitchingInputNode));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionStitchingInputNode>();
|
||||
}
|
||||
|
||||
// property: argumentIndex
|
||||
_MTL_INLINE NS::UInteger MTL::FunctionStitchingInputNode::argumentIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingInputNode::setArgumentIndex(NS::UInteger argumentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentIndex_), argumentIndex);
|
||||
}
|
||||
|
||||
// method: initWithArgumentIndex:
|
||||
_MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::init(NS::UInteger argument)
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionStitchingInputNode*>(this, _MTL_PRIVATE_SEL(initWithArgumentIndex_), argument);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionStitchingFunctionNode>(_MTL_PRIVATE_CLS(MTLFunctionStitchingFunctionNode));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionStitchingFunctionNode>();
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::FunctionStitchingFunctionNode::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingFunctionNode::setName(const NS::String* name)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
|
||||
}
|
||||
|
||||
// property: arguments
|
||||
_MTL_INLINE NS::Array* MTL::FunctionStitchingFunctionNode::arguments() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingFunctionNode::setArguments(const NS::Array* arguments)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArguments_), arguments);
|
||||
}
|
||||
|
||||
// property: controlDependencies
|
||||
_MTL_INLINE NS::Array* MTL::FunctionStitchingFunctionNode::controlDependencies() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(controlDependencies));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingFunctionNode::setControlDependencies(const NS::Array* controlDependencies)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlDependencies_), controlDependencies);
|
||||
}
|
||||
|
||||
// method: initWithName:arguments:controlDependencies:
|
||||
_MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies)
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionStitchingFunctionNode*>(this, _MTL_PRIVATE_SEL(initWithName_arguments_controlDependencies_), name, arguments, controlDependencies);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionStitchingGraph>(_MTL_PRIVATE_CLS(MTLFunctionStitchingGraph));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionStitchingGraph>();
|
||||
}
|
||||
|
||||
// property: functionName
|
||||
_MTL_INLINE NS::String* MTL::FunctionStitchingGraph::functionName() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(functionName));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingGraph::setFunctionName(const NS::String* functionName)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionName_), functionName);
|
||||
}
|
||||
|
||||
// property: nodes
|
||||
_MTL_INLINE NS::Array* MTL::FunctionStitchingGraph::nodes() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(nodes));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingGraph::setNodes(const NS::Array* nodes)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setNodes_), nodes);
|
||||
}
|
||||
|
||||
// property: outputNode
|
||||
_MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingGraph::outputNode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionStitchingFunctionNode*>(this, _MTL_PRIVATE_SEL(outputNode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingGraph::setOutputNode(const MTL::FunctionStitchingFunctionNode* outputNode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputNode_), outputNode);
|
||||
}
|
||||
|
||||
// property: attributes
|
||||
_MTL_INLINE NS::Array* MTL::FunctionStitchingGraph::attributes() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(attributes));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::FunctionStitchingGraph::setAttributes(const NS::Array* attributes)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAttributes_), attributes);
|
||||
}
|
||||
|
||||
// method: initWithFunctionName:nodes:outputNode:attributes:
|
||||
_MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::init(const NS::String* functionName, const NS::Array* nodes, const MTL::FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes)
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionStitchingGraph*>(this, _MTL_PRIVATE_SEL(initWithFunctionName_nodes_outputNode_attributes_), functionName, nodes, outputNode, attributes);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::StitchedLibraryDescriptor* MTL::StitchedLibraryDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::StitchedLibraryDescriptor>(_MTL_PRIVATE_CLS(MTLStitchedLibraryDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::StitchedLibraryDescriptor* MTL::StitchedLibraryDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::StitchedLibraryDescriptor>();
|
||||
}
|
||||
|
||||
// property: functionGraphs
|
||||
_MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::functionGraphs() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionGraphs));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StitchedLibraryDescriptor::setFunctionGraphs(const NS::Array* functionGraphs)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionGraphs_), functionGraphs);
|
||||
}
|
||||
|
||||
// property: functions
|
||||
_MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::functions() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StitchedLibraryDescriptor::setFunctions(const NS::Array* functions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_), functions);
|
||||
}
|
||||
|
||||
// property: binaryArchives
|
||||
_MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::binaryArchives() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StitchedLibraryDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
|
||||
}
|
||||
|
||||
// property: options
|
||||
_MTL_INLINE MTL::StitchedLibraryOptions MTL::StitchedLibraryDescriptor::options() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StitchedLibraryOptions>(this, _MTL_PRIVATE_SEL(options));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::StitchedLibraryDescriptor::setOptions(MTL::StitchedLibraryOptions options)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
|
||||
}
|
||||
2546
src/contrib/metal-cpp/Metal/MTLHeaderBridge.hpp
Normal file
2546
src/contrib/metal-cpp/Metal/MTLHeaderBridge.hpp
Normal file
File diff suppressed because it is too large
Load Diff
330
src/contrib/metal-cpp/Metal/MTLHeap.hpp
Normal file
330
src/contrib/metal-cpp/Metal/MTLHeap.hpp
Normal file
@@ -0,0 +1,330 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLHeap.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLAllocation.hpp"
|
||||
#include "MTLDevice.hpp"
|
||||
#include "MTLHeap.hpp"
|
||||
#include "MTLResource.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::Integer, HeapType) {
|
||||
HeapTypeAutomatic = 0,
|
||||
HeapTypePlacement = 1,
|
||||
HeapTypeSparse = 2,
|
||||
};
|
||||
|
||||
class HeapDescriptor : public NS::Copying<HeapDescriptor>
|
||||
{
|
||||
public:
|
||||
static class HeapDescriptor* alloc();
|
||||
|
||||
class HeapDescriptor* init();
|
||||
|
||||
NS::UInteger size() const;
|
||||
void setSize(NS::UInteger size);
|
||||
|
||||
MTL::StorageMode storageMode() const;
|
||||
void setStorageMode(MTL::StorageMode storageMode);
|
||||
|
||||
MTL::CPUCacheMode cpuCacheMode() const;
|
||||
void setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode);
|
||||
|
||||
MTL::SparsePageSize sparsePageSize() const;
|
||||
void setSparsePageSize(MTL::SparsePageSize sparsePageSize);
|
||||
|
||||
MTL::HazardTrackingMode hazardTrackingMode() const;
|
||||
void setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode);
|
||||
|
||||
MTL::ResourceOptions resourceOptions() const;
|
||||
void setResourceOptions(MTL::ResourceOptions resourceOptions);
|
||||
|
||||
MTL::HeapType type() const;
|
||||
void setType(MTL::HeapType type);
|
||||
};
|
||||
|
||||
class Heap : public NS::Referencing<Heap, Allocation>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
MTL::StorageMode storageMode() const;
|
||||
|
||||
MTL::CPUCacheMode cpuCacheMode() const;
|
||||
|
||||
MTL::HazardTrackingMode hazardTrackingMode() const;
|
||||
|
||||
MTL::ResourceOptions resourceOptions() const;
|
||||
|
||||
NS::UInteger size() const;
|
||||
|
||||
NS::UInteger usedSize() const;
|
||||
|
||||
NS::UInteger currentAllocatedSize() const;
|
||||
|
||||
NS::UInteger maxAvailableSize(NS::UInteger alignment);
|
||||
|
||||
class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);
|
||||
|
||||
class Texture* newTexture(const class TextureDescriptor* descriptor);
|
||||
|
||||
MTL::PurgeableState setPurgeableState(MTL::PurgeableState state);
|
||||
|
||||
MTL::HeapType type() const;
|
||||
|
||||
class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset);
|
||||
|
||||
class Texture* newTexture(const class TextureDescriptor* descriptor, NS::UInteger offset);
|
||||
|
||||
class AccelerationStructure* newAccelerationStructure(NS::UInteger size);
|
||||
|
||||
class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor);
|
||||
|
||||
class AccelerationStructure* newAccelerationStructure(NS::UInteger size, NS::UInteger offset);
|
||||
|
||||
class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor, NS::UInteger offset);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::HeapDescriptor>(_MTL_PRIVATE_CLS(MTLHeapDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::HeapDescriptor>();
|
||||
}
|
||||
|
||||
// property: size
|
||||
_MTL_INLINE NS::UInteger MTL::HeapDescriptor::size() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setSize(NS::UInteger size)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSize_), size);
|
||||
}
|
||||
|
||||
// property: storageMode
|
||||
_MTL_INLINE MTL::StorageMode MTL::HeapDescriptor::storageMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setStorageMode(MTL::StorageMode storageMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
|
||||
}
|
||||
|
||||
// property: cpuCacheMode
|
||||
_MTL_INLINE MTL::CPUCacheMode MTL::HeapDescriptor::cpuCacheMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCpuCacheMode_), cpuCacheMode);
|
||||
}
|
||||
|
||||
// property: sparsePageSize
|
||||
_MTL_INLINE MTL::SparsePageSize MTL::HeapDescriptor::sparsePageSize() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SparsePageSize>(this, _MTL_PRIVATE_SEL(sparsePageSize));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setSparsePageSize(MTL::SparsePageSize sparsePageSize)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSparsePageSize_), sparsePageSize);
|
||||
}
|
||||
|
||||
// property: hazardTrackingMode
|
||||
_MTL_INLINE MTL::HazardTrackingMode MTL::HeapDescriptor::hazardTrackingMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setHazardTrackingMode_), hazardTrackingMode);
|
||||
}
|
||||
|
||||
// property: resourceOptions
|
||||
_MTL_INLINE MTL::ResourceOptions MTL::HeapDescriptor::resourceOptions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setResourceOptions(MTL::ResourceOptions resourceOptions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResourceOptions_), resourceOptions);
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::HeapType MTL::HeapDescriptor::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::HeapDescriptor::setType(MTL::HeapType type)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::Heap::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Heap::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::Heap::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: storageMode
|
||||
_MTL_INLINE MTL::StorageMode MTL::Heap::storageMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
|
||||
}
|
||||
|
||||
// property: cpuCacheMode
|
||||
_MTL_INLINE MTL::CPUCacheMode MTL::Heap::cpuCacheMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
|
||||
}
|
||||
|
||||
// property: hazardTrackingMode
|
||||
_MTL_INLINE MTL::HazardTrackingMode MTL::Heap::hazardTrackingMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
|
||||
}
|
||||
|
||||
// property: resourceOptions
|
||||
_MTL_INLINE MTL::ResourceOptions MTL::Heap::resourceOptions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
|
||||
}
|
||||
|
||||
// property: size
|
||||
_MTL_INLINE NS::UInteger MTL::Heap::size() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
|
||||
}
|
||||
|
||||
// property: usedSize
|
||||
_MTL_INLINE NS::UInteger MTL::Heap::usedSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(usedSize));
|
||||
}
|
||||
|
||||
// property: currentAllocatedSize
|
||||
_MTL_INLINE NS::UInteger MTL::Heap::currentAllocatedSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(currentAllocatedSize));
|
||||
}
|
||||
|
||||
// method: maxAvailableSizeWithAlignment:
|
||||
_MTL_INLINE NS::UInteger MTL::Heap::maxAvailableSize(NS::UInteger alignment)
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxAvailableSizeWithAlignment_), alignment);
|
||||
}
|
||||
|
||||
// method: newBufferWithLength:options:
|
||||
_MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options)
|
||||
{
|
||||
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_), length, options);
|
||||
}
|
||||
|
||||
// method: newTextureWithDescriptor:
|
||||
_MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_), descriptor);
|
||||
}
|
||||
|
||||
// method: setPurgeableState:
|
||||
_MTL_INLINE MTL::PurgeableState MTL::Heap::setPurgeableState(MTL::PurgeableState state)
|
||||
{
|
||||
return Object::sendMessage<MTL::PurgeableState>(this, _MTL_PRIVATE_SEL(setPurgeableState_), state);
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::HeapType MTL::Heap::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
// method: newBufferWithLength:options:offset:
|
||||
_MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset)
|
||||
{
|
||||
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_offset_), length, options, offset);
|
||||
}
|
||||
|
||||
// method: newTextureWithDescriptor:offset:
|
||||
_MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset)
|
||||
{
|
||||
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_offset_), descriptor, offset);
|
||||
}
|
||||
|
||||
// method: newAccelerationStructureWithSize:
|
||||
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(NS::UInteger size)
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_), size);
|
||||
}
|
||||
|
||||
// method: newAccelerationStructureWithDescriptor:
|
||||
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor)
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_), descriptor);
|
||||
}
|
||||
|
||||
// method: newAccelerationStructureWithSize:offset:
|
||||
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(NS::UInteger size, NS::UInteger offset)
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_offset_), size, offset);
|
||||
}
|
||||
|
||||
// method: newAccelerationStructureWithDescriptor:offset:
|
||||
_MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor, NS::UInteger offset)
|
||||
{
|
||||
return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_offset_), descriptor, offset);
|
||||
}
|
||||
200
src/contrib/metal-cpp/Metal/MTLIOCommandBuffer.hpp
Normal file
200
src/contrib/metal-cpp/Metal/MTLIOCommandBuffer.hpp
Normal file
@@ -0,0 +1,200 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLIOCommandBuffer.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLIOCommandBuffer.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::Integer, IOStatus) {
|
||||
IOStatusPending = 0,
|
||||
IOStatusCancelled = 1,
|
||||
IOStatusError = 2,
|
||||
IOStatusComplete = 3,
|
||||
};
|
||||
|
||||
using IOCommandBufferHandler = void (^)(class IOCommandBuffer*);
|
||||
|
||||
using IOCommandBufferHandlerFunction = std::function<void(class IOCommandBuffer*)>;
|
||||
|
||||
class IOCommandBuffer : public NS::Referencing<IOCommandBuffer>
|
||||
{
|
||||
public:
|
||||
void addCompletedHandler(const MTL::IOCommandBufferHandlerFunction& function);
|
||||
|
||||
void addCompletedHandler(const MTL::IOCommandBufferHandler block);
|
||||
|
||||
void loadBytes(const void* pointer, NS::UInteger size, const class IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset);
|
||||
|
||||
void loadBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger size, const class IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset);
|
||||
|
||||
void loadTexture(const class Texture* texture, NS::UInteger slice, NS::UInteger level, MTL::Size size, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Origin destinationOrigin, const class IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset);
|
||||
|
||||
void copyStatusToBuffer(const class Buffer* buffer, NS::UInteger offset);
|
||||
|
||||
void commit();
|
||||
|
||||
void waitUntilCompleted();
|
||||
|
||||
void tryCancel();
|
||||
|
||||
void addBarrier();
|
||||
|
||||
void pushDebugGroup(const NS::String* string);
|
||||
|
||||
void popDebugGroup();
|
||||
|
||||
void enqueue();
|
||||
|
||||
void wait(const class SharedEvent* event, uint64_t value);
|
||||
|
||||
void signalEvent(const class SharedEvent* event, uint64_t value);
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
MTL::IOStatus status() const;
|
||||
|
||||
NS::Error* error() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::addCompletedHandler(const MTL::IOCommandBufferHandlerFunction& function)
|
||||
{
|
||||
__block IOCommandBufferHandlerFunction blockFunction = function;
|
||||
|
||||
addCompletedHandler(^(IOCommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
|
||||
}
|
||||
|
||||
// method: addCompletedHandler:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::addCompletedHandler(const MTL::IOCommandBufferHandler block)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addCompletedHandler_), block);
|
||||
}
|
||||
|
||||
// method: loadBytes:size:sourceHandle:sourceHandleOffset:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::loadBytes(const void* pointer, NS::UInteger size, const MTL::IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(loadBytes_size_sourceHandle_sourceHandleOffset_), pointer, size, sourceHandle, sourceHandleOffset);
|
||||
}
|
||||
|
||||
// method: loadBuffer:offset:size:sourceHandle:sourceHandleOffset:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::loadBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger size, const MTL::IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(loadBuffer_offset_size_sourceHandle_sourceHandleOffset_), buffer, offset, size, sourceHandle, sourceHandleOffset);
|
||||
}
|
||||
|
||||
// method: loadTexture:slice:level:size:sourceBytesPerRow:sourceBytesPerImage:destinationOrigin:sourceHandle:sourceHandleOffset:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::loadTexture(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level, MTL::Size size, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Origin destinationOrigin, const MTL::IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(loadTexture_slice_level_size_sourceBytesPerRow_sourceBytesPerImage_destinationOrigin_sourceHandle_sourceHandleOffset_), texture, slice, level, size, sourceBytesPerRow, sourceBytesPerImage, destinationOrigin, sourceHandle, sourceHandleOffset);
|
||||
}
|
||||
|
||||
// method: copyStatusToBuffer:offset:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::copyStatusToBuffer(const MTL::Buffer* buffer, NS::UInteger offset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyStatusToBuffer_offset_), buffer, offset);
|
||||
}
|
||||
|
||||
// method: commit
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::commit()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit));
|
||||
}
|
||||
|
||||
// method: waitUntilCompleted
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::waitUntilCompleted()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilCompleted));
|
||||
}
|
||||
|
||||
// method: tryCancel
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::tryCancel()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(tryCancel));
|
||||
}
|
||||
|
||||
// method: addBarrier
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::addBarrier()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addBarrier));
|
||||
}
|
||||
|
||||
// method: pushDebugGroup:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::pushDebugGroup(const NS::String* string)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
|
||||
}
|
||||
|
||||
// method: popDebugGroup
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::popDebugGroup()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
|
||||
}
|
||||
|
||||
// method: enqueue
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::enqueue()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueue));
|
||||
}
|
||||
|
||||
// method: waitForEvent:value:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::wait(const MTL::SharedEvent* event, uint64_t value)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForEvent_value_), event, value);
|
||||
}
|
||||
|
||||
// method: signalEvent:value:
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::signalEvent(const MTL::SharedEvent* event, uint64_t value)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(signalEvent_value_), event, value);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::IOCommandBuffer::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandBuffer::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: status
|
||||
_MTL_INLINE MTL::IOStatus MTL::IOCommandBuffer::status() const
|
||||
{
|
||||
return Object::sendMessage<MTL::IOStatus>(this, _MTL_PRIVATE_SEL(status));
|
||||
}
|
||||
|
||||
// property: error
|
||||
_MTL_INLINE NS::Error* MTL::IOCommandBuffer::error() const
|
||||
{
|
||||
return Object::sendMessage<NS::Error*>(this, _MTL_PRIVATE_SEL(error));
|
||||
}
|
||||
227
src/contrib/metal-cpp/Metal/MTLIOCommandQueue.hpp
Normal file
227
src/contrib/metal-cpp/Metal/MTLIOCommandQueue.hpp
Normal file
@@ -0,0 +1,227 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLIOCommandQueue.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLIOCommandQueue.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::Integer, IOPriority) {
|
||||
IOPriorityHigh = 0,
|
||||
IOPriorityNormal = 1,
|
||||
IOPriorityLow = 2,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, IOCommandQueueType) {
|
||||
IOCommandQueueTypeConcurrent = 0,
|
||||
IOCommandQueueTypeSerial = 1,
|
||||
};
|
||||
|
||||
_MTL_CONST(NS::ErrorDomain, IOErrorDomain);
|
||||
|
||||
_MTL_ENUM(NS::Integer, IOError) {
|
||||
IOErrorURLInvalid = 1,
|
||||
IOErrorInternal = 2,
|
||||
};
|
||||
|
||||
class IOCommandQueue : public NS::Referencing<IOCommandQueue>
|
||||
{
|
||||
public:
|
||||
void enqueueBarrier();
|
||||
|
||||
class IOCommandBuffer* commandBuffer();
|
||||
|
||||
class IOCommandBuffer* commandBufferWithUnretainedReferences();
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
};
|
||||
|
||||
class IOScratchBuffer : public NS::Referencing<IOScratchBuffer>
|
||||
{
|
||||
public:
|
||||
class Buffer* buffer() const;
|
||||
};
|
||||
|
||||
class IOScratchBufferAllocator : public NS::Referencing<IOScratchBufferAllocator>
|
||||
{
|
||||
public:
|
||||
class IOScratchBuffer* newScratchBuffer(NS::UInteger minimumSize);
|
||||
};
|
||||
|
||||
class IOCommandQueueDescriptor : public NS::Copying<IOCommandQueueDescriptor>
|
||||
{
|
||||
public:
|
||||
static class IOCommandQueueDescriptor* alloc();
|
||||
|
||||
class IOCommandQueueDescriptor* init();
|
||||
|
||||
NS::UInteger maxCommandBufferCount() const;
|
||||
void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount);
|
||||
|
||||
MTL::IOPriority priority() const;
|
||||
void setPriority(MTL::IOPriority priority);
|
||||
|
||||
MTL::IOCommandQueueType type() const;
|
||||
void setType(MTL::IOCommandQueueType type);
|
||||
|
||||
NS::UInteger maxCommandsInFlight() const;
|
||||
void setMaxCommandsInFlight(NS::UInteger maxCommandsInFlight);
|
||||
|
||||
class IOScratchBufferAllocator* scratchBufferAllocator() const;
|
||||
void setScratchBufferAllocator(const class IOScratchBufferAllocator* scratchBufferAllocator);
|
||||
};
|
||||
|
||||
class IOFileHandle : public NS::Referencing<IOFileHandle>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_MTL_PRIVATE_DEF_WEAK_CONST(NS::ErrorDomain, IOErrorDomain);
|
||||
|
||||
// method: enqueueBarrier
|
||||
_MTL_INLINE void MTL::IOCommandQueue::enqueueBarrier()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueueBarrier));
|
||||
}
|
||||
|
||||
// method: commandBuffer
|
||||
_MTL_INLINE MTL::IOCommandBuffer* MTL::IOCommandQueue::commandBuffer()
|
||||
{
|
||||
return Object::sendMessage<MTL::IOCommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
|
||||
}
|
||||
|
||||
// method: commandBufferWithUnretainedReferences
|
||||
_MTL_INLINE MTL::IOCommandBuffer* MTL::IOCommandQueue::commandBufferWithUnretainedReferences()
|
||||
{
|
||||
return Object::sendMessage<MTL::IOCommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::IOCommandQueue::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandQueue::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: buffer
|
||||
_MTL_INLINE MTL::Buffer* MTL::IOScratchBuffer::buffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(buffer));
|
||||
}
|
||||
|
||||
// method: newScratchBufferWithMinimumSize:
|
||||
_MTL_INLINE MTL::IOScratchBuffer* MTL::IOScratchBufferAllocator::newScratchBuffer(NS::UInteger minimumSize)
|
||||
{
|
||||
return Object::sendMessage<MTL::IOScratchBuffer*>(this, _MTL_PRIVATE_SEL(newScratchBufferWithMinimumSize_), minimumSize);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::IOCommandQueueDescriptor* MTL::IOCommandQueueDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::IOCommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLIOCommandQueueDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::IOCommandQueueDescriptor* MTL::IOCommandQueueDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::IOCommandQueueDescriptor>();
|
||||
}
|
||||
|
||||
// property: maxCommandBufferCount
|
||||
_MTL_INLINE NS::UInteger MTL::IOCommandQueueDescriptor::maxCommandBufferCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount);
|
||||
}
|
||||
|
||||
// property: priority
|
||||
_MTL_INLINE MTL::IOPriority MTL::IOCommandQueueDescriptor::priority() const
|
||||
{
|
||||
return Object::sendMessage<MTL::IOPriority>(this, _MTL_PRIVATE_SEL(priority));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandQueueDescriptor::setPriority(MTL::IOPriority priority)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPriority_), priority);
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::IOCommandQueueType MTL::IOCommandQueueDescriptor::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::IOCommandQueueType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandQueueDescriptor::setType(MTL::IOCommandQueueType type)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
|
||||
}
|
||||
|
||||
// property: maxCommandsInFlight
|
||||
_MTL_INLINE NS::UInteger MTL::IOCommandQueueDescriptor::maxCommandsInFlight() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandsInFlight));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandQueueDescriptor::setMaxCommandsInFlight(NS::UInteger maxCommandsInFlight)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandsInFlight_), maxCommandsInFlight);
|
||||
}
|
||||
|
||||
// property: scratchBufferAllocator
|
||||
_MTL_INLINE MTL::IOScratchBufferAllocator* MTL::IOCommandQueueDescriptor::scratchBufferAllocator() const
|
||||
{
|
||||
return Object::sendMessage<MTL::IOScratchBufferAllocator*>(this, _MTL_PRIVATE_SEL(scratchBufferAllocator));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOCommandQueueDescriptor::setScratchBufferAllocator(const MTL::IOScratchBufferAllocator* scratchBufferAllocator)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setScratchBufferAllocator_), scratchBufferAllocator);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::IOFileHandle::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IOFileHandle::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
94
src/contrib/metal-cpp/Metal/MTLIOCompressor.hpp
Normal file
94
src/contrib/metal-cpp/Metal/MTLIOCompressor.hpp
Normal file
@@ -0,0 +1,94 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLIOCompressor.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
#include "MTLDevice.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
using IOCompresionContext=void*;
|
||||
|
||||
_MTL_ENUM(NS::Integer, IOCompressionStatus) {
|
||||
IOCompressionStatusComplete = 0,
|
||||
IOCompressionStatusError = 1,
|
||||
};
|
||||
|
||||
size_t IOCompressionContextDefaultChunkSize();
|
||||
|
||||
IOCompresionContext IOCreateCompressionContext(const char* path, IOCompressionMethod type, size_t chunkSize);
|
||||
|
||||
void IOCompressionContextAppendData(IOCompresionContext context, const void* data, size_t size);
|
||||
|
||||
IOCompressionStatus IOFlushAndDestroyCompressionContext(IOCompresionContext context);
|
||||
|
||||
}
|
||||
|
||||
#if defined(MTL_PRIVATE_IMPLEMENTATION)
|
||||
|
||||
namespace MTL::Private {
|
||||
|
||||
MTL_DEF_FUNC(MTLIOCompressionContextDefaultChunkSize, size_t (*)(void));
|
||||
|
||||
MTL_DEF_FUNC( MTLIOCreateCompressionContext, void* (*)(const char*, MTL::IOCompressionMethod, size_t) );
|
||||
|
||||
MTL_DEF_FUNC( MTLIOCompressionContextAppendData, void (*)(void*, const void*, size_t) );
|
||||
|
||||
MTL_DEF_FUNC( MTLIOFlushAndDestroyCompressionContext, MTL::IOCompressionStatus (*)(void*) );
|
||||
|
||||
}
|
||||
|
||||
_NS_EXPORT size_t MTL::IOCompressionContextDefaultChunkSize()
|
||||
{
|
||||
return MTL::Private::MTLIOCompressionContextDefaultChunkSize();
|
||||
}
|
||||
|
||||
_NS_EXPORT void* MTL::IOCreateCompressionContext(const char* path, IOCompressionMethod type, size_t chunkSize)
|
||||
{
|
||||
if ( MTL::Private::MTLIOCreateCompressionContext )
|
||||
{
|
||||
return MTL::Private::MTLIOCreateCompressionContext( path, type, chunkSize );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_NS_EXPORT void MTL::IOCompressionContextAppendData(void* context, const void* data, size_t size)
|
||||
{
|
||||
if ( MTL::Private::MTLIOCompressionContextAppendData )
|
||||
{
|
||||
MTL::Private::MTLIOCompressionContextAppendData( context, data, size );
|
||||
}
|
||||
}
|
||||
|
||||
_NS_EXPORT MTL::IOCompressionStatus MTL::IOFlushAndDestroyCompressionContext(void* context)
|
||||
{
|
||||
if ( MTL::Private::MTLIOFlushAndDestroyCompressionContext )
|
||||
{
|
||||
return MTL::Private::MTLIOFlushAndDestroyCompressionContext( context );
|
||||
}
|
||||
return MTL::IOCompressionStatusError;
|
||||
}
|
||||
|
||||
#endif
|
||||
284
src/contrib/metal-cpp/Metal/MTLIndirectCommandBuffer.hpp
Normal file
284
src/contrib/metal-cpp/Metal/MTLIndirectCommandBuffer.hpp
Normal file
@@ -0,0 +1,284 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLIndirectCommandBuffer.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLIndirectCommandBuffer.hpp"
|
||||
#include "MTLResource.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, IndirectCommandType) {
|
||||
IndirectCommandTypeDraw = 1,
|
||||
IndirectCommandTypeDrawIndexed = 2,
|
||||
IndirectCommandTypeDrawPatches = 4,
|
||||
IndirectCommandTypeDrawIndexedPatches = 8,
|
||||
IndirectCommandTypeConcurrentDispatch = 32,
|
||||
IndirectCommandTypeConcurrentDispatchThreads = 64,
|
||||
IndirectCommandTypeDrawMeshThreadgroups = 128,
|
||||
IndirectCommandTypeDrawMeshThreads = 256,
|
||||
};
|
||||
|
||||
struct IndirectCommandBufferExecutionRange
|
||||
{
|
||||
uint32_t location;
|
||||
uint32_t length;
|
||||
} _MTL_PACKED;
|
||||
|
||||
class IndirectCommandBufferDescriptor : public NS::Copying<IndirectCommandBufferDescriptor>
|
||||
{
|
||||
public:
|
||||
static class IndirectCommandBufferDescriptor* alloc();
|
||||
|
||||
class IndirectCommandBufferDescriptor* init();
|
||||
|
||||
MTL::IndirectCommandType commandTypes() const;
|
||||
void setCommandTypes(MTL::IndirectCommandType commandTypes);
|
||||
|
||||
bool inheritPipelineState() const;
|
||||
void setInheritPipelineState(bool inheritPipelineState);
|
||||
|
||||
bool inheritBuffers() const;
|
||||
void setInheritBuffers(bool inheritBuffers);
|
||||
|
||||
NS::UInteger maxVertexBufferBindCount() const;
|
||||
void setMaxVertexBufferBindCount(NS::UInteger maxVertexBufferBindCount);
|
||||
|
||||
NS::UInteger maxFragmentBufferBindCount() const;
|
||||
void setMaxFragmentBufferBindCount(NS::UInteger maxFragmentBufferBindCount);
|
||||
|
||||
NS::UInteger maxKernelBufferBindCount() const;
|
||||
void setMaxKernelBufferBindCount(NS::UInteger maxKernelBufferBindCount);
|
||||
|
||||
NS::UInteger maxKernelThreadgroupMemoryBindCount() const;
|
||||
void setMaxKernelThreadgroupMemoryBindCount(NS::UInteger maxKernelThreadgroupMemoryBindCount);
|
||||
|
||||
NS::UInteger maxObjectBufferBindCount() const;
|
||||
void setMaxObjectBufferBindCount(NS::UInteger maxObjectBufferBindCount);
|
||||
|
||||
NS::UInteger maxMeshBufferBindCount() const;
|
||||
void setMaxMeshBufferBindCount(NS::UInteger maxMeshBufferBindCount);
|
||||
|
||||
NS::UInteger maxObjectThreadgroupMemoryBindCount() const;
|
||||
void setMaxObjectThreadgroupMemoryBindCount(NS::UInteger maxObjectThreadgroupMemoryBindCount);
|
||||
|
||||
bool supportRayTracing() const;
|
||||
void setSupportRayTracing(bool supportRayTracing);
|
||||
|
||||
bool supportDynamicAttributeStride() const;
|
||||
void setSupportDynamicAttributeStride(bool supportDynamicAttributeStride);
|
||||
};
|
||||
|
||||
class IndirectCommandBuffer : public NS::Referencing<IndirectCommandBuffer, Resource>
|
||||
{
|
||||
public:
|
||||
NS::UInteger size() const;
|
||||
|
||||
MTL::ResourceID gpuResourceID() const;
|
||||
|
||||
void reset(NS::Range range);
|
||||
|
||||
class IndirectRenderCommand* indirectRenderCommand(NS::UInteger commandIndex);
|
||||
|
||||
class IndirectComputeCommand* indirectComputeCommand(NS::UInteger commandIndex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::IndirectCommandBufferDescriptor* MTL::IndirectCommandBufferDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::IndirectCommandBufferDescriptor>(_MTL_PRIVATE_CLS(MTLIndirectCommandBufferDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::IndirectCommandBufferDescriptor* MTL::IndirectCommandBufferDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::IndirectCommandBufferDescriptor>();
|
||||
}
|
||||
|
||||
// property: commandTypes
|
||||
_MTL_INLINE MTL::IndirectCommandType MTL::IndirectCommandBufferDescriptor::commandTypes() const
|
||||
{
|
||||
return Object::sendMessage<MTL::IndirectCommandType>(this, _MTL_PRIVATE_SEL(commandTypes));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setCommandTypes(MTL::IndirectCommandType commandTypes)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCommandTypes_), commandTypes);
|
||||
}
|
||||
|
||||
// property: inheritPipelineState
|
||||
_MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::inheritPipelineState() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(inheritPipelineState));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setInheritPipelineState(bool inheritPipelineState)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInheritPipelineState_), inheritPipelineState);
|
||||
}
|
||||
|
||||
// property: inheritBuffers
|
||||
_MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::inheritBuffers() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(inheritBuffers));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setInheritBuffers(bool inheritBuffers)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInheritBuffers_), inheritBuffers);
|
||||
}
|
||||
|
||||
// property: maxVertexBufferBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxVertexBufferBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxVertexBufferBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxVertexBufferBindCount(NS::UInteger maxVertexBufferBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxVertexBufferBindCount_), maxVertexBufferBindCount);
|
||||
}
|
||||
|
||||
// property: maxFragmentBufferBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxFragmentBufferBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxFragmentBufferBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxFragmentBufferBindCount(NS::UInteger maxFragmentBufferBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxFragmentBufferBindCount_), maxFragmentBufferBindCount);
|
||||
}
|
||||
|
||||
// property: maxKernelBufferBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxKernelBufferBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxKernelBufferBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxKernelBufferBindCount(NS::UInteger maxKernelBufferBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxKernelBufferBindCount_), maxKernelBufferBindCount);
|
||||
}
|
||||
|
||||
// property: maxKernelThreadgroupMemoryBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxKernelThreadgroupMemoryBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxKernelThreadgroupMemoryBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxKernelThreadgroupMemoryBindCount(NS::UInteger maxKernelThreadgroupMemoryBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxKernelThreadgroupMemoryBindCount_), maxKernelThreadgroupMemoryBindCount);
|
||||
}
|
||||
|
||||
// property: maxObjectBufferBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxObjectBufferBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxObjectBufferBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxObjectBufferBindCount(NS::UInteger maxObjectBufferBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxObjectBufferBindCount_), maxObjectBufferBindCount);
|
||||
}
|
||||
|
||||
// property: maxMeshBufferBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxMeshBufferBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxMeshBufferBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxMeshBufferBindCount(NS::UInteger maxMeshBufferBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxMeshBufferBindCount_), maxMeshBufferBindCount);
|
||||
}
|
||||
|
||||
// property: maxObjectThreadgroupMemoryBindCount
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxObjectThreadgroupMemoryBindCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxObjectThreadgroupMemoryBindCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxObjectThreadgroupMemoryBindCount(NS::UInteger maxObjectThreadgroupMemoryBindCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxObjectThreadgroupMemoryBindCount_), maxObjectThreadgroupMemoryBindCount);
|
||||
}
|
||||
|
||||
// property: supportRayTracing
|
||||
_MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::supportRayTracing() const
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportRayTracing));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setSupportRayTracing(bool supportRayTracing)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportRayTracing_), supportRayTracing);
|
||||
}
|
||||
|
||||
// property: supportDynamicAttributeStride
|
||||
_MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::supportDynamicAttributeStride() const
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportDynamicAttributeStride));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setSupportDynamicAttributeStride(bool supportDynamicAttributeStride)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportDynamicAttributeStride_), supportDynamicAttributeStride);
|
||||
}
|
||||
|
||||
// property: size
|
||||
_MTL_INLINE NS::UInteger MTL::IndirectCommandBuffer::size() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
|
||||
}
|
||||
|
||||
// property: gpuResourceID
|
||||
_MTL_INLINE MTL::ResourceID MTL::IndirectCommandBuffer::gpuResourceID() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
|
||||
}
|
||||
|
||||
// method: resetWithRange:
|
||||
_MTL_INLINE void MTL::IndirectCommandBuffer::reset(NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetWithRange_), range);
|
||||
}
|
||||
|
||||
// method: indirectRenderCommandAtIndex:
|
||||
_MTL_INLINE MTL::IndirectRenderCommand* MTL::IndirectCommandBuffer::indirectRenderCommand(NS::UInteger commandIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::IndirectRenderCommand*>(this, _MTL_PRIVATE_SEL(indirectRenderCommandAtIndex_), commandIndex);
|
||||
}
|
||||
|
||||
// method: indirectComputeCommandAtIndex:
|
||||
_MTL_INLINE MTL::IndirectComputeCommand* MTL::IndirectCommandBuffer::indirectComputeCommand(NS::UInteger commandIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::IndirectComputeCommand*>(this, _MTL_PRIVATE_SEL(indirectComputeCommandAtIndex_), commandIndex);
|
||||
}
|
||||
259
src/contrib/metal-cpp/Metal/MTLIndirectCommandEncoder.hpp
Normal file
259
src/contrib/metal-cpp/Metal/MTLIndirectCommandEncoder.hpp
Normal file
@@ -0,0 +1,259 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLIndirectCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLRenderCommandEncoder.hpp"
|
||||
#include "MTLStageInputOutputDescriptor.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class IndirectRenderCommand : public NS::Referencing<IndirectRenderCommand>
|
||||
{
|
||||
public:
|
||||
void setRenderPipelineState(const class RenderPipelineState* pipelineState);
|
||||
|
||||
void setVertexBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setFragmentBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setVertexBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
|
||||
|
||||
void drawPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const class Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const class Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride);
|
||||
|
||||
void drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const class Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const class Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const class Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride);
|
||||
|
||||
void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance);
|
||||
|
||||
void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const class Buffer* indexBuffer, NS::UInteger indexBufferOffset, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance);
|
||||
|
||||
void setObjectThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
|
||||
|
||||
void setObjectBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setMeshBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void drawMeshThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);
|
||||
|
||||
void drawMeshThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);
|
||||
|
||||
void setBarrier();
|
||||
|
||||
void clearBarrier();
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
||||
class IndirectComputeCommand : public NS::Referencing<IndirectComputeCommand>
|
||||
{
|
||||
public:
|
||||
void setComputePipelineState(const class ComputePipelineState* pipelineState);
|
||||
|
||||
void setKernelBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setKernelBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
|
||||
|
||||
void concurrentDispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);
|
||||
|
||||
void concurrentDispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);
|
||||
|
||||
void setBarrier();
|
||||
|
||||
void clearBarrier();
|
||||
|
||||
void setImageblockWidth(NS::UInteger width, NS::UInteger height);
|
||||
|
||||
void reset();
|
||||
|
||||
void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
|
||||
|
||||
void setStageInRegion(MTL::Region region);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// method: setRenderPipelineState:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setRenderPipelineState(const MTL::RenderPipelineState* pipelineState)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_), pipelineState);
|
||||
}
|
||||
|
||||
// method: setVertexBuffer:offset:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBuffer_offset_atIndex_), buffer, offset, index);
|
||||
}
|
||||
|
||||
// method: setFragmentBuffer:offset:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setFragmentBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentBuffer_offset_atIndex_), buffer, offset, index);
|
||||
}
|
||||
|
||||
// method: setVertexBuffer:offset:attributeStride:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBuffer_offset_attributeStride_atIndex_), buffer, offset, stride, index);
|
||||
}
|
||||
|
||||
// method: drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::drawPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride_), numberOfPatchControlPoints, patchStart, patchCount, patchIndexBuffer, patchIndexBufferOffset, instanceCount, baseInstance, buffer, offset, instanceStride);
|
||||
}
|
||||
|
||||
// method: drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const MTL::Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride_), numberOfPatchControlPoints, patchStart, patchCount, patchIndexBuffer, patchIndexBufferOffset, controlPointIndexBuffer, controlPointIndexBufferOffset, instanceCount, baseInstance, buffer, offset, instanceStride);
|
||||
}
|
||||
|
||||
// method: drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::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);
|
||||
}
|
||||
|
||||
// method: drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const MTL::Buffer* indexBuffer, NS::UInteger indexBufferOffset, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance_), primitiveType, indexCount, indexType, indexBuffer, indexBufferOffset, instanceCount, baseVertex, baseInstance);
|
||||
}
|
||||
|
||||
// method: setObjectThreadgroupMemoryLength:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setObjectThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectThreadgroupMemoryLength_atIndex_), length, index);
|
||||
}
|
||||
|
||||
// method: setObjectBuffer:offset:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setObjectBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObjectBuffer_offset_atIndex_), buffer, offset, index);
|
||||
}
|
||||
|
||||
// method: setMeshBuffer:offset:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setMeshBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMeshBuffer_offset_atIndex_), buffer, offset, index);
|
||||
}
|
||||
|
||||
// method: drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::drawMeshThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup_), threadgroupsPerGrid, threadsPerObjectThreadgroup, threadsPerMeshThreadgroup);
|
||||
}
|
||||
|
||||
// method: drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::drawMeshThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup_), threadsPerGrid, threadsPerObjectThreadgroup, threadsPerMeshThreadgroup);
|
||||
}
|
||||
|
||||
// method: setBarrier
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::setBarrier()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBarrier));
|
||||
}
|
||||
|
||||
// method: clearBarrier
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::clearBarrier()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(clearBarrier));
|
||||
}
|
||||
|
||||
// method: reset
|
||||
_MTL_INLINE void MTL::IndirectRenderCommand::reset()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
|
||||
}
|
||||
|
||||
// method: setComputePipelineState:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setComputePipelineState(const MTL::ComputePipelineState* pipelineState)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_), pipelineState);
|
||||
}
|
||||
|
||||
// method: setKernelBuffer:offset:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setKernelBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setKernelBuffer_offset_atIndex_), buffer, offset, index);
|
||||
}
|
||||
|
||||
// method: setKernelBuffer:offset:attributeStride:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setKernelBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setKernelBuffer_offset_attributeStride_atIndex_), buffer, offset, stride, index);
|
||||
}
|
||||
|
||||
// method: concurrentDispatchThreadgroups:threadsPerThreadgroup:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::concurrentDispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(concurrentDispatchThreadgroups_threadsPerThreadgroup_), threadgroupsPerGrid, threadsPerThreadgroup);
|
||||
}
|
||||
|
||||
// method: concurrentDispatchThreads:threadsPerThreadgroup:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::concurrentDispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(concurrentDispatchThreads_threadsPerThreadgroup_), threadsPerGrid, threadsPerThreadgroup);
|
||||
}
|
||||
|
||||
// method: setBarrier
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setBarrier()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBarrier));
|
||||
}
|
||||
|
||||
// method: clearBarrier
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::clearBarrier()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(clearBarrier));
|
||||
}
|
||||
|
||||
// method: setImageblockWidth:height:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setImageblockWidth(NS::UInteger width, NS::UInteger height)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockWidth_height_), width, height);
|
||||
}
|
||||
|
||||
// method: reset
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::reset()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
|
||||
}
|
||||
|
||||
// method: setThreadgroupMemoryLength:atIndex:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_atIndex_), length, index);
|
||||
}
|
||||
|
||||
// method: setStageInRegion:
|
||||
_MTL_INLINE void MTL::IndirectComputeCommand::setStageInRegion(MTL::Region region)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegion_), region);
|
||||
}
|
||||
181
src/contrib/metal-cpp/Metal/MTLIntersectionFunctionTable.hpp
Normal file
181
src/contrib/metal-cpp/Metal/MTLIntersectionFunctionTable.hpp
Normal file
@@ -0,0 +1,181 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLIntersectionFunctionTable.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLIntersectionFunctionTable.hpp"
|
||||
#include "MTLResource.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_OPTIONS(NS::UInteger, IntersectionFunctionSignature) {
|
||||
IntersectionFunctionSignatureNone = 0,
|
||||
IntersectionFunctionSignatureInstancing = 1,
|
||||
IntersectionFunctionSignatureTriangleData = 2,
|
||||
IntersectionFunctionSignatureWorldSpaceData = 4,
|
||||
IntersectionFunctionSignatureInstanceMotion = 8,
|
||||
IntersectionFunctionSignaturePrimitiveMotion = 16,
|
||||
IntersectionFunctionSignatureExtendedLimits = 32,
|
||||
IntersectionFunctionSignatureMaxLevels = 64,
|
||||
IntersectionFunctionSignatureCurveData = 128,
|
||||
};
|
||||
|
||||
class IntersectionFunctionTableDescriptor : public NS::Copying<IntersectionFunctionTableDescriptor>
|
||||
{
|
||||
public:
|
||||
static class IntersectionFunctionTableDescriptor* alloc();
|
||||
|
||||
class IntersectionFunctionTableDescriptor* init();
|
||||
|
||||
static class IntersectionFunctionTableDescriptor* intersectionFunctionTableDescriptor();
|
||||
|
||||
NS::UInteger functionCount() const;
|
||||
void setFunctionCount(NS::UInteger functionCount);
|
||||
};
|
||||
|
||||
class IntersectionFunctionTable : public NS::Referencing<IntersectionFunctionTable, Resource>
|
||||
{
|
||||
public:
|
||||
void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
|
||||
|
||||
void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
|
||||
|
||||
MTL::ResourceID gpuResourceID() const;
|
||||
|
||||
void setFunction(const class FunctionHandle* function, NS::UInteger index);
|
||||
|
||||
void setFunctions(const class FunctionHandle* const functions[], NS::Range range);
|
||||
|
||||
void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index);
|
||||
|
||||
void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);
|
||||
|
||||
void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index);
|
||||
|
||||
void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);
|
||||
|
||||
void setVisibleFunctionTable(const class VisibleFunctionTable* functionTable, NS::UInteger bufferIndex);
|
||||
|
||||
void setVisibleFunctionTables(const class VisibleFunctionTable* const functionTables[], NS::Range bufferRange);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::IntersectionFunctionTableDescriptor* MTL::IntersectionFunctionTableDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::IntersectionFunctionTableDescriptor>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionTableDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::IntersectionFunctionTableDescriptor* MTL::IntersectionFunctionTableDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::IntersectionFunctionTableDescriptor>();
|
||||
}
|
||||
|
||||
// static method: intersectionFunctionTableDescriptor
|
||||
_MTL_INLINE MTL::IntersectionFunctionTableDescriptor* MTL::IntersectionFunctionTableDescriptor::intersectionFunctionTableDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::IntersectionFunctionTableDescriptor*>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionTableDescriptor), _MTL_PRIVATE_SEL(intersectionFunctionTableDescriptor));
|
||||
}
|
||||
|
||||
// property: functionCount
|
||||
_MTL_INLINE NS::UInteger MTL::IntersectionFunctionTableDescriptor::functionCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(functionCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTableDescriptor::setFunctionCount(NS::UInteger functionCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionCount_), functionCount);
|
||||
}
|
||||
|
||||
// method: setBuffer:offset:atIndex:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);
|
||||
}
|
||||
|
||||
// method: setBuffers:offsets:withRange:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::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);
|
||||
}
|
||||
|
||||
// property: gpuResourceID
|
||||
_MTL_INLINE MTL::ResourceID MTL::IntersectionFunctionTable::gpuResourceID() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
|
||||
}
|
||||
|
||||
// method: setFunction:atIndex:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setFunction(const MTL::FunctionHandle* function, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunction_atIndex_), function, index);
|
||||
}
|
||||
|
||||
// method: setFunctions:withRange:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setFunctions(const MTL::FunctionHandle* const functions[], NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_withRange_), functions, range);
|
||||
}
|
||||
|
||||
// method: setOpaqueTriangleIntersectionFunctionWithSignature:atIndex:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueTriangleIntersectionFunctionWithSignature_atIndex_), signature, index);
|
||||
}
|
||||
|
||||
// method: setOpaqueTriangleIntersectionFunctionWithSignature:withRange:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueTriangleIntersectionFunctionWithSignature_withRange_), signature, range);
|
||||
}
|
||||
|
||||
// method: setOpaqueCurveIntersectionFunctionWithSignature:atIndex:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueCurveIntersectionFunctionWithSignature_atIndex_), signature, index);
|
||||
}
|
||||
|
||||
// method: setOpaqueCurveIntersectionFunctionWithSignature:withRange:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueCurveIntersectionFunctionWithSignature_withRange_), signature, range);
|
||||
}
|
||||
|
||||
// method: setVisibleFunctionTable:atBufferIndex:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setVisibleFunctionTable(const MTL::VisibleFunctionTable* functionTable, NS::UInteger bufferIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atBufferIndex_), functionTable, bufferIndex);
|
||||
}
|
||||
|
||||
// method: setVisibleFunctionTables:withBufferRange:
|
||||
_MTL_INLINE void MTL::IntersectionFunctionTable::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const functionTables[], NS::Range bufferRange)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withBufferRange_), functionTables, bufferRange);
|
||||
}
|
||||
746
src/contrib/metal-cpp/Metal/MTLLibrary.hpp
Normal file
746
src/contrib/metal-cpp/Metal/MTLLibrary.hpp
Normal file
@@ -0,0 +1,746 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLLibrary.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLArgument.hpp"
|
||||
#include "MTLFunctionDescriptor.hpp"
|
||||
#include "MTLLibrary.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, PatchType) {
|
||||
PatchTypeNone = 0,
|
||||
PatchTypeTriangle = 1,
|
||||
PatchTypeQuad = 2,
|
||||
};
|
||||
|
||||
class VertexAttribute : public NS::Referencing<VertexAttribute>
|
||||
{
|
||||
public:
|
||||
static class VertexAttribute* alloc();
|
||||
|
||||
class VertexAttribute* init();
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
NS::UInteger attributeIndex() const;
|
||||
|
||||
MTL::DataType attributeType() const;
|
||||
|
||||
bool active() const;
|
||||
|
||||
bool patchData() const;
|
||||
|
||||
bool patchControlPointData() const;
|
||||
};
|
||||
|
||||
class Attribute : public NS::Referencing<Attribute>
|
||||
{
|
||||
public:
|
||||
static class Attribute* alloc();
|
||||
|
||||
class Attribute* init();
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
NS::UInteger attributeIndex() const;
|
||||
|
||||
MTL::DataType attributeType() const;
|
||||
|
||||
bool active() const;
|
||||
|
||||
bool patchData() const;
|
||||
|
||||
bool patchControlPointData() const;
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, FunctionType) {
|
||||
FunctionTypeVertex = 1,
|
||||
FunctionTypeFragment = 2,
|
||||
FunctionTypeKernel = 3,
|
||||
FunctionTypeVisible = 5,
|
||||
FunctionTypeIntersection = 6,
|
||||
FunctionTypeMesh = 7,
|
||||
FunctionTypeObject = 8,
|
||||
};
|
||||
|
||||
class FunctionConstant : public NS::Referencing<FunctionConstant>
|
||||
{
|
||||
public:
|
||||
static class FunctionConstant* alloc();
|
||||
|
||||
class FunctionConstant* init();
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
MTL::DataType type() const;
|
||||
|
||||
NS::UInteger index() const;
|
||||
|
||||
bool required() const;
|
||||
};
|
||||
|
||||
using AutoreleasedArgument = class Argument*;
|
||||
|
||||
class Function : public NS::Referencing<Function>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
MTL::FunctionType functionType() const;
|
||||
|
||||
MTL::PatchType patchType() const;
|
||||
|
||||
NS::Integer patchControlPointCount() const;
|
||||
|
||||
NS::Array* vertexAttributes() const;
|
||||
|
||||
NS::Array* stageInputAttributes() const;
|
||||
|
||||
NS::String* name() const;
|
||||
|
||||
NS::Dictionary* functionConstantsDictionary() const;
|
||||
|
||||
class ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex);
|
||||
|
||||
class ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex, const MTL::AutoreleasedArgument* reflection);
|
||||
|
||||
MTL::FunctionOptions options() const;
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, LanguageVersion) {
|
||||
LanguageVersion1_0 = 65536,
|
||||
LanguageVersion1_1 = 65537,
|
||||
LanguageVersion1_2 = 65538,
|
||||
LanguageVersion2_0 = 131072,
|
||||
LanguageVersion2_1 = 131073,
|
||||
LanguageVersion2_2 = 131074,
|
||||
LanguageVersion2_3 = 131075,
|
||||
LanguageVersion2_4 = 131076,
|
||||
LanguageVersion3_0 = 196608,
|
||||
LanguageVersion3_1 = 196609,
|
||||
LanguageVersion3_2 = 196610,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, LibraryType) {
|
||||
LibraryTypeExecutable = 0,
|
||||
LibraryTypeDynamic = 1,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, LibraryOptimizationLevel) {
|
||||
LibraryOptimizationLevelDefault = 0,
|
||||
LibraryOptimizationLevelSize = 1,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, CompileSymbolVisibility) {
|
||||
CompileSymbolVisibilityDefault = 0,
|
||||
CompileSymbolVisibilityHidden = 1,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, MathMode) {
|
||||
MathModeSafe = 0,
|
||||
MathModeRelaxed = 1,
|
||||
MathModeFast = 2,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, MathFloatingPointFunctions) {
|
||||
MathFloatingPointFunctionsFast = 0,
|
||||
MathFloatingPointFunctionsPrecise = 1,
|
||||
};
|
||||
|
||||
class CompileOptions : public NS::Copying<CompileOptions>
|
||||
{
|
||||
public:
|
||||
static class CompileOptions* alloc();
|
||||
|
||||
class CompileOptions* init();
|
||||
|
||||
NS::Dictionary* preprocessorMacros() const;
|
||||
void setPreprocessorMacros(const NS::Dictionary* preprocessorMacros);
|
||||
|
||||
bool fastMathEnabled() const;
|
||||
void setFastMathEnabled(bool fastMathEnabled);
|
||||
|
||||
MTL::MathMode mathMode() const;
|
||||
void setMathMode(MTL::MathMode mathMode);
|
||||
|
||||
MTL::MathFloatingPointFunctions mathFloatingPointFunctions() const;
|
||||
void setMathFloatingPointFunctions(MTL::MathFloatingPointFunctions mathFloatingPointFunctions);
|
||||
|
||||
MTL::LanguageVersion languageVersion() const;
|
||||
void setLanguageVersion(MTL::LanguageVersion languageVersion);
|
||||
|
||||
MTL::LibraryType libraryType() const;
|
||||
void setLibraryType(MTL::LibraryType libraryType);
|
||||
|
||||
NS::String* installName() const;
|
||||
void setInstallName(const NS::String* installName);
|
||||
|
||||
NS::Array* libraries() const;
|
||||
void setLibraries(const NS::Array* libraries);
|
||||
|
||||
bool preserveInvariance() const;
|
||||
void setPreserveInvariance(bool preserveInvariance);
|
||||
|
||||
MTL::LibraryOptimizationLevel optimizationLevel() const;
|
||||
void setOptimizationLevel(MTL::LibraryOptimizationLevel optimizationLevel);
|
||||
|
||||
MTL::CompileSymbolVisibility compileSymbolVisibility() const;
|
||||
void setCompileSymbolVisibility(MTL::CompileSymbolVisibility compileSymbolVisibility);
|
||||
|
||||
bool allowReferencingUndefinedSymbols() const;
|
||||
void setAllowReferencingUndefinedSymbols(bool allowReferencingUndefinedSymbols);
|
||||
|
||||
NS::UInteger maxTotalThreadsPerThreadgroup() const;
|
||||
void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
|
||||
|
||||
bool enableLogging() const;
|
||||
void setEnableLogging(bool enableLogging);
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, LibraryError) {
|
||||
LibraryErrorUnsupported = 1,
|
||||
LibraryErrorInternal = 2,
|
||||
LibraryErrorCompileFailure = 3,
|
||||
LibraryErrorCompileWarning = 4,
|
||||
LibraryErrorFunctionNotFound = 5,
|
||||
LibraryErrorFileNotFound = 6,
|
||||
};
|
||||
|
||||
class Library : public NS::Referencing<Library>
|
||||
{
|
||||
public:
|
||||
void newFunction(const NS::String* pFunctionName, const class FunctionConstantValues* pConstantValues, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler);
|
||||
|
||||
void newFunction(const class FunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler);
|
||||
|
||||
void newIntersectionFunction(const class IntersectionFunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler);
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
class Function* newFunction(const NS::String* functionName);
|
||||
|
||||
class Function* newFunction(const NS::String* name, const class FunctionConstantValues* constantValues, NS::Error** error);
|
||||
|
||||
void newFunction(const NS::String* name, const class FunctionConstantValues* constantValues, void (^completionHandler)(MTL::Function*, NS::Error*));
|
||||
|
||||
void newFunction(const class FunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*));
|
||||
|
||||
class Function* newFunction(const class FunctionDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
void newIntersectionFunction(const class IntersectionFunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*));
|
||||
|
||||
class Function* newIntersectionFunction(const class IntersectionFunctionDescriptor* descriptor, NS::Error** error);
|
||||
|
||||
NS::Array* functionNames() const;
|
||||
|
||||
MTL::LibraryType type() const;
|
||||
|
||||
NS::String* installName() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::VertexAttribute* MTL::VertexAttribute::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::VertexAttribute>(_MTL_PRIVATE_CLS(MTLVertexAttribute));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::VertexAttribute* MTL::VertexAttribute::init()
|
||||
{
|
||||
return NS::Object::init<MTL::VertexAttribute>();
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::VertexAttribute::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: attributeIndex
|
||||
_MTL_INLINE NS::UInteger MTL::VertexAttribute::attributeIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(attributeIndex));
|
||||
}
|
||||
|
||||
// property: attributeType
|
||||
_MTL_INLINE MTL::DataType MTL::VertexAttribute::attributeType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(attributeType));
|
||||
}
|
||||
|
||||
// property: active
|
||||
_MTL_INLINE bool MTL::VertexAttribute::active() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
|
||||
}
|
||||
|
||||
// property: patchData
|
||||
_MTL_INLINE bool MTL::VertexAttribute::patchData() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchData));
|
||||
}
|
||||
|
||||
// property: patchControlPointData
|
||||
_MTL_INLINE bool MTL::VertexAttribute::patchControlPointData() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchControlPointData));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::Attribute* MTL::Attribute::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::Attribute>(_MTL_PRIVATE_CLS(MTLAttribute));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::Attribute* MTL::Attribute::init()
|
||||
{
|
||||
return NS::Object::init<MTL::Attribute>();
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::Attribute::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: attributeIndex
|
||||
_MTL_INLINE NS::UInteger MTL::Attribute::attributeIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(attributeIndex));
|
||||
}
|
||||
|
||||
// property: attributeType
|
||||
_MTL_INLINE MTL::DataType MTL::Attribute::attributeType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(attributeType));
|
||||
}
|
||||
|
||||
// property: active
|
||||
_MTL_INLINE bool MTL::Attribute::active() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
|
||||
}
|
||||
|
||||
// property: patchData
|
||||
_MTL_INLINE bool MTL::Attribute::patchData() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchData));
|
||||
}
|
||||
|
||||
// property: patchControlPointData
|
||||
_MTL_INLINE bool MTL::Attribute::patchControlPointData() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchControlPointData));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::FunctionConstant* MTL::FunctionConstant::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::FunctionConstant>(_MTL_PRIVATE_CLS(MTLFunctionConstant));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::FunctionConstant* MTL::FunctionConstant::init()
|
||||
{
|
||||
return NS::Object::init<MTL::FunctionConstant>();
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::FunctionConstant::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::DataType MTL::FunctionConstant::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
// property: index
|
||||
_MTL_INLINE NS::UInteger MTL::FunctionConstant::index() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
|
||||
}
|
||||
|
||||
// property: required
|
||||
_MTL_INLINE bool MTL::FunctionConstant::required() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(required));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::Function::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Function::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::Function::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: functionType
|
||||
_MTL_INLINE MTL::FunctionType MTL::Function::functionType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionType>(this, _MTL_PRIVATE_SEL(functionType));
|
||||
}
|
||||
|
||||
// property: patchType
|
||||
_MTL_INLINE MTL::PatchType MTL::Function::patchType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::PatchType>(this, _MTL_PRIVATE_SEL(patchType));
|
||||
}
|
||||
|
||||
// property: patchControlPointCount
|
||||
_MTL_INLINE NS::Integer MTL::Function::patchControlPointCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::Integer>(this, _MTL_PRIVATE_SEL(patchControlPointCount));
|
||||
}
|
||||
|
||||
// property: vertexAttributes
|
||||
_MTL_INLINE NS::Array* MTL::Function::vertexAttributes() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(vertexAttributes));
|
||||
}
|
||||
|
||||
// property: stageInputAttributes
|
||||
_MTL_INLINE NS::Array* MTL::Function::stageInputAttributes() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(stageInputAttributes));
|
||||
}
|
||||
|
||||
// property: name
|
||||
_MTL_INLINE NS::String* MTL::Function::name() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
|
||||
}
|
||||
|
||||
// property: functionConstantsDictionary
|
||||
_MTL_INLINE NS::Dictionary* MTL::Function::functionConstantsDictionary() const
|
||||
{
|
||||
return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(functionConstantsDictionary));
|
||||
}
|
||||
|
||||
// method: newArgumentEncoderWithBufferIndex:
|
||||
_MTL_INLINE MTL::ArgumentEncoder* MTL::Function::newArgumentEncoder(NS::UInteger bufferIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithBufferIndex_), bufferIndex);
|
||||
}
|
||||
|
||||
// method: newArgumentEncoderWithBufferIndex:reflection:
|
||||
_MTL_INLINE MTL::ArgumentEncoder* MTL::Function::newArgumentEncoder(NS::UInteger bufferIndex, const MTL::AutoreleasedArgument* reflection)
|
||||
{
|
||||
return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithBufferIndex_reflection_), bufferIndex, reflection);
|
||||
}
|
||||
|
||||
// property: options
|
||||
_MTL_INLINE MTL::FunctionOptions MTL::Function::options() const
|
||||
{
|
||||
return Object::sendMessage<MTL::FunctionOptions>(this, _MTL_PRIVATE_SEL(options));
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::CompileOptions* MTL::CompileOptions::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::CompileOptions>(_MTL_PRIVATE_CLS(MTLCompileOptions));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::CompileOptions* MTL::CompileOptions::init()
|
||||
{
|
||||
return NS::Object::init<MTL::CompileOptions>();
|
||||
}
|
||||
|
||||
// property: preprocessorMacros
|
||||
_MTL_INLINE NS::Dictionary* MTL::CompileOptions::preprocessorMacros() const
|
||||
{
|
||||
return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(preprocessorMacros));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setPreprocessorMacros(const NS::Dictionary* preprocessorMacros)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreprocessorMacros_), preprocessorMacros);
|
||||
}
|
||||
|
||||
// property: fastMathEnabled
|
||||
_MTL_INLINE bool MTL::CompileOptions::fastMathEnabled() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(fastMathEnabled));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setFastMathEnabled(bool fastMathEnabled)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFastMathEnabled_), fastMathEnabled);
|
||||
}
|
||||
|
||||
// property: mathMode
|
||||
_MTL_INLINE MTL::MathMode MTL::CompileOptions::mathMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::MathMode>(this, _MTL_PRIVATE_SEL(mathMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setMathMode(MTL::MathMode mathMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMathMode_), mathMode);
|
||||
}
|
||||
|
||||
// property: mathFloatingPointFunctions
|
||||
_MTL_INLINE MTL::MathFloatingPointFunctions MTL::CompileOptions::mathFloatingPointFunctions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::MathFloatingPointFunctions>(this, _MTL_PRIVATE_SEL(mathFloatingPointFunctions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setMathFloatingPointFunctions(MTL::MathFloatingPointFunctions mathFloatingPointFunctions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMathFloatingPointFunctions_), mathFloatingPointFunctions);
|
||||
}
|
||||
|
||||
// property: languageVersion
|
||||
_MTL_INLINE MTL::LanguageVersion MTL::CompileOptions::languageVersion() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LanguageVersion>(this, _MTL_PRIVATE_SEL(languageVersion));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setLanguageVersion(MTL::LanguageVersion languageVersion)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLanguageVersion_), languageVersion);
|
||||
}
|
||||
|
||||
// property: libraryType
|
||||
_MTL_INLINE MTL::LibraryType MTL::CompileOptions::libraryType() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LibraryType>(this, _MTL_PRIVATE_SEL(libraryType));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setLibraryType(MTL::LibraryType libraryType)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLibraryType_), libraryType);
|
||||
}
|
||||
|
||||
// property: installName
|
||||
_MTL_INLINE NS::String* MTL::CompileOptions::installName() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(installName));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setInstallName(const NS::String* installName)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstallName_), installName);
|
||||
}
|
||||
|
||||
// property: libraries
|
||||
_MTL_INLINE NS::Array* MTL::CompileOptions::libraries() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(libraries));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setLibraries(const NS::Array* libraries)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLibraries_), libraries);
|
||||
}
|
||||
|
||||
// property: preserveInvariance
|
||||
_MTL_INLINE bool MTL::CompileOptions::preserveInvariance() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(preserveInvariance));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setPreserveInvariance(bool preserveInvariance)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreserveInvariance_), preserveInvariance);
|
||||
}
|
||||
|
||||
// property: optimizationLevel
|
||||
_MTL_INLINE MTL::LibraryOptimizationLevel MTL::CompileOptions::optimizationLevel() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LibraryOptimizationLevel>(this, _MTL_PRIVATE_SEL(optimizationLevel));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setOptimizationLevel(MTL::LibraryOptimizationLevel optimizationLevel)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptimizationLevel_), optimizationLevel);
|
||||
}
|
||||
|
||||
// property: compileSymbolVisibility
|
||||
_MTL_INLINE MTL::CompileSymbolVisibility MTL::CompileOptions::compileSymbolVisibility() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CompileSymbolVisibility>(this, _MTL_PRIVATE_SEL(compileSymbolVisibility));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setCompileSymbolVisibility(MTL::CompileSymbolVisibility compileSymbolVisibility)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCompileSymbolVisibility_), compileSymbolVisibility);
|
||||
}
|
||||
|
||||
// property: allowReferencingUndefinedSymbols
|
||||
_MTL_INLINE bool MTL::CompileOptions::allowReferencingUndefinedSymbols() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(allowReferencingUndefinedSymbols));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setAllowReferencingUndefinedSymbols(bool allowReferencingUndefinedSymbols)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAllowReferencingUndefinedSymbols_), allowReferencingUndefinedSymbols);
|
||||
}
|
||||
|
||||
// property: maxTotalThreadsPerThreadgroup
|
||||
_MTL_INLINE NS::UInteger MTL::CompileOptions::maxTotalThreadsPerThreadgroup() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
|
||||
}
|
||||
|
||||
// property: enableLogging
|
||||
_MTL_INLINE bool MTL::CompileOptions::enableLogging() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(enableLogging));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::CompileOptions::setEnableLogging(bool enableLogging)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEnableLogging_), enableLogging);
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Library::newFunction(const NS::String* pFunctionName, const FunctionConstantValues* pConstantValues, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler)
|
||||
{
|
||||
__block std::function<void(Function * pFunction, NS::Error * pError)> blockCompletionHandler = completionHandler;
|
||||
|
||||
newFunction(pFunctionName, pConstantValues, ^(Function* pFunction, NS::Error* pError) { blockCompletionHandler(pFunction, pError); });
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Library::newFunction(const FunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler)
|
||||
{
|
||||
__block std::function<void(Function * pFunction, NS::Error * pError)> blockCompletionHandler = completionHandler;
|
||||
|
||||
newFunction(pDescriptor, ^(Function* pFunction, NS::Error* pError) { blockCompletionHandler(pFunction, pError); });
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Library::newIntersectionFunction(const IntersectionFunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler)
|
||||
{
|
||||
__block std::function<void(Function * pFunction, NS::Error * pError)> blockCompletionHandler = completionHandler;
|
||||
|
||||
newIntersectionFunction(pDescriptor, ^(Function* pFunction, NS::Error* pError) { blockCompletionHandler(pFunction, pError); });
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::Library::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Library::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::Library::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// method: newFunctionWithName:
|
||||
_MTL_INLINE MTL::Function* MTL::Library::newFunction(const NS::String* functionName)
|
||||
{
|
||||
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newFunctionWithName_), functionName);
|
||||
}
|
||||
|
||||
// method: newFunctionWithName:constantValues:error:
|
||||
_MTL_INLINE MTL::Function* MTL::Library::newFunction(const NS::String* name, const MTL::FunctionConstantValues* constantValues, NS::Error** error)
|
||||
{
|
||||
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newFunctionWithName_constantValues_error_), name, constantValues, error);
|
||||
}
|
||||
|
||||
// method: newFunctionWithName:constantValues:completionHandler:
|
||||
_MTL_INLINE void MTL::Library::newFunction(const NS::String* name, const MTL::FunctionConstantValues* constantValues, void (^completionHandler)(MTL::Function*, NS::Error*))
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newFunctionWithName_constantValues_completionHandler_), name, constantValues, completionHandler);
|
||||
}
|
||||
|
||||
// method: newFunctionWithDescriptor:completionHandler:
|
||||
_MTL_INLINE void MTL::Library::newFunction(const MTL::FunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*))
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newFunctionWithDescriptor_completionHandler_), descriptor, completionHandler);
|
||||
}
|
||||
|
||||
// method: newFunctionWithDescriptor:error:
|
||||
_MTL_INLINE MTL::Function* MTL::Library::newFunction(const MTL::FunctionDescriptor* descriptor, NS::Error** error)
|
||||
{
|
||||
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newFunctionWithDescriptor_error_), descriptor, error);
|
||||
}
|
||||
|
||||
// method: newIntersectionFunctionWithDescriptor:completionHandler:
|
||||
_MTL_INLINE void MTL::Library::newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*))
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionWithDescriptor_completionHandler_), descriptor, completionHandler);
|
||||
}
|
||||
|
||||
// method: newIntersectionFunctionWithDescriptor:error:
|
||||
_MTL_INLINE MTL::Function* MTL::Library::newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* descriptor, NS::Error** error)
|
||||
{
|
||||
return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionWithDescriptor_error_), descriptor, error);
|
||||
}
|
||||
|
||||
// property: functionNames
|
||||
_MTL_INLINE NS::Array* MTL::Library::functionNames() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionNames));
|
||||
}
|
||||
|
||||
// property: type
|
||||
_MTL_INLINE MTL::LibraryType MTL::Library::type() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LibraryType>(this, _MTL_PRIVATE_SEL(type));
|
||||
}
|
||||
|
||||
// property: installName
|
||||
_MTL_INLINE NS::String* MTL::Library::installName() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(installName));
|
||||
}
|
||||
115
src/contrib/metal-cpp/Metal/MTLLinkedFunctions.hpp
Normal file
115
src/contrib/metal-cpp/Metal/MTLLinkedFunctions.hpp
Normal file
@@ -0,0 +1,115 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLLinkedFunctions.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class LinkedFunctions : public NS::Copying<LinkedFunctions>
|
||||
{
|
||||
public:
|
||||
static class LinkedFunctions* alloc();
|
||||
|
||||
class LinkedFunctions* init();
|
||||
|
||||
static class LinkedFunctions* linkedFunctions();
|
||||
|
||||
NS::Array* functions() const;
|
||||
void setFunctions(const NS::Array* functions);
|
||||
|
||||
NS::Array* binaryFunctions() const;
|
||||
void setBinaryFunctions(const NS::Array* binaryFunctions);
|
||||
|
||||
NS::Dictionary* groups() const;
|
||||
void setGroups(const NS::Dictionary* groups);
|
||||
|
||||
NS::Array* privateFunctions() const;
|
||||
void setPrivateFunctions(const NS::Array* privateFunctions);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::LinkedFunctions* MTL::LinkedFunctions::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::LinkedFunctions>(_MTL_PRIVATE_CLS(MTLLinkedFunctions));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::LinkedFunctions* MTL::LinkedFunctions::init()
|
||||
{
|
||||
return NS::Object::init<MTL::LinkedFunctions>();
|
||||
}
|
||||
|
||||
// static method: linkedFunctions
|
||||
_MTL_INLINE MTL::LinkedFunctions* MTL::LinkedFunctions::linkedFunctions()
|
||||
{
|
||||
return Object::sendMessage<MTL::LinkedFunctions*>(_MTL_PRIVATE_CLS(MTLLinkedFunctions), _MTL_PRIVATE_SEL(linkedFunctions));
|
||||
}
|
||||
|
||||
// property: functions
|
||||
_MTL_INLINE NS::Array* MTL::LinkedFunctions::functions() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LinkedFunctions::setFunctions(const NS::Array* functions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_), functions);
|
||||
}
|
||||
|
||||
// property: binaryFunctions
|
||||
_MTL_INLINE NS::Array* MTL::LinkedFunctions::binaryFunctions() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryFunctions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LinkedFunctions::setBinaryFunctions(const NS::Array* binaryFunctions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryFunctions_), binaryFunctions);
|
||||
}
|
||||
|
||||
// property: groups
|
||||
_MTL_INLINE NS::Dictionary* MTL::LinkedFunctions::groups() const
|
||||
{
|
||||
return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(groups));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LinkedFunctions::setGroups(const NS::Dictionary* groups)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setGroups_), groups);
|
||||
}
|
||||
|
||||
// property: privateFunctions
|
||||
_MTL_INLINE NS::Array* MTL::LinkedFunctions::privateFunctions() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(privateFunctions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LinkedFunctions::setPrivateFunctions(const NS::Array* privateFunctions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrivateFunctions_), privateFunctions);
|
||||
}
|
||||
123
src/contrib/metal-cpp/Metal/MTLLogState.hpp
Normal file
123
src/contrib/metal-cpp/Metal/MTLLogState.hpp
Normal file
@@ -0,0 +1,123 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLLogState.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLLogState.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::Integer, LogLevel) {
|
||||
LogLevelUndefined = 0,
|
||||
LogLevelDebug = 1,
|
||||
LogLevelInfo = 2,
|
||||
LogLevelNotice = 3,
|
||||
LogLevelError = 4,
|
||||
LogLevelFault = 5,
|
||||
};
|
||||
|
||||
using LogHandlerFunction = std::function<void(NS::String* subsystem, NS::String* category, MTL::LogLevel logLevel, NS::String* message)>;
|
||||
|
||||
class LogState : public NS::Referencing<LogState>
|
||||
{
|
||||
public:
|
||||
void addLogHandler(void (^block)(NS::String*, NS::String*, MTL::LogLevel, NS::String*));
|
||||
void addLogHandler(const LogHandlerFunction& handler);
|
||||
};
|
||||
|
||||
class LogStateDescriptor : public NS::Copying<LogStateDescriptor>
|
||||
{
|
||||
public:
|
||||
static class LogStateDescriptor* alloc();
|
||||
|
||||
class LogStateDescriptor* init();
|
||||
|
||||
MTL::LogLevel level() const;
|
||||
void setLevel(MTL::LogLevel level);
|
||||
|
||||
NS::Integer bufferSize() const;
|
||||
void setBufferSize(NS::Integer bufferSize);
|
||||
};
|
||||
|
||||
_MTL_CONST(NS::ErrorDomain, LogStateErrorDomain);
|
||||
|
||||
_MTL_ENUM(NS::UInteger, LogStateError) {
|
||||
LogStateErrorInvalidSize = 1,
|
||||
LogStateErrorInvalid = 2,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_MTL_PRIVATE_DEF_WEAK_CONST(NS::ErrorDomain, LogStateErrorDomain);
|
||||
|
||||
// method: addLogHandler:
|
||||
_MTL_INLINE void MTL::LogState::addLogHandler(void (^block)(NS::String*, NS::String*, MTL::LogLevel, NS::String*))
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addLogHandler_), block);
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LogState::addLogHandler(const MTL::LogHandlerFunction& handler)
|
||||
{
|
||||
__block LogHandlerFunction function = handler;
|
||||
|
||||
addLogHandler(^void(NS::String* subsystem, NS::String* category, MTL::LogLevel logLevel, NS::String* message){
|
||||
function(subsystem, category, logLevel, message);
|
||||
});
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::LogStateDescriptor* MTL::LogStateDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::LogStateDescriptor>(_MTL_PRIVATE_CLS(MTLLogStateDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::LogStateDescriptor* MTL::LogStateDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::LogStateDescriptor>();
|
||||
}
|
||||
|
||||
// property: level
|
||||
_MTL_INLINE MTL::LogLevel MTL::LogStateDescriptor::level() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LogLevel>(this, _MTL_PRIVATE_SEL(level));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LogStateDescriptor::setLevel(MTL::LogLevel level)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLevel_), level);
|
||||
}
|
||||
|
||||
// property: bufferSize
|
||||
_MTL_INLINE NS::Integer MTL::LogStateDescriptor::bufferSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::Integer>(this, _MTL_PRIVATE_SEL(bufferSize));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::LogStateDescriptor::setBufferSize(NS::Integer bufferSize)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferSize_), bufferSize);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLParallelRenderCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLCommandEncoder.hpp"
|
||||
#include "MTLRenderPass.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class ParallelRenderCommandEncoder : public NS::Referencing<ParallelRenderCommandEncoder, CommandEncoder>
|
||||
{
|
||||
public:
|
||||
class RenderCommandEncoder* renderCommandEncoder();
|
||||
|
||||
void setColorStoreAction(MTL::StoreAction storeAction, NS::UInteger colorAttachmentIndex);
|
||||
|
||||
void setDepthStoreAction(MTL::StoreAction storeAction);
|
||||
|
||||
void setStencilStoreAction(MTL::StoreAction storeAction);
|
||||
|
||||
void setColorStoreActionOptions(MTL::StoreActionOptions storeActionOptions, NS::UInteger colorAttachmentIndex);
|
||||
|
||||
void setDepthStoreActionOptions(MTL::StoreActionOptions storeActionOptions);
|
||||
|
||||
void setStencilStoreActionOptions(MTL::StoreActionOptions storeActionOptions);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// method: renderCommandEncoder
|
||||
_MTL_INLINE MTL::RenderCommandEncoder* MTL::ParallelRenderCommandEncoder::renderCommandEncoder()
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoder));
|
||||
}
|
||||
|
||||
// method: setColorStoreAction:atIndex:
|
||||
_MTL_INLINE void MTL::ParallelRenderCommandEncoder::setColorStoreAction(MTL::StoreAction storeAction, NS::UInteger colorAttachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorStoreAction_atIndex_), storeAction, colorAttachmentIndex);
|
||||
}
|
||||
|
||||
// method: setDepthStoreAction:
|
||||
_MTL_INLINE void MTL::ParallelRenderCommandEncoder::setDepthStoreAction(MTL::StoreAction storeAction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStoreAction_), storeAction);
|
||||
}
|
||||
|
||||
// method: setStencilStoreAction:
|
||||
_MTL_INLINE void MTL::ParallelRenderCommandEncoder::setStencilStoreAction(MTL::StoreAction storeAction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilStoreAction_), storeAction);
|
||||
}
|
||||
|
||||
// method: setColorStoreActionOptions:atIndex:
|
||||
_MTL_INLINE void MTL::ParallelRenderCommandEncoder::setColorStoreActionOptions(MTL::StoreActionOptions storeActionOptions, NS::UInteger colorAttachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorStoreActionOptions_atIndex_), storeActionOptions, colorAttachmentIndex);
|
||||
}
|
||||
|
||||
// method: setDepthStoreActionOptions:
|
||||
_MTL_INLINE void MTL::ParallelRenderCommandEncoder::setDepthStoreActionOptions(MTL::StoreActionOptions storeActionOptions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStoreActionOptions_), storeActionOptions);
|
||||
}
|
||||
|
||||
// method: setStencilStoreActionOptions:
|
||||
_MTL_INLINE void MTL::ParallelRenderCommandEncoder::setStencilStoreActionOptions(MTL::StoreActionOptions storeActionOptions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilStoreActionOptions_), storeActionOptions);
|
||||
}
|
||||
115
src/contrib/metal-cpp/Metal/MTLPipeline.hpp
Normal file
115
src/contrib/metal-cpp/Metal/MTLPipeline.hpp
Normal file
@@ -0,0 +1,115 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLPipeline.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLPipeline.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, Mutability) {
|
||||
MutabilityDefault = 0,
|
||||
MutabilityMutable = 1,
|
||||
MutabilityImmutable = 2,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::Integer, ShaderValidation) {
|
||||
ShaderValidationDefault = 0,
|
||||
ShaderValidationEnabled = 1,
|
||||
ShaderValidationDisabled = 2,
|
||||
};
|
||||
|
||||
class PipelineBufferDescriptor : public NS::Copying<PipelineBufferDescriptor>
|
||||
{
|
||||
public:
|
||||
static class PipelineBufferDescriptor* alloc();
|
||||
|
||||
class PipelineBufferDescriptor* init();
|
||||
|
||||
MTL::Mutability mutability() const;
|
||||
void setMutability(MTL::Mutability mutability);
|
||||
};
|
||||
|
||||
class PipelineBufferDescriptorArray : public NS::Referencing<PipelineBufferDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class PipelineBufferDescriptorArray* alloc();
|
||||
|
||||
class PipelineBufferDescriptorArray* init();
|
||||
|
||||
class PipelineBufferDescriptor* object(NS::UInteger bufferIndex);
|
||||
|
||||
void setObject(const class PipelineBufferDescriptor* buffer, NS::UInteger bufferIndex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::PipelineBufferDescriptor>(_MTL_PRIVATE_CLS(MTLPipelineBufferDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::PipelineBufferDescriptor>();
|
||||
}
|
||||
|
||||
// property: mutability
|
||||
_MTL_INLINE MTL::Mutability MTL::PipelineBufferDescriptor::mutability() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Mutability>(this, _MTL_PRIVATE_SEL(mutability));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::PipelineBufferDescriptor::setMutability(MTL::Mutability mutability)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMutability_), mutability);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::PipelineBufferDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::PipelineBufferDescriptorArray>(_MTL_PRIVATE_CLS(MTLPipelineBufferDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::PipelineBufferDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::PipelineBufferDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptorArray::object(NS::UInteger bufferIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::PipelineBufferDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), bufferIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::PipelineBufferDescriptorArray::setObject(const MTL::PipelineBufferDescriptor* buffer, NS::UInteger bufferIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), buffer, bufferIndex);
|
||||
}
|
||||
173
src/contrib/metal-cpp/Metal/MTLPixelFormat.hpp
Normal file
173
src/contrib/metal-cpp/Metal/MTLPixelFormat.hpp
Normal file
@@ -0,0 +1,173 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLPixelFormat.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, PixelFormat) {
|
||||
PixelFormatInvalid = 0,
|
||||
PixelFormatA8Unorm = 1,
|
||||
PixelFormatR8Unorm = 10,
|
||||
PixelFormatR8Unorm_sRGB = 11,
|
||||
PixelFormatR8Snorm = 12,
|
||||
PixelFormatR8Uint = 13,
|
||||
PixelFormatR8Sint = 14,
|
||||
PixelFormatR16Unorm = 20,
|
||||
PixelFormatR16Snorm = 22,
|
||||
PixelFormatR16Uint = 23,
|
||||
PixelFormatR16Sint = 24,
|
||||
PixelFormatR16Float = 25,
|
||||
PixelFormatRG8Unorm = 30,
|
||||
PixelFormatRG8Unorm_sRGB = 31,
|
||||
PixelFormatRG8Snorm = 32,
|
||||
PixelFormatRG8Uint = 33,
|
||||
PixelFormatRG8Sint = 34,
|
||||
PixelFormatB5G6R5Unorm = 40,
|
||||
PixelFormatA1BGR5Unorm = 41,
|
||||
PixelFormatABGR4Unorm = 42,
|
||||
PixelFormatBGR5A1Unorm = 43,
|
||||
PixelFormatR32Uint = 53,
|
||||
PixelFormatR32Sint = 54,
|
||||
PixelFormatR32Float = 55,
|
||||
PixelFormatRG16Unorm = 60,
|
||||
PixelFormatRG16Snorm = 62,
|
||||
PixelFormatRG16Uint = 63,
|
||||
PixelFormatRG16Sint = 64,
|
||||
PixelFormatRG16Float = 65,
|
||||
PixelFormatRGBA8Unorm = 70,
|
||||
PixelFormatRGBA8Unorm_sRGB = 71,
|
||||
PixelFormatRGBA8Snorm = 72,
|
||||
PixelFormatRGBA8Uint = 73,
|
||||
PixelFormatRGBA8Sint = 74,
|
||||
PixelFormatBGRA8Unorm = 80,
|
||||
PixelFormatBGRA8Unorm_sRGB = 81,
|
||||
PixelFormatRGB10A2Unorm = 90,
|
||||
PixelFormatRGB10A2Uint = 91,
|
||||
PixelFormatRG11B10Float = 92,
|
||||
PixelFormatRGB9E5Float = 93,
|
||||
PixelFormatBGR10A2Unorm = 94,
|
||||
PixelFormatBGR10_XR = 554,
|
||||
PixelFormatBGR10_XR_sRGB = 555,
|
||||
PixelFormatRG32Uint = 103,
|
||||
PixelFormatRG32Sint = 104,
|
||||
PixelFormatRG32Float = 105,
|
||||
PixelFormatRGBA16Unorm = 110,
|
||||
PixelFormatRGBA16Snorm = 112,
|
||||
PixelFormatRGBA16Uint = 113,
|
||||
PixelFormatRGBA16Sint = 114,
|
||||
PixelFormatRGBA16Float = 115,
|
||||
PixelFormatBGRA10_XR = 552,
|
||||
PixelFormatBGRA10_XR_sRGB = 553,
|
||||
PixelFormatRGBA32Uint = 123,
|
||||
PixelFormatRGBA32Sint = 124,
|
||||
PixelFormatRGBA32Float = 125,
|
||||
PixelFormatBC1_RGBA = 130,
|
||||
PixelFormatBC1_RGBA_sRGB = 131,
|
||||
PixelFormatBC2_RGBA = 132,
|
||||
PixelFormatBC2_RGBA_sRGB = 133,
|
||||
PixelFormatBC3_RGBA = 134,
|
||||
PixelFormatBC3_RGBA_sRGB = 135,
|
||||
PixelFormatBC4_RUnorm = 140,
|
||||
PixelFormatBC4_RSnorm = 141,
|
||||
PixelFormatBC5_RGUnorm = 142,
|
||||
PixelFormatBC5_RGSnorm = 143,
|
||||
PixelFormatBC6H_RGBFloat = 150,
|
||||
PixelFormatBC6H_RGBUfloat = 151,
|
||||
PixelFormatBC7_RGBAUnorm = 152,
|
||||
PixelFormatBC7_RGBAUnorm_sRGB = 153,
|
||||
PixelFormatPVRTC_RGB_2BPP = 160,
|
||||
PixelFormatPVRTC_RGB_2BPP_sRGB = 161,
|
||||
PixelFormatPVRTC_RGB_4BPP = 162,
|
||||
PixelFormatPVRTC_RGB_4BPP_sRGB = 163,
|
||||
PixelFormatPVRTC_RGBA_2BPP = 164,
|
||||
PixelFormatPVRTC_RGBA_2BPP_sRGB = 165,
|
||||
PixelFormatPVRTC_RGBA_4BPP = 166,
|
||||
PixelFormatPVRTC_RGBA_4BPP_sRGB = 167,
|
||||
PixelFormatEAC_R11Unorm = 170,
|
||||
PixelFormatEAC_R11Snorm = 172,
|
||||
PixelFormatEAC_RG11Unorm = 174,
|
||||
PixelFormatEAC_RG11Snorm = 176,
|
||||
PixelFormatEAC_RGBA8 = 178,
|
||||
PixelFormatEAC_RGBA8_sRGB = 179,
|
||||
PixelFormatETC2_RGB8 = 180,
|
||||
PixelFormatETC2_RGB8_sRGB = 181,
|
||||
PixelFormatETC2_RGB8A1 = 182,
|
||||
PixelFormatETC2_RGB8A1_sRGB = 183,
|
||||
PixelFormatASTC_4x4_sRGB = 186,
|
||||
PixelFormatASTC_5x4_sRGB = 187,
|
||||
PixelFormatASTC_5x5_sRGB = 188,
|
||||
PixelFormatASTC_6x5_sRGB = 189,
|
||||
PixelFormatASTC_6x6_sRGB = 190,
|
||||
PixelFormatASTC_8x5_sRGB = 192,
|
||||
PixelFormatASTC_8x6_sRGB = 193,
|
||||
PixelFormatASTC_8x8_sRGB = 194,
|
||||
PixelFormatASTC_10x5_sRGB = 195,
|
||||
PixelFormatASTC_10x6_sRGB = 196,
|
||||
PixelFormatASTC_10x8_sRGB = 197,
|
||||
PixelFormatASTC_10x10_sRGB = 198,
|
||||
PixelFormatASTC_12x10_sRGB = 199,
|
||||
PixelFormatASTC_12x12_sRGB = 200,
|
||||
PixelFormatASTC_4x4_LDR = 204,
|
||||
PixelFormatASTC_5x4_LDR = 205,
|
||||
PixelFormatASTC_5x5_LDR = 206,
|
||||
PixelFormatASTC_6x5_LDR = 207,
|
||||
PixelFormatASTC_6x6_LDR = 208,
|
||||
PixelFormatASTC_8x5_LDR = 210,
|
||||
PixelFormatASTC_8x6_LDR = 211,
|
||||
PixelFormatASTC_8x8_LDR = 212,
|
||||
PixelFormatASTC_10x5_LDR = 213,
|
||||
PixelFormatASTC_10x6_LDR = 214,
|
||||
PixelFormatASTC_10x8_LDR = 215,
|
||||
PixelFormatASTC_10x10_LDR = 216,
|
||||
PixelFormatASTC_12x10_LDR = 217,
|
||||
PixelFormatASTC_12x12_LDR = 218,
|
||||
PixelFormatASTC_4x4_HDR = 222,
|
||||
PixelFormatASTC_5x4_HDR = 223,
|
||||
PixelFormatASTC_5x5_HDR = 224,
|
||||
PixelFormatASTC_6x5_HDR = 225,
|
||||
PixelFormatASTC_6x6_HDR = 226,
|
||||
PixelFormatASTC_8x5_HDR = 228,
|
||||
PixelFormatASTC_8x6_HDR = 229,
|
||||
PixelFormatASTC_8x8_HDR = 230,
|
||||
PixelFormatASTC_10x5_HDR = 231,
|
||||
PixelFormatASTC_10x6_HDR = 232,
|
||||
PixelFormatASTC_10x8_HDR = 233,
|
||||
PixelFormatASTC_10x10_HDR = 234,
|
||||
PixelFormatASTC_12x10_HDR = 235,
|
||||
PixelFormatASTC_12x12_HDR = 236,
|
||||
PixelFormatGBGR422 = 240,
|
||||
PixelFormatBGRG422 = 241,
|
||||
PixelFormatDepth16Unorm = 250,
|
||||
PixelFormatDepth32Float = 252,
|
||||
PixelFormatStencil8 = 253,
|
||||
PixelFormatDepth24Unorm_Stencil8 = 255,
|
||||
PixelFormatDepth32Float_Stencil8 = 260,
|
||||
PixelFormatX32_Stencil8 = 261,
|
||||
PixelFormatX24_Stencil8 = 262,
|
||||
};
|
||||
|
||||
}
|
||||
156
src/contrib/metal-cpp/Metal/MTLPrivate.hpp
Normal file
156
src/contrib/metal-cpp/Metal/MTLPrivate.hpp
Normal file
@@ -0,0 +1,156 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLPrivate.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 <objc/runtime.h>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#define _MTL_PRIVATE_CLS(symbol) (Private::Class::s_k##symbol)
|
||||
#define _MTL_PRIVATE_SEL(accessor) (Private::Selector::s_k##accessor)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(MTL_PRIVATE_IMPLEMENTATION)
|
||||
|
||||
#ifdef METALCPP_SYMBOL_VISIBILITY_HIDDEN
|
||||
#define _MTL_PRIVATE_VISIBILITY __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define _MTL_PRIVATE_VISIBILITY __attribute__((visibility("default")))
|
||||
#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN
|
||||
|
||||
#define _MTL_PRIVATE_IMPORT __attribute__((weak_import))
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define _MTL_PRIVATE_OBJC_LOOKUP_CLASS(symbol) ((__bridge void*)objc_lookUpClass(#symbol))
|
||||
#define _MTL_PRIVATE_OBJC_GET_PROTOCOL(symbol) ((__bridge void*)objc_getProtocol(#symbol))
|
||||
#else
|
||||
#define _MTL_PRIVATE_OBJC_LOOKUP_CLASS(symbol) objc_lookUpClass(#symbol)
|
||||
#define _MTL_PRIVATE_OBJC_GET_PROTOCOL(symbol) objc_getProtocol(#symbol)
|
||||
#endif // __OBJC__
|
||||
|
||||
#define _MTL_PRIVATE_DEF_CLS(symbol) void* s_k##symbol _MTL_PRIVATE_VISIBILITY = _MTL_PRIVATE_OBJC_LOOKUP_CLASS(symbol)
|
||||
#define _MTL_PRIVATE_DEF_PRO(symbol) void* s_k##symbol _MTL_PRIVATE_VISIBILITY = _MTL_PRIVATE_OBJC_GET_PROTOCOL(symbol)
|
||||
#define _MTL_PRIVATE_DEF_SEL(accessor, symbol) SEL s_k##accessor _MTL_PRIVATE_VISIBILITY = sel_registerName(symbol)
|
||||
|
||||
#include <dlfcn.h>
|
||||
#define MTL_DEF_FUNC( name, signature ) \
|
||||
using Fn##name = signature; \
|
||||
Fn##name name = reinterpret_cast< Fn##name >( dlsym( RTLD_DEFAULT, #name ) )
|
||||
|
||||
namespace MTL::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;
|
||||
}
|
||||
} // MTL::Private
|
||||
|
||||
#if defined(__MAC_15_0) || defined(__IPHONE_18_0) || defined(__TVOS_18_0)
|
||||
|
||||
#define _MTL_PRIVATE_DEF_STR(type, symbol) \
|
||||
_MTL_EXTERN type const MTL##symbol _MTL_PRIVATE_IMPORT; \
|
||||
type const MTL::symbol = (nullptr != &MTL##symbol) ? MTL##symbol : nullptr
|
||||
|
||||
#define _MTL_PRIVATE_DEF_CONST(type, symbol) \
|
||||
_MTL_EXTERN type const MTL##symbol _MTL_PRIVATE_IMPORT; \
|
||||
type const MTL::symbol = (nullptr != &MTL##symbol) ? MTL##symbol : nullptr
|
||||
|
||||
#define _MTL_PRIVATE_DEF_WEAK_CONST(type, symbol) \
|
||||
_MTL_EXTERN type const MTL##symbol; \
|
||||
type const MTL::symbol = Private::LoadSymbol<type>("MTL" #symbol)
|
||||
|
||||
#else
|
||||
|
||||
#define _MTL_PRIVATE_DEF_STR(type, symbol) \
|
||||
_MTL_EXTERN type const MTL##symbol; \
|
||||
type const MTL::symbol = Private::LoadSymbol<type>("MTL" #symbol)
|
||||
|
||||
#define _MTL_PRIVATE_DEF_CONST(type, symbol) \
|
||||
_MTL_EXTERN type const MTL##symbol; \
|
||||
type const MTL::symbol = Private::LoadSymbol<type>("MTL" #symbol)
|
||||
|
||||
#define _MTL_PRIVATE_DEF_WEAK_CONST(type, symbol) _MTL_PRIVATE_DEF_CONST(type, symbol)
|
||||
|
||||
#endif // defined(__MAC_15_0) || defined(__IPHONE_18_0) || defined(__TVOS_18_0)
|
||||
|
||||
#else
|
||||
|
||||
#define _MTL_PRIVATE_DEF_CLS(symbol) extern void* s_k##symbol
|
||||
#define _MTL_PRIVATE_DEF_PRO(symbol) extern void* s_k##symbol
|
||||
#define _MTL_PRIVATE_DEF_SEL(accessor, symbol) extern SEL s_k##accessor
|
||||
#define _MTL_PRIVATE_DEF_STR(type, symbol) extern type const MTL::symbol
|
||||
#define _MTL_PRIVATE_DEF_CONST(type, symbol) extern type const MTL::symbol
|
||||
#define _MTL_PRIVATE_DEF_WEAK_CONST(type, symbol) extern type const MTL::symbol
|
||||
|
||||
#endif // MTL_PRIVATE_IMPLEMENTATION
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
namespace Class
|
||||
{
|
||||
|
||||
} // Class
|
||||
} // Private
|
||||
} // MTL
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
namespace Protocol
|
||||
{
|
||||
|
||||
} // Protocol
|
||||
} // Private
|
||||
} // MTL
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
namespace Selector
|
||||
{
|
||||
|
||||
_MTL_PRIVATE_DEF_SEL(beginScope,
|
||||
"beginScope");
|
||||
_MTL_PRIVATE_DEF_SEL(endScope,
|
||||
"endScope");
|
||||
} // Class
|
||||
} // Private
|
||||
} // MTL
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
386
src/contrib/metal-cpp/Metal/MTLRasterizationRate.hpp
Normal file
386
src/contrib/metal-cpp/Metal/MTLRasterizationRate.hpp
Normal file
@@ -0,0 +1,386 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLRasterizationRate.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLDevice.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class RasterizationRateSampleArray : public NS::Referencing<RasterizationRateSampleArray>
|
||||
{
|
||||
public:
|
||||
static class RasterizationRateSampleArray* alloc();
|
||||
|
||||
class RasterizationRateSampleArray* init();
|
||||
|
||||
NS::Number* object(NS::UInteger index);
|
||||
|
||||
void setObject(const NS::Number* value, NS::UInteger index);
|
||||
};
|
||||
|
||||
class RasterizationRateLayerDescriptor : public NS::Copying<RasterizationRateLayerDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RasterizationRateLayerDescriptor* alloc();
|
||||
|
||||
MTL::RasterizationRateLayerDescriptor* init();
|
||||
|
||||
MTL::RasterizationRateLayerDescriptor* init(MTL::Size sampleCount);
|
||||
|
||||
MTL::RasterizationRateLayerDescriptor* init(MTL::Size sampleCount, const float* horizontal, const float* vertical);
|
||||
|
||||
MTL::Size sampleCount() const;
|
||||
|
||||
MTL::Size maxSampleCount() const;
|
||||
|
||||
float* horizontalSampleStorage() const;
|
||||
|
||||
float* verticalSampleStorage() const;
|
||||
|
||||
class RasterizationRateSampleArray* horizontal() const;
|
||||
|
||||
class RasterizationRateSampleArray* vertical() const;
|
||||
|
||||
void setSampleCount(MTL::Size sampleCount);
|
||||
};
|
||||
|
||||
class RasterizationRateLayerArray : public NS::Referencing<RasterizationRateLayerArray>
|
||||
{
|
||||
public:
|
||||
static class RasterizationRateLayerArray* alloc();
|
||||
|
||||
class RasterizationRateLayerArray* init();
|
||||
|
||||
class RasterizationRateLayerDescriptor* object(NS::UInteger layerIndex);
|
||||
|
||||
void setObject(const class RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex);
|
||||
};
|
||||
|
||||
class RasterizationRateMapDescriptor : public NS::Copying<RasterizationRateMapDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RasterizationRateMapDescriptor* alloc();
|
||||
|
||||
class RasterizationRateMapDescriptor* init();
|
||||
|
||||
static class RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize);
|
||||
|
||||
static class RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, const class RasterizationRateLayerDescriptor* layer);
|
||||
|
||||
static class RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, NS::UInteger layerCount, const class RasterizationRateLayerDescriptor* const* layers);
|
||||
|
||||
class RasterizationRateLayerDescriptor* layer(NS::UInteger layerIndex);
|
||||
|
||||
void setLayer(const class RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex);
|
||||
|
||||
class RasterizationRateLayerArray* layers() const;
|
||||
|
||||
MTL::Size screenSize() const;
|
||||
void setScreenSize(MTL::Size screenSize);
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
NS::UInteger layerCount() const;
|
||||
};
|
||||
|
||||
class RasterizationRateMap : public NS::Referencing<RasterizationRateMap>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
|
||||
MTL::Size screenSize() const;
|
||||
|
||||
MTL::Size physicalGranularity() const;
|
||||
|
||||
NS::UInteger layerCount() const;
|
||||
|
||||
MTL::SizeAndAlign parameterBufferSizeAndAlign() const;
|
||||
|
||||
void copyParameterDataToBuffer(const class Buffer* buffer, NS::UInteger offset);
|
||||
|
||||
MTL::Size physicalSize(NS::UInteger layerIndex);
|
||||
|
||||
MTL::Coordinate2D mapScreenToPhysicalCoordinates(MTL::Coordinate2D screenCoordinates, NS::UInteger layerIndex);
|
||||
|
||||
MTL::Coordinate2D mapPhysicalToScreenCoordinates(MTL::Coordinate2D physicalCoordinates, NS::UInteger layerIndex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateSampleArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RasterizationRateSampleArray>(_MTL_PRIVATE_CLS(MTLRasterizationRateSampleArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateSampleArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RasterizationRateSampleArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE NS::Number* MTL::RasterizationRateSampleArray::object(NS::UInteger index)
|
||||
{
|
||||
return Object::sendMessage<NS::Number*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), index);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::RasterizationRateSampleArray::setObject(const NS::Number* value, NS::UInteger index)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), value, index);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RasterizationRateLayerDescriptor>(_MTL_PRIVATE_CLS(MTLRasterizationRateLayerDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RasterizationRateLayerDescriptor>();
|
||||
}
|
||||
|
||||
// method: initWithSampleCount:
|
||||
_MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::init(MTL::Size sampleCount)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(initWithSampleCount_), sampleCount);
|
||||
}
|
||||
|
||||
// method: initWithSampleCount:horizontal:vertical:
|
||||
_MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerDescriptor::init(MTL::Size sampleCount, const float* horizontal, const float* vertical)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(initWithSampleCount_horizontal_vertical_), sampleCount, horizontal, vertical);
|
||||
}
|
||||
|
||||
// property: sampleCount
|
||||
_MTL_INLINE MTL::Size MTL::RasterizationRateLayerDescriptor::sampleCount() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(sampleCount));
|
||||
}
|
||||
|
||||
// property: maxSampleCount
|
||||
_MTL_INLINE MTL::Size MTL::RasterizationRateLayerDescriptor::maxSampleCount() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(maxSampleCount));
|
||||
}
|
||||
|
||||
// property: horizontalSampleStorage
|
||||
_MTL_INLINE float* MTL::RasterizationRateLayerDescriptor::horizontalSampleStorage() const
|
||||
{
|
||||
return Object::sendMessage<float*>(this, _MTL_PRIVATE_SEL(horizontalSampleStorage));
|
||||
}
|
||||
|
||||
// property: verticalSampleStorage
|
||||
_MTL_INLINE float* MTL::RasterizationRateLayerDescriptor::verticalSampleStorage() const
|
||||
{
|
||||
return Object::sendMessage<float*>(this, _MTL_PRIVATE_SEL(verticalSampleStorage));
|
||||
}
|
||||
|
||||
// property: horizontal
|
||||
_MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateLayerDescriptor::horizontal() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateSampleArray*>(this, _MTL_PRIVATE_SEL(horizontal));
|
||||
}
|
||||
|
||||
// property: vertical
|
||||
_MTL_INLINE MTL::RasterizationRateSampleArray* MTL::RasterizationRateLayerDescriptor::vertical() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateSampleArray*>(this, _MTL_PRIVATE_SEL(vertical));
|
||||
}
|
||||
|
||||
// method: setSampleCount:
|
||||
_MTL_INLINE void MTL::RasterizationRateLayerDescriptor::setSampleCount(MTL::Size sampleCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleCount_), sampleCount);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RasterizationRateLayerArray* MTL::RasterizationRateLayerArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RasterizationRateLayerArray>(_MTL_PRIVATE_CLS(MTLRasterizationRateLayerArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RasterizationRateLayerArray* MTL::RasterizationRateLayerArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RasterizationRateLayerArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateLayerArray::object(NS::UInteger layerIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), layerIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::RasterizationRateLayerArray::setObject(const MTL::RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), layer, layerIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RasterizationRateMapDescriptor>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RasterizationRateMapDescriptor>();
|
||||
}
|
||||
|
||||
// static method: rasterizationRateMapDescriptorWithScreenSize:
|
||||
_MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::rasterizationRateMapDescriptor(MTL::Size screenSize)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateMapDescriptor*>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor), _MTL_PRIVATE_SEL(rasterizationRateMapDescriptorWithScreenSize_), screenSize);
|
||||
}
|
||||
|
||||
// static method: rasterizationRateMapDescriptorWithScreenSize:layer:
|
||||
_MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::rasterizationRateMapDescriptor(MTL::Size screenSize, const MTL::RasterizationRateLayerDescriptor* layer)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateMapDescriptor*>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor), _MTL_PRIVATE_SEL(rasterizationRateMapDescriptorWithScreenSize_layer_), screenSize, layer);
|
||||
}
|
||||
|
||||
// static method: rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:
|
||||
_MTL_INLINE MTL::RasterizationRateMapDescriptor* MTL::RasterizationRateMapDescriptor::rasterizationRateMapDescriptor(MTL::Size screenSize, NS::UInteger layerCount, const MTL::RasterizationRateLayerDescriptor* const* layers)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateMapDescriptor*>(_MTL_PRIVATE_CLS(MTLRasterizationRateMapDescriptor), _MTL_PRIVATE_SEL(rasterizationRateMapDescriptorWithScreenSize_layerCount_layers_), screenSize, layerCount, layers);
|
||||
}
|
||||
|
||||
// method: layerAtIndex:
|
||||
_MTL_INLINE MTL::RasterizationRateLayerDescriptor* MTL::RasterizationRateMapDescriptor::layer(NS::UInteger layerIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateLayerDescriptor*>(this, _MTL_PRIVATE_SEL(layerAtIndex_), layerIndex);
|
||||
}
|
||||
|
||||
// method: setLayer:atIndex:
|
||||
_MTL_INLINE void MTL::RasterizationRateMapDescriptor::setLayer(const MTL::RasterizationRateLayerDescriptor* layer, NS::UInteger layerIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLayer_atIndex_), layer, layerIndex);
|
||||
}
|
||||
|
||||
// property: layers
|
||||
_MTL_INLINE MTL::RasterizationRateLayerArray* MTL::RasterizationRateMapDescriptor::layers() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateLayerArray*>(this, _MTL_PRIVATE_SEL(layers));
|
||||
}
|
||||
|
||||
// property: screenSize
|
||||
_MTL_INLINE MTL::Size MTL::RasterizationRateMapDescriptor::screenSize() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(screenSize));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RasterizationRateMapDescriptor::setScreenSize(MTL::Size screenSize)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setScreenSize_), screenSize);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::RasterizationRateMapDescriptor::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RasterizationRateMapDescriptor::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: layerCount
|
||||
_MTL_INLINE NS::UInteger MTL::RasterizationRateMapDescriptor::layerCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(layerCount));
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::RasterizationRateMap::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::RasterizationRateMap::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: screenSize
|
||||
_MTL_INLINE MTL::Size MTL::RasterizationRateMap::screenSize() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(screenSize));
|
||||
}
|
||||
|
||||
// property: physicalGranularity
|
||||
_MTL_INLINE MTL::Size MTL::RasterizationRateMap::physicalGranularity() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(physicalGranularity));
|
||||
}
|
||||
|
||||
// property: layerCount
|
||||
_MTL_INLINE NS::UInteger MTL::RasterizationRateMap::layerCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(layerCount));
|
||||
}
|
||||
|
||||
// property: parameterBufferSizeAndAlign
|
||||
_MTL_INLINE MTL::SizeAndAlign MTL::RasterizationRateMap::parameterBufferSizeAndAlign() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(parameterBufferSizeAndAlign));
|
||||
}
|
||||
|
||||
// method: copyParameterDataToBuffer:offset:
|
||||
_MTL_INLINE void MTL::RasterizationRateMap::copyParameterDataToBuffer(const MTL::Buffer* buffer, NS::UInteger offset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyParameterDataToBuffer_offset_), buffer, offset);
|
||||
}
|
||||
|
||||
// method: physicalSizeForLayer:
|
||||
_MTL_INLINE MTL::Size MTL::RasterizationRateMap::physicalSize(NS::UInteger layerIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(physicalSizeForLayer_), layerIndex);
|
||||
}
|
||||
|
||||
// method: mapScreenToPhysicalCoordinates:forLayer:
|
||||
_MTL_INLINE MTL::Coordinate2D MTL::RasterizationRateMap::mapScreenToPhysicalCoordinates(MTL::Coordinate2D screenCoordinates, NS::UInteger layerIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::Coordinate2D>(this, _MTL_PRIVATE_SEL(mapScreenToPhysicalCoordinates_forLayer_), screenCoordinates, layerIndex);
|
||||
}
|
||||
|
||||
// method: mapPhysicalToScreenCoordinates:forLayer:
|
||||
_MTL_INLINE MTL::Coordinate2D MTL::RasterizationRateMap::mapPhysicalToScreenCoordinates(MTL::Coordinate2D physicalCoordinates, NS::UInteger layerIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::Coordinate2D>(this, _MTL_PRIVATE_SEL(mapPhysicalToScreenCoordinates_forLayer_), physicalCoordinates, layerIndex);
|
||||
}
|
||||
1193
src/contrib/metal-cpp/Metal/MTLRenderCommandEncoder.hpp
Normal file
1193
src/contrib/metal-cpp/Metal/MTLRenderCommandEncoder.hpp
Normal file
File diff suppressed because it is too large
Load Diff
787
src/contrib/metal-cpp/Metal/MTLRenderPass.hpp
Normal file
787
src/contrib/metal-cpp/Metal/MTLRenderPass.hpp
Normal file
@@ -0,0 +1,787 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLRenderPass.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLRenderPass.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
struct ClearColor
|
||||
{
|
||||
static ClearColor Make(double red, double green, double blue, double alpha);
|
||||
|
||||
ClearColor() = default;
|
||||
|
||||
ClearColor(double red, double green, double blue, double alpha);
|
||||
|
||||
double red;
|
||||
double green;
|
||||
double blue;
|
||||
double alpha;
|
||||
} _MTL_PACKED;
|
||||
|
||||
_MTL_ENUM(NS::UInteger, LoadAction) {
|
||||
LoadActionDontCare = 0,
|
||||
LoadActionLoad = 1,
|
||||
LoadActionClear = 2,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, StoreAction) {
|
||||
StoreActionDontCare = 0,
|
||||
StoreActionStore = 1,
|
||||
StoreActionMultisampleResolve = 2,
|
||||
StoreActionStoreAndMultisampleResolve = 3,
|
||||
StoreActionUnknown = 4,
|
||||
StoreActionCustomSampleDepthStore = 5,
|
||||
};
|
||||
|
||||
_MTL_OPTIONS(NS::UInteger, StoreActionOptions) {
|
||||
StoreActionOptionNone = 0,
|
||||
StoreActionOptionCustomSamplePositions = 1,
|
||||
StoreActionOptionValidMask = 1,
|
||||
};
|
||||
|
||||
class RenderPassAttachmentDescriptor : public NS::Copying<RenderPassAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RenderPassAttachmentDescriptor* alloc();
|
||||
|
||||
class RenderPassAttachmentDescriptor* init();
|
||||
|
||||
class Texture* texture() const;
|
||||
void setTexture(const class Texture* texture);
|
||||
|
||||
NS::UInteger level() const;
|
||||
void setLevel(NS::UInteger level);
|
||||
|
||||
NS::UInteger slice() const;
|
||||
void setSlice(NS::UInteger slice);
|
||||
|
||||
NS::UInteger depthPlane() const;
|
||||
void setDepthPlane(NS::UInteger depthPlane);
|
||||
|
||||
class Texture* resolveTexture() const;
|
||||
void setResolveTexture(const class Texture* resolveTexture);
|
||||
|
||||
NS::UInteger resolveLevel() const;
|
||||
void setResolveLevel(NS::UInteger resolveLevel);
|
||||
|
||||
NS::UInteger resolveSlice() const;
|
||||
void setResolveSlice(NS::UInteger resolveSlice);
|
||||
|
||||
NS::UInteger resolveDepthPlane() const;
|
||||
void setResolveDepthPlane(NS::UInteger resolveDepthPlane);
|
||||
|
||||
MTL::LoadAction loadAction() const;
|
||||
void setLoadAction(MTL::LoadAction loadAction);
|
||||
|
||||
MTL::StoreAction storeAction() const;
|
||||
void setStoreAction(MTL::StoreAction storeAction);
|
||||
|
||||
MTL::StoreActionOptions storeActionOptions() const;
|
||||
void setStoreActionOptions(MTL::StoreActionOptions storeActionOptions);
|
||||
};
|
||||
|
||||
class RenderPassColorAttachmentDescriptor : public NS::Copying<RenderPassColorAttachmentDescriptor, MTL::RenderPassAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RenderPassColorAttachmentDescriptor* alloc();
|
||||
|
||||
class RenderPassColorAttachmentDescriptor* init();
|
||||
|
||||
MTL::ClearColor clearColor() const;
|
||||
void setClearColor(MTL::ClearColor clearColor);
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, MultisampleDepthResolveFilter) {
|
||||
MultisampleDepthResolveFilterSample0 = 0,
|
||||
MultisampleDepthResolveFilterMin = 1,
|
||||
MultisampleDepthResolveFilterMax = 2,
|
||||
};
|
||||
|
||||
class RenderPassDepthAttachmentDescriptor : public NS::Copying<RenderPassDepthAttachmentDescriptor, MTL::RenderPassAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RenderPassDepthAttachmentDescriptor* alloc();
|
||||
|
||||
class RenderPassDepthAttachmentDescriptor* init();
|
||||
|
||||
double clearDepth() const;
|
||||
void setClearDepth(double clearDepth);
|
||||
|
||||
MTL::MultisampleDepthResolveFilter depthResolveFilter() const;
|
||||
void setDepthResolveFilter(MTL::MultisampleDepthResolveFilter depthResolveFilter);
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, MultisampleStencilResolveFilter) {
|
||||
MultisampleStencilResolveFilterSample0 = 0,
|
||||
MultisampleStencilResolveFilterDepthResolvedSample = 1,
|
||||
};
|
||||
|
||||
class RenderPassStencilAttachmentDescriptor : public NS::Copying<RenderPassStencilAttachmentDescriptor, MTL::RenderPassAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RenderPassStencilAttachmentDescriptor* alloc();
|
||||
|
||||
class RenderPassStencilAttachmentDescriptor* init();
|
||||
|
||||
uint32_t clearStencil() const;
|
||||
void setClearStencil(uint32_t clearStencil);
|
||||
|
||||
MTL::MultisampleStencilResolveFilter stencilResolveFilter() const;
|
||||
void setStencilResolveFilter(MTL::MultisampleStencilResolveFilter stencilResolveFilter);
|
||||
};
|
||||
|
||||
class RenderPassColorAttachmentDescriptorArray : public NS::Referencing<RenderPassColorAttachmentDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class RenderPassColorAttachmentDescriptorArray* alloc();
|
||||
|
||||
class RenderPassColorAttachmentDescriptorArray* init();
|
||||
|
||||
class RenderPassColorAttachmentDescriptor* object(NS::UInteger attachmentIndex);
|
||||
|
||||
void setObject(const class RenderPassColorAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
|
||||
};
|
||||
|
||||
class RenderPassSampleBufferAttachmentDescriptor : public NS::Copying<RenderPassSampleBufferAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RenderPassSampleBufferAttachmentDescriptor* alloc();
|
||||
|
||||
class RenderPassSampleBufferAttachmentDescriptor* init();
|
||||
|
||||
class CounterSampleBuffer* sampleBuffer() const;
|
||||
void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
|
||||
|
||||
NS::UInteger startOfVertexSampleIndex() const;
|
||||
void setStartOfVertexSampleIndex(NS::UInteger startOfVertexSampleIndex);
|
||||
|
||||
NS::UInteger endOfVertexSampleIndex() const;
|
||||
void setEndOfVertexSampleIndex(NS::UInteger endOfVertexSampleIndex);
|
||||
|
||||
NS::UInteger startOfFragmentSampleIndex() const;
|
||||
void setStartOfFragmentSampleIndex(NS::UInteger startOfFragmentSampleIndex);
|
||||
|
||||
NS::UInteger endOfFragmentSampleIndex() const;
|
||||
void setEndOfFragmentSampleIndex(NS::UInteger endOfFragmentSampleIndex);
|
||||
};
|
||||
|
||||
class RenderPassSampleBufferAttachmentDescriptorArray : public NS::Referencing<RenderPassSampleBufferAttachmentDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class RenderPassSampleBufferAttachmentDescriptorArray* alloc();
|
||||
|
||||
class RenderPassSampleBufferAttachmentDescriptorArray* init();
|
||||
|
||||
class RenderPassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
|
||||
|
||||
void setObject(const class RenderPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
|
||||
};
|
||||
|
||||
class RenderPassDescriptor : public NS::Copying<RenderPassDescriptor>
|
||||
{
|
||||
public:
|
||||
static class RenderPassDescriptor* alloc();
|
||||
|
||||
class RenderPassDescriptor* init();
|
||||
|
||||
static class RenderPassDescriptor* renderPassDescriptor();
|
||||
|
||||
class RenderPassColorAttachmentDescriptorArray* colorAttachments() const;
|
||||
|
||||
class RenderPassDepthAttachmentDescriptor* depthAttachment() const;
|
||||
void setDepthAttachment(const class RenderPassDepthAttachmentDescriptor* depthAttachment);
|
||||
|
||||
class RenderPassStencilAttachmentDescriptor* stencilAttachment() const;
|
||||
void setStencilAttachment(const class RenderPassStencilAttachmentDescriptor* stencilAttachment);
|
||||
|
||||
class Buffer* visibilityResultBuffer() const;
|
||||
void setVisibilityResultBuffer(const class Buffer* visibilityResultBuffer);
|
||||
|
||||
NS::UInteger renderTargetArrayLength() const;
|
||||
void setRenderTargetArrayLength(NS::UInteger renderTargetArrayLength);
|
||||
|
||||
NS::UInteger imageblockSampleLength() const;
|
||||
void setImageblockSampleLength(NS::UInteger imageblockSampleLength);
|
||||
|
||||
NS::UInteger threadgroupMemoryLength() const;
|
||||
void setThreadgroupMemoryLength(NS::UInteger threadgroupMemoryLength);
|
||||
|
||||
NS::UInteger tileWidth() const;
|
||||
void setTileWidth(NS::UInteger tileWidth);
|
||||
|
||||
NS::UInteger tileHeight() const;
|
||||
void setTileHeight(NS::UInteger tileHeight);
|
||||
|
||||
NS::UInteger defaultRasterSampleCount() const;
|
||||
void setDefaultRasterSampleCount(NS::UInteger defaultRasterSampleCount);
|
||||
|
||||
NS::UInteger renderTargetWidth() const;
|
||||
void setRenderTargetWidth(NS::UInteger renderTargetWidth);
|
||||
|
||||
NS::UInteger renderTargetHeight() const;
|
||||
void setRenderTargetHeight(NS::UInteger renderTargetHeight);
|
||||
|
||||
void setSamplePositions(const MTL::SamplePosition* positions, NS::UInteger count);
|
||||
|
||||
NS::UInteger getSamplePositions(MTL::SamplePosition* positions, NS::UInteger count);
|
||||
|
||||
class RasterizationRateMap* rasterizationRateMap() const;
|
||||
void setRasterizationRateMap(const class RasterizationRateMap* rasterizationRateMap);
|
||||
|
||||
class RenderPassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_MTL_INLINE MTL::ClearColor MTL::ClearColor::Make(double red, double green, double blue, double alpha)
|
||||
{
|
||||
return ClearColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
_MTL_INLINE MTL::ClearColor::ClearColor(double _red, double _green, double _blue, double _alpha)
|
||||
: red(_red)
|
||||
, green(_green)
|
||||
, blue(_blue)
|
||||
, alpha(_alpha)
|
||||
{
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassAttachmentDescriptor* MTL::RenderPassAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLRenderPassAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassAttachmentDescriptor* MTL::RenderPassAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: texture
|
||||
_MTL_INLINE MTL::Texture* MTL::RenderPassAttachmentDescriptor::texture() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(texture));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setTexture(const MTL::Texture* texture)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_), texture);
|
||||
}
|
||||
|
||||
// property: level
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassAttachmentDescriptor::level() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(level));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setLevel(NS::UInteger level)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLevel_), level);
|
||||
}
|
||||
|
||||
// property: slice
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassAttachmentDescriptor::slice() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(slice));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setSlice(NS::UInteger slice)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSlice_), slice);
|
||||
}
|
||||
|
||||
// property: depthPlane
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassAttachmentDescriptor::depthPlane() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(depthPlane));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setDepthPlane(NS::UInteger depthPlane)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthPlane_), depthPlane);
|
||||
}
|
||||
|
||||
// property: resolveTexture
|
||||
_MTL_INLINE MTL::Texture* MTL::RenderPassAttachmentDescriptor::resolveTexture() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(resolveTexture));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setResolveTexture(const MTL::Texture* resolveTexture)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResolveTexture_), resolveTexture);
|
||||
}
|
||||
|
||||
// property: resolveLevel
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassAttachmentDescriptor::resolveLevel() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(resolveLevel));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setResolveLevel(NS::UInteger resolveLevel)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResolveLevel_), resolveLevel);
|
||||
}
|
||||
|
||||
// property: resolveSlice
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassAttachmentDescriptor::resolveSlice() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(resolveSlice));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setResolveSlice(NS::UInteger resolveSlice)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResolveSlice_), resolveSlice);
|
||||
}
|
||||
|
||||
// property: resolveDepthPlane
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassAttachmentDescriptor::resolveDepthPlane() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(resolveDepthPlane));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setResolveDepthPlane(NS::UInteger resolveDepthPlane)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResolveDepthPlane_), resolveDepthPlane);
|
||||
}
|
||||
|
||||
// property: loadAction
|
||||
_MTL_INLINE MTL::LoadAction MTL::RenderPassAttachmentDescriptor::loadAction() const
|
||||
{
|
||||
return Object::sendMessage<MTL::LoadAction>(this, _MTL_PRIVATE_SEL(loadAction));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setLoadAction(MTL::LoadAction loadAction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLoadAction_), loadAction);
|
||||
}
|
||||
|
||||
// property: storeAction
|
||||
_MTL_INLINE MTL::StoreAction MTL::RenderPassAttachmentDescriptor::storeAction() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StoreAction>(this, _MTL_PRIVATE_SEL(storeAction));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setStoreAction(MTL::StoreAction storeAction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStoreAction_), storeAction);
|
||||
}
|
||||
|
||||
// property: storeActionOptions
|
||||
_MTL_INLINE MTL::StoreActionOptions MTL::RenderPassAttachmentDescriptor::storeActionOptions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StoreActionOptions>(this, _MTL_PRIVATE_SEL(storeActionOptions));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassAttachmentDescriptor::setStoreActionOptions(MTL::StoreActionOptions storeActionOptions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStoreActionOptions_), storeActionOptions);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptor* MTL::RenderPassColorAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassColorAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLRenderPassColorAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptor* MTL::RenderPassColorAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassColorAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: clearColor
|
||||
_MTL_INLINE MTL::ClearColor MTL::RenderPassColorAttachmentDescriptor::clearColor() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ClearColor>(this, _MTL_PRIVATE_SEL(clearColor));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassColorAttachmentDescriptor::setClearColor(MTL::ClearColor clearColor)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setClearColor_), clearColor);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassDepthAttachmentDescriptor* MTL::RenderPassDepthAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassDepthAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLRenderPassDepthAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassDepthAttachmentDescriptor* MTL::RenderPassDepthAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassDepthAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: clearDepth
|
||||
_MTL_INLINE double MTL::RenderPassDepthAttachmentDescriptor::clearDepth() const
|
||||
{
|
||||
return Object::sendMessage<double>(this, _MTL_PRIVATE_SEL(clearDepth));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDepthAttachmentDescriptor::setClearDepth(double clearDepth)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setClearDepth_), clearDepth);
|
||||
}
|
||||
|
||||
// property: depthResolveFilter
|
||||
_MTL_INLINE MTL::MultisampleDepthResolveFilter MTL::RenderPassDepthAttachmentDescriptor::depthResolveFilter() const
|
||||
{
|
||||
return Object::sendMessage<MTL::MultisampleDepthResolveFilter>(this, _MTL_PRIVATE_SEL(depthResolveFilter));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDepthAttachmentDescriptor::setDepthResolveFilter(MTL::MultisampleDepthResolveFilter depthResolveFilter)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthResolveFilter_), depthResolveFilter);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassStencilAttachmentDescriptor* MTL::RenderPassStencilAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassStencilAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLRenderPassStencilAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassStencilAttachmentDescriptor* MTL::RenderPassStencilAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassStencilAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: clearStencil
|
||||
_MTL_INLINE uint32_t MTL::RenderPassStencilAttachmentDescriptor::clearStencil() const
|
||||
{
|
||||
return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(clearStencil));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassStencilAttachmentDescriptor::setClearStencil(uint32_t clearStencil)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setClearStencil_), clearStencil);
|
||||
}
|
||||
|
||||
// property: stencilResolveFilter
|
||||
_MTL_INLINE MTL::MultisampleStencilResolveFilter MTL::RenderPassStencilAttachmentDescriptor::stencilResolveFilter() const
|
||||
{
|
||||
return Object::sendMessage<MTL::MultisampleStencilResolveFilter>(this, _MTL_PRIVATE_SEL(stencilResolveFilter));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassStencilAttachmentDescriptor::setStencilResolveFilter(MTL::MultisampleStencilResolveFilter stencilResolveFilter)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilResolveFilter_), stencilResolveFilter);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptorArray* MTL::RenderPassColorAttachmentDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassColorAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLRenderPassColorAttachmentDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptorArray* MTL::RenderPassColorAttachmentDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassColorAttachmentDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptor* MTL::RenderPassColorAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassColorAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::RenderPassColorAttachmentDescriptorArray::setObject(const MTL::RenderPassColorAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassSampleBufferAttachmentDescriptor* MTL::RenderPassSampleBufferAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLRenderPassSampleBufferAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassSampleBufferAttachmentDescriptor* MTL::RenderPassSampleBufferAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassSampleBufferAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: sampleBuffer
|
||||
_MTL_INLINE MTL::CounterSampleBuffer* MTL::RenderPassSampleBufferAttachmentDescriptor::sampleBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
|
||||
}
|
||||
|
||||
// property: startOfVertexSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassSampleBufferAttachmentDescriptor::startOfVertexSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfVertexSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassSampleBufferAttachmentDescriptor::setStartOfVertexSampleIndex(NS::UInteger startOfVertexSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfVertexSampleIndex_), startOfVertexSampleIndex);
|
||||
}
|
||||
|
||||
// property: endOfVertexSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassSampleBufferAttachmentDescriptor::endOfVertexSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfVertexSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassSampleBufferAttachmentDescriptor::setEndOfVertexSampleIndex(NS::UInteger endOfVertexSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfVertexSampleIndex_), endOfVertexSampleIndex);
|
||||
}
|
||||
|
||||
// property: startOfFragmentSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassSampleBufferAttachmentDescriptor::startOfFragmentSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfFragmentSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassSampleBufferAttachmentDescriptor::setStartOfFragmentSampleIndex(NS::UInteger startOfFragmentSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfFragmentSampleIndex_), startOfFragmentSampleIndex);
|
||||
}
|
||||
|
||||
// property: endOfFragmentSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassSampleBufferAttachmentDescriptor::endOfFragmentSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfFragmentSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassSampleBufferAttachmentDescriptor::setEndOfFragmentSampleIndex(NS::UInteger endOfFragmentSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfFragmentSampleIndex_), endOfFragmentSampleIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassSampleBufferAttachmentDescriptorArray* MTL::RenderPassSampleBufferAttachmentDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLRenderPassSampleBufferAttachmentDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassSampleBufferAttachmentDescriptorArray* MTL::RenderPassSampleBufferAttachmentDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassSampleBufferAttachmentDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::RenderPassSampleBufferAttachmentDescriptor* MTL::RenderPassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::RenderPassSampleBufferAttachmentDescriptorArray::setObject(const MTL::RenderPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::RenderPassDescriptor* MTL::RenderPassDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::RenderPassDescriptor>(_MTL_PRIVATE_CLS(MTLRenderPassDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::RenderPassDescriptor* MTL::RenderPassDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::RenderPassDescriptor>();
|
||||
}
|
||||
|
||||
// static method: renderPassDescriptor
|
||||
_MTL_INLINE MTL::RenderPassDescriptor* MTL::RenderPassDescriptor::renderPassDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassDescriptor*>(_MTL_PRIVATE_CLS(MTLRenderPassDescriptor), _MTL_PRIVATE_SEL(renderPassDescriptor));
|
||||
}
|
||||
|
||||
// property: colorAttachments
|
||||
_MTL_INLINE MTL::RenderPassColorAttachmentDescriptorArray* MTL::RenderPassDescriptor::colorAttachments() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassColorAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(colorAttachments));
|
||||
}
|
||||
|
||||
// property: depthAttachment
|
||||
_MTL_INLINE MTL::RenderPassDepthAttachmentDescriptor* MTL::RenderPassDescriptor::depthAttachment() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassDepthAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(depthAttachment));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setDepthAttachment(const MTL::RenderPassDepthAttachmentDescriptor* depthAttachment)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthAttachment_), depthAttachment);
|
||||
}
|
||||
|
||||
// property: stencilAttachment
|
||||
_MTL_INLINE MTL::RenderPassStencilAttachmentDescriptor* MTL::RenderPassDescriptor::stencilAttachment() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassStencilAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(stencilAttachment));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setStencilAttachment(const MTL::RenderPassStencilAttachmentDescriptor* stencilAttachment)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilAttachment_), stencilAttachment);
|
||||
}
|
||||
|
||||
// property: visibilityResultBuffer
|
||||
_MTL_INLINE MTL::Buffer* MTL::RenderPassDescriptor::visibilityResultBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(visibilityResultBuffer));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setVisibilityResultBuffer(const MTL::Buffer* visibilityResultBuffer)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibilityResultBuffer_), visibilityResultBuffer);
|
||||
}
|
||||
|
||||
// property: renderTargetArrayLength
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::renderTargetArrayLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(renderTargetArrayLength));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setRenderTargetArrayLength(NS::UInteger renderTargetArrayLength)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderTargetArrayLength_), renderTargetArrayLength);
|
||||
}
|
||||
|
||||
// property: imageblockSampleLength
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::imageblockSampleLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(imageblockSampleLength));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setImageblockSampleLength(NS::UInteger imageblockSampleLength)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockSampleLength_), imageblockSampleLength);
|
||||
}
|
||||
|
||||
// property: threadgroupMemoryLength
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::threadgroupMemoryLength() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryLength));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setThreadgroupMemoryLength(NS::UInteger threadgroupMemoryLength)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_), threadgroupMemoryLength);
|
||||
}
|
||||
|
||||
// property: tileWidth
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::tileWidth() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(tileWidth));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setTileWidth(NS::UInteger tileWidth)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTileWidth_), tileWidth);
|
||||
}
|
||||
|
||||
// property: tileHeight
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::tileHeight() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(tileHeight));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setTileHeight(NS::UInteger tileHeight)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTileHeight_), tileHeight);
|
||||
}
|
||||
|
||||
// property: defaultRasterSampleCount
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::defaultRasterSampleCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(defaultRasterSampleCount));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setDefaultRasterSampleCount(NS::UInteger defaultRasterSampleCount)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDefaultRasterSampleCount_), defaultRasterSampleCount);
|
||||
}
|
||||
|
||||
// property: renderTargetWidth
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::renderTargetWidth() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(renderTargetWidth));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setRenderTargetWidth(NS::UInteger renderTargetWidth)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderTargetWidth_), renderTargetWidth);
|
||||
}
|
||||
|
||||
// property: renderTargetHeight
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::renderTargetHeight() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(renderTargetHeight));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setRenderTargetHeight(NS::UInteger renderTargetHeight)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderTargetHeight_), renderTargetHeight);
|
||||
}
|
||||
|
||||
// method: setSamplePositions:count:
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setSamplePositions(const MTL::SamplePosition* positions, NS::UInteger count)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplePositions_count_), positions, count);
|
||||
}
|
||||
|
||||
// method: getSamplePositions:count:
|
||||
_MTL_INLINE NS::UInteger MTL::RenderPassDescriptor::getSamplePositions(MTL::SamplePosition* positions, NS::UInteger count)
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(getSamplePositions_count_), positions, count);
|
||||
}
|
||||
|
||||
// property: rasterizationRateMap
|
||||
_MTL_INLINE MTL::RasterizationRateMap* MTL::RenderPassDescriptor::rasterizationRateMap() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RasterizationRateMap*>(this, _MTL_PRIVATE_SEL(rasterizationRateMap));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::RenderPassDescriptor::setRasterizationRateMap(const MTL::RasterizationRateMap* rasterizationRateMap)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRasterizationRateMap_), rasterizationRateMap);
|
||||
}
|
||||
|
||||
// property: sampleBufferAttachments
|
||||
_MTL_INLINE MTL::RenderPassSampleBufferAttachmentDescriptorArray* MTL::RenderPassDescriptor::sampleBufferAttachments() const
|
||||
{
|
||||
return Object::sendMessage<MTL::RenderPassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
|
||||
}
|
||||
1719
src/contrib/metal-cpp/Metal/MTLRenderPipeline.hpp
Normal file
1719
src/contrib/metal-cpp/Metal/MTLRenderPipeline.hpp
Normal file
File diff suppressed because it is too large
Load Diff
195
src/contrib/metal-cpp/Metal/MTLResidencySet.hpp
Normal file
195
src/contrib/metal-cpp/Metal/MTLResidencySet.hpp
Normal file
@@ -0,0 +1,195 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLResidencySet.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class ResidencySetDescriptor : public NS::Copying<ResidencySetDescriptor>
|
||||
{
|
||||
public:
|
||||
static class ResidencySetDescriptor* alloc();
|
||||
|
||||
class ResidencySetDescriptor* init();
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
NS::UInteger initialCapacity() const;
|
||||
void setInitialCapacity(NS::UInteger initialCapacity);
|
||||
};
|
||||
|
||||
class ResidencySet : public NS::Referencing<ResidencySet>
|
||||
{
|
||||
public:
|
||||
class Device* device() const;
|
||||
|
||||
NS::String* label() const;
|
||||
|
||||
uint64_t allocatedSize() const;
|
||||
|
||||
void requestResidency();
|
||||
|
||||
void endResidency();
|
||||
|
||||
void addAllocation(const class Allocation* allocation);
|
||||
|
||||
void addAllocations(const class Allocation* const allocations[], NS::UInteger count);
|
||||
|
||||
void removeAllocation(const class Allocation* allocation);
|
||||
|
||||
void removeAllocations(const class Allocation* const allocations[], NS::UInteger count);
|
||||
|
||||
void removeAllAllocations();
|
||||
|
||||
bool containsAllocation(const class Allocation* anAllocation);
|
||||
|
||||
NS::Array* allAllocations() const;
|
||||
|
||||
NS::UInteger allocationCount() const;
|
||||
|
||||
void commit();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ResidencySetDescriptor* MTL::ResidencySetDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ResidencySetDescriptor>(_MTL_PRIVATE_CLS(MTLResidencySetDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ResidencySetDescriptor* MTL::ResidencySetDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ResidencySetDescriptor>();
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::ResidencySetDescriptor::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ResidencySetDescriptor::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: initialCapacity
|
||||
_MTL_INLINE NS::UInteger MTL::ResidencySetDescriptor::initialCapacity() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(initialCapacity));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ResidencySetDescriptor::setInitialCapacity(NS::UInteger initialCapacity)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInitialCapacity_), initialCapacity);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::ResidencySet::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::ResidencySet::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: allocatedSize
|
||||
_MTL_INLINE uint64_t MTL::ResidencySet::allocatedSize() const
|
||||
{
|
||||
return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(allocatedSize));
|
||||
}
|
||||
|
||||
// method: requestResidency
|
||||
_MTL_INLINE void MTL::ResidencySet::requestResidency()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(requestResidency));
|
||||
}
|
||||
|
||||
// method: endResidency
|
||||
_MTL_INLINE void MTL::ResidencySet::endResidency()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endResidency));
|
||||
}
|
||||
|
||||
// method: addAllocation:
|
||||
_MTL_INLINE void MTL::ResidencySet::addAllocation(const MTL::Allocation* allocation)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addAllocation_), allocation);
|
||||
}
|
||||
|
||||
// method: addAllocations:count:
|
||||
_MTL_INLINE void MTL::ResidencySet::addAllocations(const MTL::Allocation* const allocations[], NS::UInteger count)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addAllocations_count_), allocations, count);
|
||||
}
|
||||
|
||||
// method: removeAllocation:
|
||||
_MTL_INLINE void MTL::ResidencySet::removeAllocation(const MTL::Allocation* allocation)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeAllocation_), allocation);
|
||||
}
|
||||
|
||||
// method: removeAllocations:count:
|
||||
_MTL_INLINE void MTL::ResidencySet::removeAllocations(const MTL::Allocation* const allocations[], NS::UInteger count)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeAllocations_count_), allocations, count);
|
||||
}
|
||||
|
||||
// method: removeAllAllocations
|
||||
_MTL_INLINE void MTL::ResidencySet::removeAllAllocations()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeAllAllocations));
|
||||
}
|
||||
|
||||
// method: containsAllocation:
|
||||
_MTL_INLINE bool MTL::ResidencySet::containsAllocation(const MTL::Allocation* anAllocation)
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(containsAllocation_), anAllocation);
|
||||
}
|
||||
|
||||
// property: allAllocations
|
||||
_MTL_INLINE NS::Array* MTL::ResidencySet::allAllocations() const
|
||||
{
|
||||
return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(allAllocations));
|
||||
}
|
||||
|
||||
// property: allocationCount
|
||||
_MTL_INLINE NS::UInteger MTL::ResidencySet::allocationCount() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(allocationCount));
|
||||
}
|
||||
|
||||
// method: commit
|
||||
_MTL_INLINE void MTL::ResidencySet::commit()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit));
|
||||
}
|
||||
189
src/contrib/metal-cpp/Metal/MTLResource.hpp
Normal file
189
src/contrib/metal-cpp/Metal/MTLResource.hpp
Normal file
@@ -0,0 +1,189 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLResource.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 <mach/mach.h>
|
||||
|
||||
#include "MTLDefines.hpp"
|
||||
#include "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLAllocation.hpp"
|
||||
#include "MTLResource.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, PurgeableState) {
|
||||
PurgeableStateKeepCurrent = 1,
|
||||
PurgeableStateNonVolatile = 2,
|
||||
PurgeableStateVolatile = 3,
|
||||
PurgeableStateEmpty = 4,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, CPUCacheMode) {
|
||||
CPUCacheModeDefaultCache = 0,
|
||||
CPUCacheModeWriteCombined = 1,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, StorageMode) {
|
||||
StorageModeShared = 0,
|
||||
StorageModeManaged = 1,
|
||||
StorageModePrivate = 2,
|
||||
StorageModeMemoryless = 3,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, HazardTrackingMode) {
|
||||
HazardTrackingModeDefault = 0,
|
||||
HazardTrackingModeUntracked = 1,
|
||||
HazardTrackingModeTracked = 2,
|
||||
};
|
||||
|
||||
_MTL_OPTIONS(NS::UInteger, ResourceOptions) {
|
||||
ResourceCPUCacheModeDefaultCache = 0,
|
||||
ResourceCPUCacheModeWriteCombined = 1,
|
||||
ResourceStorageModeShared = 0,
|
||||
ResourceStorageModeManaged = 16,
|
||||
ResourceStorageModePrivate = 32,
|
||||
ResourceStorageModeMemoryless = 48,
|
||||
ResourceHazardTrackingModeDefault = 0,
|
||||
ResourceHazardTrackingModeUntracked = 256,
|
||||
ResourceHazardTrackingModeTracked = 512,
|
||||
ResourceOptionCPUCacheModeDefault = 0,
|
||||
ResourceOptionCPUCacheModeWriteCombined = 1,
|
||||
};
|
||||
|
||||
class Resource : public NS::Referencing<Resource, Allocation>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
MTL::CPUCacheMode cpuCacheMode() const;
|
||||
|
||||
MTL::StorageMode storageMode() const;
|
||||
|
||||
MTL::HazardTrackingMode hazardTrackingMode() const;
|
||||
|
||||
MTL::ResourceOptions resourceOptions() const;
|
||||
|
||||
MTL::PurgeableState setPurgeableState(MTL::PurgeableState state);
|
||||
|
||||
class Heap* heap() const;
|
||||
|
||||
NS::UInteger heapOffset() const;
|
||||
|
||||
NS::UInteger allocatedSize() const;
|
||||
|
||||
void makeAliasable();
|
||||
|
||||
bool isAliasable();
|
||||
|
||||
kern_return_t setOwner(task_id_token_t task_id_token);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::Resource::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::Resource::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::Resource::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: cpuCacheMode
|
||||
_MTL_INLINE MTL::CPUCacheMode MTL::Resource::cpuCacheMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
|
||||
}
|
||||
|
||||
// property: storageMode
|
||||
_MTL_INLINE MTL::StorageMode MTL::Resource::storageMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
|
||||
}
|
||||
|
||||
// property: hazardTrackingMode
|
||||
_MTL_INLINE MTL::HazardTrackingMode MTL::Resource::hazardTrackingMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
|
||||
}
|
||||
|
||||
// property: resourceOptions
|
||||
_MTL_INLINE MTL::ResourceOptions MTL::Resource::resourceOptions() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
|
||||
}
|
||||
|
||||
// method: setPurgeableState:
|
||||
_MTL_INLINE MTL::PurgeableState MTL::Resource::setPurgeableState(MTL::PurgeableState state)
|
||||
{
|
||||
return Object::sendMessage<MTL::PurgeableState>(this, _MTL_PRIVATE_SEL(setPurgeableState_), state);
|
||||
}
|
||||
|
||||
// property: heap
|
||||
_MTL_INLINE MTL::Heap* MTL::Resource::heap() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Heap*>(this, _MTL_PRIVATE_SEL(heap));
|
||||
}
|
||||
|
||||
// property: heapOffset
|
||||
_MTL_INLINE NS::UInteger MTL::Resource::heapOffset() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(heapOffset));
|
||||
}
|
||||
|
||||
// property: allocatedSize
|
||||
_MTL_INLINE NS::UInteger MTL::Resource::allocatedSize() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(allocatedSize));
|
||||
}
|
||||
|
||||
// method: makeAliasable
|
||||
_MTL_INLINE void MTL::Resource::makeAliasable()
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(makeAliasable));
|
||||
}
|
||||
|
||||
// method: isAliasable
|
||||
_MTL_INLINE bool MTL::Resource::isAliasable()
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isAliasable));
|
||||
}
|
||||
|
||||
// method: setOwnerWithIdentity:
|
||||
_MTL_INLINE kern_return_t MTL::Resource::setOwner(task_id_token_t task_id_token)
|
||||
{
|
||||
return Object::sendMessage<kern_return_t>(this, _MTL_PRIVATE_SEL(setOwnerWithIdentity_), task_id_token);
|
||||
}
|
||||
103
src/contrib/metal-cpp/Metal/MTLResourceStateCommandEncoder.hpp
Normal file
103
src/contrib/metal-cpp/Metal/MTLResourceStateCommandEncoder.hpp
Normal file
@@ -0,0 +1,103 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLResourceStateCommandEncoder.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLCommandEncoder.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, SparseTextureMappingMode) {
|
||||
SparseTextureMappingModeMap = 0,
|
||||
SparseTextureMappingModeUnmap = 1,
|
||||
};
|
||||
|
||||
struct MapIndirectArguments
|
||||
{
|
||||
uint32_t regionOriginX;
|
||||
uint32_t regionOriginY;
|
||||
uint32_t regionOriginZ;
|
||||
uint32_t regionSizeWidth;
|
||||
uint32_t regionSizeHeight;
|
||||
uint32_t regionSizeDepth;
|
||||
uint32_t mipMapLevel;
|
||||
uint32_t sliceId;
|
||||
} _MTL_PACKED;
|
||||
|
||||
class ResourceStateCommandEncoder : public NS::Referencing<ResourceStateCommandEncoder, CommandEncoder>
|
||||
{
|
||||
public:
|
||||
void updateTextureMappings(const class Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Region* regions, const NS::UInteger* mipLevels, const NS::UInteger* slices, NS::UInteger numRegions);
|
||||
|
||||
void updateTextureMapping(const class Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Region region, const NS::UInteger mipLevel, const NS::UInteger slice);
|
||||
|
||||
void updateTextureMapping(const class Texture* texture, const MTL::SparseTextureMappingMode mode, const class Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);
|
||||
|
||||
void updateFence(const class Fence* fence);
|
||||
|
||||
void waitForFence(const class Fence* fence);
|
||||
|
||||
void moveTextureMappingsFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// method: updateTextureMappings:mode:regions:mipLevels:slices:numRegions:
|
||||
_MTL_INLINE void MTL::ResourceStateCommandEncoder::updateTextureMappings(const MTL::Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Region* regions, const NS::UInteger* mipLevels, const NS::UInteger* slices, NS::UInteger numRegions)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateTextureMappings_mode_regions_mipLevels_slices_numRegions_), texture, mode, regions, mipLevels, slices, numRegions);
|
||||
}
|
||||
|
||||
// method: updateTextureMapping:mode:region:mipLevel:slice:
|
||||
_MTL_INLINE void MTL::ResourceStateCommandEncoder::updateTextureMapping(const MTL::Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Region region, const NS::UInteger mipLevel, const NS::UInteger slice)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateTextureMapping_mode_region_mipLevel_slice_), texture, mode, region, mipLevel, slice);
|
||||
}
|
||||
|
||||
// method: updateTextureMapping:mode:indirectBuffer:indirectBufferOffset:
|
||||
_MTL_INLINE void MTL::ResourceStateCommandEncoder::updateTextureMapping(const MTL::Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateTextureMapping_mode_indirectBuffer_indirectBufferOffset_), texture, mode, indirectBuffer, indirectBufferOffset);
|
||||
}
|
||||
|
||||
// method: updateFence:
|
||||
_MTL_INLINE void MTL::ResourceStateCommandEncoder::updateFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
|
||||
}
|
||||
|
||||
// method: waitForFence:
|
||||
_MTL_INLINE void MTL::ResourceStateCommandEncoder::waitForFence(const MTL::Fence* fence)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
|
||||
}
|
||||
|
||||
// method: moveTextureMappingsFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:
|
||||
_MTL_INLINE void MTL::ResourceStateCommandEncoder::moveTextureMappingsFromTexture(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(moveTextureMappingsFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
|
||||
}
|
||||
165
src/contrib/metal-cpp/Metal/MTLResourceStatePass.hpp
Normal file
165
src/contrib/metal-cpp/Metal/MTLResourceStatePass.hpp
Normal file
@@ -0,0 +1,165 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLResourceStatePass.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
class ResourceStatePassSampleBufferAttachmentDescriptor : public NS::Copying<ResourceStatePassSampleBufferAttachmentDescriptor>
|
||||
{
|
||||
public:
|
||||
static class ResourceStatePassSampleBufferAttachmentDescriptor* alloc();
|
||||
|
||||
class ResourceStatePassSampleBufferAttachmentDescriptor* init();
|
||||
|
||||
class CounterSampleBuffer* sampleBuffer() const;
|
||||
void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
|
||||
|
||||
NS::UInteger startOfEncoderSampleIndex() const;
|
||||
void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
|
||||
|
||||
NS::UInteger endOfEncoderSampleIndex() const;
|
||||
void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
|
||||
};
|
||||
|
||||
class ResourceStatePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<ResourceStatePassSampleBufferAttachmentDescriptorArray>
|
||||
{
|
||||
public:
|
||||
static class ResourceStatePassSampleBufferAttachmentDescriptorArray* alloc();
|
||||
|
||||
class ResourceStatePassSampleBufferAttachmentDescriptorArray* init();
|
||||
|
||||
class ResourceStatePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
|
||||
|
||||
void setObject(const class ResourceStatePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
|
||||
};
|
||||
|
||||
class ResourceStatePassDescriptor : public NS::Copying<ResourceStatePassDescriptor>
|
||||
{
|
||||
public:
|
||||
static class ResourceStatePassDescriptor* alloc();
|
||||
|
||||
class ResourceStatePassDescriptor* init();
|
||||
|
||||
static class ResourceStatePassDescriptor* resourceStatePassDescriptor();
|
||||
|
||||
class ResourceStatePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ResourceStatePassSampleBufferAttachmentDescriptor* MTL::ResourceStatePassSampleBufferAttachmentDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ResourceStatePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLResourceStatePassSampleBufferAttachmentDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ResourceStatePassSampleBufferAttachmentDescriptor* MTL::ResourceStatePassSampleBufferAttachmentDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ResourceStatePassSampleBufferAttachmentDescriptor>();
|
||||
}
|
||||
|
||||
// property: sampleBuffer
|
||||
_MTL_INLINE MTL::CounterSampleBuffer* MTL::ResourceStatePassSampleBufferAttachmentDescriptor::sampleBuffer() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ResourceStatePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
|
||||
}
|
||||
|
||||
// property: startOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::ResourceStatePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ResourceStatePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// property: endOfEncoderSampleIndex
|
||||
_MTL_INLINE NS::UInteger MTL::ResourceStatePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::ResourceStatePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray* MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLResourceStatePassSampleBufferAttachmentDescriptorArray));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray* MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray>();
|
||||
}
|
||||
|
||||
// method: objectAtIndexedSubscript:
|
||||
_MTL_INLINE MTL::ResourceStatePassSampleBufferAttachmentDescriptor* MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceStatePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
|
||||
}
|
||||
|
||||
// method: setObject:atIndexedSubscript:
|
||||
_MTL_INLINE void MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::ResourceStatePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::ResourceStatePassDescriptor* MTL::ResourceStatePassDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::ResourceStatePassDescriptor>(_MTL_PRIVATE_CLS(MTLResourceStatePassDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::ResourceStatePassDescriptor* MTL::ResourceStatePassDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::ResourceStatePassDescriptor>();
|
||||
}
|
||||
|
||||
// static method: resourceStatePassDescriptor
|
||||
_MTL_INLINE MTL::ResourceStatePassDescriptor* MTL::ResourceStatePassDescriptor::resourceStatePassDescriptor()
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceStatePassDescriptor*>(_MTL_PRIVATE_CLS(MTLResourceStatePassDescriptor), _MTL_PRIVATE_SEL(resourceStatePassDescriptor));
|
||||
}
|
||||
|
||||
// property: sampleBufferAttachments
|
||||
_MTL_INLINE MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray* MTL::ResourceStatePassDescriptor::sampleBufferAttachments() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
|
||||
}
|
||||
319
src/contrib/metal-cpp/Metal/MTLSampler.hpp
Normal file
319
src/contrib/metal-cpp/Metal/MTLSampler.hpp
Normal file
@@ -0,0 +1,319 @@
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Metal/MTLSampler.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 "MTLHeaderBridge.hpp"
|
||||
#include "MTLPrivate.hpp"
|
||||
|
||||
#include <Foundation/Foundation.hpp>
|
||||
|
||||
#include "MTLDepthStencil.hpp"
|
||||
#include "MTLSampler.hpp"
|
||||
#include "MTLTypes.hpp"
|
||||
|
||||
namespace MTL
|
||||
{
|
||||
_MTL_ENUM(NS::UInteger, SamplerMinMagFilter) {
|
||||
SamplerMinMagFilterNearest = 0,
|
||||
SamplerMinMagFilterLinear = 1,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, SamplerMipFilter) {
|
||||
SamplerMipFilterNotMipmapped = 0,
|
||||
SamplerMipFilterNearest = 1,
|
||||
SamplerMipFilterLinear = 2,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, SamplerAddressMode) {
|
||||
SamplerAddressModeClampToEdge = 0,
|
||||
SamplerAddressModeMirrorClampToEdge = 1,
|
||||
SamplerAddressModeRepeat = 2,
|
||||
SamplerAddressModeMirrorRepeat = 3,
|
||||
SamplerAddressModeClampToZero = 4,
|
||||
SamplerAddressModeClampToBorderColor = 5,
|
||||
};
|
||||
|
||||
_MTL_ENUM(NS::UInteger, SamplerBorderColor) {
|
||||
SamplerBorderColorTransparentBlack = 0,
|
||||
SamplerBorderColorOpaqueBlack = 1,
|
||||
SamplerBorderColorOpaqueWhite = 2,
|
||||
};
|
||||
|
||||
class SamplerDescriptor : public NS::Copying<SamplerDescriptor>
|
||||
{
|
||||
public:
|
||||
static class SamplerDescriptor* alloc();
|
||||
|
||||
class SamplerDescriptor* init();
|
||||
|
||||
MTL::SamplerMinMagFilter minFilter() const;
|
||||
void setMinFilter(MTL::SamplerMinMagFilter minFilter);
|
||||
|
||||
MTL::SamplerMinMagFilter magFilter() const;
|
||||
void setMagFilter(MTL::SamplerMinMagFilter magFilter);
|
||||
|
||||
MTL::SamplerMipFilter mipFilter() const;
|
||||
void setMipFilter(MTL::SamplerMipFilter mipFilter);
|
||||
|
||||
NS::UInteger maxAnisotropy() const;
|
||||
void setMaxAnisotropy(NS::UInteger maxAnisotropy);
|
||||
|
||||
MTL::SamplerAddressMode sAddressMode() const;
|
||||
void setSAddressMode(MTL::SamplerAddressMode sAddressMode);
|
||||
|
||||
MTL::SamplerAddressMode tAddressMode() const;
|
||||
void setTAddressMode(MTL::SamplerAddressMode tAddressMode);
|
||||
|
||||
MTL::SamplerAddressMode rAddressMode() const;
|
||||
void setRAddressMode(MTL::SamplerAddressMode rAddressMode);
|
||||
|
||||
MTL::SamplerBorderColor borderColor() const;
|
||||
void setBorderColor(MTL::SamplerBorderColor borderColor);
|
||||
|
||||
bool normalizedCoordinates() const;
|
||||
void setNormalizedCoordinates(bool normalizedCoordinates);
|
||||
|
||||
float lodMinClamp() const;
|
||||
void setLodMinClamp(float lodMinClamp);
|
||||
|
||||
float lodMaxClamp() const;
|
||||
void setLodMaxClamp(float lodMaxClamp);
|
||||
|
||||
bool lodAverage() const;
|
||||
void setLodAverage(bool lodAverage);
|
||||
|
||||
MTL::CompareFunction compareFunction() const;
|
||||
void setCompareFunction(MTL::CompareFunction compareFunction);
|
||||
|
||||
bool supportArgumentBuffers() const;
|
||||
void setSupportArgumentBuffers(bool supportArgumentBuffers);
|
||||
|
||||
NS::String* label() const;
|
||||
void setLabel(const NS::String* label);
|
||||
};
|
||||
|
||||
class SamplerState : public NS::Referencing<SamplerState>
|
||||
{
|
||||
public:
|
||||
NS::String* label() const;
|
||||
|
||||
class Device* device() const;
|
||||
|
||||
MTL::ResourceID gpuResourceID() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// static method: alloc
|
||||
_MTL_INLINE MTL::SamplerDescriptor* MTL::SamplerDescriptor::alloc()
|
||||
{
|
||||
return NS::Object::alloc<MTL::SamplerDescriptor>(_MTL_PRIVATE_CLS(MTLSamplerDescriptor));
|
||||
}
|
||||
|
||||
// method: init
|
||||
_MTL_INLINE MTL::SamplerDescriptor* MTL::SamplerDescriptor::init()
|
||||
{
|
||||
return NS::Object::init<MTL::SamplerDescriptor>();
|
||||
}
|
||||
|
||||
// property: minFilter
|
||||
_MTL_INLINE MTL::SamplerMinMagFilter MTL::SamplerDescriptor::minFilter() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerMinMagFilter>(this, _MTL_PRIVATE_SEL(minFilter));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setMinFilter(MTL::SamplerMinMagFilter minFilter)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMinFilter_), minFilter);
|
||||
}
|
||||
|
||||
// property: magFilter
|
||||
_MTL_INLINE MTL::SamplerMinMagFilter MTL::SamplerDescriptor::magFilter() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerMinMagFilter>(this, _MTL_PRIVATE_SEL(magFilter));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setMagFilter(MTL::SamplerMinMagFilter magFilter)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMagFilter_), magFilter);
|
||||
}
|
||||
|
||||
// property: mipFilter
|
||||
_MTL_INLINE MTL::SamplerMipFilter MTL::SamplerDescriptor::mipFilter() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerMipFilter>(this, _MTL_PRIVATE_SEL(mipFilter));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setMipFilter(MTL::SamplerMipFilter mipFilter)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMipFilter_), mipFilter);
|
||||
}
|
||||
|
||||
// property: maxAnisotropy
|
||||
_MTL_INLINE NS::UInteger MTL::SamplerDescriptor::maxAnisotropy() const
|
||||
{
|
||||
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxAnisotropy));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setMaxAnisotropy(NS::UInteger maxAnisotropy)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxAnisotropy_), maxAnisotropy);
|
||||
}
|
||||
|
||||
// property: sAddressMode
|
||||
_MTL_INLINE MTL::SamplerAddressMode MTL::SamplerDescriptor::sAddressMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerAddressMode>(this, _MTL_PRIVATE_SEL(sAddressMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setSAddressMode(MTL::SamplerAddressMode sAddressMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSAddressMode_), sAddressMode);
|
||||
}
|
||||
|
||||
// property: tAddressMode
|
||||
_MTL_INLINE MTL::SamplerAddressMode MTL::SamplerDescriptor::tAddressMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerAddressMode>(this, _MTL_PRIVATE_SEL(tAddressMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setTAddressMode(MTL::SamplerAddressMode tAddressMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTAddressMode_), tAddressMode);
|
||||
}
|
||||
|
||||
// property: rAddressMode
|
||||
_MTL_INLINE MTL::SamplerAddressMode MTL::SamplerDescriptor::rAddressMode() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerAddressMode>(this, _MTL_PRIVATE_SEL(rAddressMode));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setRAddressMode(MTL::SamplerAddressMode rAddressMode)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRAddressMode_), rAddressMode);
|
||||
}
|
||||
|
||||
// property: borderColor
|
||||
_MTL_INLINE MTL::SamplerBorderColor MTL::SamplerDescriptor::borderColor() const
|
||||
{
|
||||
return Object::sendMessage<MTL::SamplerBorderColor>(this, _MTL_PRIVATE_SEL(borderColor));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setBorderColor(MTL::SamplerBorderColor borderColor)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBorderColor_), borderColor);
|
||||
}
|
||||
|
||||
// property: normalizedCoordinates
|
||||
_MTL_INLINE bool MTL::SamplerDescriptor::normalizedCoordinates() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(normalizedCoordinates));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setNormalizedCoordinates(bool normalizedCoordinates)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setNormalizedCoordinates_), normalizedCoordinates);
|
||||
}
|
||||
|
||||
// property: lodMinClamp
|
||||
_MTL_INLINE float MTL::SamplerDescriptor::lodMinClamp() const
|
||||
{
|
||||
return Object::sendMessage<float>(this, _MTL_PRIVATE_SEL(lodMinClamp));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setLodMinClamp(float lodMinClamp)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLodMinClamp_), lodMinClamp);
|
||||
}
|
||||
|
||||
// property: lodMaxClamp
|
||||
_MTL_INLINE float MTL::SamplerDescriptor::lodMaxClamp() const
|
||||
{
|
||||
return Object::sendMessage<float>(this, _MTL_PRIVATE_SEL(lodMaxClamp));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setLodMaxClamp(float lodMaxClamp)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLodMaxClamp_), lodMaxClamp);
|
||||
}
|
||||
|
||||
// property: lodAverage
|
||||
_MTL_INLINE bool MTL::SamplerDescriptor::lodAverage() const
|
||||
{
|
||||
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(lodAverage));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setLodAverage(bool lodAverage)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLodAverage_), lodAverage);
|
||||
}
|
||||
|
||||
// property: compareFunction
|
||||
_MTL_INLINE MTL::CompareFunction MTL::SamplerDescriptor::compareFunction() const
|
||||
{
|
||||
return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(compareFunction));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setCompareFunction(MTL::CompareFunction compareFunction)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCompareFunction_), compareFunction);
|
||||
}
|
||||
|
||||
// property: supportArgumentBuffers
|
||||
_MTL_INLINE bool MTL::SamplerDescriptor::supportArgumentBuffers() const
|
||||
{
|
||||
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportArgumentBuffers));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setSupportArgumentBuffers(bool supportArgumentBuffers)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportArgumentBuffers_), supportArgumentBuffers);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::SamplerDescriptor::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
_MTL_INLINE void MTL::SamplerDescriptor::setLabel(const NS::String* label)
|
||||
{
|
||||
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
|
||||
}
|
||||
|
||||
// property: label
|
||||
_MTL_INLINE NS::String* MTL::SamplerState::label() const
|
||||
{
|
||||
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
|
||||
}
|
||||
|
||||
// property: device
|
||||
_MTL_INLINE MTL::Device* MTL::SamplerState::device() const
|
||||
{
|
||||
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
|
||||
}
|
||||
|
||||
// property: gpuResourceID
|
||||
_MTL_INLINE MTL::ResourceID MTL::SamplerState::gpuResourceID() const
|
||||
{
|
||||
return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user