This issue stems from the fact that currently the vertex count for drawing a triangle is implied from the vertex buffer. However, drawing with the Traditional Rasterization without a vertex buffer is a very valid use case. (Example: A post-processing filter in a pixel shader, where the vertex shader generates a full-screen quad using the vertex ID). Since this is a case we would like to add tests for, we need to be able to specify the VertexCount.
However, at some point we may also want to specify an IndexCount, InstanceCount, IndexOffset, InstanceOffset, VertexOffset, or even more it doesn't quite make sense to store these fields in the Shader type. These parameters are not part of the shader, but are related to dispatching the pipeline.
Instead, the user should be able to specify the DispatchParameters for the pipeline instead.
This will also simplify the backend as in cases with more than one shader we don't need to scan for the shader containing the parameters for dispatching work on the GPU.
Additionally, we can add a default dispatch size of [1,1,1] for compute shaders, since most test launch a single group.
Similarly, we can still imply the vertex count from the vertex buffer if the user did not specify one in the test.
Finally, we should validate the passed DispatchParameters against the type of pipeline to check if the user did not accidentally specify parameters that are irrelevant and could cause confusion or mistakes.
This issue stems from the fact that currently the vertex count for drawing a triangle is implied from the vertex buffer. However, drawing with the Traditional Rasterization without a vertex buffer is a very valid use case. (Example: A post-processing filter in a pixel shader, where the vertex shader generates a full-screen quad using the vertex ID). Since this is a case we would like to add tests for, we need to be able to specify the
VertexCount.However, at some point we may also want to specify an
IndexCount,InstanceCount,IndexOffset,InstanceOffset,VertexOffset, or even more it doesn't quite make sense to store these fields in theShadertype. These parameters are not part of the shader, but are related to dispatching the pipeline.Instead, the user should be able to specify the
DispatchParametersfor the pipeline instead.This will also simplify the backend as in cases with more than one shader we don't need to scan for the shader containing the parameters for dispatching work on the GPU.
Additionally, we can add a default dispatch size of [1,1,1] for compute shaders, since most test launch a single group.
Similarly, we can still imply the vertex count from the vertex buffer if the user did not specify one in the test.
Finally, we should validate the passed
DispatchParametersagainst the type of pipeline to check if the user did not accidentally specify parameters that are irrelevant and could cause confusion or mistakes.