d3dcoder / d3d12book

Sample code for the book "Introduction to 3D Game Programming with DirectX 12"
1.47k stars 571 forks source link

Chapter 13 SobelFilter: debug layer warnings and errors #10

Open llyzs opened 7 years ago

llyzs commented 7 years ago

The two errors seem to be newly introduced after anniversary update.

D3D12 WARNING: ID3D12CommandList::ClearRenderTargetView: The application did not pass any clear value to resource creation. The clear operation is typically slower as a result; but will still clear to the desired value. [ EXECUTION WARNING #820: CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE]

D3D12 ERROR: ID3D12CommandList::DrawInstanced: Root Parameter Index [2] is not set. On a Resource Binding Tier 2 hardware, all descriptor tables of type CBV and UAV declared in the currently set Root Signature (0x000002400B54D410:'Unnamed ID3D12RootSignature Object') must be populated, even if the shaders do not need the descriptor. [ EXECUTION ERROR #991: COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET]

D3D12 ERROR: ID3D12CommandQueue::ExecuteCommandLists: Using ResourceBarrier on Command List (0x000002400AC783F0:'Unnamed ID3D12GraphicsCommandList Object'): Before state (0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS) of resource (0x000002400AC9EAB0:'Unnamed ID3D12Resource Object') (subresource: 0) specified by transition barrier does not match with the state (0xAC3: D3D12_RESOURCE_STATE_GENERIC_READ) specified in the previous call to ResourceBarrier [ RESOURCE_MANIPULATION ERROR #527: RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH]

llyzs commented 7 years ago

Same type of errors also found in "WavesCS".

omd24 commented 3 years ago

These warnings can be suppressed by dummy values. For example, in Sobel Filter sample you can use a D3D12_VERTEX_BUFFER_VIEW just to suppress EXECUTION WARNING #202: COMMAND_LIST_DRAW_VERTEX_BUFFER_NOT_SET when setting vertex buffer with cmdlist->IASetVertexBuffers(0, 1, &vbv); Of course, you are not going to use that dummy vbv because the vertices are built using SV_VertexID in shader code.

Similarly to suppress warning EXECUTION WARNING #820 use a D3D12_CLEAR_VALUE when creating the committed resource (offscreen render target).

As for RESOURCE BARRIER mismatch error messages, tracking the resource states throughout the code should solve the issue. I noticed this problem a few times in book's code samples but it's not really difficult to find.