diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt index 5d291e606ba..e406514810a 100644 --- a/src/panfrost/ci/panfrost-g52-fails.txt +++ b/src/panfrost/ci/panfrost-g52-fails.txt @@ -2691,8 +2691,6 @@ dEQP-VK.draw.renderpass.indexed_draw.draw_instanced_indexed_triangle_list_offset dEQP-VK.draw.renderpass.indexed_draw.draw_instanced_indexed_triangle_list_with_alloc_offset,Fail dEQP-VK.draw.renderpass.indexed_draw.draw_instanced_indexed_triangle_strip_with_alloc_offset,Fail -dEQP-VK.draw.renderpass.inverted_depth_ranges.nodepthclamp_deltazero,Fail - dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.1024,Fail dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.1048576,Fail dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.65536,Fail @@ -2779,7 +2777,6 @@ dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.indexed_draw.draw_ins dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_offset_negative_large_with_bind_offset_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_with_bind_offset_with_alloc_offset,Fail -dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.inverted_depth_ranges.nodepthclamp_deltazero,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_minus_one_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_minus_one_with_bind_offset_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_negative_large_with_alloc_offset,Fail @@ -2804,7 +2801,6 @@ dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_inst dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_offset_negative_large_with_bind_offset_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_with_bind_offset_with_alloc_offset,Fail -dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.inverted_depth_ranges.nodepthclamp_deltazero,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_minus_one_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_minus_one_with_bind_offset_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_negative_large_with_alloc_offset,Fail @@ -2829,7 +2825,6 @@ dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_instanced_inde dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_offset_negative_large_with_bind_offset_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_with_alloc_offset,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.indexed_draw.draw_instanced_indexed_triangle_strip_with_bind_offset_with_alloc_offset,Fail -dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.inverted_depth_ranges.nodepthclamp_deltazero,Fail dEQP-VK.rasterization.rasterization_order_attachment_access.depth.samples_1.multi_draw_barriers,Crash dEQP-VK.rasterization.rasterization_order_attachment_access.stencil.samples_1.multi_draw_barriers,Crash diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c index ff4841fe223..fe468eb63de 100644 --- a/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c @@ -631,12 +631,18 @@ panvk_draw_prepare_attributes(struct panvk_cmd_buffer *cmdbuf, } static void -panvk_emit_viewport(const struct vk_viewport_state *vp, void *vpd) +panvk_emit_viewport(struct panvk_cmd_buffer *cmdbuf, void *vpd) { - assert(vp->viewport_count == 1); + const struct vk_viewport_state *vp = &cmdbuf->vk.dynamic_graphics_state.vp; + if (vp->viewport_count < 1) + return; + + struct panvk_graphics_sysvals *sysvals = &cmdbuf->state.gfx.sysvals; const VkViewport *viewport = &vp->viewports[0]; const VkRect2D *scissor = &vp->scissors[0]; + float minz = sysvals->viewport.offset.z; + float maxz = minz + sysvals->viewport.scale.z; /* The spec says "width must be greater than 0.0" */ assert(viewport->width >= 0); @@ -663,16 +669,13 @@ panvk_emit_viewport(const struct vk_viewport_state *vp, void *vpd) miny = CLAMP(miny, 0, UINT16_MAX); maxy = CLAMP(maxy, 0, UINT16_MAX); - assert(viewport->minDepth >= 0.0f && viewport->minDepth <= 1.0f); - assert(viewport->maxDepth >= 0.0f && viewport->maxDepth <= 1.0f); - pan_pack(vpd, VIEWPORT, cfg) { cfg.scissor_minimum_x = minx; cfg.scissor_minimum_y = miny; cfg.scissor_maximum_x = maxx; cfg.scissor_maximum_y = maxy; - cfg.minimum_z = MIN2(viewport->minDepth, viewport->maxDepth); - cfg.maximum_z = MAX2(viewport->minDepth, viewport->maxDepth); + cfg.minimum_z = MIN2(minz, maxz); + cfg.maximum_z = MAX2(minz, maxz); } } @@ -685,16 +688,14 @@ panvk_draw_prepare_viewport(struct panvk_cmd_buffer *cmdbuf, * As a result, we define an empty one. */ if (!cmdbuf->state.gfx.vpd || dyn_gfx_state_dirty(cmdbuf, VP_VIEWPORTS) || - dyn_gfx_state_dirty(cmdbuf, VP_SCISSORS)) { + dyn_gfx_state_dirty(cmdbuf, VP_SCISSORS) || + dyn_gfx_state_dirty(cmdbuf, RS_DEPTH_CLIP_ENABLE) || + dyn_gfx_state_dirty(cmdbuf, RS_DEPTH_CLAMP_ENABLE)) { struct panfrost_ptr vp = panvk_cmd_alloc_desc(cmdbuf, VIEWPORT); if (!vp.gpu) return VK_ERROR_OUT_OF_DEVICE_MEMORY; - const struct vk_viewport_state *vps = - &cmdbuf->vk.dynamic_graphics_state.vp; - - if (vps->viewport_count > 0) - panvk_emit_viewport(vps, vp.cpu); + panvk_emit_viewport(cmdbuf, vp.cpu); cmdbuf->state.gfx.vpd = vp.gpu; } @@ -1231,10 +1232,6 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_data *draw) if (result != VK_SUCCESS) return; - result = panvk_draw_prepare_viewport(cmdbuf, draw); - if (result != VK_SUCCESS) - return; - batch->tlsinfo.tls.size = MAX3(vs->info.tls_size, fs ? fs->info.tls_size : 0, batch->tlsinfo.tls.size); @@ -1260,6 +1257,16 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_data *draw) panvk_per_arch(cmd_prepare_draw_sysvals)(cmdbuf, &draw->info); + /* Viewport emission requires up-to-date {scale,offset}.z for min/max Z, + * so we need to call it after calling cmd_prepare_draw_sysvals(), but + * viewports are the same for all layers, so we only emit when layer_id=0. + */ + if (i == 0) { + result = panvk_draw_prepare_viewport(cmdbuf, draw); + if (result != VK_SUCCESS) + return; + } + result = panvk_per_arch(cmd_prepare_push_uniforms)( cmdbuf, cmdbuf->state.gfx.vs.shader); if (result != VK_SUCCESS) diff --git a/src/panfrost/vulkan/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/panvk_vX_cmd_draw.c index 07bcadad3bf..109044c3c9a 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_draw.c @@ -606,7 +606,6 @@ panvk_per_arch(cmd_prepare_draw_sysvals)(struct panvk_cmd_buffer *cmdbuf, set_gfx_sysval(cmdbuf, dirty_sysvals, viewport.offset.z, viewport->minDepth); -#if PAN_ARCH >= 9 /* Doing the viewport transform in the vertex shader and then depth * clipping with the viewport depth range gets a similar result to * clipping in clip-space, but loses precision when the viewport depth @@ -643,7 +642,6 @@ panvk_per_arch(cmd_prepare_draw_sysvals)(struct panvk_cmd_buffer *cmdbuf, set_gfx_sysval(cmdbuf, dirty_sysvals, viewport.offset.z, CLAMP(z_offset, 0.0f, 1.0f)); } -#endif } const struct panvk_shader *vs = cmdbuf->state.gfx.vs.shader;