[Mesa-dev] NIR constant problem for GPU which doesn't have native integer support

Ilia Mirkin imirkin at alum.mit.edu
Wed Jan 2 15:43:32 UTC 2019


Have a look at the first 4 patches in the series from Jonathan Marek
to address some of these issues:

https://patchwork.freedesktop.org/series/54295/

Not sure exactly what state that work is in, but I've added Jonathan
to CC, perhaps he can provide an update.

Cheers,

  -ilia

On Wed, Jan 2, 2019 at 6:28 AM Qiang Yu <yuq825 at gmail.com> wrote:
>
> Hi guys,
>
> I found the problem with this test fragment shader when lima development:
> uniform int color;
> void main() {
>     if (color > 1)
>         gl_FragColor = vec4(1.0, 0.0, 0.0, 1);
>     else
>         gl_FragColor = vec4(0.0, 1.0, 0.0, 1);
> }
>
> nir_print_shader output:
> impl main {
>         block block_0:
>         /* preds: */
>         vec1 32 ssa_0 = load_const (0x00000001 /* 0.000000 */)
>         vec4 32 ssa_1 = load_const (0x3f800000 /* 1.000000 */,
> 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /*
> 1.000000 */)
>         vec4 32 ssa_2 = load_const (0x00000000 /* 0.000000 */,
> 0x3f800000 /* 1.000000 */, 0x00000000 /* 0.000000 */, 0x3f800000 /*
> 1.000000 */)
>         vec1 32 ssa_3 = load_const (0x00000000 /* 0.000000 */)
>         vec1 32 ssa_4 = intrinsic load_uniform (ssa_3) (0, 1, 0) /*
> base=0 */ /* range=1 */ /* component=0 */   /* color */
>         vec1 32 ssa_5 = slt ssa_0, ssa_4
>         vec1 32 ssa_6 = fnot ssa_5
>         vec4 32 ssa_7 = bcsel ssa_6.xxxx, ssa_2, ssa_1
>         intrinsic store_output (ssa_7, ssa_3) (0, 15, 0) /* base=0 */
> /* wrmask=xyzw */ /* component=0 */       /* gl_FragColor */
>         /* succs: block_1 */
>         block block_1:
> }
>
> ssa0 is not converted to float when glsl to nir. I see glsl_to_nir.cpp
> will create flt/ilt/ult
> based on source type for gpu support native integer, but for gpu not
> support native
> integer, just create slt for all source type. And in
> nir_lower_constant_initializers,
> there's also no type conversion for integer constant.
>
> Do you know how to fix this problem?
>
> Thanks,
> Qiang
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list