It's safer and more elegant.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
{
state->old_pipeline = cmd_buffer->state.compute_pipeline;
state->old_descriptor_set0 = cmd_buffer->state.descriptors[0];
+ state->push_constant_size = push_constant_size;
- if (push_constant_size)
- memcpy(state->push_constants, cmd_buffer->push_constants, push_constant_size);
+ if (state->push_constant_size) {
+ memcpy(state->push_constants, cmd_buffer->push_constants,
+ state->push_constant_size);
+ }
}
void
radv_meta_restore_compute(const struct radv_meta_saved_compute_state *state,
- struct radv_cmd_buffer *cmd_buffer,
- unsigned push_constant_size)
+ struct radv_cmd_buffer *cmd_buffer)
{
radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_COMPUTE,
radv_pipeline_to_handle(state->old_pipeline));
cmd_buffer->state.descriptors[0] = state->old_descriptor_set0;
- if (push_constant_size) {
- memcpy(cmd_buffer->push_constants, state->push_constants, push_constant_size);
+ if (state->push_constant_size) {
+ memcpy(cmd_buffer->push_constants, state->push_constants,
+ state->push_constant_size);
cmd_buffer->push_constant_stages |= VK_SHADER_STAGE_COMPUTE_BIT;
}
}
struct radv_descriptor_set *old_descriptor_set0;
struct radv_pipeline *old_pipeline;
+ unsigned push_constant_size;
char push_constants[128];
};
unsigned push_constant_size);
void radv_meta_restore_compute(const struct radv_meta_saved_compute_state *state,
- struct radv_cmd_buffer *cmd_buffer,
- unsigned push_constant_size);
+ struct radv_cmd_buffer *cmd_buffer);
VkImageViewType radv_meta_get_view_type(const struct radv_image *image);
radv_CmdDispatch(radv_cmd_buffer_to_handle(cmd_buffer), block_count, 1, 1);
- radv_meta_restore_compute(&saved_state, cmd_buffer, 4);
+ radv_meta_restore_compute(&saved_state, cmd_buffer);
}
static void copy_buffer_shader(struct radv_cmd_buffer *cmd_buffer,
radv_CmdDispatch(radv_cmd_buffer_to_handle(cmd_buffer), block_count, 1, 1);
- radv_meta_restore_compute(&saved_state, cmd_buffer, 0);
+ radv_meta_restore_compute(&saved_state, cmd_buffer);
}
rangeCount, pRanges, cs);
if (cs)
- radv_meta_restore_compute(&saved_state.compute, cmd_buffer, 16);
+ radv_meta_restore_compute(&saved_state.compute, cmd_buffer);
else
radv_meta_restore(&saved_state.gfx, cmd_buffer);
}
}
}
if (cs)
- radv_meta_restore_compute(&saved_state.compute, cmd_buffer, 12);
+ radv_meta_restore_compute(&saved_state.compute, cmd_buffer);
else
radv_meta_restore(&saved_state.gfx, cmd_buffer);
}
slice_array++;
}
}
- radv_meta_restore_compute(&saved_state, cmd_buffer, 12);
+ radv_meta_restore_compute(&saved_state, cmd_buffer);
}
void radv_CmdCopyImageToBuffer(
}
if (cs)
- radv_meta_restore_compute(&saved_state.compute, cmd_buffer, 16);
+ radv_meta_restore_compute(&saved_state.compute, cmd_buffer);
else
radv_meta_restore(&saved_state.gfx, cmd_buffer);
}
&(VkExtent2D) {extent.width, extent.height });
}
}
- radv_meta_restore_compute(&saved_state, cmd_buffer, 16);
+ radv_meta_restore_compute(&saved_state, cmd_buffer);
}
/**
&(VkExtent2D) { fb->width, fb->height });
}
- radv_meta_restore_compute(&saved_state, cmd_buffer, 16);
+ radv_meta_restore_compute(&saved_state, cmd_buffer);
for (uint32_t i = 0; i < subpass->color_count; ++i) {
VkAttachmentReference dest_att = subpass->resolve_attachments[i];
RADV_CMD_FLAG_INV_VMEM_L1 |
RADV_CMD_FLAG_CS_PARTIAL_FLUSH;
- radv_meta_restore_compute(&saved_state, cmd_buffer, 16);
+ radv_meta_restore_compute(&saved_state, cmd_buffer);
}
VkResult radv_CreateQueryPool(