Bug 104424 - DOOM 2016 broken by spirv OpStore validation
Summary: DOOM 2016 broken by spirv OpStore validation
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/Common (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Jason Ekstrand
QA Contact:
Keywords: bisected, regression
Depends on:
Reported: 2017-12-31 16:34 UTC by Grazvydas Ignotas
Modified: 2018-01-08 23:17 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:

spirv binary (33.77 KB, application/octet-stream)
2017-12-31 16:34 UTC, Grazvydas Ignotas
old doom version failing spirv binary (41.06 KB, application/octet-stream)
2018-01-04 23:32 UTC, Grazvydas Ignotas

Description Grazvydas Ignotas 2017-12-31 16:34:35 UTC
Created attachment 136462 [details]
spirv binary

After 6737b1b859aadad64e5fe04a92d196a672413e06 DOOM 2016 is no longer working, spirv_to_nir() fails with:
SPIR-V parsing FAILED:
    In file spirv/vtn_variables.c:2009
    Value and pointer types of OpStore do not match
    23800 bytes into the SPIR-V binary

The offending spirv binary attached.
Comment 1 Jason Ekstrand 2018-01-02 04:12:28 UTC
Patch on the list:

Comment 2 Grazvydas Ignotas 2018-01-03 00:39:43 UTC
Still failing, tested on the newer 3-patch series:

SPIR-V parsing FAILED:
    Source and destination types of SpvOpStore do not match: bool vs. uint
    23800 bytes into the SPIR-V binary

also triggers with spirv2nir and the binary I've attached, just change MESA_SHADER_FRAGMENT to MESA_SHADER_COMPUTE in spirv2nir.c .
Comment 3 Jason Ekstrand 2018-01-03 17:34:54 UTC
Could you please give this a try:

Comment 4 Grazvydas Ignotas 2018-01-04 00:45:15 UTC
Works now, thanks.
Comment 5 Jason Ekstrand 2018-01-04 01:37:45 UTC
Patches are now on the list:

Comment 6 Grazvydas Ignotas 2018-01-04 23:32:19 UTC
Created attachment 136559 [details]
old doom version failing spirv binary

BTW I still have the old DOOM version installed, that worked before validation was added, and it fails with suspicious looking message:
SPIR-V parsing FAILED:
    Source and destination types of SpvOpStore do not match: vectorfield_t vs. vectorfield_t
    31328 bytes into the SPIR-V binary

Binary attached, thought it might be interesting to you.
Comment 7 Jason Ekstrand 2018-01-04 23:38:55 UTC
Does your older DOOM work with the above branch?
Comment 8 Grazvydas Ignotas 2018-01-05 00:25:09 UTC
It hangs. I was testing and took the binary with that branch.
Comment 9 Jason Ekstrand 2018-01-08 23:17:23 UTC
This should be fixed by the following commit: 

commit 9e5aaa93cb242d8e401d61156809082dae86ed03
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Wed Jan 3 09:26:18 2018 -0800

    spirv: Do implicit conversions of uint to bool in OpStore
    Technically, the GLSLang bug related to this can also affect SSBO writes
    where the bool -> uint conversion is missing.  However, the only known
    shipping application with an old enough version of GLSLang to cause
    issues with this is the new DOOM game so we keep the workaround as small
    as possible.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104424
    Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

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.