About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/kosmickrisp/bridge/mtl_compute_state.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/kosmickrisp/bridge/mtl_compute_state.m')
-rw-r--r--src/kosmickrisp/bridge/mtl_compute_state.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/kosmickrisp/bridge/mtl_compute_state.m b/src/kosmickrisp/bridge/mtl_compute_state.m
new file mode 100644
index 00000000000..f6ebce751b5
--- /dev/null
+++ b/src/kosmickrisp/bridge/mtl_compute_state.m
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2025 LunarG, Inc.
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "mtl_compute_state.h"
+
+#include <Metal/MTLComputePipeline.h>
+
+mtl_compute_pipeline_state *
+mtl_new_compute_pipeline_state(mtl_device *device, mtl_function *function,
+ uint64_t max_total_threads_per_threadgroup)
+{
+ @autoreleasepool {
+ id<MTLDevice> dev = (id<MTLDevice>)device;
+ id<MTLComputePipelineState> pipeline = NULL;
+
+ MTLComputePipelineDescriptor *comp_desc = [[[MTLComputePipelineDescriptor alloc] init] autorelease];
+ NSError *error;
+ comp_desc.computeFunction = (id<MTLFunction>)function;
+ comp_desc.maxTotalThreadsPerThreadgroup = max_total_threads_per_threadgroup;
+ pipeline = [dev newComputePipelineStateWithDescriptor:comp_desc options:0 reflection:nil error:&error];
+
+ /* TODO_KOSMICKRISP Error checking */
+
+ return pipeline;
+ }
+}