Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


rendering to 3DTexture performance question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 04 March 2013 - 04:33 PM

This is the first time i am rendering to a 3Dtexture, from what i read I can only render to one 2D slice of the 3DTexture with a quad.

I want to render to all the texels so I have to clone those quads and each one renders to a different layer of the 3d texture, so i have this question.

 

When rendering to all the texels of that texture what is faster

- Using drawIndexedInstanced so every intance draws quad to each layer of the 3Dtexture

-Make the geometry shader clone the quads and each one render to different layer

 

the 3Dtexture is 100X100X100


Edited by lomateron, 04 March 2013 - 04:35 PM.


Sponsor:

#2 Tsus   Members   -  Reputation: 1050

Like
0Likes
Like

Posted 04 March 2013 - 05:23 PM

Hi!

 

Since you have to specify which slice you want to render into in a geometry shader by using the semantic SV_RenderTargetArrayIndex, I'd suggest to use the geometry shader approach.

I would render 100 vertices as a point list, without actually binding a vertex buffer (so that you get 100 vertex shader invocations).

The vertex shader does nothing.

In the geometry shader you can take the SV_PrimitiveID (in 0..99) to specify the target slice to render into. Expand then a quad (as a triangle strip) with the coordinates (-1,-1,0) (-1,1,0) (1,-1,0) (1,1,0).

The pixel shader receives with SV_Position the texel coordinate in the slice. (Additionally you can pass the SV_PrimitiveID from the geometry shader to the pixel shader, if you need the slice id.)

Be careful, though, because SV_Position comes in as float, so better cast it to int.

 

You can also use a compute shader, if you want to avoid the rasterization pipeline. (Hard to tell, whether it will be faster, since you'd need to switch from the rasterization pipeline to the compute pipeline and back. If I recall correctly, I heard in a talk at gamefest someone mentioning that frequent switches are to avoid.)

 

Cheers!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS