intel/brw: Actually retype integer sources of sampler message payload

According to PRMs:
"All parameters are of type IEEE_Float, except those in the The ld*,
resinfo, and the offu, offv of the gather4_po[_c] instruction message
types, which are of type signed integer."

Currently, we load parameters with the correct types, but use them as send
sources with the default float type, which may confuse passes downstream.
Fix this by actually storing the retyped sources.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11118
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29581>
This commit is contained in:
Sviatoslav Peleshko 2024-05-24 11:27:06 +03:00 committed by Marge Bot
parent 59218cdf07
commit 2358c997f3

View file

@ -939,41 +939,44 @@ lower_sampler_logical_send(const fs_builder &bld, fs_inst *inst,
coordinate_done = true;
break;
case SHADER_OPCODE_TXS_LOGICAL:
bld.MOV(retype(sources[length], payload_unsigned_type), lod);
length++;
sources[length] = retype(sources[length], payload_unsigned_type);
bld.MOV(sources[length++], lod);
break;
case SHADER_OPCODE_IMAGE_SIZE_LOGICAL:
/* We need an LOD; just use 0 */
bld.MOV(retype(sources[length], payload_unsigned_type), brw_imm_ud(0));
length++;
sources[length] = retype(sources[length], payload_unsigned_type);
bld.MOV(sources[length++], brw_imm_ud(0));
break;
case SHADER_OPCODE_TXF_LOGICAL:
/* On Gfx9 the parameters are intermixed they are u, v, lod, r. */
bld.MOV(retype(sources[length++], payload_signed_type), coordinate);
sources[length] = retype(sources[length], payload_signed_type);
bld.MOV(sources[length++], coordinate);
if (coord_components >= 2) {
bld.MOV(retype(sources[length], payload_signed_type),
offset(coordinate, bld, 1));
sources[length] = retype(sources[length], payload_signed_type);
bld.MOV(sources[length], offset(coordinate, bld, 1));
} else {
sources[length] = brw_imm_d(0);
}
length++;
if (!lod_is_zero) {
bld.MOV(retype(sources[length], payload_signed_type), lod);
length++;
sources[length] = retype(sources[length], payload_signed_type);
bld.MOV(sources[length++], lod);
}
for (unsigned i = 2; i < coord_components; i++)
bld.MOV(retype(sources[length++], payload_signed_type),
offset(coordinate, bld, i));
for (unsigned i = 2; i < coord_components; i++) {
sources[length] = retype(sources[length], payload_signed_type);
bld.MOV(sources[length++], offset(coordinate, bld, i));
}
coordinate_done = true;
break;
case SHADER_OPCODE_TXF_CMS_W_LOGICAL:
case SHADER_OPCODE_TXF_CMS_W_GFX12_LOGICAL:
bld.MOV(retype(sources[length++], payload_unsigned_type), sample_index);
sources[length] = retype(sources[length], payload_unsigned_type);
bld.MOV(sources[length++], sample_index);
/* Data from the multisample control surface. */
for (unsigned i = 0; i < 2; ++i) {
@ -989,14 +992,18 @@ lower_sampler_logical_send(const fs_builder &bld, fs_inst *inst,
*/
if (op == SHADER_OPCODE_TXF_CMS_W_GFX12_LOGICAL) {
fs_reg tmp = offset(mcs, bld, i);
bld.MOV(retype(sources[length++], payload_unsigned_type),
sources[length] = retype(sources[length], payload_unsigned_type);
bld.MOV(sources[length++],
mcs.file == IMM ? mcs :
subscript(tmp, payload_unsigned_type, 0));
bld.MOV(retype(sources[length++], payload_unsigned_type),
sources[length] = retype(sources[length], payload_unsigned_type);
bld.MOV(sources[length++],
mcs.file == IMM ? mcs :
subscript(tmp, payload_unsigned_type, 1));
} else {
bld.MOV(retype(sources[length++], payload_unsigned_type),
sources[length] = retype(sources[length], payload_unsigned_type);
bld.MOV(sources[length++],
mcs.file == IMM ? mcs : offset(mcs, bld, i));
}
}
@ -1006,9 +1013,10 @@ lower_sampler_logical_send(const fs_builder &bld, fs_inst *inst,
/* There is no offsetting for this message; just copy in the integer
* texture coordinates.
*/
for (unsigned i = 0; i < coord_components; i++)
bld.MOV(retype(sources[length++], payload_signed_type),
offset(coordinate, bld, i));
for (unsigned i = 0; i < coord_components; i++) {
sources[length] = retype(sources[length], payload_signed_type);
bld.MOV(sources[length++], offset(coordinate, bld, i));
}
coordinate_done = true;
break;
@ -1017,9 +1025,10 @@ lower_sampler_logical_send(const fs_builder &bld, fs_inst *inst,
for (unsigned i = 0; i < 2; i++) /* u, v */
bld.MOV(sources[length++], offset(coordinate, bld, i));
for (unsigned i = 0; i < 2; i++) /* offu, offv */
bld.MOV(retype(sources[length++], payload_signed_type),
offset(tg4_offset, bld, i));
for (unsigned i = 0; i < 2; i++) { /* offu, offv */
sources[length] = retype(sources[length], payload_signed_type);
bld.MOV(sources[length++], offset(tg4_offset, bld, i));
}
if (coord_components == 3) /* r if present */
bld.MOV(sources[length++], offset(coordinate, bld, 2));