v3dv: always program a reasonable internal depth type for copies/clears
This doesn't seem to fix anything, but it is the right thing to do. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
committed by
Marge Bot
parent
1ed8252514
commit
49549f43c7
@@ -660,25 +660,8 @@ v3dv_CreateImageView(VkDevice _device,
|
||||
assert(iview->format && iview->format->supported);
|
||||
iview->swap_rb = iview->format->swizzle[0] == PIPE_SWIZZLE_Z;
|
||||
|
||||
/* FIXME: should we just move this to
|
||||
* v3dv_get_internal_type_bpp_for_output_format instead?
|
||||
*/
|
||||
if (vk_format_is_depth_or_stencil(iview->vk_format)) {
|
||||
switch (iview->vk_format) {
|
||||
case VK_FORMAT_D16_UNORM:
|
||||
iview->internal_type = V3D_INTERNAL_TYPE_DEPTH_16;
|
||||
break;
|
||||
case VK_FORMAT_D32_SFLOAT:
|
||||
iview->internal_type = V3D_INTERNAL_TYPE_DEPTH_32F;
|
||||
break;
|
||||
case VK_FORMAT_X8_D24_UNORM_PACK32:
|
||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
iview->internal_type = V3D_INTERNAL_TYPE_DEPTH_24;
|
||||
break;
|
||||
default:
|
||||
assert(!"unsupported format");
|
||||
break;
|
||||
}
|
||||
iview->internal_type = v3dv_get_internal_depth_type(iview->vk_format);
|
||||
} else {
|
||||
v3dv_get_internal_type_bpp_for_output_format(iview->format->rt_type,
|
||||
&iview->internal_type,
|
||||
|
||||
@@ -1392,10 +1392,15 @@ emit_tlb_clear_job(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
uint32_t color_attachment_count = 0;
|
||||
VkClearAttachment color_attachments[4];
|
||||
const VkClearDepthStencilValue *ds_clear_value = NULL;
|
||||
uint8_t internal_depth_type = V3D_INTERNAL_TYPE_DEPTH_32F;
|
||||
for (uint32_t i = 0; i < attachment_count; i++) {
|
||||
if (attachments[i].aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT |
|
||||
VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
assert(subpass->ds_attachment.attachment != VK_ATTACHMENT_UNUSED);
|
||||
ds_clear_value = &attachments[i].clearValue.depthStencil;
|
||||
struct v3dv_render_pass_attachment *att =
|
||||
&state->pass->attachments[subpass->ds_attachment.attachment];
|
||||
internal_depth_type = v3dv_get_internal_depth_type(att->desc.format);
|
||||
} else if (attachments[i].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
color_attachments[color_attachment_count++] = attachments[i];
|
||||
}
|
||||
@@ -1427,6 +1432,7 @@ emit_tlb_clear_job(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
config.number_of_render_targets = MAX2(color_attachment_count, 1);
|
||||
config.multisample_mode_4x = false; /* FIXME */
|
||||
config.maximum_bpp_of_all_render_targets = tiling->internal_bpp;
|
||||
config.internal_depth_type = internal_depth_type;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < color_attachment_count; i++) {
|
||||
|
||||
@@ -104,6 +104,7 @@ struct framebuffer_data {
|
||||
/* Format info */
|
||||
VkFormat vk_format;
|
||||
const struct v3dv_format *format;
|
||||
uint8_t internal_depth_type;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -127,6 +128,10 @@ setup_framebuffer_data(struct framebuffer_data *fb,
|
||||
|
||||
fb->vk_format = vk_format;
|
||||
fb->format = v3dv_get_format(vk_format);
|
||||
|
||||
fb->internal_depth_type = V3D_INTERNAL_TYPE_DEPTH_32F;
|
||||
if (vk_format_is_depth_or_stencil(vk_format))
|
||||
fb->internal_depth_type = v3dv_get_internal_depth_type(vk_format);
|
||||
}
|
||||
|
||||
/* This chooses a tile buffer format that is appropriate for the copy operation.
|
||||
@@ -253,7 +258,7 @@ struct rcl_clear_info {
|
||||
|
||||
static struct v3dv_cl *
|
||||
emit_rcl_prologue(struct v3dv_job *job,
|
||||
uint32_t rt_internal_type,
|
||||
struct framebuffer_data *fb,
|
||||
const struct rcl_clear_info *clear_info)
|
||||
{
|
||||
const struct v3dv_frame_tiling *tiling = &job->frame_tiling;
|
||||
@@ -272,6 +277,7 @@ emit_rcl_prologue(struct v3dv_job *job,
|
||||
config.number_of_render_targets = 1;
|
||||
config.multisample_mode_4x = tiling->msaa;
|
||||
config.maximum_bpp_of_all_render_targets = tiling->internal_bpp;
|
||||
config.internal_depth_type = fb->internal_depth_type;
|
||||
}
|
||||
|
||||
if (clear_info && (clear_info->aspects & VK_IMAGE_ASPECT_COLOR_BIT)) {
|
||||
@@ -322,7 +328,7 @@ emit_rcl_prologue(struct v3dv_job *job,
|
||||
|
||||
cl_emit(rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) {
|
||||
rt.render_target_0_internal_bpp = tiling->internal_bpp;
|
||||
rt.render_target_0_internal_type = rt_internal_type;
|
||||
rt.render_target_0_internal_type = fb->internal_type;
|
||||
rt.render_target_0_clamp = V3D_RENDER_TARGET_CLAMP_NONE;
|
||||
}
|
||||
|
||||
@@ -691,8 +697,7 @@ emit_copy_image_to_buffer_rcl(struct v3dv_job *job,
|
||||
struct framebuffer_data *framebuffer,
|
||||
const VkBufferImageCopy *region)
|
||||
{
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, NULL);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, NULL);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
for (int layer = 0; layer < job->frame_tiling.layers; layer++)
|
||||
@@ -1177,8 +1182,7 @@ emit_copy_image_rcl(struct v3dv_job *job,
|
||||
struct framebuffer_data *framebuffer,
|
||||
const VkImageCopy *region)
|
||||
{
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, NULL);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, NULL);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
for (int layer = 0; layer < job->frame_tiling.layers; layer++)
|
||||
@@ -1457,8 +1461,7 @@ emit_clear_image_rcl(struct v3dv_job *job,
|
||||
.level = level,
|
||||
};
|
||||
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, &clear_info);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, &clear_info);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
emit_frame_setup(job, 0, clear_value);
|
||||
@@ -1688,8 +1691,7 @@ emit_copy_buffer_rcl(struct v3dv_job *job,
|
||||
struct framebuffer_data *framebuffer,
|
||||
uint32_t format)
|
||||
{
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, NULL);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, NULL);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
emit_frame_setup(job, 0, NULL);
|
||||
@@ -1944,8 +1946,7 @@ emit_fill_buffer_rcl(struct v3dv_job *job,
|
||||
.level = 0,
|
||||
};
|
||||
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, &clear_info);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, &clear_info);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
emit_frame_setup(job, 0, &clear_value);
|
||||
@@ -2283,8 +2284,7 @@ emit_copy_buffer_to_image_rcl(struct v3dv_job *job,
|
||||
struct framebuffer_data *framebuffer,
|
||||
const VkBufferImageCopy *region)
|
||||
{
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, NULL);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, NULL);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
for (int layer = 0; layer < job->frame_tiling.layers; layer++)
|
||||
@@ -4290,8 +4290,7 @@ emit_resolve_image_rcl(struct v3dv_job *job,
|
||||
struct framebuffer_data *framebuffer,
|
||||
const VkImageResolve *region)
|
||||
{
|
||||
struct v3dv_cl *rcl =
|
||||
emit_rcl_prologue(job, framebuffer->internal_type, NULL);
|
||||
struct v3dv_cl *rcl = emit_rcl_prologue(job, framebuffer, NULL);
|
||||
v3dv_return_if_oom(NULL, job);
|
||||
|
||||
for (int layer = 0; layer < job->frame_tiling.layers; layer++)
|
||||
|
||||
@@ -1681,6 +1681,23 @@ v3dv_zs_buffer(bool depth, bool stencil)
|
||||
return NONE;
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
v3dv_get_internal_depth_type(VkFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case VK_FORMAT_D16_UNORM:
|
||||
return V3D_INTERNAL_TYPE_DEPTH_16;
|
||||
case VK_FORMAT_D32_SFLOAT:
|
||||
return V3D_INTERNAL_TYPE_DEPTH_32F;
|
||||
case VK_FORMAT_X8_D24_UNORM_PACK32:
|
||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
return V3D_INTERNAL_TYPE_DEPTH_24;
|
||||
default:
|
||||
unreachable("Invalid depth format");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t v3dv_physical_device_api_version(struct v3dv_physical_device *dev);
|
||||
uint32_t v3dv_physical_device_vendor_id(struct v3dv_physical_device *dev);
|
||||
uint32_t v3dv_physical_device_device_id(struct v3dv_physical_device *dev);
|
||||
|
||||
Reference in New Issue
Block a user