From a114a2c7d431c70472d2217a33cd5849b83ee872 Mon Sep 17 00:00:00 2001 From: SoroushIMG Date: Fri, 9 Jun 2023 01:24:03 +0100 Subject: [PATCH] pvr: set nn coords in sampler state for tq shaders when needed Instead of setting these explicitly in the shader, set it in the sampler state. Signed-off-by: SoroushIMG Co-authored-by: Simon Perretta Acked-by: Erik Faye-Lund Part-of: --- src/imagination/vulkan/pvr_job_transfer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/imagination/vulkan/pvr_job_transfer.c b/src/imagination/vulkan/pvr_job_transfer.c index d43223139df..83c80dbbe65 100644 --- a/src/imagination/vulkan/pvr_job_transfer.c +++ b/src/imagination/vulkan/pvr_job_transfer.c @@ -1480,6 +1480,7 @@ static VkResult pvr_sampler_state_for_surface( enum pvr_filter filter, const struct pvr_tq_frag_sh_reg_layout *sh_reg_layout, uint32_t sampler, + bool nn_coords, uint32_t *mem_ptr) { uint64_t sampler_state[2U] = { 0UL, 0UL }; @@ -1502,6 +1503,8 @@ static VkResult pvr_sampler_state_for_surface( reg.magfilter = ROGUE_TEXSTATE_FILTER_BICUBIC; } + reg.non_normalized_coords = nn_coords; + reg.addrmode_u = ROGUE_TEXSTATE_ADDRMODE_CLAMP_TO_EDGE; reg.addrmode_v = ROGUE_TEXSTATE_ADDRMODE_CLAMP_TO_EDGE; @@ -1712,12 +1715,15 @@ pvr_sampler_image_state(struct pvr_transfer_ctx *ctx, layer->pbe_format)) { const struct pvr_device_info *dev_info = &transfer_cmd->cmd_buffer->device->pdevice->dev_info; + const bool nn_coords = state->shader_props.layer_props.linear || + !state->shader_props.iterated; result = pvr_sampler_state_for_surface(dev_info, surface, filter, sh_reg_layout, uf_sampler, + nn_coords, mem_ptr); if (result != VK_SUCCESS) return result; @@ -4174,6 +4180,7 @@ static VkResult pvr_isp_ctrl_stream(const struct pvr_device_info *dev_info, state->filter[source], sh_reg_layout, 0U, + layer->linear, pvr_bo_suballoc_get_map_addr(pvr_bo)); if (result != VK_SUCCESS) return result;