xenko icon indicating copy to clipboard operation
xenko copied to clipboard

Problem with GPU buffers with DX12

Open matmuze opened this issue 7 years ago • 4 comments

Hi there, I am experimenting with Xenko and custom shaders.

In my sample I need to pass custom information stored in structured buffer to the shader program.

To declare the buffer I do something like this:

Buffer PositionBuffer = Buffer.Structured.New(graphicsDevice, positions).DisposeBy(this);

This runs well with DX11 but with DX12 I get the following error:

Unhandled Exception: System.NotImplementedException: The method or operation is not implemented.
   at SiliconStudio.Xenko.Graphics.Buffer.Recreate(IntPtr dataPointer)
   at SiliconStudio.Xenko.Graphics.Buffer.InitializeFromImpl(BufferDescription description, BufferFlags viewFlags, PixelFormat viewFormat, IntPtr dataPointer)
   at SiliconStudio.Xenko.Graphics.Buffer.New(GraphicsDevice device, Int32 bufferSize, Int32 elementSize, BufferFlags bufferFlags, PixelFormat viewFormat, GraphicsResourceUsage usage)
   at SiliconStudio.Xenko.Graphics.Buffer.Structured.New(GraphicsDevice device, Int32 count, Int32 elementSize, Boolean isUnorderedAccess)

matmuze avatar May 22 '17 09:05 matmuze

Well I inspected the source code and it seems structured buffers are not implemented for DX12... :(

public void Recreate(IntPtr dataPointer)
{
	...

	if ((bufferFlags & BufferFlags.StructuredBuffer) != 0)
	{
		throw new NotImplementedException();
		if (bufferDescription.StructureByteStride == 0)
			throw new ArgumentException("Element size cannot be set to 0 for structured buffer");
	}

matmuze avatar May 22 '17 10:05 matmuze

Hello,

Sorry to say that indeed Structured buffers are not implemented yet for DX12. We'll let you know when they will.

Benlitz avatar May 26 '17 00:05 Benlitz

Any ETA ? I want this feature very badly...

matmuze avatar May 29 '17 19:05 matmuze

Hello, we fixed this issue internally. Will be probably released in version 2.1.

mafiesto4 avatar Jun 05 '17 06:06 mafiesto4