- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022
06:54 AM
Another D3D Compiler Bug
I found that AMD Radeon RX 6400 mis-optimizes another HLSL pixel shader program. The expected output is a white screen, but the wrong optimization causes the output color to be black. After manual debugging the compiled binary executable, I found that the compiler incorrectly optimizes the statement "c = 0.09 - h * h" to be "c = 0.09 - h". The runtime value of c is 0.1, so the correct computation should be "c = 0.09 - 0.1 * 0.1 = 0.08", but after the wrong optimization, the statement execution becomes "c = 0.09 - 0.1 = -0.01".
The code and the explanation of the code can be found in:
https://www.dropbox.com/s/wg0i92wcreek1pa/square_bug_chrome.frag?dl=0 (for reproducing the bug in the browser)
https://www.dropbox.com/s/i3y2dtg9s9398u6/square_bug_desktop.hlsl?dl=0 (for reproducing the bug on the desktop)
Configurations:
The configurations are the same as https://community.amd.com/t5/opengl-vulkan/compiler-bug-on-a-d3d-pixel-shader-program/m-p/539369#M42... , except that the driver version of AMD Radeon RX 6400 is updated to the latest one (22.7.1.220725).
Reproduce the bug in the browser:
Prerequisite: Windows 10 system, Chrome, AMD Radeon 6400
The Chrome on Windows system by default uses Direct3D 11 as the backend to execute the OpenGL ES shader programs.
Steps:
Open Chrome on Windows 10, then go to the website https://www.shadertoy.com/new
Copy&paste the content of the file in https://www.dropbox.com/s/wg0i92wcreek1pa/square_bug_chrome.frag?dl=0 into the text-input box.
Click the "Compile" button to compile the shader program. Then click "Pause" button to stop the variable iTime from changing. Next, click "Reset time" button to set the variable iTime to 0.
The correct output should be white. However, you would see the output as black due to the incorrect compilation.
Reproduce the bug on the desktop:
Follow the same steps in the "Steps to reproduce the bug" section of https://community.amd.com/t5/opengl-vulkan/compiler-bug-on-a-d3d-pixel-shader-program/m-p/539369#M42... to reproduce the bug, except that after step 1, replace the content of the file ./HLSL/pixel.hlsl with the content of https://www.dropbox.com/s/i3y2dtg9s9398u6/square_bug_desktop.hlsl?dl=0
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022
12:32 AM
Thank you for reporting it. I have reported the issue to the DirectX team.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022
01:17 AM
Update:
The DirectX team was able to reproduce the issue. A ticket has been created to track this compiler bug.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2023
07:36 AM
Hi @Saniajuneor ,
The DX team investigated this issue and it appeared to be a similar MS runtime bug as reported here: Compiler Bug on a D3D Pixel Shader Program. They submitted a bug report to MS, however the related MS support team has informed us that they will not fix this bug.
Thanks.
