v3dv: handle unnormalized coordinates in samplers

In OpenGL, unnormalized coordinates are implicit based on the sampler
type (rectangle textures), so the compiler can set the flag when needed.
In Vulkan, however, this is configured explicitly in the sampler object,
so the compiler won't set it and we need to do it manually when we are
writing the P1 uniform.

Fixes:
dEQP-VK.pipeline.sampler.exact_sampling.*.unnormalized_coords

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index 800b89e..aa4e753 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -2086,6 +2086,7 @@
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
 
    sampler->compare_enable = pCreateInfo->compareEnable;
+   sampler->unnormalized_coordinates = pCreateInfo->unnormalizedCoordinates;
    pack_sampler_state(sampler, pCreateInfo);
 
    *pSampler = v3dv_sampler_to_handle(sampler);
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index bc48c81..f53b7a6 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -1375,6 +1375,7 @@
 
 struct v3dv_sampler {
    bool compare_enable;
+   bool unnormalized_coordinates;
 
    /* Prepacked SAMPLER_STATE, that is referenced as part of the tmu
     * configuration. If needed it will be copied to the descriptor info during
diff --git a/src/broadcom/vulkan/v3dv_uniforms.c b/src/broadcom/vulkan/v3dv_uniforms.c
index f1117fc..a3ad5c2 100644
--- a/src/broadcom/vulkan/v3dv_uniforms.c
+++ b/src/broadcom/vulkan/v3dv_uniforms.c
@@ -140,10 +140,25 @@
       v3dv_descriptor_map_get_sampler_state(descriptor_state, &pipeline->sampler_map,
                                             pipeline->layout, sampler_idx);
 
+   const struct v3dv_sampler *sampler =
+      v3dv_descriptor_map_get_sampler(descriptor_state, &pipeline->sampler_map,
+                                         pipeline->layout, sampler_idx);
+   assert(sampler);
+
+   /* Set unnormalized coordinates flag from sampler object */
+   uint32_t p1_packed = v3d_unit_data_get_offset(data);
+   if (sampler->unnormalized_coordinates) {
+      struct V3DX(TMU_CONFIG_PARAMETER_1) p1_unpacked;
+      V3DX(TMU_CONFIG_PARAMETER_1_unpack)((uint8_t *)&p1_packed, &p1_unpacked);
+      p1_unpacked.unnormalized_coordinates = true;
+      V3DX(TMU_CONFIG_PARAMETER_1_pack)(NULL, (uint8_t *)&p1_packed,
+                                        &p1_unpacked);
+   }
+
    cl_aligned_reloc(&job->indirect, uniforms,
                     sampler_state_reloc.bo,
                     sampler_state_reloc.offset +
-                    v3d_unit_data_get_offset(data));
+                    p1_packed);
 }
 
 static void