[Mesa-dev] [PATCH 09/19] radv: use the new attachments array in CmdEndRenderPass()

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Feb 1 07:55:26 UTC 2019


On 1/31/19 11:16 AM, Bas Nieuwenhuizen wrote:
> On Tue, Jan 29, 2019 at 10:16 PM Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> That shouldn't change anything as we check if the last
>> subpass id is the final subpass.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/amd/vulkan/radv_cmd_buffer.c | 16 +++++++++++++---
>>   1 file changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
>> index 914ff0055d9..b0b453d76e9 100644
>> --- a/src/amd/vulkan/radv_cmd_buffer.c
>> +++ b/src/amd/vulkan/radv_cmd_buffer.c
>> @@ -4333,15 +4333,25 @@ void radv_CmdEndRenderPass(
>>          VkCommandBuffer                             commandBuffer)
>>   {
>>          RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
>> +       struct radv_cmd_state *state = &cmd_buffer->state;
>> +       const struct radv_subpass *subpass = state->subpass;
>> +       uint32_t subpass_id = radv_get_subpass_id(cmd_buffer);
>>
>>          radv_subpass_barrier(cmd_buffer, &cmd_buffer->state.pass->end_barrier);
>>
>>          radv_cmd_buffer_resolve_subpass(cmd_buffer);
>>
>> -       for (unsigned i = 0; i < cmd_buffer->state.framebuffer->attachment_count; ++i) {
>> -               VkImageLayout layout = cmd_buffer->state.pass->attachments[i].final_layout;
>> +       for (uint32_t i = 0; i < subpass->attachment_count; ++i) {
>> +               const uint32_t a = subpass->attachments[i].attachment;
>> +               if (a == VK_ATTACHMENT_UNUSED)
>> +                       continue;
>> +
>> +               if (state->pass->attachments[a].last_subpass_idx != subpass_id)
>> +                       continue;
> I don't think we can add this without adding logic that if the
> attachment is not in the final subpass, we transition it to the final
> layout earlier?

I don't see the problem. If the attachment isn't in the final subpass, 
the transition should happen in the previous subpass?

>
>> +
>> +               VkImageLayout layout = state->pass->attachments[a].final_layout;
>>                  radv_handle_subpass_image_transition(cmd_buffer,
>> -                                     (struct radv_subpass_attachment){i, layout});
>> +                                     (struct radv_subpass_attachment){a, layout});
>>          }
>>
>>          vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
>> --
>> 2.20.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list