Class: GPUContext
WebGPU api use context
Constructors
Properties
- lastGeometry
- lastPipeline
- lastShader
- drawCount
- renderPassCount
- geometryCount
- pipelineCount
- matrixCount
- lastRenderPassState
- LastCommand
Methods
- bindPipeline
- bindCamera
- bindGeometryBuffer
- cleanCache
- createPipeline
- beginCommandEncoder
- endCommandEncoder
- recordBundleEncoder
- beginRenderPass
- drawIndexed
- draw
- endPass
- computeCommand
- copyTexture
Constructors
constructor
• new GPUContext(): GPUContext
Returns
Properties
lastGeometry
▪ Static
lastGeometry: GeometryBase
Defined in
src/gfx/renderJob/GPUContext.ts:15
lastPipeline
▪ Static
lastPipeline: GPURenderPipeline
Defined in
src/gfx/renderJob/GPUContext.ts:16
lastShader
▪ Static
lastShader: RenderShaderPass
Defined in
src/gfx/renderJob/GPUContext.ts:17
drawCount
▪ Static
drawCount: number
= 0
Defined in
src/gfx/renderJob/GPUContext.ts:18
renderPassCount
▪ Static
renderPassCount: number
= 0
Defined in
src/gfx/renderJob/GPUContext.ts:19
geometryCount
▪ Static
geometryCount: number
= 0
Defined in
src/gfx/renderJob/GPUContext.ts:20
pipelineCount
▪ Static
pipelineCount: number
= 0
Defined in
src/gfx/renderJob/GPUContext.ts:21
matrixCount
▪ Static
matrixCount: number
= 0
Defined in
src/gfx/renderJob/GPUContext.ts:22
lastRenderPassState
▪ Static
lastRenderPassState: RendererPassState
Defined in
src/gfx/renderJob/GPUContext.ts:23
LastCommand
▪ Static
LastCommand: GPUCommandEncoder
Defined in
src/gfx/renderJob/GPUContext.ts:24
Methods
bindPipeline
▸ bindPipeline(encoder
, renderShader
): boolean
renderPipeline before render need bind pipeline
Parameters
Name | Type | Description |
---|---|---|
encoder | GPURenderPassEncoder | GPURenderBundleEncoder | current GPURenderPassEncoder GPURenderPassEncoder GPURenderBundleEncoder |
renderShader | RenderShaderPass | render pass shader RenderShaderPass |
Returns
boolean
Defined in
src/gfx/renderJob/GPUContext.ts:32
bindCamera
▸ bindCamera(encoder
, camera
): void
render before need make sure use camera
Parameters
Name | Type | Description |
---|---|---|
encoder | GPURenderPassEncoder | GPURenderBundleEncoder | current GPURenderPassEncoder GPURenderPassEncoder GPURenderBundleEncoder |
camera | Camera3D | use camera Camera3D |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:58
bindGeometryBuffer
▸ bindGeometryBuffer(encoder
, geometry
): void
bind geometry vertex buffer to current render pipeline
Parameters
Name | Type | Description |
---|---|---|
encoder | GPURenderPassEncoder | GPURenderBundleEncoder | current GPURenderPassEncoder GPURenderPassEncoder GPURenderBundleEncoder |
geometry | GeometryBase | engine geometry |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:70
cleanCache
▸ cleanCache(): void
begin or end clean all use cache
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:89
createPipeline
▸ createPipeline(gpuRenderPipeline
): GPURenderPipeline
create a render pipeline
Parameters
Name | Type | Description |
---|---|---|
gpuRenderPipeline | GPURenderPipelineDescriptor | GPURenderPipelineDescriptor |
Returns
GPURenderPipeline
Defined in
src/gfx/renderJob/GPUContext.ts:100
beginCommandEncoder
▸ beginCommandEncoder(): GPUCommandEncoder
auto get webgpu commandEncoder and start a command encoder
Returns
GPUCommandEncoder
commandEncoder GPUCommandEncoder
Defined in
src/gfx/renderJob/GPUContext.ts:110
endCommandEncoder
▸ endCommandEncoder(command
): void
end CommandEncoder record and submit
Parameters
Name | Type | Description |
---|---|---|
command | GPUCommandEncoder | GPUCommandEncoder |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:123
recordBundleEncoder
▸ recordBundleEncoder(des
): GPURenderBundleEncoder
create a renderBundle gpu object by GPURenderBundleEncoderDescriptor
Parameters
Name | Type | Description |
---|---|---|
des | GPURenderBundleEncoderDescriptor | GPURenderBundleEncoderDescriptor |
Returns
GPURenderBundleEncoder
renderBundleEncoder GPURenderBundleEncoder
Defined in
src/gfx/renderJob/GPUContext.ts:136
beginRenderPass
▸ beginRenderPass(command
, renderPassState
): GPURenderPassEncoder
render pass start return current use gpu renderPassEncoder
Parameters
Name | Type | Description |
---|---|---|
command | GPUCommandEncoder | GPUCommandEncoder |
renderPassState | RendererPassState | RendererPassState |
Returns
GPURenderPassEncoder
encoder GPURenderPassEncoder
Defined in
src/gfx/renderJob/GPUContext.ts:147
drawIndexed
▸ drawIndexed(encoder
, indexCount
, instanceCount?
, firstIndex?
, baseVertex?
, firstInstance?
): void
Start the rendering process to draw any pipes
Parameters
Name | Type |
---|---|
encoder | GPURenderPassEncoder |
indexCount | number |
instanceCount? | number |
firstIndex? | number |
baseVertex? | number |
firstInstance? | number |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:190
draw
▸ draw(encoder
, vertexCount
, instanceCount?
, firstVertex?
, firstInstance?
): void
Parameters
Name | Type |
---|---|
encoder | GPURenderPassEncoder |
vertexCount | number |
instanceCount? | number |
firstVertex? | number |
firstInstance? | number |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:199
endPass
▸ endPass(encoder
): void
The GPU must be informed of the end of encoder recording
Parameters
Name | Type |
---|---|
encoder | GPURenderPassEncoder |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:211
computeCommand
▸ computeCommand(command
, computes
): void
Perform the final calculation and submit the Shader to the GPU
Parameters
Name | Type |
---|---|
command | GPUCommandEncoder |
computes | ComputeShader [] |
Returns
void
Defined in
src/gfx/renderJob/GPUContext.ts:221
copyTexture
▸ copyTexture(command
, source
, dest
): void
Parameters
Name | Type |
---|---|
command | GPUCommandEncoder |
source | Texture |
dest | Texture |
Returns
void