Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

Journeyman III

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:     (for reproducing the bug on the desktop)

The configurations are the same as , except that the driver version of AMD Radeon RX 6400 is updated to the latest one (

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.

Open Chrome on Windows 10, then go to the website  
Copy&paste the content of the file in 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 to reproduce the bug, except that after step 1, replace the content of the file ./HLSL/pixel.hlsl with the content of
3 Replies
Big Boss

Thank you for reporting it. I have reported the issue to the DirectX team.

Big Boss


The DirectX team was able to reproduce the issue. A ticket has been created to track this compiler bug. 


Big Boss

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 ProgramThey submitted a bug report to MS, however the related MS support team has informed us that they will not fix this bug.