- Home /
Compute shader dispatch large spike in CPU and GPU profiler
Hi everyone, I'm coding a Quadtree based system for the rendering of large planets (similar to No man's sky). Every time im generating a new node in my Quadtree, I have to calculate the new vertex and texture data from a noise function. This is done in a compute shader, the data is never read back to the GPU though (I think) and directly send for rendering. It worked decently well, but I wanted to reduce the load on the GPU and spread the texture calculation ove several frames by dividing it into smaller parts that are sequentially send to the GPU. Unfortunantly, this leads to an even worse perfomance and a single digit framerate. Does anyone know whats going wrong?Shouldnt the GPU load go down when I "divide and conquer" the textue? Heres a picture from the profiler
and the code to dispatch the compute shaders:
public IEnumerator CalculateNodeData(){
InstantiateBuffers();
ComputeShader NodeComputeShader=planet.NodeComputeShader;
propertyBlock=new MaterialPropertyBlock();
int vertexKernel = NodeComputeShader.FindKernel("TerrainNodeVertex");
int textureKernel = NodeComputeShader.FindKernel("TerrainNodeTexture");
//Set a bunch of constants and our vertexBuffer and RenderTexture
NodeComputeShader.SetBuffer(vertexKernel,"vertexBuffer",verticesBuffer);
NodeComputeShader.SetTexture(textureKernel,"textureBuffer",texture);
//Calculate the vertices
NodeComputeShader.Dispatch(vertexKernel,threads,1,threads);
yield return new WaitForEndOfFrame();
//Calculate a part of the texture, one part per frame
for(int p=0;p<parts;p++){
NodeComputeShader.SetInt("part",p);
NodeComputeShader.Dispatch(textureKernel,threads,1,threads);
yield return new WaitForEndOfFrame();
}
propertyBlock.SetBuffer ("vertexBuffer", verticesBuffer);
propertyBlock.SetTexture ("tex", texture);
}
Your answer
Follow this Question
Related Questions
Is it possible to profile compute shaders? 2 Answers
GPU (render time) increase if screen size increase 1 Answer
weird profiler result? 0 Answers