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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible fix/improvement for d3d12 demo #569

Open
saidwho12 opened this issue Jul 31, 2023 · 0 comments
Open

Possible fix/improvement for d3d12 demo #569

saidwho12 opened this issue Jul 31, 2023 · 0 comments

Comments

@saidwho12
Copy link

I was trying to use the d3d12 demo but I had to adapt the code to work for C++ as our project is C++ (unfortunately 馃拃). I rewrote the file nuklear_d3d12.h to use the C++ version of D3D without changing any of the logic. I was getting an access violation here when trying to read d3d12.upload_buffer. I was trying to investigate and I found that both d3d12.upload_buffer and d3d12.font_upload_buffer were NULL however the other buffers were being initialized correctly.

After some digging I found this:

image

I then changed the parameter passed in to ID3D12Device_CreateCommittedResource from D3D12_RESOURCE_STATE_COPY_SOURCE to D3D12_RESOURCE_STATE_GENERIC_READ which seemed to solve the issue completely for me. Is this an issue with the original demo implementation or because I have adapted the code to use the C++? The lines that were causing an issue are this line:

    hr = device->CreateCommittedResource(&d3d12.heap_prop_upload, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, IID_ID3D12Resource, (void **)&d3d12.upload_buffer);
    NK_ASSERT(SUCCEEDED(hr));

and this one:

    hr = d3d12.device->CreateCommittedResource(&d3d12.heap_prop_upload, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, IID_ID3D12Resource, (void **)&d3d12.font_upload_buffer);
    NK_ASSERT(SUCCEEDED(hr));

I'm on Windows 10 my GPU is a GTX 1070 Ti.
image

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

1 participant