/
descriptor-set-layout.ts
53 lines (40 loc) · 1.39 KB
/
descriptor-set-layout.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
/**
* @packageDocumentation
* @module gfx
*/
import { GFXDescriptorType, GFXObject, GFXObjectType, GFXShaderStageFlags } from './define';
import { GFXDevice } from './device';
import { GFXSampler } from './sampler';
export interface IGFXDescriptorSetLayoutBinding {
descriptorType: GFXDescriptorType;
count: number;
stageFlags: GFXShaderStageFlags;
immutableSamplers?: GFXSampler[];
}
export interface IGFXDescriptorSetLayoutInfo {
// array index is used as the binding numbers,
// i.e. they should be strictly consecutive and start from 0
bindings: IGFXDescriptorSetLayoutBinding[];
}
export const DESCRIPTOR_DYNAMIC_TYPE = GFXDescriptorType.DYNAMIC_STORAGE_BUFFER | GFXDescriptorType.DYNAMIC_UNIFORM_BUFFER;
/**
* @en GFX descriptor sets layout.
* @zh GFX 描述符集布局。
*/
export abstract class GFXDescriptorSetLayout extends GFXObject {
get bindings () {
return this._bindings;
}
get descriptorIndices () {
return this._descriptorIndices;
}
protected _device: GFXDevice;
protected _bindings: IGFXDescriptorSetLayoutBinding[] = [];
protected _descriptorIndices: number[] = [];
constructor (device: GFXDevice) {
super(GFXObjectType.DESCRIPTOR_SET_LAYOUT);
this._device = device;
}
public abstract initialize (info: IGFXDescriptorSetLayoutInfo): boolean;
public abstract destroy (): void;
}