i915g: Make sure the 1D texture Y channel is initialized.

Even with the wrap mode forced to REPEAT, we get undefined results in
CelShading when the Y channel is unwritten since the beginning of the
program.

I dropped the coords==0 case in the process, since that's not possible and
made the 1D case confusing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11457>
This commit is contained in:
Emma Anholt 2021-06-30 21:58:23 -07:00 committed by Marge Bot
parent d0ac174fda
commit c656c5f055
3 changed files with 12 additions and 12 deletions

View File

@ -735,6 +735,7 @@ spec@glsl-1.10@execution@loops@glsl-fs-unroll-side-effect,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d-01,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d-03,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d-04,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d-07,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d-08,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-shadow1d-bias,Fail

View File

@ -23,14 +23,11 @@ traces:
# expectations:
# - device: i915-g33
# checksum: 8d4c52f0af9c09710d358f24c73fae3c
#- path: humus/CelShading.trace
# # The cel shading is pretty chunky, but maybe that's just precision stuff.
# # Since the NIR change, 1D textures are getting undefined .y channels that
# # could trigger the known bad 1D texture wrap behavior, and the rendering looks
# # like undefined data.
# expectations:
# - device: i915-g33
# checksum: 4605ceed2b5c3a03f9262c546d75a8d8
- path: humus/CelShading.trace
# The cel shading is pretty chunky, but maybe that's just precision stuff.
expectations:
- device: i915-g33
checksum: 86094ef6a40bfe48d4b7d66871af97a5
# Requires GLSL 1.30
#- path: humus/DynamicBranching3.trace
# expectations:

View File

@ -186,11 +186,13 @@ i915_emit_texld(struct i915_fp_compile *p, uint32_t dest, uint32_t destmask,
/* Eliminate the useless texture coordinates. Otherwise we end up generating
* a swizzle for no reason below. */
switch (num_coord) {
case 0:
ignore |= (0xf << UREG_CHANNEL_X_SHIFT);
FALLTHROUGH;
case 1:
ignore |= (0xf << UREG_CHANNEL_Y_SHIFT);
/* For 1D textures, make sure that the Y coordinate is actually
* initialized. It seems that if the channel is never written during the
* program, texturing returns undefined results (even if the Y wrap is
* REPEAT).
*/
coord = swizzle(coord, X, X, Y, Z);
FALLTHROUGH;
case 2:
ignore |= (0xf << UREG_CHANNEL_Z_SHIFT);