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

Additional Flags to NRI init to disable features #30

Closed
pollend opened this issue Jan 28, 2024 · 13 comments
Closed

Additional Flags to NRI init to disable features #30

pollend opened this issue Jan 28, 2024 · 13 comments

Comments

@pollend
Copy link
Contributor

pollend commented Jan 28, 2024

for my use case when I create the nri device would it be possible to extend NriDeviceCreationDesc with flags to enable extensions. would be preferable if the init code assumed the minimum set of extensions?

@dzhdanNV
Copy link
Collaborator

I'm happy to help. But, please, explain a bit more your request. Something like:

  • currently we have "this"
  • but I would like to get something like "that", because...
  • to achieve this I need to extend NriDeviceCreationDesc (or more) and expose ...

@Nielsbishere
Copy link

@dzhdanNV I'd like to expand on what he might mean, because we're having a similar issue. Currently when we create NRI, it will assume all features are used. This basically results in querying all DirectX12 features, which fails when older windows versions are used (Windows 10 for example). It seems like all currently existing d3d12_feature_data_d3d12_options have to be present and options8 and up are Windows 11 only it seems. This means that dependencies such as NRD would get this requirement too if updated and that's not very desired, as that'd restrict usage for products as lots of customers still use Windows 10 (even I haven't switched yet, only on my other PC).

@vertver
Copy link
Contributor

vertver commented Jan 31, 2024

It seems like all currently existing d3d12_feature_data_d3d12_options have to be present and options8 and up are Windows 11 only it seems.

I have already fixed this in my PR. It looks like you don't have the Agility SDK installed, so it just doesn't know about the new D3D12 feature options.

@vertver
Copy link
Contributor

vertver commented Jan 31, 2024

Fixed in #33

@pollend
Copy link
Contributor Author

pollend commented Jan 31, 2024

I just wanted a way to disable raytracing, mesh shaders, and a couple other extensions. The default API checks what is available for the GPU and enables all of these? At the moment I'm just using the other API where it takes in a custom device. nriCreateDeviceFromVkDevice. umm, I guess if you need more control this is better but I would just like to init nri without having to opt into all these extensions since I'm porting this into an older game where none of these extensions are relevant.

@vertver
Copy link
Contributor

vertver commented Jan 31, 2024

The default API checks what is available for the GPU and enables all of these?

What do you mean by "enables"? If you are talking about extensions on Vulkan, an extension is only enabled if it is available on your GPU. In D3D12 there is thing called "feature data" which does not affect the feature set of the device, all features are enabled by default if your GPU supports them. In Vulkan, however, you need to add an extension string to enable them when you create a device.

@dzhdanNV
Copy link
Collaborator

Fixed in #33

To avoid mixing apples and oranges I will comment on D3D12 topic in the PR.

@pollend A few questions about your problem - is it a:

  • compilation problem?
  • "I can't run" problem?

Fancy VK exts get enabled only if available, but for compilation, yes, you need to have most recent VK SDK.

@dzhdanNV
Copy link
Collaborator

@pollend another question - are you "creating" device or "wrapping" it via nriCreateDeviceFromVkDevice? Please, clarify the symptoms of the outcome (can't compile, can't run, validation error, crash...).

@pollend
Copy link
Contributor Author

pollend commented Jan 31, 2024

I ended up using nriCreateDeviceFromVkDevice to just enable vulkan with the minimum set of extensions I would need. not sure if its worth having flags to disable extensions.

in DeviceVK under CreateLogicalDevice; if the extension is supported then its added CreateDevice. If I'm never using VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME would it make sense to have flags to opt out raytracing if I'm not currenting using the feature under DeviceVK? does it even matter if I would want to opt out of extensions?

@dzhdanNV
Copy link
Collaborator

In DeviceVK under CreateLogicalDevice; if the extension is supported then its added CreateDevice. If I'm never using VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME would it make sense to have flags to opt out raytracing if I'm not currenting using the feature under DeviceVK?

I believe this is free. VK is super strict, but I just don't see any overhead on the driver side if RT is enabled but never used. Let me ask ;)

@pollend
Copy link
Contributor Author

pollend commented Jan 31, 2024

I don't really have an immediate problem with this at the moment. I guess its better not to clutter the API.

@pollend pollend closed this as completed Jan 31, 2024
@dzhdanNV
Copy link
Collaborator

@pollend The next release will get DeviceCreationDesc::vkDisableRayTracing, as it turned out:

Testing bench:
App creates 3 windows:
2 - on RTX 4080
1 - on Intel UHD graphics
Rendering is very simple: clear + UI rendering
A breakpoint is set at the very beginning of the 1st frame

Below is memory usage of the entire process if all windows use same GAPI:
D3D11                - 34 Mb
D3D11 (+debug layer) - 34 Mb
D3D12                - 66 Mb
D3D12 (+debug layer) - 81 Mb
VK                   - 159 Mb
VK (+validation)     - 203 Mb

If RT extensions are disabled in VK, the memory usage matches D3D12, i.e. 66 Mb. So, it's worth pursuing. Thanks for bringing it up!

@Nielsbishere
Copy link

@vertver good stuff

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

No branches or pull requests

4 participants