aboutsummaryrefslogtreecommitdiff
path: root/src/venus/vkr_pipeline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/venus/vkr_pipeline.c')
-rw-r--r--src/venus/vkr_pipeline.c142
1 files changed, 142 insertions, 0 deletions
diff --git a/src/venus/vkr_pipeline.c b/src/venus/vkr_pipeline.c
new file mode 100644
index 00000000..d30756ea
--- /dev/null
+++ b/src/venus/vkr_pipeline.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2020 Google LLC
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "vkr_pipeline.h"
+
+#include "vkr_pipeline_gen.h"
+
+static void
+vkr_dispatch_vkCreateShaderModule(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkCreateShaderModule *args)
+{
+ vkr_shader_module_create_and_add(dispatch->data, args);
+}
+
+static void
+vkr_dispatch_vkDestroyShaderModule(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkDestroyShaderModule *args)
+{
+ vkr_shader_module_destroy_and_remove(dispatch->data, args);
+}
+
+static void
+vkr_dispatch_vkCreatePipelineLayout(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkCreatePipelineLayout *args)
+{
+ vkr_pipeline_layout_create_and_add(dispatch->data, args);
+}
+
+static void
+vkr_dispatch_vkDestroyPipelineLayout(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkDestroyPipelineLayout *args)
+{
+ vkr_pipeline_layout_destroy_and_remove(dispatch->data, args);
+}
+
+static void
+vkr_dispatch_vkCreatePipelineCache(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkCreatePipelineCache *args)
+{
+ vkr_pipeline_cache_create_and_add(dispatch->data, args);
+}
+
+static void
+vkr_dispatch_vkDestroyPipelineCache(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkDestroyPipelineCache *args)
+{
+ vkr_pipeline_cache_destroy_and_remove(dispatch->data, args);
+}
+
+static void
+vkr_dispatch_vkGetPipelineCacheData(UNUSED struct vn_dispatch_context *dispatch,
+ struct vn_command_vkGetPipelineCacheData *args)
+{
+ vn_replace_vkGetPipelineCacheData_args_handle(args);
+ args->ret = vkGetPipelineCacheData(args->device, args->pipelineCache, args->pDataSize,
+ args->pData);
+}
+
+static void
+vkr_dispatch_vkMergePipelineCaches(UNUSED struct vn_dispatch_context *dispatch,
+ struct vn_command_vkMergePipelineCaches *args)
+{
+ vn_replace_vkMergePipelineCaches_args_handle(args);
+ args->ret = vkMergePipelineCaches(args->device, args->dstCache, args->srcCacheCount,
+ args->pSrcCaches);
+}
+
+static void
+vkr_dispatch_vkCreateGraphicsPipelines(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkCreateGraphicsPipelines *args)
+{
+ struct vkr_context *ctx = dispatch->data;
+ struct vkr_device *dev = vkr_device_from_handle(args->device);
+ struct object_array arr;
+
+ if (vkr_graphics_pipeline_create_array(ctx, args, &arr) != VK_SUCCESS)
+ return;
+
+ vkr_pipeline_add_array(ctx, dev, &arr);
+}
+
+static void
+vkr_dispatch_vkCreateComputePipelines(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkCreateComputePipelines *args)
+{
+ struct vkr_context *ctx = dispatch->data;
+ struct vkr_device *dev = vkr_device_from_handle(args->device);
+ struct object_array arr;
+
+ if (vkr_compute_pipeline_create_array(ctx, args, &arr) != VK_SUCCESS)
+ return;
+
+ vkr_pipeline_add_array(ctx, dev, &arr);
+}
+
+static void
+vkr_dispatch_vkDestroyPipeline(struct vn_dispatch_context *dispatch,
+ struct vn_command_vkDestroyPipeline *args)
+{
+ vkr_pipeline_destroy_and_remove(dispatch->data, args);
+}
+
+void
+vkr_context_init_shader_module_dispatch(struct vkr_context *ctx)
+{
+ struct vn_dispatch_context *dispatch = &ctx->dispatch;
+
+ dispatch->dispatch_vkCreateShaderModule = vkr_dispatch_vkCreateShaderModule;
+ dispatch->dispatch_vkDestroyShaderModule = vkr_dispatch_vkDestroyShaderModule;
+}
+
+void
+vkr_context_init_pipeline_layout_dispatch(struct vkr_context *ctx)
+{
+ struct vn_dispatch_context *dispatch = &ctx->dispatch;
+
+ dispatch->dispatch_vkCreatePipelineLayout = vkr_dispatch_vkCreatePipelineLayout;
+ dispatch->dispatch_vkDestroyPipelineLayout = vkr_dispatch_vkDestroyPipelineLayout;
+}
+
+void
+vkr_context_init_pipeline_cache_dispatch(struct vkr_context *ctx)
+{
+ struct vn_dispatch_context *dispatch = &ctx->dispatch;
+
+ dispatch->dispatch_vkCreatePipelineCache = vkr_dispatch_vkCreatePipelineCache;
+ dispatch->dispatch_vkDestroyPipelineCache = vkr_dispatch_vkDestroyPipelineCache;
+ dispatch->dispatch_vkGetPipelineCacheData = vkr_dispatch_vkGetPipelineCacheData;
+ dispatch->dispatch_vkMergePipelineCaches = vkr_dispatch_vkMergePipelineCaches;
+}
+
+void
+vkr_context_init_pipeline_dispatch(struct vkr_context *ctx)
+{
+ struct vn_dispatch_context *dispatch = &ctx->dispatch;
+
+ dispatch->dispatch_vkCreateGraphicsPipelines = vkr_dispatch_vkCreateGraphicsPipelines;
+ dispatch->dispatch_vkCreateComputePipelines = vkr_dispatch_vkCreateComputePipelines;
+ dispatch->dispatch_vkDestroyPipeline = vkr_dispatch_vkDestroyPipeline;
+}