mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
c/render: Use new Vulkan helpers
This commit is contained in:
parent
e8b0ab3b35
commit
7ecf649ac2
|
@ -85,119 +85,6 @@ calc_dispatch_dims(const struct comp_viewport_data views[2], uint32_t *out_w, ui
|
|||
*
|
||||
*/
|
||||
|
||||
static VkResult
|
||||
create_command_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkCommandBufferAllocateInfo cmd_buffer_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
|
||||
.commandPool = vk->cmd_pool,
|
||||
.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
|
||||
.commandBufferCount = 1,
|
||||
};
|
||||
|
||||
VkCommandBuffer cmd = VK_NULL_HANDLE;
|
||||
|
||||
os_mutex_lock(&vk->cmd_pool_mutex);
|
||||
|
||||
ret = vk->vkAllocateCommandBuffers( //
|
||||
vk->device, //
|
||||
&cmd_buffer_info, //
|
||||
&cmd); //
|
||||
|
||||
os_mutex_unlock(&vk->cmd_pool_mutex);
|
||||
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkCreateFramebuffer failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_cmd = cmd;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_command_buffer(struct vk_bundle *vk, VkCommandBuffer command_buffer)
|
||||
{
|
||||
os_mutex_lock(&vk->cmd_pool_mutex);
|
||||
|
||||
vk->vkFreeCommandBuffers( //
|
||||
vk->device, // device
|
||||
vk->cmd_pool, // commandPool
|
||||
1, // commandBufferCount
|
||||
&command_buffer); // pCommandBuffers
|
||||
|
||||
os_mutex_unlock(&vk->cmd_pool_mutex);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
begin_command_buffer(struct vk_bundle *vk, VkCommandBuffer command_buffer)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkCommandBufferBeginInfo command_buffer_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
};
|
||||
|
||||
ret = vk->vkBeginCommandBuffer( //
|
||||
command_buffer, //
|
||||
&command_buffer_info); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkBeginCommandBuffer failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
end_command_buffer(struct vk_bundle *vk, VkCommandBuffer command_buffer)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
// End the command buffer.
|
||||
ret = vk->vkEndCommandBuffer( //
|
||||
command_buffer); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkEndCommandBuffer failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_descriptor_set(struct vk_bundle *vk,
|
||||
VkDescriptorPool descriptor_pool,
|
||||
VkDescriptorSetLayout descriptor_layout,
|
||||
VkDescriptorSet *out_descriptor_set)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkDescriptorSetAllocateInfo alloc_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
|
||||
.descriptorPool = descriptor_pool,
|
||||
.descriptorSetCount = 1,
|
||||
.pSetLayouts = &descriptor_layout,
|
||||
};
|
||||
|
||||
VkDescriptorSet descriptor_set = VK_NULL_HANDLE;
|
||||
ret = vk->vkAllocateDescriptorSets( //
|
||||
vk->device, //
|
||||
&alloc_info, //
|
||||
&descriptor_set); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_DEBUG(vk, "vkAllocateDescriptorSets failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_descriptor_set = descriptor_set;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
XRT_MAYBE_UNUSED static void
|
||||
update_compute_discriptor_set(struct vk_bundle *vk,
|
||||
uint32_t src_binding,
|
||||
|
@ -375,9 +262,9 @@ comp_rendering_compute_init(struct comp_rendering_compute *crc, struct comp_reso
|
|||
struct vk_bundle *vk = r->vk;
|
||||
crc->r = r;
|
||||
|
||||
C(create_command_buffer(vk, &crc->cmd));
|
||||
C(vk_create_command_buffer(vk, &crc->cmd));
|
||||
|
||||
C(create_descriptor_set( //
|
||||
C(vk_create_descriptor_set( //
|
||||
vk, //
|
||||
r->compute.descriptor_pool, // descriptor_pool
|
||||
r->compute.descriptor_set_layout, // descriptor_set_layout
|
||||
|
@ -391,7 +278,7 @@ comp_rendering_compute_begin(struct comp_rendering_compute *crc)
|
|||
{
|
||||
struct vk_bundle *vk = vk_from_crc(crc);
|
||||
|
||||
C(begin_command_buffer(vk, crc->cmd));
|
||||
C(vk_begin_command_buffer(vk, crc->cmd));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -401,7 +288,7 @@ comp_rendering_compute_end(struct comp_rendering_compute *crc)
|
|||
{
|
||||
struct vk_bundle *vk = vk_from_crc(crc);
|
||||
|
||||
C(end_command_buffer(vk, crc->cmd));
|
||||
C(vk_end_command_buffer(vk, crc->cmd));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -413,7 +300,7 @@ comp_rendering_compute_close(struct comp_rendering_compute *crc)
|
|||
|
||||
struct vk_bundle *vk = vk_from_crc(crc);
|
||||
|
||||
destroy_command_buffer(vk, crc->cmd);
|
||||
vk_destroy_command_buffer(vk, crc->cmd);
|
||||
|
||||
// Reclaimed by vkResetDescriptorPool.
|
||||
crc->descriptor_set = VK_NULL_HANDLE;
|
||||
|
|
|
@ -130,35 +130,6 @@ create_external_render_pass(struct vk_bundle *vk, VkFormat format, VkRenderPass
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_descriptor_set(struct vk_bundle *vk,
|
||||
VkDescriptorPool descriptor_pool,
|
||||
VkDescriptorSetLayout descriptor_layout,
|
||||
VkDescriptorSet *out_descriptor_set)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkDescriptorSetAllocateInfo alloc_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
|
||||
.descriptorPool = descriptor_pool,
|
||||
.descriptorSetCount = 1,
|
||||
.pSetLayouts = &descriptor_layout,
|
||||
};
|
||||
|
||||
VkDescriptorSet descriptor_set = VK_NULL_HANDLE;
|
||||
ret = vk->vkAllocateDescriptorSets(vk->device, //
|
||||
&alloc_info, //
|
||||
&descriptor_set); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_DEBUG(vk, "vkAllocateDescriptorSets failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_descriptor_set = descriptor_set;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_framebuffer(struct vk_bundle *vk,
|
||||
VkImageView image_view,
|
||||
|
@ -196,56 +167,6 @@ create_framebuffer(struct vk_bundle *vk,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_command_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkCommandBufferAllocateInfo cmd_buffer_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
|
||||
.commandPool = vk->cmd_pool,
|
||||
.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
|
||||
.commandBufferCount = 1,
|
||||
};
|
||||
|
||||
VkCommandBuffer cmd = VK_NULL_HANDLE;
|
||||
|
||||
os_mutex_lock(&vk->cmd_pool_mutex);
|
||||
|
||||
ret = vk->vkAllocateCommandBuffers(vk->device, //
|
||||
&cmd_buffer_info, //
|
||||
&cmd); //
|
||||
|
||||
os_mutex_unlock(&vk->cmd_pool_mutex);
|
||||
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkCreateFramebuffer failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_cmd = cmd;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
begin_command_buffer(struct vk_bundle *vk, VkCommandBuffer command_buffer)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkCommandBufferBeginInfo command_buffer_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
};
|
||||
|
||||
ret = vk->vkBeginCommandBuffer(command_buffer, &command_buffer_info);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkBeginCommandBuffer failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
begin_render_pass(struct vk_bundle *vk,
|
||||
VkCommandBuffer command_buffer,
|
||||
|
@ -507,20 +428,6 @@ update_mesh_discriptor_set(struct vk_bundle *vk,
|
|||
NULL); // pDescriptorCopies
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_command_buffer(struct vk_bundle *vk, VkCommandBuffer command_buffer)
|
||||
{
|
||||
os_mutex_lock(&vk->cmd_pool_mutex);
|
||||
|
||||
vk->vkFreeCommandBuffers( //
|
||||
vk->device, // device
|
||||
vk->cmd_pool, // commandPool
|
||||
1, // commandBufferCount
|
||||
&command_buffer); // pCommandBuffers
|
||||
|
||||
os_mutex_unlock(&vk->cmd_pool_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -595,22 +502,22 @@ comp_rendering_init(struct comp_rendering *rr, struct comp_resources *r)
|
|||
* Per rendering.
|
||||
*/
|
||||
|
||||
C(create_command_buffer(vk, &rr->cmd));
|
||||
C(vk_create_command_buffer(vk, &rr->cmd));
|
||||
|
||||
C(begin_command_buffer(vk, rr->cmd));
|
||||
C(vk_begin_command_buffer(vk, rr->cmd));
|
||||
|
||||
|
||||
/*
|
||||
* Mesh per view
|
||||
*/
|
||||
|
||||
C(create_descriptor_set( //
|
||||
C(vk_create_descriptor_set( //
|
||||
vk, // vk_bundle
|
||||
r->mesh.descriptor_pool, // descriptor_pool
|
||||
r->mesh.descriptor_set_layout, // descriptor_set_layout
|
||||
&rr->views[0].mesh.descriptor_set)); // descriptor_set
|
||||
|
||||
C(create_descriptor_set( //
|
||||
C(vk_create_descriptor_set( //
|
||||
vk, // vk_bundle
|
||||
r->mesh.descriptor_pool, // descriptor_pool
|
||||
r->mesh.descriptor_set_layout, // descriptor_set_layout
|
||||
|
@ -623,14 +530,8 @@ void
|
|||
comp_rendering_finalize(struct comp_rendering *rr)
|
||||
{
|
||||
struct vk_bundle *vk = vk_from_rr(rr);
|
||||
VkResult ret;
|
||||
|
||||
// End the command buffer.
|
||||
ret = vk->vkEndCommandBuffer(rr->cmd);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkEndCommandBuffer failed: %s", vk_result_string(ret));
|
||||
return;
|
||||
}
|
||||
vk_end_command_buffer(vk, rr->cmd);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -639,7 +540,7 @@ comp_rendering_close(struct comp_rendering *rr)
|
|||
struct vk_bundle *vk = vk_from_rr(rr);
|
||||
struct comp_resources *r = rr->r;
|
||||
|
||||
destroy_command_buffer(vk, rr->cmd);
|
||||
vk_destroy_command_buffer(vk, rr->cmd);
|
||||
rr->cmd = VK_NULL_HANDLE;
|
||||
|
||||
// Reclaimed by vkResetDescriptorPool.
|
||||
|
|
|
@ -36,123 +36,6 @@
|
|||
}
|
||||
|
||||
|
||||
static VkResult
|
||||
create_pipeline_cache(struct vk_bundle *vk, VkPipelineCache *out_pipeline_cache)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkPipelineCacheCreateInfo pipeline_cache_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
|
||||
};
|
||||
|
||||
VkPipelineCache pipeline_cache;
|
||||
ret = vk->vkCreatePipelineCache(vk->device, //
|
||||
&pipeline_cache_info, //
|
||||
NULL, //
|
||||
&pipeline_cache); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkCreatePipelineCache failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_pipeline_cache = pipeline_cache;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_pipeline_layout(struct vk_bundle *vk,
|
||||
VkDescriptorSetLayout descriptor_set_layout,
|
||||
VkPipelineLayout *out_pipeline_layout)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkPipelineLayoutCreateInfo pipeline_layout_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
||||
.setLayoutCount = 1,
|
||||
.pSetLayouts = &descriptor_set_layout,
|
||||
};
|
||||
|
||||
VkPipelineLayout pipeline_layout = VK_NULL_HANDLE;
|
||||
ret = vk->vkCreatePipelineLayout(vk->device, //
|
||||
&pipeline_layout_info, //
|
||||
NULL, //
|
||||
&pipeline_layout); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkCreatePipelineLayout failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_pipeline_layout = pipeline_layout;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_descriptor_pool(struct vk_bundle *vk,
|
||||
uint32_t num_uniform_per_desc,
|
||||
uint32_t num_sampler_per_desc,
|
||||
uint32_t num_storage_per_desc,
|
||||
uint32_t num_descs,
|
||||
bool freeable,
|
||||
VkDescriptorPool *out_descriptor_pool)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
|
||||
uint32_t count = 0;
|
||||
VkDescriptorPoolSize pool_sizes[3] = {0};
|
||||
|
||||
if (num_uniform_per_desc > 0) {
|
||||
pool_sizes[count].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
pool_sizes[count].descriptorCount = num_uniform_per_desc * num_descs;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (num_sampler_per_desc > 0) {
|
||||
pool_sizes[count].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
pool_sizes[count].descriptorCount = num_sampler_per_desc * num_descs;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (num_storage_per_desc > 0) {
|
||||
pool_sizes[count].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
||||
pool_sizes[count].descriptorCount = num_storage_per_desc * num_descs;
|
||||
count++;
|
||||
}
|
||||
|
||||
assert(count > 0 && count <= ARRAY_SIZE(pool_sizes));
|
||||
|
||||
VkDescriptorPoolCreateFlags flags = 0;
|
||||
|
||||
if (freeable) {
|
||||
flags |= VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
||||
}
|
||||
|
||||
VkDescriptorPoolCreateInfo descriptor_pool_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
||||
.flags = flags,
|
||||
.maxSets = num_descs,
|
||||
.poolSizeCount = count,
|
||||
.pPoolSizes = pool_sizes,
|
||||
};
|
||||
|
||||
VkDescriptorPool descriptor_pool = VK_NULL_HANDLE;
|
||||
ret = vk->vkCreateDescriptorPool(vk->device, //
|
||||
&descriptor_pool_info, //
|
||||
NULL, //
|
||||
&descriptor_pool); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkCreateRenderPass failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_descriptor_pool = descriptor_pool;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Mesh
|
||||
|
@ -356,49 +239,6 @@ create_compute_descriptor_set_layout(struct vk_bundle *vk,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_compute_pipeline(struct vk_bundle *vk,
|
||||
VkPipelineCache pipeline_cache,
|
||||
VkShaderModule shader,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkPipeline *out_compute_pipeline)
|
||||
{
|
||||
VkResult ret;
|
||||
|
||||
VkPipelineShaderStageCreateInfo shader_stage_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.stage = VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
.module = shader,
|
||||
.pName = "main",
|
||||
};
|
||||
|
||||
VkComputePipelineCreateInfo pipeline_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.stage = shader_stage_info,
|
||||
.layout = pipeline_layout,
|
||||
};
|
||||
|
||||
VkPipeline pipeline = VK_NULL_HANDLE;
|
||||
ret = vk->vkCreateComputePipelines( //
|
||||
vk->device, //
|
||||
pipeline_cache, //
|
||||
1, //
|
||||
&pipeline_info, //
|
||||
NULL, //
|
||||
&pipeline); //
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_DEBUG(vk, "vkCreateComputePipelines failed: %s", vk_result_string(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
*out_compute_pipeline = pipeline;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_distortion_image_and_view(struct vk_bundle *vk,
|
||||
VkExtent2D extent,
|
||||
|
@ -671,29 +511,37 @@ comp_resources_init(struct comp_resources *r,
|
|||
* Shared
|
||||
*/
|
||||
|
||||
C(create_pipeline_cache(vk, &r->pipeline_cache));
|
||||
C(vk_create_pipeline_cache(vk, &r->pipeline_cache));
|
||||
|
||||
|
||||
/*
|
||||
* Mesh static.
|
||||
*/
|
||||
|
||||
C(create_descriptor_pool(vk, // vk_bundle
|
||||
1, // num_uniform_per_desc
|
||||
1, // num_sampler_per_desc
|
||||
0, // num_storage_per_desc
|
||||
16 * 2, // num_descs
|
||||
false, // freeable
|
||||
&r->mesh.descriptor_pool)); // out_descriptor_pool
|
||||
struct vk_descriptor_pool_info mesh_pool_info = {
|
||||
.uniform_per_descriptor_count = 1,
|
||||
.sampler_per_descriptor_count = 1,
|
||||
.storage_image_per_descriptor_count = 0,
|
||||
.storage_buffer_per_descriptor_count = 0,
|
||||
.descriptor_count = 16 * 2,
|
||||
.freeable = false,
|
||||
};
|
||||
|
||||
C(create_mesh_descriptor_set_layout(vk, // vk_bundle
|
||||
r->mesh.src_binding, // src_binding
|
||||
r->mesh.ubo_binding, // ubo_binding
|
||||
&r->mesh.descriptor_set_layout)); // out_mesh_descriptor_set_layout
|
||||
C(vk_create_descriptor_pool( //
|
||||
vk, // vk_bundle
|
||||
&mesh_pool_info, // info
|
||||
&r->mesh.descriptor_pool)); // out_descriptor_pool
|
||||
|
||||
C(create_pipeline_layout(vk, // vk_bundle
|
||||
r->mesh.descriptor_set_layout, // descriptor_set_layout
|
||||
&r->mesh.pipeline_layout)); // out_pipeline_layout
|
||||
C(create_mesh_descriptor_set_layout( //
|
||||
vk, // vk_bundle
|
||||
r->mesh.src_binding, // src_binding
|
||||
r->mesh.ubo_binding, // ubo_binding
|
||||
&r->mesh.descriptor_set_layout)); // out_mesh_descriptor_set_layout
|
||||
|
||||
C(vk_create_pipeline_layout( //
|
||||
vk, // vk_bundle
|
||||
r->mesh.descriptor_set_layout, // descriptor_set_layout
|
||||
&r->mesh.pipeline_layout)); // out_pipeline_layout
|
||||
|
||||
if (!init_mesh_vertex_buffers(vk, //
|
||||
&r->mesh.vbo, //
|
||||
|
@ -722,13 +570,18 @@ comp_resources_init(struct comp_resources *r,
|
|||
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // clamp_mode
|
||||
&r->compute.default_sampler)); // out_sampler
|
||||
|
||||
C(create_descriptor_pool( //
|
||||
struct vk_descriptor_pool_info compute_pool_info = {
|
||||
.uniform_per_descriptor_count = 1,
|
||||
.sampler_per_descriptor_count = 8,
|
||||
.storage_image_per_descriptor_count = 1,
|
||||
.storage_buffer_per_descriptor_count = 0,
|
||||
.descriptor_count = 1,
|
||||
.freeable = false,
|
||||
};
|
||||
|
||||
C(vk_create_descriptor_pool( //
|
||||
vk, // vk_bundle
|
||||
1, // num_uniform_per_desc
|
||||
8, // num_sampler_per_desc
|
||||
1, // num_storage_per_desc
|
||||
1, // num_descs
|
||||
false, // freeable
|
||||
&compute_pool_info, // info
|
||||
&r->compute.descriptor_pool)); // out_descriptor_pool
|
||||
|
||||
C(create_compute_descriptor_set_layout( //
|
||||
|
@ -739,26 +592,26 @@ comp_resources_init(struct comp_resources *r,
|
|||
r->compute.ubo_binding, // ubo_binding,
|
||||
&r->compute.descriptor_set_layout)); // out_descriptor_set_layout
|
||||
|
||||
C(create_pipeline_layout( //
|
||||
C(vk_create_pipeline_layout( //
|
||||
vk, // vk_bundle
|
||||
r->compute.descriptor_set_layout, // descriptor_set_layout
|
||||
&r->compute.pipeline_layout)); // out_pipeline_layout
|
||||
|
||||
C(create_compute_pipeline( //
|
||||
C(vk_create_compute_pipeline( //
|
||||
vk, // vk_bundle
|
||||
r->pipeline_cache, // pipeline_cache
|
||||
r->shaders->clear_comp, // shader
|
||||
r->compute.pipeline_layout, // pipeline_layout
|
||||
&r->compute.clear_pipeline)); // out_compute_pipeline
|
||||
|
||||
C(create_compute_pipeline( //
|
||||
C(vk_create_compute_pipeline( //
|
||||
vk, // vk_bundle
|
||||
r->pipeline_cache, // pipeline_cache
|
||||
r->shaders->distortion_comp, // shader
|
||||
r->compute.pipeline_layout, // pipeline_layout
|
||||
&r->compute.distortion_pipeline)); // out_compute_pipeline
|
||||
|
||||
C(create_compute_pipeline( //
|
||||
C(vk_create_compute_pipeline( //
|
||||
vk, // vk_bundle
|
||||
r->pipeline_cache, // pipeline_cache
|
||||
r->shaders->distortion_timewarp_comp, // shader
|
||||
|
|
Loading…
Reference in a new issue