Jump to content

  • Log In with Google      Sign In   
  • Create Account

Funkymunky

Member Since 28 Jul 1999
Offline Last Active Yesterday, 02:50 PM

Topics I've Started

Multi-threaded deferred setup

02 February 2016 - 07:25 PM

My current setup is a forward renderer, I build a command list to make render calls and then copy upload-heap data to default-heap data (mostly MVPs and such).  Then I switch to a different "frame" and do the same thing while the first set of calls get processed.  I have a fence at the beginning of each frame to make sure that all the data has been copied for the new frame before I begin making new draw calls.  I rarely have to wait on it because of the dual-frame setup.

 

I started thinking about how to do things for a deferred render.  It's going to need to wait for the G Buffer textures to be generated each frame.  Even if I spread it out to 3 frames, I can't think of a setup where I don't end up waiting for either the default-heap copy of MVP data or the G-Buffer texture data.  It seems like that's going to be inherent in a setup where I need to render a texture as an input to another texture, but I was wondering if anyone had any advice on how to maximize the GPU usage for a deferred renderer with DirectX 12.


Inverting normals when rendering backfaces

31 January 2016 - 09:36 AM

I've turned off culling because I have some geometry that I want to render both front and backfaces of.  Is there a way to invert the normal when rendering the backface?  Or should I turn culling back on and make the geometry two-sided...


[D3D12] Freeing committed resources?

17 January 2016 - 12:32 PM

Say I have a "ComPtr<ID3D12Resource> vertexBuffer;" that I've initialized with a call to CreateCommittedResource.  I want to wipe that out and reuse the pointer to create a different Committed Resource.  How do I "free" the committed resource before calling CreateCommittedResource again?


[D3D12] CopyTextureRegion with a fence?

25 December 2015 - 06:44 PM

I am streaming in texture data on a background thread.  I have a 3x3 grid of textures that I load data into, and I use these textures to sample from when rendering the immediate area around the camera.  This grid of textures is updated as the camera moves, such that they represent the currently desired textures surrounding the camera.  As such, I re-use grid entries when the camera has moved sufficiently, and upload new data to the textures regularly.

 

Anyway, I update these textures with a call to UpdateSubresources, which ultimately calls CopyTextureRegion.  I wrap the call to UpdateSubresources in calls to ResourceBarrier to transition to/from pixel shader resources and copy destinations.  This all works fine when the camera is moving slowly.  But when I move fast, I see some of the old texture data get rendered, as if the CopyTextureRegion call hadn't completed before the texture was sampled.

 

I put in a fence, which calls ID3D12CommandQueue::Signal after the call to CopyTextureRegion (well, after the second ResourceBarrier transition), and I check its value before rendering with the intended new data, but it doesn't seem to have any effect.

 

I guess what I'm wondering is, can a fence be used to ensure the completetion of CopyTextureRegion?


std::chrono incrementing a time_point by a duration?

26 November 2015 - 10:51 PM

I'm trying to implement a fixed timestep update loop.  I tried the following:

.

	typedef std::chrono::high_resolution_clock clock;
	typedef std::chrono::duration<float, std::ratio<1, 30>> updateRate;
	typedef std::chrono::time_point<clock, updateRate> time;

	const auto frameDelta = updateRate{ 1 };
	static time oldTime = clock::now();
	time newTime = clock::now();

	while(newTime - oldTime >= frameDelta)
	{
		// Here I call my updates

		oldTime += frameDelta;
	}

.

Strangely this operates as an infinite loop.  frameDelta is apparently 1.0f, and when I call oldTime += frameDelta, oldTime doesn't seem to change...


PARTNERS