compute pipeline
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0a8cd263c9
commit
11cc01cc9a
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
title: "ComputePipeline"
|
||||||
|
date: 2021-01-28T13:55:13-08:00
|
||||||
|
weight: 9
|
||||||
|
---
|
||||||
|
|
||||||
|
There is another kind of pipeline we have access to other than graphics pipelines, and that is compute pipelines. Whereas graphics pipelines are specifically constructed for rendering, compute pipelines can do parallel processing on any kind of input data and output any kind of data we want. Some common use cases for compute pipelines are particle systems and sprite batching.
|
||||||
|
|
||||||
|
Describing exactly how to use compute pipelines is (my favorite phrase!) beyond the scope of this tutorial, so you should seek out other resources to learn how to use them. Many games will never need a compute pipeline and at the point where you could benefit from one you will probably know.
|
||||||
|
|
||||||
|
To construct a compute pipeline, we need a shader stage state containing a compute shader module, a buffer binding count, and an image binding count.
|
||||||
|
|
||||||
|
```cs
|
||||||
|
var myComputeShader = new ShaderModule(
|
||||||
|
GraphicsDevice,
|
||||||
|
"ParticleCompute.spv"
|
||||||
|
);
|
||||||
|
|
||||||
|
var myComputeShaderState = new ShaderStageState
|
||||||
|
{
|
||||||
|
ShaderModule = myComputeShader,
|
||||||
|
EntryPointName = "main",
|
||||||
|
UniformBufferSize = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var myComputePipeline = new ComputePipeline(
|
||||||
|
GraphicsDevice,
|
||||||
|
myComputeShaderState,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
This example creates a compute pipeline with no uniform input, one buffer binding, and no image bindings.
|
|
@ -4,7 +4,7 @@ date: 2021-01-25T14:31:59-08:00
|
||||||
weight: 3
|
weight: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
MoonWorks provides nine different kinds of graphics resources that you use to construct your renderer.
|
MoonWorks provides eight different kinds of graphics resources that you use to construct your renderer.
|
||||||
|
|
||||||
`Buffer` holds generic data, like vertex information for example. The way this data is interpreted is determined by the pipeline.
|
`Buffer` holds generic data, like vertex information for example. The way this data is interpreted is determined by the pipeline.
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@ MoonWorks provides nine different kinds of graphics resources that you use to co
|
||||||
|
|
||||||
`Sampler` tells a shader how it should sample texture data.
|
`Sampler` tells a shader how it should sample texture data.
|
||||||
|
|
||||||
`ComputePipeline` sets up the graphics device to do computational work using [compute shaders](https://anteru.net/blog/2018/intro-to-compute-shaders/index.html).
|
|
||||||
|
|
||||||
`GraphicsPipeline` sets up the graphics device to do rendering work.
|
`GraphicsPipeline` sets up the graphics device to do rendering work.
|
||||||
|
|
||||||
`RenderTarget` is a structure that can be rendered to.
|
`RenderTarget` is a structure that can be rendered to.
|
||||||
|
@ -22,4 +20,7 @@ MoonWorks provides nine different kinds of graphics resources that you use to co
|
||||||
|
|
||||||
`RenderPass` is a structure that tells the `GraphicsPipeline` how it should use a `Framebuffer`.
|
`RenderPass` is a structure that tells the `GraphicsPipeline` how it should use a `Framebuffer`.
|
||||||
|
|
||||||
|
`ComputePipeline` sets up the graphics device to do computational work using [compute shaders](https://anteru.net/blog/2018/intro-to-compute-shaders/index.html).
|
||||||
|
|
||||||
|
|
||||||
This is all pretty abstract. Let's get into some more detail.
|
This is all pretty abstract. Let's get into some more detail.
|
||||||
|
|
Loading…
Reference in New Issue