Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute shaders unable to write to UNIFORM_TYPE_IMAGE (uniform image2D) in D3D12 #102192

Open
Bonkahe opened this issue Jan 30, 2025 · 10 comments
Open

Comments

@Bonkahe
Copy link
Contributor

Bonkahe commented Jan 30, 2025

Tested versions

Reproducible in 4.4beta1 and 4.3stable.
Tried to do it in 4.2 and the option for d3d12 doesn't exist, I presume that's when directx support was added in the first place.
Which implies that this maybe has never worked correctly?

System information

Godot v4.4.beta1.mono - Windows 10 (build 19045) - Single-window, 2 monitors - Direct3D 12 (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6636) - AMD Ryzen 5 5600X 6-Core Processor (12 threads)

Issue description

When running any compute shader in the D3D12 driver all writing to Image2D seemingly is either not executed, or not retrieval-able from cpu entirely.

This is both in personal projects as well as example projects like the Compute Shader Heightmap Demo

Steps to reproduce

  1. Download Heightmap Demo: https://github.com/godotengine/godot-demo-projects/tree/4.2-31d1c0c/misc/compute_shader_heightmap
  2. Open in any version of Godot that has D3D12 support
  3. Set Renderer to Forward+ then restart.
  4. Set Driver (Project/General/Rendering/RenderingDevice/Driver.Windows) to d3d12 then restart.
  5. Run build in editor and press Create (GPU)

Expected Result (and the result you get on vulkan):
Image

Actual Result:
Image

Minimal reproduction project (MRP)

You can download the heightmap demo from the asset store or directly from here: https://github.com/godotengine/godot-demo-projects/tree/4.2-31d1c0c/misc/compute_shader_heightmap

A note, the recorded time elapsed being so similar in both examples might be a result of a significant amount of the time being in syncing/retrieving the image data for viewing in the player on the main rendering thread, and may not be indicative of the compute shader executing correctly. In short I do not know if the compute shader is even being executed.

Also there are no errors resulting from this, or my personal project attempts at using d3d12 with compute shaders, they just don't output any data.

Please note, non-image related compute shaders are functioning, like with my draw indirect PR example project here: #99455 which I tested and it ran fine, no errors and grass was placed correctly in the frustum. So this issue seems to be entirely related to Image2D uniforms.

@Chaosus
Copy link
Member

Chaosus commented Jan 31, 2025

Cannot confirm, probably a driver related issue:

Image

@ydeltastar
Copy link
Contributor

Don't work on my RTX 3070 too (NVIDIA; 32.0.15.7216).

@Bonkahe
Copy link
Contributor Author

Bonkahe commented Jan 31, 2025

Updated my drivers no such luck, I'm on 572.16 (I did need an update but updating did not fix it), there's no standalone versions of directx12 anymore so I can't reinstall that, maybe it's just because I've been holding out on windows 10.
Unless someone can replicate this we should probably close the issue, as it does seem to be just a me thing, and probably will be fixed when I get a new rig (this one has a lot of problems and is getting rather old).

@Chaosus
Copy link
Member

Chaosus commented Jan 31, 2025

No need to close it, it may be a target of specific fix, though.

@ydeltastar
Copy link
Contributor

ydeltastar commented Jan 31, 2025

Unless someone can replicate this we should probably close the issue, as it does seem to be just a me thing,

I have the same issue. It returns a texture with all pixels black in D3D12 and I use the same GPU as you.

@Bonkahe
Copy link
Contributor Author

Bonkahe commented Jan 31, 2025

Unless someone can replicate this we should probably close the issue, as it does seem to be just a me thing,

I have the same issue. It returns a texture with all pixels black in D3D12 and I use the same GPU as you.

I am so sorry I miss-read your original post terribly!
ty for testing, maybe this is a 30 series nvidia issue? (Chaosus is 40 series)

@matheusmdx
Copy link
Contributor

I can reproduce this issue in 4.4 beta 2 with an AMD GPU

Image

Godot v4.4.beta2 - Windows 10 (build 19045) - Multi-window, 2 monitors - Direct3D 12 (Forward+) - dedicated AMD Radeon RX 580 2048SP (Advanced Micro Devices, Inc.; 31.0.21921.1000) - AMD Ryzen 5 3600 6-Core Processor (12 threads)

@Bonkahe
Copy link
Contributor Author

Bonkahe commented Feb 2, 2025

Unless someone can replicate this we should probably close the issue, as it does seem to be just a me thing,

I have the same issue. It returns a texture with all pixels black in D3D12 and I use the same GPU as you.

out of curiosity, what cpu do you have?

@ydeltastar
Copy link
Contributor

ydeltastar commented Feb 3, 2025

out of curiosity, what cpu do you have?

Godot v4.4.beta (1204d5ca2) - Windows 11 (build 22621) - Multi-window, 3 monitors - Direct3D 12 (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.7216) - AMD Ryzen 9 7950X 16-Core Processor (32 threads)

@Bonkahe
Copy link
Contributor Author

Bonkahe commented Feb 3, 2025

Ok My cpu is a AMD Ryzen 5 5600x, this may just be a coincidence but maybe it's the cpu? (grasping at straws here a little), @Chaosus if you don't mind me asking, what is the vender of your cpu?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants