Comments (4)
Can you please provide a test case (in a fork of this repo) that reproduces the issue?
from learningdirectx12.
Yes ofcourse! this I my fork: https://github.com/FireFlyForLife/LearningDirectX12
I modified the Tutorial project, in Tutorial3.h I added the DebugRenderer object:
https://github.com/FireFlyForLife/LearningDirectX12/blob/master/Tutorial3/inc/Tutorial3.h#L94
And in Tutorial3.cpp I added the Initialize call and add some example lines:
https://github.com/FireFlyForLife/LearningDirectX12/blob/master/Tutorial3/src/Tutorial3.cpp#L121-L123
And finally try to render the debug overlay in the onRender() function:
https://github.com/FireFlyForLife/LearningDirectX12/blob/master/Tutorial3/src/Tutorial3.cpp#L585
Thank you for your time!
~Maiko
from learningdirectx12.
After a while debugging I found the issue.
At CommandList::CopyVertexBuffer(...)
and then CommandList::CopyBuffer(...)
the global state of the vertex buffer resource was set to D3D12_RESOURCE_STATE_COMMON
while it was in the state D3D12_RESOURCE_STATE_COPY_DEST
. at the end of the method I added a this line: ResourceStateTracker::AddGlobalResourceState(d3d12Resource.Get(), D3D12_RESOURCE_STATE_COPY_DEST);
Then, the difference between Tutorial 3 and my debug renderer is that you load the mesh vertex buffers in LoadContent()
where you execute the command list. However I load the vertex buffer and try to draw it in the same list. This is a problem because ID3D12GraphicsCommandList2::Draw(...)
will already check if the vertex buffer resource is in the correct state, however, because the VertexBuffer resource was already used to copy stuff to, the state is already known which means that now the resource barrier is placed in m_PendingResourceBarriers
and the pending resource barriers will only be flushes when the CommandlList::Close()
is called (when the command queue is executed). So what I had to do was create a new method CommandList::ForceFlushPendingResourceBarriers()
to make sure that the resource barriers were correctly pushed to the command list, since Draw() only calls FlushResourceBarriers()
which only looks at the m_ResourceBarriers
which the new barriers were not placed on.
I have pushed my solution to my fork in this commit: FireFlyForLife@2047c20
from learningdirectx12.
I've fixed this by explicitly transitioning the ID3D12Resource to D3D12_RESOURCE_STATE_COPY_DEST before updating the subresource of the buffer.
The resource was not being transitioned explicitly to the COPY_DEST state because I was relying on "Common state promotion" as described in this article: Using Resource Barriers to Synchronize Resource States in Direct3D 12.
The fix has been pushed in 0669f4a.
from learningdirectx12.
Related Issues (18)
- Cleanup: missing ByteAddressBuffer::m_BufferSize initialization value... HOT 1
- Error on line 77 of ThreadSafeQueue.h HOT 1
- GetTypelessFormat is missing... HOT 1
- Read Access Violation in Window::RegisterCallbacks() HOT 3
- Indicies is misspelled should be Indices HOT 2
- The GenerateProjectFiles.bat crash with VS2022 HOT 4
- RootSignature::SetRootSignatureDesc HOT 1
- Bugs on initialization sequence of Application::Run()
- Unhandled Exception on CreateCommittedResource. HOT 1
- Crash after minimizing the window HOT 1
- Minimal example to reproduce "D3D12_RESOURCE_STATES has bits that mismatch support required from D3D12_RESOURCE_FLAGS" Error HOT 1
- WARP HOT 1
- Texture loading bug with specific .png images HOT 1
- Structured buffer CreateViews doesn't check resource desc for validation HOT 1
- CommandList add wrapper functions for setting inline SRV's and UAV's HOT 2
- Iterator of m_AvailableHeaps after erase issue HOT 1
- Missing flushBarriers argument on AliasingBarrier and UAVBarrier HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learningdirectx12.