Skip to content

Commit

Permalink
HACK: Make constants available outside of IR_PRIVATE_IMPLEMENTATION
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Jan 24, 2025
1 parent 4fce68a commit 067e548
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ 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 @@ -202,11 +199,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
Expand Up @@ -25,9 +25,9 @@ extern "C" {
#include <stdint.h>
#endif // __cplusplus

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

/**
* Query the size in bytes necessary to store the tessellator tables.
Expand Down Expand Up @@ -4209,10 +4209,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,6 @@ extern "C" {
#define IR_INLINE __attribute__((always_inline))
#define IR_OVERLOADABLE __attribute__((overloadable))

extern const uint64_t kIRArgumentBufferBindPoint;
extern const uint64_t kIRDescriptorHeapBindPoint;
extern const uint64_t kIRSamplerHeapBindPoint;
extern const uint64_t kIRArgumentBufferHullDomainBindPoint;
extern const uint64_t kIRArgumentBufferDrawArgumentsBindPoint;
extern const uint64_t kIRArgumentBufferUniformsBindPoint;
extern const uint64_t kIRVertexBufferBindPoint;
extern const uint64_t kIRStageInAttributeStartIndex;

extern const char* kIRIndirectTriangleIntersectionFunctionName;
extern const char* kIRIndirectProceduralIntersectionFunctionName;

extern const char* kIRTrianglePassthroughGeometryShader;
extern const char* kIRLinePassthroughGeometryShader;
extern const char* kIRPointPassthroughGeometryShader;

extern const char* kIRFunctionGroupRayGeneration;
extern const char* kIRFunctionGroupClosestHit;
extern const char* kIRFunctionGroupMiss;

extern const uint16_t kIRNonIndexedDraw;

typedef struct IRDescriptorTableEntry
{
uint64_t gpuVA;
Expand Down Expand Up @@ -541,15 +519,6 @@ renderpipelinestate_t IRRuntimeNewGeometryTessellationEmulationPipeline(device_t
const IRGeometryTessellationEmulationPipelineDescriptor* descriptor,
nserror_t* error) API_AVAILABLE(macosx(14), ios(17));

#ifdef IR_PRIVATE_IMPLEMENTATION

#ifndef IR_RUNTIME_METALCPP
#if !__has_feature(objc_arc)
#error The implementation of this file needs to be generated in a module with ARC enabled when in Objective-C mode.
#endif
#endif


const uint64_t kIRArgumentBufferBindPoint = 2;
const uint64_t kIRArgumentBufferHullDomainBindPoint = 3;
const uint64_t kIRDescriptorHeapBindPoint = 0;
Expand Down Expand Up @@ -579,6 +548,15 @@ const uint64_t kIRTexViewMask = 0xff;
const uint64_t kIRTypedBufferOffset = 63;


#ifdef IR_PRIVATE_IMPLEMENTATION

#ifndef IR_RUNTIME_METALCPP
#if !__has_feature(objc_arc)
#error The implementation of this file needs to be generated in a module with ARC enabled when in Objective-C mode.
#endif
#endif


IR_INLINE
void IRRuntimeCreateAppendBufferView(device_t device, buffer_t appendBuffer, uint64_t appendBufferOffset, uint32_t initialCounterValue, IRBufferView* outBufferView)
{
Expand Down

0 comments on commit 067e548

Please sign in to comment.