-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPipelineEntries.ts
110 lines (97 loc) · 4.96 KB
/
PipelineEntries.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import {
MaterialBindGroups,
MaterialShaders,
RenderMaterialAttributes,
RenderMaterialRenderingOptions,
} from './Materials'
import { Renderer } from '../core/renderers/utils'
import { GPUCurtains } from '../curtains/GPUCurtains'
/**
* Defines a {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry} shader object
*/
export interface PipelineEntryShader {
/** Additional piece of WGSL code added at the beginning of the shader, with bits coming from the {@link core/bindings/Binding.Binding | Binding} and {@link core/geometries/Geometry.Geometry | Geometry} */
head?: string
/** Complete WGSL shader code, i.e. {@link PipelineEntryShader#head | head code} plus code that has been passed by the {@link core/materials/Material.Material | Material} */
code: string
/** {@link GPUShaderModule} created based on the given {@link code} */
module: GPUShaderModule | null
}
/**
* Defines all possible {@link PipelineEntryShader} objects
*/
export interface PipelineEntryShaders {
/** Vertex {@link PipelineEntryShader} object */
vertex?: PipelineEntryShader
/** Fragment {@link PipelineEntryShader} object */
fragment?: PipelineEntryShader
/** Compute {@link PipelineEntryShader} object */
compute?: PipelineEntryShader
/** Full {@link PipelineEntryShader} object (i.e. vertex + fragment) */
full?: PipelineEntryShader
}
/**
* Options used to create this {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry}
*/
export interface PipelineEntryOptions {
/** The label of the {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry}, sent to various GPU objects for debugging purpose */
label: string
/** Whether to compile the {@link core/pipelines/PipelineEntry.PipelineEntry#pipeline | pipeline} asynchronously or not */
useAsync?: boolean
/** Shaders to use with this {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry} */
shaders: MaterialShaders
}
/** Base parameters used to create this {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry} */
export type PipelineEntryBaseParams = Partial<PipelineEntryOptions>
/**
* Parameters used to create this {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry}
*/
export interface PipelineEntryParams extends PipelineEntryBaseParams {
/** {@link Renderer} used to create this {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry}, or our {@link curtains/GPUCurtains | GPUCurtains} class object */
renderer: Renderer | GPUCurtains
}
/**
* Defines our current {@link core/pipelines/PipelineEntry.PipelineEntry#pipeline | pipeline} compilation status
*/
export interface PipelineEntryStatus {
/** Whether the {@link core/pipelines/PipelineEntry.PipelineEntry#pipeline | pipeline} is currently compiling */
compiling: boolean
/** Whether the {@link core/pipelines/PipelineEntry.PipelineEntry#pipeline | pipeline} has been successfully compiled */
compiled: boolean
/** Whether there has been an error while compiling the {@link core/pipelines/PipelineEntry.PipelineEntry#pipeline | pipeline}, and the corresponding error */
error: null | string
}
/**
* Parameters used to add properties to the {@link core/pipelines/PipelineEntry.PipelineEntry | PipelineEntry}
*/
export interface PipelineEntryPropertiesParams {
/** Array of {@link core/bindGroups/BindGroup.BindGroup | BindGroup} to use with this {@link core/pipelines/PipelineEntry.PipelineEntry#pipeline | pipeline} */
bindGroups: MaterialBindGroups
}
/* RENDER PIPELINES */
/**
* Parameters used to add properties to the {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry | RenderPipelineEntry}
*/
export interface RenderPipelineEntryPropertiesParams extends PipelineEntryPropertiesParams {
/** Geometry attributes to use with this {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry#pipeline | render pipeline} */
attributes: RenderMaterialAttributes
}
/**
* Specific rendering parameters used to create a {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry | RenderPipelineEntry}
*/
export interface RenderPipelineRenderingParams {
/** {@link RenderMaterialRenderingOptions | render material rendering options} used to create the {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry | RenderPipelineEntry} */
rendering: RenderMaterialRenderingOptions
}
/**
* Base parameters used to create a {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry | RenderPipelineEntry}
*/
export interface RenderPipelineEntryBaseParams extends PipelineEntryBaseParams, RenderPipelineRenderingParams {}
/**
* Parameters used to create a {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry | RenderPipelineEntry}
*/
export interface RenderPipelineEntryParams extends PipelineEntryParams, RenderPipelineRenderingParams {}
/**
* Options used to create this {@link core/pipelines/RenderPipelineEntry.RenderPipelineEntry | RenderPipelineEntry}
*/
export interface RenderPipelineEntryOptions extends PipelineEntryOptions, RenderPipelineRenderingParams {}