vkr: split out vkr_pipeline.c

No functional change.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Chia-I Wu 3 years ago
parent 939991220a
commit 243cacf2bb
  1. 1
      src/meson.build
  2. 170
      src/venus/vkr_pipeline.c
  3. 12
      src/venus/vkr_pipeline.h
  4. 135
      src/venus/vkr_renderer.c

@ -89,6 +89,7 @@ venus_sources = [
'venus/vkr_device.h',
'venus/vkr_device_memory.h',
'venus/vkr_image.h',
'venus/vkr_pipeline.c',
'venus/vkr_pipeline.h',
'venus/vkr_query_pool.h',
'venus/vkr_queue.h',

@ -0,0 +1,170 @@
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#include "vkr_pipeline.h"
#include "venus-protocol/vn_protocol_renderer_pipeline.h"
#include "venus-protocol/vn_protocol_renderer_pipeline_cache.h"
#include "venus-protocol/vn_protocol_renderer_pipeline_layout.h"
#include "venus-protocol/vn_protocol_renderer_shader_module.h"
#include "vkr_context.h"
#include "vkr_device.h"
static void
vkr_dispatch_vkCreateShaderModule(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateShaderModule *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(mod, shader_module, SHADER_MODULE, vkCreateShaderModule, pShaderModule);
util_hash_table_set_u64(ctx->object_table, mod->base.id, mod);
}
static void
vkr_dispatch_vkDestroyShaderModule(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyShaderModule *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(mod, shader_module, SHADER_MODULE, vkDestroyShaderModule, shaderModule);
util_hash_table_remove_u64(ctx->object_table, mod->base.id);
}
static void
vkr_dispatch_vkCreatePipelineLayout(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreatePipelineLayout *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkCreatePipelineLayout,
pPipelineLayout);
util_hash_table_set_u64(ctx->object_table, layout->base.id, layout);
}
static void
vkr_dispatch_vkDestroyPipelineLayout(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipelineLayout *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkDestroyPipelineLayout,
pipelineLayout);
util_hash_table_remove_u64(ctx->object_table, layout->base.id);
}
static void
vkr_dispatch_vkCreatePipelineCache(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreatePipelineCache *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkCreatePipelineCache,
pPipelineCache);
util_hash_table_set_u64(ctx->object_table, cache->base.id, cache);
}
static void
vkr_dispatch_vkDestroyPipelineCache(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipelineCache *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkDestroyPipelineCache,
pipelineCache);
util_hash_table_remove_u64(ctx->object_table, cache->base.id);
}
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;
CREATE_PIPELINE_ARRAY(vkCreateGraphicsPipelines);
}
static void
vkr_dispatch_vkCreateComputePipelines(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateComputePipelines *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_PIPELINE_ARRAY(vkCreateComputePipelines);
}
static void
vkr_dispatch_vkDestroyPipeline(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipeline *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(pipeline, pipeline, PIPELINE, vkDestroyPipeline, pipeline);
util_hash_table_remove_u64(ctx->object_table, pipeline->base.id);
}
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;
}

@ -24,4 +24,16 @@ struct vkr_pipeline {
struct vkr_object base;
};
void
vkr_context_init_shader_module_dispatch(struct vkr_context *ctx);
void
vkr_context_init_pipeline_layout_dispatch(struct vkr_context *ctx);
void
vkr_context_init_pipeline_cache_dispatch(struct vkr_context *ctx);
void
vkr_context_init_pipeline_dispatch(struct vkr_context *ctx);
#endif /* VKR_PIPELINE_H */

@ -2775,123 +2775,6 @@ vkr_dispatch_vkResetQueryPool(struct vn_dispatch_context *dispatch,
dev->ResetQueryPool(args->device, args->queryPool, args->firstQuery, args->queryCount);
}
static void
vkr_dispatch_vkCreateShaderModule(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateShaderModule *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(mod, shader_module, SHADER_MODULE, vkCreateShaderModule, pShaderModule);
util_hash_table_set_u64(ctx->object_table, mod->base.id, mod);
}
static void
vkr_dispatch_vkDestroyShaderModule(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyShaderModule *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(mod, shader_module, SHADER_MODULE, vkDestroyShaderModule, shaderModule);
util_hash_table_remove_u64(ctx->object_table, mod->base.id);
}
static void
vkr_dispatch_vkCreatePipelineLayout(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreatePipelineLayout *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkCreatePipelineLayout,
pPipelineLayout);
util_hash_table_set_u64(ctx->object_table, layout->base.id, layout);
}
static void
vkr_dispatch_vkDestroyPipelineLayout(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipelineLayout *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkDestroyPipelineLayout,
pipelineLayout);
util_hash_table_remove_u64(ctx->object_table, layout->base.id);
}
static void
vkr_dispatch_vkCreatePipelineCache(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreatePipelineCache *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkCreatePipelineCache,
pPipelineCache);
util_hash_table_set_u64(ctx->object_table, cache->base.id, cache);
}
static void
vkr_dispatch_vkDestroyPipelineCache(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipelineCache *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkDestroyPipelineCache,
pipelineCache);
util_hash_table_remove_u64(ctx->object_table, cache->base.id);
}
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;
CREATE_PIPELINE_ARRAY(vkCreateGraphicsPipelines);
}
static void
vkr_dispatch_vkCreateComputePipelines(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateComputePipelines *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_PIPELINE_ARRAY(vkCreateComputePipelines);
}
static void
vkr_dispatch_vkDestroyPipeline(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipeline *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(pipeline, pipeline, PIPELINE, vkDestroyPipeline, pipeline);
util_hash_table_remove_u64(ctx->object_table, pipeline->base.id);
}
static void
vkr_dispatch_vkGetImageDrmFormatModifierPropertiesEXT(
struct vn_dispatch_context *dispatch,
@ -3191,20 +3074,10 @@ vkr_context_init_dispatch(struct vkr_context *ctx)
dispatch->dispatch_vkGetQueryPoolResults = vkr_dispatch_vkGetQueryPoolResults;
dispatch->dispatch_vkResetQueryPool = vkr_dispatch_vkResetQueryPool;
dispatch->dispatch_vkCreateShaderModule = vkr_dispatch_vkCreateShaderModule;
dispatch->dispatch_vkDestroyShaderModule = vkr_dispatch_vkDestroyShaderModule;
dispatch->dispatch_vkCreatePipelineLayout = vkr_dispatch_vkCreatePipelineLayout;
dispatch->dispatch_vkDestroyPipelineLayout = vkr_dispatch_vkDestroyPipelineLayout;
dispatch->dispatch_vkCreatePipelineCache = vkr_dispatch_vkCreatePipelineCache;
dispatch->dispatch_vkDestroyPipelineCache = vkr_dispatch_vkDestroyPipelineCache;
dispatch->dispatch_vkGetPipelineCacheData = vkr_dispatch_vkGetPipelineCacheData;
dispatch->dispatch_vkMergePipelineCaches = vkr_dispatch_vkMergePipelineCaches;
dispatch->dispatch_vkCreateGraphicsPipelines = vkr_dispatch_vkCreateGraphicsPipelines;
dispatch->dispatch_vkCreateComputePipelines = vkr_dispatch_vkCreateComputePipelines;
dispatch->dispatch_vkDestroyPipeline = vkr_dispatch_vkDestroyPipeline;
vkr_context_init_shader_module_dispatch(ctx);
vkr_context_init_pipeline_layout_dispatch(ctx);
vkr_context_init_pipeline_cache_dispatch(ctx);
vkr_context_init_pipeline_dispatch(ctx);
vkr_context_init_command_pool_dispatch(ctx);
vkr_context_init_command_buffer_dispatch(ctx);

Loading…
Cancel
Save