Jump to content

  • Log In with Google      Sign In   
  • Create Account

WFP

Member Since 23 Mar 2013
Offline Last Active Today, 06:35 PM

Posts I've Made

In Topic: Pixel Shader 'stage Did Not Run'

24 July 2016 - 09:31 AM

Is there a depth buffer bound?  And if so, is depth testing enabled?  First glance looks like it's getting rejected. If you look in the event history (usually on the side of the graphics debugger) you may see a little symbol that looks like a crossed out 'Z' (if I'm remembering correctly).


In Topic: Magic Number 8 Used For Energy Conservation, One Reason ?

13 July 2016 - 06:34 PM

It's an approximation of the Blinn-Phong normalization factor for the specular distribution function.

 

See Fabien Giesen's article here for the correct factor:  http://www.farbrausch.de/~fg/stuff/phong.pdf


In Topic: Resource barrier pre and post states

26 April 2016 - 03:55 PM

Subresources can be in different states, but the rules still apply when setting resource barriers in that the before and after states must be correct.  So for example, you could set mip level 0 to a shader resource and mip level 1 as a render target.  See the documentation for D3D12_RESOURCE_TRANSITION_BARRIER, specifically the Subresource member.


In Topic: [D3D12] About CommandList, CommandQueue and CommandAllocator

20 April 2016 - 06:24 PM

You can definitely re-use command lists, as well as command allocators, albeit at different paces.

 

You can think of a command list as providing the interface to write instructions to the command allocator.  The command allocator is basically just a chunk of memory that lives somewhere.  It doesn't really matter exactly where - that's for the driver implementer to decide.  When you submit a command list to the command queue, you're basically saying "this is the next chunk of work for the GPU to complete and here's the chunk of memory that contains all the instructions".  Even if the GPU immediately takes that work on (it probably won't), you still need that chunk of memory containing the instructions to be available the entire time they're being processed and executed.

 

So for command lists, you can reset them as soon as you have submitted them to the command queue and immediately begin to reuse them, because all you're really resetting is the command allocator they're using.  However, you must not reset the command allocator that's just been submitted until you are completely sure that all GPU work has completed.  Once you're sure the GPU has finished working on the tasks submitted to it, then you're free to cycle back and reset/reuse that allocator.

 

I'd recommend searching this site for ID3D12Fence.  I'm sure I've seen a few posts over the past few months that have touched on this topic and show how to synchronize command list and allocator usage across multiple frames.  To get you started, though, you'll need to think in terms of having enough allocators to cover however many frames of latency you'll be working with.


In Topic: [DX12] Constant Buffer Packing

07 February 2016 - 09:31 AM

You seem to have discovered for yourself, and Krzysztof mentioned, how arrays are stored in HLSL constant buffers.  A possible solution to this would be to just halve your sample count and use the full float4 for storage.  Your example would turn into:

static const int SampleCount = 64;

struct OffsetData
{
    float4 Samples[SampleCount];
};

Then just index into it for the value you want:

[unroll]
for(uint i = 0; i < SampleCount; ++i)
{
	[unroll]
	for(uint j = 0; j < 4; ++j)
	{

		float currentDataPoint = Samples[i][j];
	}
}

You can update that loop to extract the float2 value if that's what you're after, the approach is essentially the same.

 

Edit:  Here's some documentation.  It's for SM4, but I'm almost positive it hasn't changed since https://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx


PARTNERS