mp3butcher
12-20-2010, 08:04 AM
Developping 3D fluid simulation, I'm using the common technique in order to write to all layers of a 3D texture:
For each tex3D slice Do
Render a Quad with a shader program
However, as i have several RTT pass this solution uses a lot of CPU drawCall (depth*nbpass) and so is the bottleneck of my engine.
I've read here http://developer.download.nvidia.com/books/gpu_gems_3/samples/gems3_ch30.pdf that in directX:
instancing can be used to draw all slices in a single draw call, rather than
making a separate call for each slice. In this case, the instance ID can be used to specify
the target slice.
I see that Opengl offer a functionality in order to write different cubemap faces using gl_layer in a geometry shader.
So I decide to improve performance with a geometry shader that specify wich is the targetted slice of my 3D texture to write to.
(fbo binding :glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture3D, 0);)
But it doesnt work properly (all 3Dtexture is updated when i define a constant gl_Layer=0);
Q: Have you test it?
Q: Do i need glFramebufferTexture working on my HW to do this?
I also see that gl_layer is used to output differents 2D textures of a TEXTURE_2D_ARRAY...
Q:Would it be a good thing for performances to reorganise my 3D texture as a 2D texture array?
---------------------
Dev on QTX275/QuadCore Q8300
For each tex3D slice Do
Render a Quad with a shader program
However, as i have several RTT pass this solution uses a lot of CPU drawCall (depth*nbpass) and so is the bottleneck of my engine.
I've read here http://developer.download.nvidia.com/books/gpu_gems_3/samples/gems3_ch30.pdf that in directX:
instancing can be used to draw all slices in a single draw call, rather than
making a separate call for each slice. In this case, the instance ID can be used to specify
the target slice.
I see that Opengl offer a functionality in order to write different cubemap faces using gl_layer in a geometry shader.
So I decide to improve performance with a geometry shader that specify wich is the targetted slice of my 3D texture to write to.
(fbo binding :glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture3D, 0);)
But it doesnt work properly (all 3Dtexture is updated when i define a constant gl_Layer=0);
Q: Have you test it?
Q: Do i need glFramebufferTexture working on my HW to do this?
I also see that gl_layer is used to output differents 2D textures of a TEXTURE_2D_ARRAY...
Q:Would it be a good thing for performances to reorganise my 3D texture as a 2D texture array?
---------------------
Dev on QTX275/QuadCore Q8300