I wanted to verify some rendering technique in Ogre and I didn't find support for UAVs in D3D11 render system neither also in GL renderer. I found in forums very brief discussion about this topic from 2015 (link) but there was not a lot. What is the status of this? Most specifically I am interested only in support of read/write shader buffers in pixel shaders.
I am trying to compose a rendering technique which requires to collect all pixels (with some additional data per pixel) from pixel shaders - using just textures is not enough as the pixels are overwriting there and also it is harder to extend the collected pixel information. As quick test I already extended D3D11 renderer to have support for it so it is possible to create addition buffers (and UAVs) through D3D11MultiRenderTarget. As I am not working with OpenGL, I am studying how an equivalent support can be added there, but as pointed also in the forum link above, the OpenGL has different concept about SSBO compared to D3D11 with buffer+UAV.
Is it desired feature for Ogre? Is it worth to check further and come with some proposals, prototype, patches for Ogre?
D3D11 example shader:
Code: Select all
struct FragmentData
{
int2 coords;
int visible;
};
RWStructuredBuffer<FragmentData> fragmentData;
PS_OUTPUT PSMain(PS_INPUT v, ...)
{
FragmentData output;
... // initialize output
uint index = fragmentData.IncrementCounter();
fragmentData[index] = output;
...
}
Code: Select all
struct FragmentData
{
ivec2 coords;
int visible;
};
layout(std430, binding = 0) buffer fragmentData
{
int count;
FragmentData data[];
};
void main()
{
FragmentData output;
... // initialize output
uint index = atomicAdd(fragmentData.count, 1);
fragmentData.data[index] = output;
...
}
Code: Select all
layout(std430, binding = 0) buffer fragmentData
{
// structured part
int var1;
float var2;
...
// unbound part
FragmentData data[];
};
I didn't think further how it would be possible to declare/create/use those shader buffers through scripts (program / material / compositor scripts). Do you see deeper usage in such feature? Is it worth to look further?