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

Exception on slSetTag(), when cloning resource when 'D3D12_RESOURCE_DESC::Alignment == 4096' and 'D3D12_RESOURCE_DESC::Format == DXGI_FORMAT_R16G16_FLOAT' #27

Open
QDanteQ opened this issue Dec 18, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@QDanteQ
Copy link

QDanteQ commented Dec 18, 2023

Hello, I got exception on slSetTag(). After looking into source code, I see that it happens in ResourcePool::allocate(), when you call m_compute->getResourceState(res->state, initialState);
https://github.com/NVIDIAGameWorks/Streamline/blob/7ac42e47c7dd55b5b6dd6176c0228048636541b2/source/platforms/sl.chi/generic.cpp#L172C21-L172C21
The possible problem is that you don't test the return value of m_compute->cloneResource(source, res, debugName, initialState); which might not initialize sl::chi::Resource res variable, which is pointer to sl::Resource, therefore in res->state you access with nullptr.
Also I enabled d3d12 debug layer validation to investigate why m_compute->cloneResource(source, res, debugName, initialState); don't initialize res and got this d3d12 error

D3D12 ERROR: ID3D12Device::CreateCommittedResource: D3D12_RESOURCE_DESC::Alignment is invalid. The value is 4096. Resources with D3D12_RESOURCE_DESC::Flags with either D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET or D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL must set Alignment equal to 65536 (aka. D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT), or 0. [ STATE_CREATION ERROR #721: CREATERESOURCE_INVALIDALIGNMENT]
D3D12: BREAK enabled for the previous message, which was: [ ERROR STATE_CREATION #721: CREATERESOURCE_INVALIDALIGNMENT ]

Looks like you add D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET flag, without changing D3D12_RESOURCE_DESC::Alignment. I guess you did not expected the alignment to be 4096.

https://github.com/NVIDIAGameWorks/Streamline/blob/7ac42e47c7dd55b5b6dd6176c0228048636541b2/source/platforms/sl.chi/d3d12.cpp#L2159C39-L2159C39

Thanks for your work and hope these issues will be fixed soon.

@jake-nv jake-nv added the bug Something isn't working label Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants