DirectX 12 custom engine questions
Posted: 09 Feb 2026, 22:27
Hello again,
I've been experimenting with a custom DirectX 12 mini-engine and I've gotten most Noesis features integrated into it nicely. But I suddenly ran into problems as soon as I tried to use a drop-shadow effect on a control (Button). As soon as I mouse over the button and trigger that state (which uses the effect), I get spammed with a bunch of error/warning messages from the SDK debug layer and the whole NoesisGUI view flickers and disappears:
The last rendering function I was trying:
The engine does this and triggers the UI/Noesis rendering logic after drawing the "main scene":
Yes, I've been trying some different things and commenting things out and making a bit of mess here, lol. But I figured before I plunge into that huge 3,000+ line .cpp file D3D12RenderDevice I would ask a few questions and get some clarifications that might save me some considerable time and trouble.
Am I making any obvious mistakes in how I'm attempting to render/use things? Should I use the "render context" instead of the raw "render device" code? Or should I possibly just use the whole NoesisApp source code as-is? And any ideas on what's going wrong here and how I'm getting these invalid states and resource barrier issues? The problem only occurs when I use that drop-shadow effect, so it has to do with this and the pixel shader and how resources are handled.
I'm also curious what I would need to do to integrate with Noesis Studio and accomplish things like having my custom components/views show up ... basically, just a high-level overview of what I need to do to make a small integration for my engine similar to the ones from Unity and Unreal and how that's accomplished.
Lately, I've experimented with NoesisGUI in Unreal, Unity and native DirectX 12 and it's been quite fun and rewarding! I have some findings and suggestions/improvements for all 3 I intend to share with you guys soon, and if time allows I'll try to make some YouTube videos or something about this. This native DirectX 12 engine/app project is for experimenting with a 4x "grand strategy" style of game set during the decline/collapse of the Roman Empire and the Great Migration period. As I've been working on this, I'm simultaneously working on the 3D campaign map in Houdini, and I expect it's going to be quite a spectacle, haha. :D
Regards,
Aaron
I've been experimenting with a custom DirectX 12 mini-engine and I've gotten most Noesis features integrated into it nicely. But I suddenly ran into problems as soon as I tried to use a drop-shadow effect on a control (Button). As soon as I mouse over the button and trigger that state (which uses the effect), I get spammed with a bunch of error/warning messages from the SDK debug layer and the whole NoesisGUI view flickers and disappears:
It seems like I've got an issue where an off-screen texture resource is being used as render target and pixel shader resource at the same time and there are some split resource barriers not being handled properly. I threw all of this together pretty quickly using code from the Native SDK's NoesisApp source and putting it into a static library project alongside my actual application. What I'm not so sure about is if the problem is just the usage of this code or if it has a bug or some kind of fundamental conflict with the mini-engine (custom version of the one from DirectX 12 samples).D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Using Draw on Command List (0x0000019B538716F0:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x80: D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) of resource (0x0000019B5B7449C0:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a render target. Expected State Bits (all): 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET, Actual State: 0x80: D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, Missing State: 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET. [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B747C00:'Unnamed ID3D12Resource Object'), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B740AF0:'Unnamed ID3D12Resource Object'), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B741780:'Unnamed ID3D12Resource Object'), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B743D30:'Unnamed ID3D12Resource Object'), Subresource (1) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B748890:'Unnamed ID3D12Resource Object'), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B7430A0:'Unnamed ID3D12Resource Object'), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x0000019B5B7449C0:'Unnamed ID3D12Resource Object'), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawIndexedInstanced) on Command List (0x0000019B708DC5F0:'CommandList'). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Using Draw on Command List (0x0000019B5B77D040:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x80: D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) of resource (0x0000019B5B7449C0:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a render target. Expected State Bits (all): 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET, Actual State: 0x80: D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, Missing State: 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET. [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: Draw: Resource 0x0000019B5B7449C0:'Unnamed ID3D12Resource Object', subresource [0] is pending an incomplete split barrier. This is used as a render target [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
The last rendering function I was trying:
Code: Select all
void ArkaenNoesisHost::Render( GraphicsContext& ctx ) {
if( !m_view || !m_renderDevice ) return ;
// Make sure any engine barriers are flushed before giving the list to Noesis
//ctx.FlushResourceBarriers( ) ;
ID3D12GraphicsCommandList* cmd = ctx.GetCommandList( ) ;
uint64_t fenceValue = Graphics::g_CommandManager.GetGraphicsQueue( ).GetNextFenceValue( ) ;
NoesisApp::D3D12Factory::SetCommandList( m_renderDevice, cmd, fenceValue+1 ) ;
auto* r = m_view->GetRenderer( ) ;
r->SetRenderRegion( 0, 0, (float)m_width, (float)m_height ) ;
r->UpdateRenderTree( ) ;
r->RenderOffscreen( ) ;
r->Render( false, false ) ;
//NoesisApp::D3D12Factory::EndPendingSplitBarriers( m_renderDevice ) ;
// CRITICAL: Noesis mutated heaps/PSO/rootsig on the raw command list.
// Your engine wrapper MUST invalidate its caches or it will "think" the old heaps are still bound.
ctx.InvalidateCachedState( ) ;
}
Code: Select all
static bool UpdateApplication( IGameApp& game ) {
EngineProfiling::Update( ) ;
float DeltaTime = Graphics::GetFrameTime( ) ;
GameInput::Update( DeltaTime ) ;
EngineTuning::Update( DeltaTime ) ;
game.Update( DeltaTime ) ;
game.RenderScene( ) ;
PostEffects::Render( ) ;
GraphicsContext& UiContext = GraphicsContext::Begin( L"Render UI" ) ;
UiContext.TransitionResource( g_OverlayBuffer, D3D12_RESOURCE_STATE_RENDER_TARGET, true ) ;
UiContext.ClearColor( g_OverlayBuffer ) ;
UiContext.SetRenderTarget( g_OverlayBuffer.GetRTV() ) ;
UiContext.SetViewportAndScissor( 0, 0, g_OverlayBuffer.GetWidth(), g_OverlayBuffer.GetHeight() ) ;
game.RenderUI( UiContext ) ;
UiContext.SetRenderTarget( g_OverlayBuffer.GetRTV() ) ;
UiContext.SetViewportAndScissor( 0, 0, g_OverlayBuffer.GetWidth(), g_OverlayBuffer.GetHeight() ) ;
EngineTuning::Display( UiContext, 10.0f, 40.0f, 1900.0f, 1040.0f ) ;
UiContext.Finish( ) ;
Display::Present( ) ;
return !game.IsDone( ) ;
}
Am I making any obvious mistakes in how I'm attempting to render/use things? Should I use the "render context" instead of the raw "render device" code? Or should I possibly just use the whole NoesisApp source code as-is? And any ideas on what's going wrong here and how I'm getting these invalid states and resource barrier issues? The problem only occurs when I use that drop-shadow effect, so it has to do with this and the pixel shader and how resources are handled.
I'm also curious what I would need to do to integrate with Noesis Studio and accomplish things like having my custom components/views show up ... basically, just a high-level overview of what I need to do to make a small integration for my engine similar to the ones from Unity and Unreal and how that's accomplished.
Lately, I've experimented with NoesisGUI in Unreal, Unity and native DirectX 12 and it's been quite fun and rewarding! I have some findings and suggestions/improvements for all 3 I intend to share with you guys soon, and if time allows I'll try to make some YouTube videos or something about this. This native DirectX 12 engine/app project is for experimenting with a 4x "grand strategy" style of game set during the decline/collapse of the Roman Empire and the Great Migration period. As I've been working on this, I'm simultaneously working on the 3D campaign map in Houdini, and I expect it's going to be quite a spectacle, haha. :D
Regards,
Aaron
