Render from tbuffer to tbuffer?

Started by
1 comment, last by MJP 9 years, 2 months ago

Hello!

In my vertex shader I am using two tbuffers. The first tbuffer is an array of World transform matrices, used for normal transformations for lighting. The other tbuffer is an array of WorldViewProjection matrices, used for transforming vertex positions.

What I do now is to calculate both matrix arrays on the CPU and send them to the GPU. However, I figured that I could just generate the second tbuffer from first tbuffer on the GPU by multipling every element in the first tbuffer with a ViewProjection matrix that is located in a cbuffer.

What ways are there to implement "tbuffer2 = tbuffer1 * cbuffer.ViewProj;" on the GPU?

Cheers!

Advertisement
You could bind the second/output buffer to a "stream out" slot, and then use a vertex shader to read the first buffer, perform the calculation, and stream-out the results.

By far the easiest way to do this would be to use structured buffers instead of tbuffers, and then writing a compute shader to do the matrix multiply. A structured buffer will give you the same performance characteristics, except with much more flexibility. They're also easier to work with, IMO.

This topic is closed to new replies.

Advertisement