The Wayback Machine - https://web.archive.org/web/20190530234721/https://github.com/gfx-rs/gfx/issues/2643
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

dx12: Stricter shader visibility flags #2643

Open
msiglreith opened this issue Feb 24, 2019 · 5 comments

Comments

@msiglreith
Copy link
Member

commented Feb 24, 2019

e.g https://github.com/gfx-rs/gfx/blob/master/src/backend/dx12/src/device.rs#L1333

dx12 supports resource shader visibility for one particular shader or for all. We currently just set it always to ALL, which may have some performance impacts.

@termhn

This comment has been minimized.

Copy link
Contributor

commented Feb 24, 2019

And also is somewhat misleading in that for someone primarily developing on dx12 and does not properly set shader stage flags, their code won't run properly on vulkan/metal. Vulkan panics and gives proper validation error, metal seemingly doesn't complain but will give wrong output.

@msiglreith

This comment has been minimized.

Copy link
Member Author

commented Feb 24, 2019

Fair enough but handling all sort of invalid usage is not really in scope of the library. This means specifying for example VERTEX | FRAGMENT as shader visibility flags and using the descriptor in a geometry shader will still work fine for dx12 after addressing the issue.

@termhn

This comment has been minimized.

Copy link
Contributor

commented Feb 24, 2019

Of course, just thought it was funny to see this issue posted when I'd helped someone debug this issue literally last night ;p

@msiglreith

This comment has been minimized.

Copy link
Member Author

commented Feb 24, 2019

yeah, I skimmed over the discussion 👀

@msiglreith

This comment has been minimized.

Copy link
Member Author

commented Apr 2, 2019

Guideline:

  1. Identify all occurences of ShaderVisibility::All in the code (e.g https://github.com/gfx-rs/gfx/blob/master/src/backend/dx12/src/device.rs#L1326)
  2. Write a mapping function from Vulkan's shader stage flags (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkShaderStageFlagBits.html) to D3D12s visbility flags (https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ne-d3d12-d3d12_shader_visibility)
  3. Apply mapping to all occurences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.