Bug 95410

Summary: SPIR-V: Passing textures into functions doesn't work
Product: Mesa Reporter: Lionel Landwerlin <lionel.g.landwerlin>
Component: Drivers/Vulkan/intelAssignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Vertex shader
Fragment shader

Description Lionel Landwerlin 2016-05-15 17:52:59 UTC
Attached are vertex and fragment shaders I'm trying to use to render a simple textured cube.
I might be doing something wrong in the shader generation, but that's not really obvious to me.

Using Mesa master :

commit 9323d084ac5a5f59936097b6f5bf9db41c1a89bd
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Sun May 15 01:26:37 2016 -0400

    nvc0: don't try to go through the push path for indirect draws
    
    This fixes
    
    dEQP-GLES31.functional.draw_indirect.draw_elements_indirect.*.default_attribute
    
    These tests were causing a const vbo to be set up, and were small enough
    draws that the logic was trying to go via the push path (which emits
    data directly into the cmd stream rather than uploading a user vbo).
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: mesa-stable@lists.freedesktop.org
    Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>


Here is a backtrace that I get :

Program received signal SIGSEGV, Segmentation fault.
0x00007fffefa96c9a in nir_deref_var_create (mem_ctx=0x957dd8, var=0x0) at nir/nir.c:580
580	   deref->deref.type = var->type;
(gdb) bt
#0  0x00007fffefa96c9a in nir_deref_var_create (mem_ctx=0x957dd8, var=0x0) at nir/nir.c:580
#1  0x00007fffefa99f27 in clone_deref_var (state=0x7fffffffbc40, dvar=0x945398, ninstr=0x957dd8) at nir/nir_clone.c:253
#2  0x00007fffefa9a735 in clone_tex (state=0x7fffffffbc40, tex=0x955f28) at nir/nir_clone.c:406
#3  0x00007fffefa9aa8e in clone_instr (state=0x7fffffffbc40, instr=0x955f28) at nir/nir_clone.c:496
#4  0x00007fffefa9ab5e in clone_block (state=0x7fffffffbc40, cf_list=0x92d2c0, blk=0x92d078) at nir/nir_clone.c:535
#5  0x00007fffefa9ad0f in clone_cf_list (state=0x7fffffffbc40, dst=0x92d2c0, list=0x930190) at nir/nir_clone.c:582
#6  0x00007fffefa9ae9f in clone_function_impl (state=0x7fffffffbc40, fi=0x930168) at nir/nir_clone.c:615
#7  0x00007fffefa9afc1 in nir_function_impl_clone (fi=0x930168) at nir/nir_clone.c:648
#8  0x00007fffefab2748 in inline_functions_block (block=0x952f48, b=0x7fffffffbd50, inlined=0x943798) at nir/nir_inline_functions.c:149
#9  0x00007fffefab2b05 in inline_function_impl (impl=0x952e78, inlined=0x943798) at nir/nir_inline_functions.c:232
#10 0x00007fffefab2734 in inline_functions_block (block=0x92ef78, b=0x7fffffffbe70, inlined=0x943798) at nir/nir_inline_functions.c:147
#11 0x00007fffefab2b05 in inline_function_impl (impl=0x92eea8, inlined=0x943798) at nir/nir_inline_functions.c:232
#12 0x00007fffefab2bde in nir_inline_functions (shader=0x923748) at nir/nir_inline_functions.c:257
#13 0x00007fffef6d56a5 in anv_shader_compile_to_nir (device=0x7cf0d0, module=0x951870, entrypoint_name=0x7ffff5d3e887 "main", stage=MESA_SHADER_FRAGMENT, spec_info=0x0)
    at anv_pipeline.c:148
#14 0x00007fffef6d5c2e in anv_pipeline_compile (pipeline=0x932be0, module=0x951870, entrypoint=0x7ffff5d3e887 "main", stage=MESA_SHADER_FRAGMENT, spec_info=0x0, 
    prog_data=0x7fffffffc070, map=0x7fffffffcac0) at anv_pipeline.c:314
#15 0x00007fffef6d674f in anv_pipeline_compile_fs (pipeline=0x932be0, cache=0x7cf388, info=0x7fffffffd2b0, extra=0x0, module=0x951870, entrypoint=0x7ffff5d3e887 "main", 
    spec_info=0x0) at anv_pipeline.c:608
#16 0x00007fffef6d7a9e in anv_pipeline_init (pipeline=0x932be0, device=0x7cf0d0, cache=0x7cf388, pCreateInfo=0x7fffffffd2b0, extra=0x0, alloc=0x7cf0d8) at anv_pipeline.c:1156
#17 0x00007fffefb2690e in gen75_graphics_pipeline_create (_device=0x7cf0d0, cache=0x7cf388, pCreateInfo=0x7fffffffd2b0, extra=0x0, pAllocator=0x0, pPipeline=0x626780)
    at gen7_pipeline.c:203
#18 0x00007fffef6d7d85 in anv_graphics_pipeline_create (_device=0x7cf0d0, _cache=0x0, pCreateInfo=0x7fffffffd2b0, extra=0x0, pAllocator=0x0, pPipeline=0x626780)
    at anv_pipeline.c:1245
#19 0x00007fffef6d7e7e in anv_CreateGraphicsPipelines (_device=0x7cf0d0, pipelineCache=0x0, count=1, pCreateInfos=0x7fffffffd2b0, pAllocator=0x0, pPipelines=0x626780)
    at anv_pipeline.c:1269
#20 0x00007ffff1b82119 in vkCreateGraphicsPipelines (device=0x7cf0d0, pipelineCache=0x0, createInfoCount=1, pCreateInfos=0x7fffffffd2b0, pAllocator=0x0, pPipelines=0x626780)
    at /home/djdeath/src/gnome-3.14-src/VulkanTools/loader/trampoline.c:1438
#21 0x00007ffff5bf6fa6 in _cogl_pipeline_vulkan_create_pipeline (pipeline=0x8ab4d0, vk_pipeline=0x626780, framebuffer=0x8b6d30) at driver/vulkan/cogl-pipeline-vulkan.c:331
#22 0x00007ffff5bf7303 in _cogl_pipeline_flush_vulkan_state (framebuffer=0x8b6d30, pipeline=0x8ab4d0, attributes=0x8af220, n_attributes=2)
    at driver/vulkan/cogl-pipeline-vulkan.c:494
#23 0x00007ffff5bf742f in _cogl_vulkan_flush_attributes_state (framebuffer=0x8b6d30, pipeline=0x8ab4d0, layer_state=0x7fffffffd660, flags=(unknown: 0), attributes=0x8af220, 
    n_attributes=2) at driver/vulkan/cogl-pipeline-vulkan.c:533
#24 0x00007ffff5c0c033 in _cogl_flush_attributes_state (framebuffer=0x8b6d30, pipeline=0x8ab4d0, flags=(unknown: 0), attributes=0x8af220, n_attributes=2) at cogl-attribute.c:669
#25 0x00007ffff5bf0dcf in _cogl_framebuffer_vulkan_draw_indexed_attributes (framebuffer=0x8b6d30, pipeline=0x8ab4d0, mode=COGL_VERTICES_MODE_TRIANGLES, first_vertex=0, 
    n_vertices=36, indices=0x8bb4c0, attributes=0x8af220, n_attributes=2, flags=(unknown: 0)) at driver/vulkan/cogl-framebuffer-vulkan.c:379
#26 0x00007ffff5c4440c in _cogl_framebuffer_draw_indexed_attributes (framebuffer=0x8b6d30, pipeline=0x8ab4d0, mode=COGL_VERTICES_MODE_TRIANGLES, first_vertex=0, n_vertices=36, 
    indices=0x8bb4c0, attributes=0x8af220, n_attributes=2, flags=(unknown: 0)) at cogl-framebuffer.c:2318
#27 0x00007ffff5c0d4b6 in _cogl_primitive_draw (primitive=0x8af1b0, framebuffer=0x8b6d30, pipeline=0x8ab4d0, flags=(unknown: 0)) at cogl-primitive.c:619
#28 0x00007ffff5c0d52f in cogl_primitive_draw (primitive=0x8af1b0, framebuffer=0x8b6d30, pipeline=0x8ab4d0) at cogl-primitive.c:644
#29 0x0000000000401b6d in paint (data=0x7fffffffd8b0) at cogl-crate.c:118
#30 0x00000000004020ae in main (argc=1, argv=0x7fffffffdae8) at cogl-crate.c:284
Comment 1 Lionel Landwerlin 2016-05-15 17:53:28 UTC
Created attachment 123760 [details]
Vertex shader
Comment 2 Lionel Landwerlin 2016-05-15 17:53:45 UTC
Created attachment 123761 [details]
Fragment shader
Comment 3 Lionel Landwerlin 2016-05-17 00:09:37 UTC
Link to the discussion Jason had on glslang : https://github.com/KhronosGroup/glslang/issues/179
Feel free to close if appropriate.
Comment 4 Jason Ekstrand 2016-05-24 19:07:33 UTC

*** This bug has been marked as a duplicate of bug 94831 ***
Comment 5 Jason Ekstrand 2016-05-24 19:08:38 UTC
Sorry.  Not a duplicate.
Comment 6 Jason Ekstrand 2016-05-28 00:03:56 UTC
This should be fixed with the latest glslang and the latest driver.
Comment 7 Lionel Landwerlin 2016-05-31 10:23:13 UTC
Indeed, thanks a lot!

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.