Jump to content
  • Advertisement
Sign in to follow this  
karnaltaB

DX12 DirectX 12 Root Constant Buffer Problem

Recommended Posts

Hi,

I am trying to learn D3D12 programming by programming a small engine but I have a strange behavior that I cannot understand.

Basically, I am drawing 200 cubes each frame and between each draw call I use a root 32 bits constant to determine the cube color in my shader. It work fine for a couple of seconds then the root constant seem to stop to be updated and so my shader can't determine color anymore. I don't know why it work and suddenly stop without any debug error.

Here is the pseudo code of what I am doing :

Init()
{
	...
	- Define a float value
	- Create a pointer to this float value
	- Add a root constant to my root signature parameters.
	...
}

RenderLoop()
{
	...
	For 0 to 200
	{
		- Update my float value
		- CommandList->SetGraphicsRoot32BitConstants(floatPtr)
		- Draw cube
	}
}

Thank for help.

Share this post


Link to post
Share on other sites
Advertisement
27 minutes ago, ajmiles said:

Have you tried using PIX For Windows to debug this?

No yet. The shader is really minimalist. When my cube turns black it’s because the root constant has not an expected value. So I know the problem come from that constant. Can I see root constant life with PIX ? 

Share this post


Link to post
Share on other sites

You can see the value of a root constant and how it changes with each draw, yes.

Share this post


Link to post
Share on other sites

ajmiles is right, you can use the visual studio graphic debugger to have a better idea on what happened with your root parameter. Here's a screenshot of where to look at. I'd suggest playing around with that debugger a bit and get used to all it's features, especially if you're learning DX12. It will save you a lot of time in the future. Otherwise we will need much more than the pseudo-code to help you figure what went wrong.

image.thumb.png.fccb414f32541badc00729ce830a461f.png

Share this post


Link to post
Share on other sites

The Visual Studio Graphics Debugger (VSGD) should work fine for simple applications, but that particular feature is no longer under active development and is likely to become less useful to DX12 developers as time goes on. "PIX For Windows" is a separate standalone graphics profiler and debugger and is in constant development. I would recommend installing PIX For Windows and using this for any investigations you might want to do in the future.

Share this post


Link to post
Share on other sites

Thank all. I have installed PIX it will probably save me a lot of time later.

But in my specific case (really simple app), thing happen as I thought, the constant switch between value 5 and 6 (which is intended) while my app is working and fall down to 0 when all my cubes goes to black.

So, as I expected the root constant stop being updated in the middle of my rendering loop after a few second.

Share this post


Link to post
Share on other sites
7 hours ago, ajmiles said:

Does that mean you still haven't figured out what's wrong?

Yes, I haven't figured yet.

I keep learning other aspect, maybe I will find what's wrong when I get a better understanding of D3D12. I understand that it's quite hard for you too help me with that bug, but pasting code is impossible even my small learning engine has dozen of classes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!