mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 04:00:10 +01:00
radv: pass the HTILE buffer to radv_copy_vrs_htile()
Will be used to use a global HTILE buffer without an image. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12243>
This commit is contained in:
parent
ad60354a92
commit
ab635b024b
3 changed files with 25 additions and 15 deletions
|
|
@ -5142,14 +5142,22 @@ radv_cmd_buffer_begin_subpass(struct radv_cmd_buffer *cmd_buffer, uint32_t subpa
|
|||
*/
|
||||
int ds_idx = subpass->depth_stencil_attachment->attachment;
|
||||
struct radv_image_view *ds_iview = cmd_buffer->state.attachments[ds_idx].iview;
|
||||
struct radv_image *ds_image = ds_iview->image;
|
||||
|
||||
VkExtent2D extent = {
|
||||
.width = ds_iview->image->info.width,
|
||||
.height = ds_iview->image->info.height,
|
||||
.width = ds_image->info.width,
|
||||
.height = ds_image->info.height,
|
||||
};
|
||||
|
||||
/* HTILE buffer */
|
||||
uint64_t htile_offset = ds_image->offset + ds_image->planes[0].surface.meta_offset;
|
||||
uint64_t htile_size = ds_image->planes[0].surface.meta_slice_size;
|
||||
struct radv_buffer htile_buffer = {.bo = ds_image->bo,
|
||||
.offset = htile_offset,
|
||||
.size = htile_size};
|
||||
|
||||
/* Copy the VRS rates to the HTILE buffer. */
|
||||
radv_copy_vrs_htile(cmd_buffer, vrs_iview->image, &extent, ds_iview->image, true);
|
||||
radv_copy_vrs_htile(cmd_buffer, vrs_iview->image, &extent, ds_image, &htile_buffer, true);
|
||||
} else {
|
||||
/* When a subpass uses a VRS attachment without binding a depth/stencil attachment, we have
|
||||
* to copy the VRS rates to our internal HTILE buffer.
|
||||
|
|
@ -5158,13 +5166,20 @@ radv_cmd_buffer_begin_subpass(struct radv_cmd_buffer *cmd_buffer, uint32_t subpa
|
|||
struct radv_image *ds_image = radv_cmd_buffer_get_vrs_image(cmd_buffer);
|
||||
|
||||
if (ds_image) {
|
||||
/* HTILE buffer */
|
||||
uint64_t htile_offset = ds_image->offset + ds_image->planes[0].surface.meta_offset;
|
||||
uint64_t htile_size = ds_image->planes[0].surface.meta_slice_size;
|
||||
struct radv_buffer htile_buffer = {.bo = ds_image->bo,
|
||||
.offset = htile_offset,
|
||||
.size = htile_size};
|
||||
|
||||
VkExtent2D extent = {
|
||||
.width = MIN2(fb->width, ds_image->info.width),
|
||||
.height = MIN2(fb->height, ds_image->info.height),
|
||||
};
|
||||
|
||||
/* Copy the VRS rates to the HTILE buffer. */
|
||||
radv_copy_vrs_htile(cmd_buffer, vrs_iview->image, &extent, ds_image, false);
|
||||
radv_copy_vrs_htile(cmd_buffer, vrs_iview->image, &extent, ds_image, &htile_buffer, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@ void radv_retile_dcc(struct radv_cmd_buffer *cmd_buffer, struct radv_image *imag
|
|||
void radv_expand_fmask_image_inplace(struct radv_cmd_buffer *cmd_buffer, struct radv_image *image,
|
||||
const VkImageSubresourceRange *subresourceRange);
|
||||
void radv_copy_vrs_htile(struct radv_cmd_buffer *cmd_buffer, struct radv_image *vrs_image,
|
||||
VkExtent2D *extent, struct radv_image *dst_image, bool read_htile_value);
|
||||
VkExtent2D *extent, struct radv_image *dst_image,
|
||||
struct radv_buffer *htile_buffer, bool read_htile_value);
|
||||
|
||||
void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_image *src_image, VkFormat src_format,
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@ fail:
|
|||
|
||||
void
|
||||
radv_copy_vrs_htile(struct radv_cmd_buffer *cmd_buffer, struct radv_image *vrs_image,
|
||||
VkExtent2D *extent, struct radv_image *dst_image, bool read_htile_value)
|
||||
VkExtent2D *extent, struct radv_image *dst_image,
|
||||
struct radv_buffer *htile_buffer, bool read_htile_value)
|
||||
{
|
||||
struct radv_device *device = cmd_buffer->device;
|
||||
struct radv_meta_state *state = &device->meta_state;
|
||||
|
|
@ -249,13 +250,6 @@ radv_copy_vrs_htile(struct radv_cmd_buffer *cmd_buffer, struct radv_image *vrs_i
|
|||
radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
state->copy_vrs_htile_pipeline);
|
||||
|
||||
/* HTILE buffer */
|
||||
uint64_t htile_offset = dst_image->offset + dst_image->planes[0].surface.meta_offset;
|
||||
uint64_t htile_size = dst_image->planes[0].surface.meta_slice_size;
|
||||
struct radv_buffer htile_buffer = {.bo = dst_image->bo,
|
||||
.offset = htile_offset,
|
||||
.size = htile_size};
|
||||
|
||||
radv_image_view_init(&vrs_iview, cmd_buffer->device,
|
||||
&(VkImageViewCreateInfo){
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
|
|
@ -292,9 +286,9 @@ radv_copy_vrs_htile(struct radv_cmd_buffer *cmd_buffer, struct radv_image *vrs_i
|
|||
.dstArrayElement = 0,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.pBufferInfo = &(VkDescriptorBufferInfo){.buffer = radv_buffer_to_handle(&htile_buffer),
|
||||
.pBufferInfo = &(VkDescriptorBufferInfo){.buffer = radv_buffer_to_handle(htile_buffer),
|
||||
.offset = 0,
|
||||
.range = htile_size}}});
|
||||
.range = htile_buffer->size}}});
|
||||
|
||||
const unsigned constants[3] = {
|
||||
dst_image->planes[0].surface.meta_pitch, dst_image->planes[0].surface.meta_slice_size,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue