Unnecessary to double check that handles are not NULL.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
void
radv_device_finish_meta_blit_state(struct radv_device *device)
{
- for (unsigned i = 0; i < NUM_META_FS_KEYS; ++i) {
- if (device->meta_state.blit.render_pass[i])
- radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit.render_pass[i],
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_1d_src[i])
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_1d_src[i],
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_2d_src[i])
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_2d_src[i],
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_3d_src[i])
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_3d_src[i],
- &device->meta_state.alloc);
- }
+ struct radv_meta_state *state = &device->meta_state;
- if (device->meta_state.blit.depth_only_rp)
- radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_rp,
- &device->meta_state.alloc);
- if (device->meta_state.blit.depth_only_1d_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_1d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.depth_only_2d_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_2d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.depth_only_3d_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_3d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_rp)
+ for (unsigned i = 0; i < NUM_META_FS_KEYS; ++i) {
radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_rp,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_1d_pipeline)
+ state->blit.render_pass[i],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_1d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_2d_pipeline)
+ state->blit.pipeline_1d_src[i],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_2d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_3d_pipeline)
+ state->blit.pipeline_2d_src[i],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_3d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_layout)
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_layout,
- &device->meta_state.alloc);
- if (device->meta_state.blit.ds_layout)
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.blit.ds_layout,
- &device->meta_state.alloc);
+ state->blit.pipeline_3d_src[i],
+ &state->alloc);
+ }
+
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->blit.depth_only_rp, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.depth_only_1d_pipeline, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.depth_only_2d_pipeline, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.depth_only_3d_pipeline, &state->alloc);
+
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->blit.stencil_only_rp, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.stencil_only_1d_pipeline,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.stencil_only_2d_pipeline,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.stencil_only_3d_pipeline,
+ &state->alloc);
+
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->blit.pipeline_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->blit.ds_layout, &state->alloc);
}
static VkFormat pipeline_formats[] = {
void
radv_device_finish_meta_blit2d_state(struct radv_device *device)
{
+ struct radv_meta_state *state = &device->meta_state;
+
for(unsigned j = 0; j < NUM_META_FS_KEYS; ++j) {
- if (device->meta_state.blit2d.render_passes[j]) {
- radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit2d.render_passes[j],
- &device->meta_state.alloc);
- }
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->blit2d.render_passes[j],
+ &state->alloc);
}
radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit2d.depth_only_rp,
- &device->meta_state.alloc);
+ state->blit2d.depth_only_rp, &state->alloc);
radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit2d.stencil_only_rp,
- &device->meta_state.alloc);
+ state->blit2d.stencil_only_rp, &state->alloc);
for (unsigned src = 0; src < BLIT2D_NUM_SRC_TYPES; src++) {
- if (device->meta_state.blit2d.p_layouts[src]) {
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.blit2d.p_layouts[src],
- &device->meta_state.alloc);
- }
-
- if (device->meta_state.blit2d.ds_layouts[src]) {
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.blit2d.ds_layouts[src],
- &device->meta_state.alloc);
- }
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->blit2d.p_layouts[src],
+ &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->blit2d.ds_layouts[src],
+ &state->alloc);
for (unsigned j = 0; j < NUM_META_FS_KEYS; ++j) {
- if (device->meta_state.blit2d.pipelines[src][j]) {
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit2d.pipelines[src][j],
- &device->meta_state.alloc);
- }
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit2d.pipelines[src][j],
+ &state->alloc);
}
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit2d.depth_only_pipeline[src],
- &device->meta_state.alloc);
+ state->blit2d.depth_only_pipeline[src],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit2d.stencil_only_pipeline[src],
- &device->meta_state.alloc);
+ state->blit2d.stencil_only_pipeline[src],
+ &state->alloc);
}
}
void radv_device_finish_meta_buffer_state(struct radv_device *device)
{
- if (device->meta_state.buffer.copy_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.buffer.copy_pipeline,
- &device->meta_state.alloc);
-
- if (device->meta_state.buffer.fill_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.buffer.fill_pipeline,
- &device->meta_state.alloc);
-
- if (device->meta_state.buffer.copy_p_layout)
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.buffer.copy_p_layout,
- &device->meta_state.alloc);
-
- if (device->meta_state.buffer.fill_p_layout)
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.buffer.fill_p_layout,
- &device->meta_state.alloc);
-
- if (device->meta_state.buffer.copy_ds_layout)
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.buffer.copy_ds_layout,
- &device->meta_state.alloc);
-
- if (device->meta_state.buffer.fill_ds_layout)
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.buffer.fill_ds_layout,
- &device->meta_state.alloc);
+ struct radv_meta_state *state = &device->meta_state;
+
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->buffer.copy_pipeline, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->buffer.fill_pipeline, &state->alloc);
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->buffer.copy_p_layout, &state->alloc);
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->buffer.fill_p_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->buffer.copy_ds_layout,
+ &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->buffer.fill_ds_layout,
+ &state->alloc);
}
static void fill_buffer_shader(struct radv_cmd_buffer *cmd_buffer,
static void
radv_device_finish_meta_itob_state(struct radv_device *device)
{
- if (device->meta_state.itob.img_p_layout) {
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.itob.img_p_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.itob.img_ds_layout) {
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.itob.img_ds_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.itob.pipeline) {
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.itob.pipeline,
- &device->meta_state.alloc);
- }
+ struct radv_meta_state *state = &device->meta_state;
+
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->itob.img_p_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->itob.img_ds_layout,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->itob.pipeline, &state->alloc);
}
static nir_shader *
static void
radv_device_finish_meta_btoi_state(struct radv_device *device)
{
- if (device->meta_state.btoi.img_p_layout) {
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.btoi.img_p_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.btoi.img_ds_layout) {
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.btoi.img_ds_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.btoi.pipeline) {
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.btoi.pipeline,
- &device->meta_state.alloc);
- }
+ struct radv_meta_state *state = &device->meta_state;
+
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->btoi.img_p_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->btoi.img_ds_layout,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->btoi.pipeline, &state->alloc);
}
static nir_shader *
static void
radv_device_finish_meta_itoi_state(struct radv_device *device)
{
- if (device->meta_state.itoi.img_p_layout) {
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.itoi.img_p_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.itoi.img_ds_layout) {
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.itoi.img_ds_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.itoi.pipeline) {
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.itoi.pipeline,
- &device->meta_state.alloc);
- }
+ struct radv_meta_state *state = &device->meta_state;
+
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->itoi.img_p_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->itoi.img_ds_layout,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->itoi.pipeline, &state->alloc);
}
static nir_shader *
static void
radv_device_finish_meta_cleari_state(struct radv_device *device)
{
- if (device->meta_state.cleari.img_p_layout) {
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.cleari.img_p_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.cleari.img_ds_layout) {
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.cleari.img_ds_layout,
- &device->meta_state.alloc);
- }
- if (device->meta_state.cleari.pipeline) {
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.cleari.pipeline,
- &device->meta_state.alloc);
- }
+ struct radv_meta_state *state = &device->meta_state;
+
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->cleari.img_p_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->cleari.img_ds_layout,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->cleari.pipeline, &state->alloc);
}
void
for (uint32_t j = 0; j < ARRAY_SIZE(state->clear[i].color_pipelines); ++j) {
radv_DestroyPipeline(radv_device_to_handle(device),
state->clear[i].color_pipelines[j],
- &device->meta_state.alloc);
+ &state->alloc);
radv_DestroyRenderPass(radv_device_to_handle(device),
state->clear[i].render_pass[j],
- &device->meta_state.alloc);
+ &state->alloc);
}
for (uint32_t j = 0; j < NUM_DEPTH_CLEAR_PIPELINES; j++) {
radv_DestroyPipeline(radv_device_to_handle(device),
state->clear[i].depth_only_pipeline[j],
- &device->meta_state.alloc);
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
state->clear[i].stencil_only_pipeline[j],
- &device->meta_state.alloc);
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
state->clear[i].depthstencil_pipeline[j],
- &device->meta_state.alloc);
+ &state->alloc);
}
radv_DestroyRenderPass(radv_device_to_handle(device),
state->clear[i].depthstencil_rp,
- &device->meta_state.alloc);
+ &state->alloc);
}
radv_DestroyPipelineLayout(radv_device_to_handle(device),
state->clear_color_p_layout,
radv_device_finish_meta_depth_decomp_state(struct radv_device *device)
{
struct radv_meta_state *state = &device->meta_state;
- VkDevice device_h = radv_device_to_handle(device);
- const VkAllocationCallbacks *alloc = &device->meta_state.alloc;
for (uint32_t i = 0; i < ARRAY_SIZE(state->depth_decomp); ++i) {
- VkRenderPass pass_h = state->depth_decomp[i].pass;
- if (pass_h) {
- radv_DestroyRenderPass(device_h, pass_h, alloc);
- }
- VkPipeline pipeline_h = state->depth_decomp[i].decompress_pipeline;
- if (pipeline_h) {
- radv_DestroyPipeline(device_h, pipeline_h, alloc);
- }
- pipeline_h = state->depth_decomp[i].resummarize_pipeline;
- if (pipeline_h) {
- radv_DestroyPipeline(device_h, pipeline_h, alloc);
- }
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->depth_decomp[i].pass,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->depth_decomp[i].decompress_pipeline,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->depth_decomp[i].resummarize_pipeline,
+ &state->alloc);
}
}
radv_device_finish_meta_fast_clear_flush_state(struct radv_device *device)
{
struct radv_meta_state *state = &device->meta_state;
- VkDevice device_h = radv_device_to_handle(device);
- VkRenderPass pass_h = device->meta_state.fast_clear_flush.pass;
- const VkAllocationCallbacks *alloc = &device->meta_state.alloc;
-
- if (pass_h)
- radv_DestroyRenderPass(device_h, pass_h,
- &device->meta_state.alloc);
- VkPipeline pipeline_h = state->fast_clear_flush.cmask_eliminate_pipeline;
- if (pipeline_h) {
- radv_DestroyPipeline(device_h, pipeline_h, alloc);
- }
-
- pipeline_h = state->fast_clear_flush.fmask_decompress_pipeline;
- if (pipeline_h) {
- radv_DestroyPipeline(device_h, pipeline_h, alloc);
- }
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->fast_clear_flush.pass, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->fast_clear_flush.cmask_eliminate_pipeline,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->fast_clear_flush.fmask_decompress_pipeline,
+ &state->alloc);
}
VkResult
radv_device_finish_meta_resolve_state(struct radv_device *device)
{
struct radv_meta_state *state = &device->meta_state;
- VkDevice device_h = radv_device_to_handle(device);
- VkRenderPass pass_h = device->meta_state.resolve.pass;
- const VkAllocationCallbacks *alloc = &device->meta_state.alloc;
- if (pass_h)
- radv_DestroyRenderPass(device_h, pass_h,
- &device->meta_state.alloc);
-
- VkPipeline pipeline_h = state->resolve.pipeline;
- if (pipeline_h) {
- radv_DestroyPipeline(device_h, pipeline_h, alloc);
- }
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->resolve.pass, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->resolve.pipeline, &state->alloc);
}
VkResult