Bug 102941 - shader storage buffer failed to write when buffer variables > 1
Summary: shader storage buffer failed to write when buffer variables > 1
Status: RESOLVED WONTFIX
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 17.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-22 08:43 UTC by Jiajia Qin
Modified: 2018-01-11 07:25 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Test shader storage buffer write (3.13 KB, patch)
2017-09-26 11:02 UTC, Jiajia Qin
Details | Splinter Review

Description Jiajia Qin 2017-09-22 08:43:32 UTC
If we have a compute shader like below:
    const std::string &csSource =
        "#version 450\n"
        "layout(local_size_x=1, local_size_y=1, local_size_z=1) in;\n"
        "layout(shared, binding = 1) buffer blockName {\n"
        "    uint data[2];\n"
        "} instanceName;\n"
        "void main()\n"
        "{\n"
        "    instanceName.data[0] = 3u;\n"
        "    instanceName.data[1] = 4u;\n"
        "}\n";

When we check the buffer data in api side, data[0] is 3u as expected, but data[1] is always 0u.

The error is found in ANGLE angle_end2end_tests. See https://chromium-review.googlesource.com/c/angle/angle/+/618132/14/src/tests/gl_tests/ShaderStorageBufferTest.cpp#86

Note: The NVDIA driver works well for it. And Intel Win10 OpenGL driver also works well.
Comment 1 Tapani Pälli 2017-09-26 10:00:31 UTC
The shader is a bit different in referred angle tests (has additional control flow), do you mean tte shader in description fails as well? Is there some standalone test for this? If not, how to run angle tests?
Comment 2 Jiajia Qin 2017-09-26 10:34:02 UTC
>do you mean tte shader in description fails as well?
Yes, it fails in this shader too. I tested it based on native deqp environment and added a simple test for this bug. It has the same failure with angle end2end test. So I report bug here. Let me clean up my deqp case and I will upload the patch soon.

If you want to reproduce this bug in ANGLE, please follow the below steps:
1. Follow https://github.com/google/angle/blob/master/doc/DevSetup.md to build angle on linux. When everything is ready, you can build target angle_end2end_tests #ninja -C out/Release angle_end2end_tests

2. Run #out/Release/angle_end2end_tests --gtest_filter=ShaderStorageBuffer*

Then, you will see the failure.
Comment 3 Jiajia Qin 2017-09-26 11:02:53 UTC
Created attachment 134490 [details] [review]
Test shader storage buffer write
Comment 4 Jiajia Qin 2017-09-26 11:08:59 UTC
Hi Tapani, I have uploaded the deqp patch that I used.

1. put the attachment file 0001-Test-shader-storage-buffer.patch to deqp.
2. git am 0001-Test-shader-storage-buffer.patch
3. in deqp/build-glx, run $ninja -j32
4. cd deqp/build-glx/modules/gles31
5. Run './deqp-gles31 -n dEQP-GLES31.functional.atomic_counter.get.1_counter_1_call_1_thread'

Then you will see the result like below:
Test case 'dEQP-GLES31.functional.atomic_counter.get.1_counter_1_call_1_thread'..
--------------end: data[0] = 3, data[1] = 0

=============================================
Compute shader compile time = 0.247000 ms
Link time = 0.398000 ms
Test case duration in microseconds = 7932 us
  Pass (Pass)

DONE!

Test run totals:
  Passed:        1/1 (100.0%)
  Failed:        0/1 (0.0%)
  Not supported: 0/1 (0.0%)
  Warnings:      0/1 (0.0%)

However, we expect data[1] = 4 not 0
Comment 5 Jiajia Qin 2017-09-30 01:26:11 UTC
Hi Tapani, is there any update on this? Can you reproduce this issue now?
Comment 6 Jiajia Qin 2017-10-24 01:07:31 UTC
Hi, is anyone looking at this bug? There is no update for a long time.
Comment 7 Jiajia Qin 2018-01-11 07:25:57 UTC
Find that it's test case issue. We should use ARRAY_STRIDE to query the stride between array elements in a buffer variable since the size may be different between 'uint' and 'unsigned int'.


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.