static VkResult
create_pipeline(struct radv_device *device,
- VkShaderModule vs_module_h,
uint32_t samples,
VkRenderPass pass,
VkPipelineLayout layout,
{
VkResult result;
VkDevice device_h = radv_device_to_handle(device);
- struct radv_shader_module vs_module = {0};
mtx_lock(&device->meta_state.mtx);
if (*pipeline) {
return VK_SUCCESS;
}
- if (!vs_module_h) {
- vs_module.nir = radv_meta_build_nir_vs_generate_vertices();
- vs_module_h = radv_shader_module_to_handle(&vs_module);
+ struct radv_shader_module vs_module = {
+ .nir = radv_meta_build_nir_vs_generate_vertices()
+ };
+
+ if (!vs_module.nir) {
+ /* XXX: Need more accurate error */
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
+ goto cleanup;
}
struct radv_shader_module fs_module = {
{
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.stage = VK_SHADER_STAGE_VERTEX_BIT,
- .module = vs_module_h,
+ .module = radv_shader_module_to_handle(&vs_module),
.pName = "main",
},
{
cleanup:
ralloc_free(fs_module.nir);
- if (vs_module.nir)
- ralloc_free(vs_module.nir);
+ ralloc_free(vs_module.nir);
mtx_unlock(&device->meta_state.mtx);
return result;
}
struct radv_meta_state *state = &device->meta_state;
VkResult res = VK_SUCCESS;
- struct radv_shader_module vs_module = { .nir = radv_meta_build_nir_vs_generate_vertices() };
- if (!vs_module.nir) {
- /* XXX: Need more accurate error */
- res = VK_ERROR_OUT_OF_HOST_MEMORY;
- goto fail;
- }
-
- VkShaderModule vs_module_h = radv_shader_module_to_handle(&vs_module);
-
for (uint32_t i = 0; i < ARRAY_SIZE(state->depth_decomp); ++i) {
uint32_t samples = 1 << i;
continue;
for (uint32_t j = 0; j < NUM_DEPTH_DECOMPRESS_PIPELINES; j++) {
- res = create_pipeline(device, vs_module_h, samples,
+ res = create_pipeline(device, samples,
state->depth_decomp[i].pass,
state->depth_decomp[i].p_layout,
DEPTH_DECOMPRESS,
goto fail;
}
- res = create_pipeline(device, vs_module_h, samples,
+ res = create_pipeline(device, samples,
state->depth_decomp[i].pass,
state->depth_decomp[i].p_layout,
DEPTH_RESUMMARIZE,
goto fail;
}
- goto cleanup;
+ return VK_SUCCESS;
fail:
radv_device_finish_meta_depth_decomp_state(device);
-
-cleanup:
- ralloc_free(vs_module.nir);
-
return res;
}
VkResult ret;
for (uint32_t i = 0; i < NUM_DEPTH_DECOMPRESS_PIPELINES; i++) {
- ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
+ ret = create_pipeline(cmd_buffer->device, samples,
state->depth_decomp[samples_log2].pass,
state->depth_decomp[samples_log2].p_layout,
DEPTH_DECOMPRESS,
}
}
- ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
+ ret = create_pipeline(cmd_buffer->device, samples,
state->depth_decomp[samples_log2].pass,
state->depth_decomp[samples_log2].p_layout,
DEPTH_RESUMMARIZE,