Advertisement

Failing to create a Heap for 3D Render Target

Started by March 29, 2018 09:19 PM
12 comments, last by NikiTo 6 years, 10 months ago

@galop1n you are correct. I don't need 3D texture. I just read that 3D texture's main advantage is three dimensional interpolation. I don't need that.

@Hodgman Thanks for the suggestions. I try to avoid UAVs for now, because I think that they should be slower by default than a regular RTV.

I need what is shown in the picture. Imagine that I have to read 6 photos inside the shader, then blend them in a particular way and output 50 levels of gray of the resulting image.
Running the shader various times, I would read the photos 6 extra times for each extra drawing call.
Now that I re-think it, maybe using GS was a bad solution, because it will still call the shader 49 extra times.

If there is not a way to select from the pixel shader the slice to render to, and these slices to be more than 8, I am screwed...
 

New Bitmap Image.bmp

That is the perfect example of a compute shader. Why would UAV write be more costly if coherent, it does not make sense

 


Texture2D srcImg[6];
RWTexture3D dst;

[numthreads(8,8,1)]
void main ( uint2 dtID : SV_DispatchThreadID )
{
	float4 srcs[6];
	for(uint i = 0; i!=6;++i)
 		srcs[i] = srcImg[i][dtID.xy];

	for(uint slice=0;slice!=numSlice;++slice)
	{
		float4 result = /* do something of my input + slice index */
		dst[ uint3(stID.xy,slice)] = result;
	}
}

 

That is a core example, you may not want to run all the slice in a single group because you may have some stall and not have enough thread group to hide latency. But man, simpler is better at first, then optimize if it is a problem !

 

And even if you read the 50 times, 6 photos, let say 2048 square ( hopefully in BC7 format to save bandwidth ), it is 1GB of memory read. A GTX 770 has 224GB/s of bandwidth, it means the read account for less than 5ms. Yes, it is not the end of the word if your app is merely doing that !

 

Advertisement

Thank you for the suggestion! I will do as you say if everything else fails. Thank you!

(my laptop GPU says "total memory bandwidth 14 GByte/s" and "Memory Bit Rate 1.80 Gbps")
 

This topic is closed to new replies.

Advertisement