Skip to content

Commit

Permalink
Upgrade metal_irconverter headers to 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Aug 23, 2024
1 parent 98b128d commit 7e7b3be
Show file tree
Hide file tree
Showing 25 changed files with 236 additions and 115 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "saxaboom"
version = "0.1.0+irconverter-1.1"
version = "0.1.0+irconverter-2.0"
authors = ["Traverse Research <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion bindings_generator/vendor/metal_irconverter/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright © 2023 Apple Inc.
Copyright © 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
2 changes: 1 addition & 1 deletion bindings_generator/vendor/metal_irconverter/ir_filter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
2 changes: 1 addition & 1 deletion bindings_generator/vendor/metal_irconverter/ir_format.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down
6 changes: 3 additions & 3 deletions bindings_generator/vendor/metal_irconverter/ir_version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand All @@ -19,8 +19,8 @@
#ifndef IRVERSION_H
#define IRVERSION_H

#define IR_VERSION_MAJOR 1
#define IR_VERSION_MINOR 1
#define IR_VERSION_MAJOR 2
#define IR_VERSION_MINOR 0
#define IR_VERSION_PATCH 0

#define IR_SUPPORTS_VERSION(major, minor, patch) \
Expand Down
45 changes: 37 additions & 8 deletions bindings_generator/vendor/metal_irconverter/metal_irconverter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down Expand Up @@ -128,7 +128,7 @@ typedef struct IRVertexInputTable
{
uint32_t NumDescriptorRanges;
const IRDescriptorRange* pDescriptorRanges;
} IRVertexInput;
} IRVertexInputTable;

typedef struct IRRootConstants
{
Expand Down Expand Up @@ -188,7 +188,7 @@ typedef enum IRCompatibilityFlags
IRCompatibilityFlagSamplerLODBias = (1 << 3),
IRCompatibilityFlagPositionInvariance = (1 << 4),
IRCompatibilityFlagSampleNanToZero = (1 << 5),

IRCompatibilityFlagTexWriteRoundingRTZ = (1 << 6),
} IRCompatibilityFlags;

typedef struct IRStaticSamplerDescriptor
Expand Down Expand Up @@ -284,8 +284,8 @@ typedef struct IRInputElementDescriptor1
IRFormat format;
uint32_t inputSlot;
uint32_t alignedByteOffset;
IRInputClassification inputSlotClass;
uint32_t instanceDataStepRate;
IRInputClassification inputSlotClass;
} IRInputElementDescriptor1;


Expand Down Expand Up @@ -343,6 +343,7 @@ enum IRErrorCode
IRErrorCodeUnableToLinkModule,
IRErrorCodeUnrecognizedDXILHeader,
IRErrorCodeInvalidRaytracingAttribute,
IRErrorCodeNullHullShaderInputOutputMismatch,
IRErrorCodeUnknown
};

Expand Down Expand Up @@ -454,7 +455,7 @@ void IRCompilerDestroy(IRCompiler* compiler);
* @param entryPointName optional entry point name to compile when converting a library with multiple entry points.
* @param input input IR object.
* @param error on return, if the compiler generates any errors, this optional out parameter contains error information. If an error occurs and this parameter is non-NULL, you must free it by calling IRErrorDestroy.
* @return an IR Object containing MetalIR compiled from the input IR, or NULL if an error occurs. You must destroy this object by calling IRObjectDestroy.
* @return an IR Object containing MetalIR compiled and linked from the input IR, or NULL if an error occurs. You must destroy this object by calling IRObjectDestroy.
*/
IRObject* IRCompilerAllocCompileAndLink(IRCompiler* compiler, const char* entryPointName, const IRObject* input, IRError** error);

Expand Down Expand Up @@ -546,7 +547,7 @@ void IRCompilerSetHitgroupType(IRCompiler* compiler, IRHitGroupType hitGroupType

#define IRIntrinsicMaskClosestHitAll 0x7FFFFFFF
#define IRIntrinsicMaskMissShaderAll 0x7FFF
#define IRIntrinsicMaskCallableShaderAll 0x7FFF
#define IRIntrinsicMaskCallableShaderAll 0x703F
#define IRIntrinsicMaskAnyHitShaderAll ((uint64_t)-1)
#define IRRayTracingUnlimitedRecursionDepth (-1)

Expand Down Expand Up @@ -695,6 +696,13 @@ void IRCompilerSetMinimumGPUFamily(IRCompiler* compiler, IRGPUFamily family);
*/
void IRCompilerIgnoreRootSignature(IRCompiler* compiler, bool ignoreEmbeddedRootSignature);

/**
* Set compiler settings to ignore debug information.
* @param compiler compiler for which to set the flags.
* @param ignoreDebugInformation whether dxil debug information should be ignored. Defaults to false.
*/
void IRCompilerIgnoreDebugInformation(IRCompiler* compiler, bool ignoreDebugInformation);

typedef enum IROperatingSystem
{
IROperatingSystem_macOS,
Expand Down Expand Up @@ -752,7 +760,7 @@ dispatch_data_t IRMetalLibGetBytecodeData(const IRMetalLibBinary* lib);
#endif // __APPLE__

/**
* Serialize an MetalIR object's shader bytecode to disk.
* Serialize a MetalIR object's shader bytecode to disk.
* @param outputPath path into which to write the serialized MetalIR.
* @param obj IRObject containing the bytecode to serialize.
* @param stage shader stage to serialize.
Expand Down Expand Up @@ -1256,13 +1264,34 @@ const char* IRVersionedRootSignatureDescriptorAllocStringAndSerialize(IRVersione
void IRVersionedRootSignatureDescriptorFreeString(const char* serialized);

/**
* Deserialized a string representation of a root signature into a root signature object.
* Deserialize a string representation of a root signature into a root signature object.
* @param serialized a string representation of a root signature.
* @param rootSignatureDescriptor root signature object into which to deserialize the root signature.
* @return true if deserialization is successful, false otherwise.
*/
bool IRVersionedRootSignatureDescriptorDeserialize(const char* serialized, IRVersionedRootSignatureDescriptor* rootSignatureDescriptor);

/**
* Serialize an input layout descriptor version 1 into a string.
* @param inputLayoutDescriptor descriptor to serialize.
* @return a string representation of the input layout descriptor. You need to release this string by calling IRInputLayoutDescriptor1FreeString.
*/
const char* IRInputLayoutDescriptor1AllocStringAndSerialize(IRInputLayoutDescriptor1* inputLayoutDescriptor);

/**
* Release a string allocated by IRInputLayoutDescriptor1AllocStringAndSerialize.
* @param serialized string to release.
*/
void IRInputLayoutDescriptor1FreeString(const char* serialized);

/**
* Deserialize a string representation of an input layout descriptor version 1 into an IRInputLayoutDescriptor1 structure.
* @param serialized a string representation of an input layout descriptor version 1.
* @param inputLayoutDescriptor input layout descriptor version 1 object into which to deserialized the input layout descriptor.
* @return true if deserialization is successful, false otherwise.
*/
bool IRInputLayoutDescriptor1Deserialize(const char* serialized, IRInputLayoutDescriptor1* inputLayoutDescriptor);

#ifdef __cplusplus
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright © 2023 Apple Inc.
Copyright © 2023-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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand Down Expand Up @@ -157,6 +157,9 @@ void IRRaytracingUpdateInstanceContributions(IRRaytracingAccelerationStructureGP

#ifndef __METAL_VERSION__

extern const char* kIRRayDispatchIndirectionKernelName;
extern const uint64_t kIRRayDispatchArgumentsBindPoint;

/**
* Encode an acceleration structure into the argument buffer.
* @param entry the pointer to the descriptor table entry to encode the acceleration structure reference into.
Expand Down Expand Up @@ -195,11 +198,11 @@ void IRShaderIdentifierInit(IRShaderIdentifier* identifier, uint64_t shaderHandl
*/
void IRShaderIdentifierInitWithCustomIntersection(IRShaderIdentifier* identifier, uint64_t shaderHandle, uint64_t intersectionShaderHandle) IR_OVERLOADABLE;

#ifdef IR_PRIVATE_IMPLEMENTATION

const char* kIRRayDispatchIndirectionKernelName = "RaygenIndirection";
const uint64_t kIRRayDispatchArgumentsBindPoint = 3;

#ifdef IR_PRIVATE_IMPLEMENTATION

IR_INLINE
void IRShaderIdentifierInit(IRShaderIdentifier* identifier, uint64_t shaderHandle) IR_OVERLOADABLE
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright 2023 Apple Inc.
// Copyright 2023-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.
Expand All @@ -25,9 +25,9 @@ extern "C" {
#include <stdint.h>
#endif // __cplusplus

const uint64_t kIRRuntimeTessellatorTablesBindPoint = 7;
const uint32_t kIRRuntimeTessellatorTablesCountsAndOffsetLength = 32768;
const uint32_t kIRRuntimeTessellatorTablesLookupTableLength = 701114;
extern const uint64_t kIRRuntimeTessellatorTablesBindPoint;
extern const uint32_t kIRRuntimeTessellatorTablesCountsAndOffsetLength;
extern const uint32_t kIRRuntimeTessellatorTablesLookupTableLength;

/**
* Query the size in bytes necessary to store the tessellator tables.
Expand Down Expand Up @@ -4209,6 +4209,10 @@ static const uint8_t kIRTessellatorTablesLookupTable[] = {
0,1,0,0,1,3,1,2,2,3,2,2,3,3,3,2,4,3,4,2,5,3,5,2,6,3,6,2,7,3,7,2,8,3,8,2,9,3,9,2,10,3,10,2,11,3,11,2,12,3,12,2,13,3,13,2,14,3,14,2,15,3,15,2,16,3,16,2,17,3,17,2,18,3,18,2,19,3,19,2,20,3,20,2,21,3,21,2,22,3,22,2,23,3,23,2,24,3,24,2,25,3,25,2,26,3,26,2,27,3,27,2,28,3,28,2,29,3,29,2,30,3,30,2,31,3,31,2,32,3,31,0,33,3,32,2,34,3,33,2,35,3,34,2,36,3,35,2,37,3,36,2,38,3,37,2,39,3,38,2,40,3,39,2,41,3,40,2,42,3,41,2,43,3,42,2,44,3,43,2,45,3,44,2,46,3,45,2,47,3,46,2,48,3,47,2,49,3,48,2,50,3,49,2,51,3,50,2,52,3,51,2,53,3,52,2,54,3,53,2,55,3,54,2,56,3,55,2,57,3,56,2,58,3,57,2,59,3,58,2,60,3,59,2,61,3,60,2,62,3,61,2,63,3,62,2,64,3,// in:64 out:64
};

const uint64_t kIRRuntimeTessellatorTablesBindPoint = 7;
const uint32_t kIRRuntimeTessellatorTablesCountsAndOffsetLength = 32768;
const uint32_t kIRRuntimeTessellatorTablesLookupTableLength = 701114;

IR_INLINE
uint64_t IRRuntimeTessellatorTablesSize(void)
{
Expand Down
Loading

0 comments on commit 7e7b3be

Please sign in to comment.