Bug 79085 - Khronos conformance test ES3-CTS.shaders.struct.uniform.sampler_nested_vertex assert fails
Summary: Khronos conformance test ES3-CTS.shaders.struct.uniform.sampler_nested_vertex...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-22 18:46 UTC by Anuj Phogat
Modified: 2015-05-04 09:38 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Anuj Phogat 2014-05-22 18:46:56 UTC
Tested with mesa master (46737ce) on IVB. I haven't tested but looks like issue can also be reproduced on HSW and BDW. 

Test log:
glcts: brw_reg.h:240: brw_reg brw_reg(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int): Assertion `nr < 128' failed.

Stack trace:
#3  0x0000003b90a2ea02 in __GI___assert_fail (assertion=0x7ffff7495ea6 "nr < 128", file=0x7ffff7495e9c "brw_reg.h", line=240, function=0x7ffff7496700 <_ZZ7brw_regE19__PRETTY_FUNCTION__> "brw_reg brw_reg(unsigned int, unsigned int, unsigne
d int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)") at assert.c:101
#4  0x00007ffff7391358 in brw_reg (file=1, nr=16384, subnr=4, type=4, vstride=3, width=2, hstride=1, swizzle=228, writemask=15) at brw_reg.h:240
#5  0x00007ffff739157c in brw_vec4_reg (file=1, nr=16384, subnr=4) at brw_reg.h:313
#6  0x00007ffff739175c in brw_vec4_grf (nr=16384, subnr=4) at brw_reg.h:574
#7  0x00007ffff7391e37 in brw::vec4_instruction::get_src (this=0x18db9a0, prog_data=0x7fffffffd1f0, i=0) at brw_vec4_generator.cpp:107
#8  0x00007ffff7394ed5 in brw::vec4_generator::generate_code (this=0x7fffffffc2d0, instructions=0x7fffffffc3b0) at brw_vec4_generator.cpp:1308
#9  0x00007ffff73951e6 in brw::vec4_generator::generate_assembly (this=0x7fffffffc2d0, instructions=0x7fffffffc3b0, assembly_size=0x7fffffffd394) at brw_vec4_generator.cpp:1365
#10 0x00007ffff738ff6e in brw_vs_emit (brw=0x7ffff6d11040, prog=0x18e60f0, c=0x7fffffffd2e0, prog_data=0x7fffffffd1f0, mem_ctx=0x1c54200, final_assembly_size=0x7fffffffd394) at brw_vec4.cpp:1850
#11 0x00007ffff73c1d6c in do_vs_prog (brw=0x7ffff6d11040, prog=0x18e60f0, vp=0x1c45860, key=0x7fffffffd3f0) at brw_vs.c:293
#12 0x00007ffff73c2a0a in brw_vs_precompile (ctx=0x7ffff6d11040, prog=0x18e60f0) at brw_vs.c:542
#13 0x00007ffff7382ee4 in brw_shader_precompile (ctx=0x7ffff6d11040, prog=0x18e60f0) at brw_shader.cpp:78
#14 0x00007ffff73836f8 in brw_link_shader (ctx=0x7ffff6d11040, shProg=0x18e60f0) at brw_shader.cpp:274
#15 0x00007ffff71f1d5a in _mesa_glsl_link_shader (ctx=0x7ffff6d11040, prog=0x18e60f0) at program/ir_to_mesa.cpp:3092
Comment 1 Neil Roberts 2014-08-13 18:24:19 UTC
I had a quick look at this with GDB but I don't yet know the code well enough to diagnose it properly. The shader is creating a uniform with a nested struct. It looks like the problem is caused in vec4_visitor::pack_uniform_registers. It allocates some variable-length arrays to store a new location for some uniforms and the size of the arrays is this->uniforms, which in this case is 3. The arrays are indexed with src.reg from the instruction but in this case the src.reg value for one of the instructions is 3 so it reads and writes off the end of the arrays.

One of the members of the nested struct is a sampler2D. I think this causes this->uniforms to have the wrong value. this->uniforms is calculated in vec4_visitor::setup_uniform_values. However it doesn't increment for the sampler variable because the vector_count is zero as a result of storage->type->matrix_columns also being zero.
Comment 2 Tapani Pälli 2015-05-04 09:38:13 UTC
this has been fixed
Comment 3 Tapani Pälli 2015-05-04 09:38:37 UTC
Note, I tested on IVB and SKL.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.