The program cycle is
Update();
UpdatePipeline();
In Update()
constant buffer for each object, that after transformations, has this object world matrix is copied to GPU upload heap. And in UpdatePipeline()
, among other things, installed shaders are called. Because we do all matrix transformation using CPU, vertex shader just returns position, right? If yes - is it true that performance will increase?
Now I want to do all transformations using GPU, i.e. via vertex shader. It means that in Update()
I just should call memcpy()
with an empty constant buffer as a source?
Learning more, I found that I can put in constant buffer position vector float4
or matrix float4x4
of vertex, and as a root constant choose ProjectionView
Matrix. The shader will mul one on other. Keep searching... Or constant buffer is one of the root constants? Confused
I don’t understand how to choose what to send as an argument to shader function, like input here:
VS_OUTPUT main(VS_input input)
{
...
}
As I understand, I can access constant buffer the next way:
cbuffer ConstantBuffer : register(b0)
{
float4x4 mat;
}
There can be ProjectionView
matrix, okey got that. But how to send vertex pos to input then?