vkr: split out vkr_render_pass.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 ccf9552e92
commit 0dd30e9704
  1. 1
      src/meson.build
  2. 118
      src/venus/vkr_render_pass.c
  3. 6
      src/venus/vkr_render_pass.h
  4. 95
      src/venus/vkr_renderer.c

@ -94,6 +94,7 @@ venus_sources = [
'venus/vkr_query_pool.c', 'venus/vkr_query_pool.c',
'venus/vkr_query_pool.h', 'venus/vkr_query_pool.h',
'venus/vkr_queue.h', 'venus/vkr_queue.h',
'venus/vkr_render_pass.c',
'venus/vkr_render_pass.h', 'venus/vkr_render_pass.h',
'venus/vkr_renderer.c', 'venus/vkr_renderer.c',
'venus/vkr_renderer.h', 'venus/vkr_renderer.h',

@ -0,0 +1,118 @@
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#include "vkr_render_pass.h"
#include "venus-protocol/vn_protocol_renderer_framebuffer.h"
#include "venus-protocol/vn_protocol_renderer_render_pass.h"
#include "vkr_context.h"
#include "vkr_device.h"
static void
vkr_dispatch_vkCreateRenderPass(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateRenderPass *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(pass, render_pass, RENDER_PASS, vkCreateRenderPass, pRenderPass);
util_hash_table_set_u64(ctx->object_table, pass->base.id, pass);
}
static void
vkr_dispatch_vkCreateRenderPass2(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateRenderPass2 *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = (struct vkr_device *)args->device;
if (!dev || dev->base.type != VK_OBJECT_TYPE_DEVICE) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
struct vkr_render_pass *pass = calloc(1, sizeof(*pass));
if (!pass) {
args->ret = VK_ERROR_OUT_OF_HOST_MEMORY;
return;
}
pass->base.type = VK_OBJECT_TYPE_RENDER_PASS;
pass->base.id =
vkr_cs_handle_load_id((const void **)args->pRenderPass, pass->base.type);
vn_replace_vkCreateRenderPass2_args_handle(args);
args->ret = dev->CreateRenderPass2(args->device, args->pCreateInfo, NULL,
&pass->base.handle.render_pass);
if (args->ret != VK_SUCCESS) {
free(pass);
return;
}
list_add(&pass->base.track_head, &dev->objects);
util_hash_table_set_u64(ctx->object_table, pass->base.id, pass);
}
static void
vkr_dispatch_vkDestroyRenderPass(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyRenderPass *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(pass, render_pass, RENDER_PASS, vkDestroyRenderPass, renderPass);
util_hash_table_remove_u64(ctx->object_table, pass->base.id);
}
static void
vkr_dispatch_vkGetRenderAreaGranularity(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkGetRenderAreaGranularity *args)
{
vn_replace_vkGetRenderAreaGranularity_args_handle(args);
vkGetRenderAreaGranularity(args->device, args->renderPass, args->pGranularity);
}
static void
vkr_dispatch_vkCreateFramebuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateFramebuffer *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(fb, framebuffer, FRAMEBUFFER, vkCreateFramebuffer, pFramebuffer);
util_hash_table_set_u64(ctx->object_table, fb->base.id, fb);
}
static void
vkr_dispatch_vkDestroyFramebuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyFramebuffer *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(fb, framebuffer, FRAMEBUFFER, vkDestroyFramebuffer, framebuffer);
util_hash_table_remove_u64(ctx->object_table, fb->base.id);
}
void
vkr_context_init_render_pass_dispatch(struct vkr_context *ctx)
{
struct vn_dispatch_context *dispatch = &ctx->dispatch;
dispatch->dispatch_vkCreateRenderPass = vkr_dispatch_vkCreateRenderPass;
dispatch->dispatch_vkCreateRenderPass2 = vkr_dispatch_vkCreateRenderPass2;
dispatch->dispatch_vkDestroyRenderPass = vkr_dispatch_vkDestroyRenderPass;
dispatch->dispatch_vkGetRenderAreaGranularity =
vkr_dispatch_vkGetRenderAreaGranularity;
}
void
vkr_context_init_framebuffer_dispatch(struct vkr_context *ctx)
{
struct vn_dispatch_context *dispatch = &ctx->dispatch;
dispatch->dispatch_vkCreateFramebuffer = vkr_dispatch_vkCreateFramebuffer;
dispatch->dispatch_vkDestroyFramebuffer = vkr_dispatch_vkDestroyFramebuffer;
}

@ -16,4 +16,10 @@ struct vkr_framebuffer {
struct vkr_object base; struct vkr_object base;
}; };
void
vkr_context_init_render_pass_dispatch(struct vkr_context *ctx);
void
vkr_context_init_framebuffer_dispatch(struct vkr_context *ctx);
#endif /* VKR_RENDER_PASS_H */ #endif /* VKR_RENDER_PASS_H */

@ -2597,91 +2597,6 @@ vkr_dispatch_vkDestroyDescriptorUpdateTemplate(
util_hash_table_remove_u64(ctx->object_table, templ->base.id); util_hash_table_remove_u64(ctx->object_table, templ->base.id);
} }
static void
vkr_dispatch_vkCreateRenderPass(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateRenderPass *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(pass, render_pass, RENDER_PASS, vkCreateRenderPass, pRenderPass);
util_hash_table_set_u64(ctx->object_table, pass->base.id, pass);
}
static void
vkr_dispatch_vkCreateRenderPass2(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateRenderPass2 *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = (struct vkr_device *)args->device;
if (!dev || dev->base.type != VK_OBJECT_TYPE_DEVICE) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
struct vkr_render_pass *pass = calloc(1, sizeof(*pass));
if (!pass) {
args->ret = VK_ERROR_OUT_OF_HOST_MEMORY;
return;
}
pass->base.type = VK_OBJECT_TYPE_RENDER_PASS;
pass->base.id =
vkr_cs_handle_load_id((const void **)args->pRenderPass, pass->base.type);
vn_replace_vkCreateRenderPass2_args_handle(args);
args->ret = dev->CreateRenderPass2(args->device, args->pCreateInfo, NULL,
&pass->base.handle.render_pass);
if (args->ret != VK_SUCCESS) {
free(pass);
return;
}
list_add(&pass->base.track_head, &dev->objects);
util_hash_table_set_u64(ctx->object_table, pass->base.id, pass);
}
static void
vkr_dispatch_vkDestroyRenderPass(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyRenderPass *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(pass, render_pass, RENDER_PASS, vkDestroyRenderPass, renderPass);
util_hash_table_remove_u64(ctx->object_table, pass->base.id);
}
static void
vkr_dispatch_vkGetRenderAreaGranularity(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkGetRenderAreaGranularity *args)
{
vn_replace_vkGetRenderAreaGranularity_args_handle(args);
vkGetRenderAreaGranularity(args->device, args->renderPass, args->pGranularity);
}
static void
vkr_dispatch_vkCreateFramebuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateFramebuffer *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(fb, framebuffer, FRAMEBUFFER, vkCreateFramebuffer, pFramebuffer);
util_hash_table_set_u64(ctx->object_table, fb->base.id, fb);
}
static void
vkr_dispatch_vkDestroyFramebuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyFramebuffer *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(fb, framebuffer, FRAMEBUFFER, vkDestroyFramebuffer, framebuffer);
util_hash_table_remove_u64(ctx->object_table, fb->base.id);
}
static void static void
vkr_dispatch_vkCreateEvent(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateEvent(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateEvent *args) struct vn_command_vkCreateEvent *args)
@ -3007,14 +2922,8 @@ vkr_context_init_dispatch(struct vkr_context *ctx)
vkr_dispatch_vkDestroyDescriptorUpdateTemplate; vkr_dispatch_vkDestroyDescriptorUpdateTemplate;
dispatch->dispatch_vkUpdateDescriptorSetWithTemplate = NULL; dispatch->dispatch_vkUpdateDescriptorSetWithTemplate = NULL;
dispatch->dispatch_vkCreateRenderPass = vkr_dispatch_vkCreateRenderPass; vkr_context_init_render_pass_dispatch(ctx);
dispatch->dispatch_vkCreateRenderPass2 = vkr_dispatch_vkCreateRenderPass2; vkr_context_init_framebuffer_dispatch(ctx);
dispatch->dispatch_vkDestroyRenderPass = vkr_dispatch_vkDestroyRenderPass;
dispatch->dispatch_vkGetRenderAreaGranularity =
vkr_dispatch_vkGetRenderAreaGranularity;
dispatch->dispatch_vkCreateFramebuffer = vkr_dispatch_vkCreateFramebuffer;
dispatch->dispatch_vkDestroyFramebuffer = vkr_dispatch_vkDestroyFramebuffer;
dispatch->dispatch_vkCreateEvent = vkr_dispatch_vkCreateEvent; dispatch->dispatch_vkCreateEvent = vkr_dispatch_vkCreateEvent;
dispatch->dispatch_vkDestroyEvent = vkr_dispatch_vkDestroyEvent; dispatch->dispatch_vkDestroyEvent = vkr_dispatch_vkDestroyEvent;

Loading…
Cancel
Save