[Mesa-dev] Mesa (master): glsl: Make lower_const_arrays_to_uniforms work directly on constants.
Ilia Mirkin
imirkin at alum.mit.edu
Fri Jun 24 14:11:11 UTC 2016
Same deal on nouveau. This is the TGSI:
FRAG
PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1
DCL IN[0], POSITION, LINEAR
DCL OUT[0], COLOR
DCL SAMP[0]
DCL SVIEW[0], 2D, FLOAT
DCL CONST[5]
DCL CONST[0..3]
DCL TEMP[0]
DCL TEMP[1..2], LOCAL
IMM[0] INT32 {0, 0, 0, 0}
0: MOV TEMP[0], IN[0]
1: MAD TEMP[0].y, IN[0], CONST[5].xxxx, CONST[5].yyyy
2: TXQ TEMP[1].xy, IMM[0].xxxx, SAMP[0], 2D
3: I2F TEMP[1].xy, TEMP[1].xyyy
4: RCP TEMP[2].x, TEMP[1].xxxx
5: RCP TEMP[2].y, TEMP[1].yyyy
6: MUL TEMP[1].xy, TEMP[0].xyyy, TEMP[2].xyyy
7: MOV TEMP[1].xy, TEMP[1].xyyy
8: TG4 TEMP[1], TEMP[1], IMM[0].xxxx, SAMP[0], 2D,
MEMORY[-23280].wxy, MEMORY[-23280].wxy, MEMORY[-23280].wxy,
MEMORY[-23280].wxy
9: MOV OUT[0], TEMP[1]
10: END
textureGather: codegen/nv50_ir_from_tgsi.cpp:1826:
nv50_ir::BuildUtil::DataArray*
{anonymous}::Converter::getArrayForFile(unsigned int, int): Assertion
`!"invalid/unhandled TGSI source file"' failed.
So I'm guessing something is causing unexpected things to go through
there. Ah yeah. this is the GLSL IR:
: GLSL IR for linked fragment program 3:
(
(declare (location=0 shader_in ) vec4 gl_FragCoord)
(declare (location=1 uniform ) (array ivec2 4) constarray__0x24099d0)
(declare (location=2 shader_out ) vec4 gl_FragColor)
(declare (temporary ) vec4 gl_FragColor)
(declare (location=0 uniform ) sampler2D s)
( function main
(signature void
(parameters
)
(
(assign (xyzw) (var_ref gl_FragColor) (tg4 vec4 (var_ref s)
(expression vec2 * (swiz xy (var_ref gl_FragCoord) )(expression vec2
rcp (expression vec2 i2f (txs ivec2 (var_ref s) (constant int (0))
)) ) ) (var_ref constarray__0x24099d0) (constant int (0)) ))
(assign (xyzw) (var_ref gl_FragColor at 3) (var_ref gl_FragColor) )
))
)
)
The offsets are supposed to be immediates in this case. Looks like the
full array dereference is getting lowered to a uniform for some
reason? Note that the original arg was:
(constant (array ivec2 4) ((constant ivec2 (-32 31)) (constant ivec2
(31 -32)) (constant ivec2 (3 3)) (constant ivec2 (-3 -3)) )
And to be perfectly honest, I'm not sure what the extra (constant int
0) is doing there at the end - that wasn't there in the original.
Ken... any ideas?
-ilia
On Fri, Jun 24, 2016 at 2:31 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On 24.06.2016 03:59, Kenneth Graunke wrote:
>> Module: Mesa
>> Branch: master
>> Commit: ef78df8d3b0cf540e5f08c8c2f6caa338b64a6c7
>> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef78df8d3b0cf540e5f08c8c2f6caa338b64a6c7
>>
>> Author: Kenneth Graunke <kenneth at whitecape.org>
>> Date: Fri Apr 29 18:05:26 2016 -0700
>>
>> glsl: Make lower_const_arrays_to_uniforms work directly on constants.
>
> This change caused all spec at arb_gpu_shader5@texturegatheroffsets tests
> to fail an assertion with radeonsi and llvmpipe (needs
> MESA_EXTENSION_OVERRIDE="GL_ARB_gpu_shader5" to run these tests). For
> example textureGather fs offsets r 0 float 2D repeat:
>
> ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:442:lp_build_emit_fetch_texoffset: Assertion `off->Index <= bld_base->info->file_max[off->File]' failed.
>
> Thread 1 "textureGather" received signal SIGTRAP, Trace/breakpoint trap.
> 0x00007ffff0b93f86 in _debug_assert_fail (expr=expr at entry=0x7ffff0fcef88 "off->Index <= bld_base->info->file_max[off->File]", file=file at entry=0x7ffff0fcee78 "../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c", line=line at entry=442,
> function=function at entry=0x7ffff0fcf090 <__func__.11579> "lp_build_emit_fetch_texoffset") at ../../../../src/gallium/auxiliary/util/u_debug.c:330
> 330 os_abort();
> (gdb) bt
> #0 0x00007ffff0b93f86 in _debug_assert_fail (expr=expr at entry=0x7ffff0fcef88 "off->Index <= bld_base->info->file_max[off->File]", file=file at entry=0x7ffff0fcee78 "../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c", line=line at entry=442,
> function=function at entry=0x7ffff0fcf090 <__func__.11579> "lp_build_emit_fetch_texoffset") at ../../../../src/gallium/auxiliary/util/u_debug.c:330
> #1 0x00007ffff0cdc051 in lp_build_emit_fetch_texoffset (bld_base=bld_base at entry=0x7fffffff47f0, inst=inst at entry=0xce0a50, tex_off_op=tex_off_op at entry=0, chan_index=chan_index at entry=0) at ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:442
> #2 0x00007ffff0ce3dc0 in emit_tex (modifier=LP_BLD_TEX_MODIFIER_NONE, sampler_op=LP_SAMPLER_OP_GATHER, sampler_reg=2, texel=<optimized out>, inst=0xce0a50, bld=0x7fffffff47f0) at ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c:2316
> #3 tg4_emit (action=<optimized out>, bld_base=0x7fffffff47f0, emit_data=0x7fffffff45e0) at ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c:3257
> #4 0x00007ffff0cdb75a in lp_build_tgsi_inst_llvm (bld_base=bld_base at entry=0x7fffffff47f0, inst=inst at entry=0xce0a50) at ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:306
> #5 0x00007ffff0cdc181 in lp_build_tgsi_llvm (bld_base=bld_base at entry=0x7fffffff47f0, tokens=tokens at entry=0x7f6740) at ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:517
> #6 0x00007ffff0ceac72 in lp_build_tgsi_soa (gallivm=gallivm at entry=0x7f7720, tokens=tokens at entry=0x7f6740, type=..., type at entry=..., mask=mask at entry=0x7fffffffa860, consts_ptr=consts_ptr at entry=0xcb4a28, const_sizes_ptr=const_sizes_ptr at entry=0xcb4ac8,
> system_values=0x7fffffffa880, inputs=0x7fffffffd570, outputs=0x7fffffffac40, context_ptr=0x7f4590, thread_data_ptr=0x7f2470, sampler=0x7f39a0, info=0xc8a5e0, gs_iface=0x0) at ../../../../src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c:4026
> #7 0x00007ffff0ea2ed5 in generate_fs_loop (thread_data_ptr=0x7f2470, facing=0x7f1a40, depth_stride=0x7f24f0, depth_ptr=0x7f23f0, out_color=0x7fffffffaa00, mask_store=0x7fbc78, sampler=0x7f39a0, interp=0x7fffffffb640, num_loop=<optimized out>,
> context_ptr=0x7f4590, type=..., builder=<optimized out>, key=0x7f7720, shader=0xc8a3b0, gallivm=0x7f7720) at ../../../../../src/gallium/drivers/llvmpipe/lp_state_fs.c:421
> #8 generate_fragment (shader=shader at entry=0xc8a3b0, variant=variant at entry=0x7f74a0, partial_mask=partial_mask at entry=1, lp=0x62e0a0) at ../../../../../src/gallium/drivers/llvmpipe/lp_state_fs.c:2367
> #9 0x00007ffff0ea57b4 in generate_variant (lp=0x62e0a0, key=0x7fffffffe040, shader=0xc8a3b0) at ../../../../../src/gallium/drivers/llvmpipe/lp_state_fs.c:2619
> #10 llvmpipe_update_fs (lp=lp at entry=0x62e0a0) at ../../../../../src/gallium/drivers/llvmpipe/lp_state_fs.c:3179
> #11 0x00007ffff0e9aa48 in llvmpipe_update_derived (llvmpipe=llvmpipe at entry=0x62e0a0) at ../../../../../src/gallium/drivers/llvmpipe/lp_state_derived.c:209
> #12 0x00007ffff0e6e458 in llvmpipe_draw_vbo (pipe=0x62e0a0, info=0x7fffffffe350) at ../../../../../src/gallium/drivers/llvmpipe/lp_draw_arrays.c:70
> #13 0x00007ffff0949d8f in st_draw_vbo (ctx=0x741d70, prims=<optimized out>, nr_prims=<optimized out>, ib=0x0, index_bounds_valid=<optimized out>, min_index=0, max_index=5, tfb_vertcount=0x0, stream=0, indirect=0x0)
> at ../../../src/mesa/state_tracker/st_draw.c:252
> #14 0x00007ffff08ff5ce in vbo_draw_arrays (baseInstance=0, numInstances=1, count=6, start=0, mode=4, ctx=0x741d70) at ../../../src/mesa/vbo/vbo_exec_array.c:503
> #15 vbo_exec_DrawArrays (mode=4, start=0, count=6) at ../../../src/mesa/vbo/vbo_exec_array.c:655
> #16 0x00007ffff7aab9f2 in stub_glDrawArrays (mode=4, first=0, count=6) at tests/util/piglit-dispatch-gen.c:11862
> #17 0x0000000000401c3b in piglit_display () at tests/texturing/shaders/textureGather.c:70
> #18 0x00007ffff7b3a591 in run_test (gl_fw=0x616c20, argc=8, argv=0x7fffffffe6c8) at tests/util/piglit-framework-gl/piglit_fbo_framework.c:52
> #19 0x00007ffff7b20995 in piglit_gl_test_run (argc=8, argv=0x7fffffffe6c8, config=0x7fffffffe590) at tests/util/piglit-framework-gl.c:199
> #20 0x0000000000401b17 in main (argc=8, argv=0x7fffffffe6c8) at tests/texturing/shaders/textureGather.c:10
>
>
> --
> Earthling Michel Dänzer | http://www.amd.com
> Libre software enthusiast | Mesa and X developer
> _______________________________________________
> 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