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>
This commit is contained in:
Iago Toral Quiroga
2020-07-01 14:21:09 +02:00
committed by Marge Bot
parent 0385da9e08
commit cb1e492ee0
3 changed files with 18 additions and 1 deletions
+1
View File
@@ -2086,6 +2086,7 @@ v3dv_CreateSampler(VkDevice _device,
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);
+1
View File
@@ -1375,6 +1375,7 @@ struct v3dv_descriptor_map {
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
+16 -1
View File
@@ -140,10 +140,25 @@ write_tmu_p1(struct v3dv_cmd_buffer *cmd_buffer,
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