typegpu 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{attributes--1y4Kirx.d.cts → attributes-B5bhZAAK.d.cts} +1 -1
- package/{attributes-Dri8dk1v.d.ts → attributes-Cfiq6vud.d.ts} +1 -1
- package/chunk-C6C35PDM.cjs +2 -0
- package/{chunk-O7JKWPDH.cjs.map → chunk-C6C35PDM.cjs.map} +1 -1
- package/chunk-ZJMGYM7L.js +2 -0
- package/chunk-ZJMGYM7L.js.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.d.cts +3 -3
- package/data/index.d.ts +3 -3
- package/data/index.js +1 -1
- package/index.cjs +9 -9
- package/index.d.cts +99 -97
- package/index.d.ts +99 -97
- package/index.js +8 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/std/index.d.cts +1 -1
- package/std/index.d.ts +1 -1
- package/{wgslTypes-D0JqCGnw.d.cts → wgslTypes-DgaoTc4M.d.cts} +22 -22
- package/{wgslTypes-D0JqCGnw.d.ts → wgslTypes-DgaoTc4M.d.ts} +22 -22
- package/chunk-O7JKWPDH.cjs +0 -2
- package/chunk-OERXDFXG.js +0 -2
- package/chunk-OERXDFXG.js.map +0 -1
package/index.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { A as AnyWgslData, T as TgpuNamable, I as Infer, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, D as Decorated, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, K as KindToDefaultFormatMap, v as KindToAcceptedAttribMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as WgslTypeLiteral, y as InferPartial, z as MemIdentity, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-
|
2
|
-
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, b as AnyFragmentInputBuiltin, c as AnyFragmentOutputBuiltin, O as OmitBuiltins } from './attributes
|
1
|
+
import { A as AnyWgslData, T as TgpuNamable, I as Infer, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, D as Decorated, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, K as KindToDefaultFormatMap, v as KindToAcceptedAttribMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as WgslTypeLiteral, y as InferPartial, z as MemIdentity, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-DgaoTc4M.cjs';
|
2
|
+
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, b as AnyFragmentInputBuiltin, c as AnyFragmentOutputBuiltin, O as OmitBuiltins } from './attributes-B5bhZAAK.cjs';
|
3
3
|
import * as smol from 'tinyest';
|
4
4
|
import { Block } from 'tinyest';
|
5
5
|
|
@@ -523,7 +523,7 @@ type DataToContainedAttribs<T> = T extends AnyWgslStruct | Unstruct ? {
|
|
523
523
|
type: VertexFormat;
|
524
524
|
} ? TgpuVertexAttrib<T['type']> : T extends {
|
525
525
|
type: keyof KindToDefaultFormatMap;
|
526
|
-
} ? TgpuVertexAttrib<KindToDefaultFormatMap[T['type']]> : never;
|
526
|
+
} ? TgpuVertexAttrib<KindToDefaultFormatMap[T['type']]> : T extends Decorated<infer TInner> ? DataToContainedAttribs<TInner> : never;
|
527
527
|
/**
|
528
528
|
* Interprets an array as a set of vertex attributes.
|
529
529
|
*/
|
@@ -651,6 +651,100 @@ interface DepthStencilAttachment {
|
|
651
651
|
stencilReadOnly?: boolean;
|
652
652
|
}
|
653
653
|
|
654
|
+
interface SamplerProps {
|
655
|
+
addressModeU?: GPUAddressMode;
|
656
|
+
addressModeV?: GPUAddressMode;
|
657
|
+
/**
|
658
|
+
* Specifies the address modes for the texture width, height, and depth
|
659
|
+
* coordinates, respectively.
|
660
|
+
*/
|
661
|
+
addressModeW?: GPUAddressMode;
|
662
|
+
/**
|
663
|
+
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
664
|
+
* texel.
|
665
|
+
*/
|
666
|
+
magFilter?: GPUFilterMode;
|
667
|
+
/**
|
668
|
+
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
669
|
+
*/
|
670
|
+
minFilter?: GPUFilterMode;
|
671
|
+
/**
|
672
|
+
* Specifies behavior for sampling between mipmap levels.
|
673
|
+
*/
|
674
|
+
mipmapFilter?: GPUMipmapFilterMode;
|
675
|
+
lodMinClamp?: number;
|
676
|
+
/**
|
677
|
+
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
678
|
+
* sampling a texture.
|
679
|
+
*/
|
680
|
+
lodMaxClamp?: number;
|
681
|
+
/**
|
682
|
+
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
683
|
+
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
684
|
+
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
685
|
+
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
686
|
+
* anisotropy supported when filtering.
|
687
|
+
*
|
688
|
+
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
689
|
+
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
690
|
+
* will be clamped to the maximum value that the platform supports.
|
691
|
+
* The precise filtering behavior is implementation-dependent.
|
692
|
+
*/
|
693
|
+
maxAnisotropy?: number;
|
694
|
+
}
|
695
|
+
interface ComparisonSamplerProps {
|
696
|
+
compare: GPUCompareFunction;
|
697
|
+
addressModeU?: GPUAddressMode;
|
698
|
+
addressModeV?: GPUAddressMode;
|
699
|
+
/**
|
700
|
+
* Specifies the address modes for the texture width, height, and depth
|
701
|
+
* coordinates, respectively.
|
702
|
+
*/
|
703
|
+
addressModeW?: GPUAddressMode;
|
704
|
+
/**
|
705
|
+
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
706
|
+
* texel.
|
707
|
+
*/
|
708
|
+
magFilter?: GPUFilterMode;
|
709
|
+
/**
|
710
|
+
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
711
|
+
*/
|
712
|
+
minFilter?: GPUFilterMode;
|
713
|
+
/**
|
714
|
+
* Specifies behavior for sampling between mipmap levels.
|
715
|
+
*/
|
716
|
+
mipmapFilter?: GPUMipmapFilterMode;
|
717
|
+
lodMinClamp?: number;
|
718
|
+
/**
|
719
|
+
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
720
|
+
* sampling a texture.
|
721
|
+
*/
|
722
|
+
lodMaxClamp?: number;
|
723
|
+
/**
|
724
|
+
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
725
|
+
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
726
|
+
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
727
|
+
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
728
|
+
* anisotropy supported when filtering.
|
729
|
+
*
|
730
|
+
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
731
|
+
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
732
|
+
* will be clamped to the maximum value that the platform supports.
|
733
|
+
* The precise filtering behavior is implementation-dependent.
|
734
|
+
*/
|
735
|
+
maxAnisotropy?: number;
|
736
|
+
}
|
737
|
+
interface TgpuSampler {
|
738
|
+
readonly resourceType: 'sampler';
|
739
|
+
}
|
740
|
+
interface TgpuComparisonSampler {
|
741
|
+
readonly resourceType: 'sampler-comparison';
|
742
|
+
}
|
743
|
+
declare function sampler(props: SamplerProps): TgpuSampler;
|
744
|
+
declare function comparisonSampler(props: ComparisonSamplerProps): TgpuComparisonSampler;
|
745
|
+
declare function isSampler(resource: unknown): resource is TgpuSampler;
|
746
|
+
declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler;
|
747
|
+
|
654
748
|
interface Unwrapper {
|
655
749
|
readonly device: GPUDevice;
|
656
750
|
unwrap(resource: TgpuComputePipeline): GPUComputePipeline;
|
@@ -661,6 +755,8 @@ interface Unwrapper {
|
|
661
755
|
unwrap(resource: TgpuTexture): GPUTexture;
|
662
756
|
unwrap(resource: TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture): GPUTextureView;
|
663
757
|
unwrap(resource: TgpuVertexLayout): GPUVertexBufferLayout;
|
758
|
+
unwrap(resource: TgpuSampler): GPUSampler;
|
759
|
+
unwrap(resource: TgpuComparisonSampler): GPUSampler;
|
664
760
|
}
|
665
761
|
|
666
762
|
interface WithCompute {
|
@@ -959,100 +1055,6 @@ type RestrictVertexUsages<TData extends BaseData> = TData extends {
|
|
959
1055
|
readonly type: WgslTypeLiteral;
|
960
1056
|
} ? ('uniform' | 'storage' | 'vertex')[] : 'vertex'[];
|
961
1057
|
|
962
|
-
interface SamplerProps {
|
963
|
-
addressModeU?: GPUAddressMode;
|
964
|
-
addressModeV?: GPUAddressMode;
|
965
|
-
/**
|
966
|
-
* Specifies the address modes for the texture width, height, and depth
|
967
|
-
* coordinates, respectively.
|
968
|
-
*/
|
969
|
-
addressModeW?: GPUAddressMode;
|
970
|
-
/**
|
971
|
-
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
972
|
-
* texel.
|
973
|
-
*/
|
974
|
-
magFilter?: GPUFilterMode;
|
975
|
-
/**
|
976
|
-
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
977
|
-
*/
|
978
|
-
minFilter?: GPUFilterMode;
|
979
|
-
/**
|
980
|
-
* Specifies behavior for sampling between mipmap levels.
|
981
|
-
*/
|
982
|
-
mipmapFilter?: GPUMipmapFilterMode;
|
983
|
-
lodMinClamp?: number;
|
984
|
-
/**
|
985
|
-
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
986
|
-
* sampling a texture.
|
987
|
-
*/
|
988
|
-
lodMaxClamp?: number;
|
989
|
-
/**
|
990
|
-
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
991
|
-
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
992
|
-
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
993
|
-
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
994
|
-
* anisotropy supported when filtering.
|
995
|
-
*
|
996
|
-
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
997
|
-
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
998
|
-
* will be clamped to the maximum value that the platform supports.
|
999
|
-
* The precise filtering behavior is implementation-dependent.
|
1000
|
-
*/
|
1001
|
-
maxAnisotropy?: number;
|
1002
|
-
}
|
1003
|
-
interface ComparisonSamplerProps {
|
1004
|
-
compare: GPUCompareFunction;
|
1005
|
-
addressModeU?: GPUAddressMode;
|
1006
|
-
addressModeV?: GPUAddressMode;
|
1007
|
-
/**
|
1008
|
-
* Specifies the address modes for the texture width, height, and depth
|
1009
|
-
* coordinates, respectively.
|
1010
|
-
*/
|
1011
|
-
addressModeW?: GPUAddressMode;
|
1012
|
-
/**
|
1013
|
-
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
1014
|
-
* texel.
|
1015
|
-
*/
|
1016
|
-
magFilter?: GPUFilterMode;
|
1017
|
-
/**
|
1018
|
-
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
1019
|
-
*/
|
1020
|
-
minFilter?: GPUFilterMode;
|
1021
|
-
/**
|
1022
|
-
* Specifies behavior for sampling between mipmap levels.
|
1023
|
-
*/
|
1024
|
-
mipmapFilter?: GPUMipmapFilterMode;
|
1025
|
-
lodMinClamp?: number;
|
1026
|
-
/**
|
1027
|
-
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
1028
|
-
* sampling a texture.
|
1029
|
-
*/
|
1030
|
-
lodMaxClamp?: number;
|
1031
|
-
/**
|
1032
|
-
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
1033
|
-
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
1034
|
-
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
1035
|
-
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
1036
|
-
* anisotropy supported when filtering.
|
1037
|
-
*
|
1038
|
-
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
1039
|
-
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
1040
|
-
* will be clamped to the maximum value that the platform supports.
|
1041
|
-
* The precise filtering behavior is implementation-dependent.
|
1042
|
-
*/
|
1043
|
-
maxAnisotropy?: number;
|
1044
|
-
}
|
1045
|
-
interface TgpuSampler {
|
1046
|
-
readonly resourceType: 'sampler';
|
1047
|
-
}
|
1048
|
-
interface TgpuComparisonSampler {
|
1049
|
-
readonly resourceType: 'sampler-comparison';
|
1050
|
-
}
|
1051
|
-
declare function sampler(props: SamplerProps): TgpuSampler;
|
1052
|
-
declare function comparisonSampler(props: ComparisonSamplerProps): TgpuComparisonSampler;
|
1053
|
-
declare function isSampler(resource: unknown): resource is TgpuSampler;
|
1054
|
-
declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler;
|
1055
|
-
|
1056
1058
|
type TgpuLayoutEntryBase = {
|
1057
1059
|
/**
|
1058
1060
|
* Limits this resource's visibility to specific shader stages.
|
package/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { A as AnyWgslData, T as TgpuNamable, I as Infer, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, D as Decorated, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, K as KindToDefaultFormatMap, v as KindToAcceptedAttribMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as WgslTypeLiteral, y as InferPartial, z as MemIdentity, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-
|
2
|
-
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, b as AnyFragmentInputBuiltin, c as AnyFragmentOutputBuiltin, O as OmitBuiltins } from './attributes-
|
1
|
+
import { A as AnyWgslData, T as TgpuNamable, I as Infer, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, D as Decorated, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, K as KindToDefaultFormatMap, v as KindToAcceptedAttribMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as WgslTypeLiteral, y as InferPartial, z as MemIdentity, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-DgaoTc4M.js';
|
2
|
+
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, b as AnyFragmentInputBuiltin, c as AnyFragmentOutputBuiltin, O as OmitBuiltins } from './attributes-Cfiq6vud.js';
|
3
3
|
import * as smol from 'tinyest';
|
4
4
|
import { Block } from 'tinyest';
|
5
5
|
|
@@ -523,7 +523,7 @@ type DataToContainedAttribs<T> = T extends AnyWgslStruct | Unstruct ? {
|
|
523
523
|
type: VertexFormat;
|
524
524
|
} ? TgpuVertexAttrib<T['type']> : T extends {
|
525
525
|
type: keyof KindToDefaultFormatMap;
|
526
|
-
} ? TgpuVertexAttrib<KindToDefaultFormatMap[T['type']]> : never;
|
526
|
+
} ? TgpuVertexAttrib<KindToDefaultFormatMap[T['type']]> : T extends Decorated<infer TInner> ? DataToContainedAttribs<TInner> : never;
|
527
527
|
/**
|
528
528
|
* Interprets an array as a set of vertex attributes.
|
529
529
|
*/
|
@@ -651,6 +651,100 @@ interface DepthStencilAttachment {
|
|
651
651
|
stencilReadOnly?: boolean;
|
652
652
|
}
|
653
653
|
|
654
|
+
interface SamplerProps {
|
655
|
+
addressModeU?: GPUAddressMode;
|
656
|
+
addressModeV?: GPUAddressMode;
|
657
|
+
/**
|
658
|
+
* Specifies the address modes for the texture width, height, and depth
|
659
|
+
* coordinates, respectively.
|
660
|
+
*/
|
661
|
+
addressModeW?: GPUAddressMode;
|
662
|
+
/**
|
663
|
+
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
664
|
+
* texel.
|
665
|
+
*/
|
666
|
+
magFilter?: GPUFilterMode;
|
667
|
+
/**
|
668
|
+
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
669
|
+
*/
|
670
|
+
minFilter?: GPUFilterMode;
|
671
|
+
/**
|
672
|
+
* Specifies behavior for sampling between mipmap levels.
|
673
|
+
*/
|
674
|
+
mipmapFilter?: GPUMipmapFilterMode;
|
675
|
+
lodMinClamp?: number;
|
676
|
+
/**
|
677
|
+
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
678
|
+
* sampling a texture.
|
679
|
+
*/
|
680
|
+
lodMaxClamp?: number;
|
681
|
+
/**
|
682
|
+
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
683
|
+
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
684
|
+
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
685
|
+
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
686
|
+
* anisotropy supported when filtering.
|
687
|
+
*
|
688
|
+
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
689
|
+
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
690
|
+
* will be clamped to the maximum value that the platform supports.
|
691
|
+
* The precise filtering behavior is implementation-dependent.
|
692
|
+
*/
|
693
|
+
maxAnisotropy?: number;
|
694
|
+
}
|
695
|
+
interface ComparisonSamplerProps {
|
696
|
+
compare: GPUCompareFunction;
|
697
|
+
addressModeU?: GPUAddressMode;
|
698
|
+
addressModeV?: GPUAddressMode;
|
699
|
+
/**
|
700
|
+
* Specifies the address modes for the texture width, height, and depth
|
701
|
+
* coordinates, respectively.
|
702
|
+
*/
|
703
|
+
addressModeW?: GPUAddressMode;
|
704
|
+
/**
|
705
|
+
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
706
|
+
* texel.
|
707
|
+
*/
|
708
|
+
magFilter?: GPUFilterMode;
|
709
|
+
/**
|
710
|
+
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
711
|
+
*/
|
712
|
+
minFilter?: GPUFilterMode;
|
713
|
+
/**
|
714
|
+
* Specifies behavior for sampling between mipmap levels.
|
715
|
+
*/
|
716
|
+
mipmapFilter?: GPUMipmapFilterMode;
|
717
|
+
lodMinClamp?: number;
|
718
|
+
/**
|
719
|
+
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
720
|
+
* sampling a texture.
|
721
|
+
*/
|
722
|
+
lodMaxClamp?: number;
|
723
|
+
/**
|
724
|
+
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
725
|
+
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
726
|
+
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
727
|
+
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
728
|
+
* anisotropy supported when filtering.
|
729
|
+
*
|
730
|
+
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
731
|
+
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
732
|
+
* will be clamped to the maximum value that the platform supports.
|
733
|
+
* The precise filtering behavior is implementation-dependent.
|
734
|
+
*/
|
735
|
+
maxAnisotropy?: number;
|
736
|
+
}
|
737
|
+
interface TgpuSampler {
|
738
|
+
readonly resourceType: 'sampler';
|
739
|
+
}
|
740
|
+
interface TgpuComparisonSampler {
|
741
|
+
readonly resourceType: 'sampler-comparison';
|
742
|
+
}
|
743
|
+
declare function sampler(props: SamplerProps): TgpuSampler;
|
744
|
+
declare function comparisonSampler(props: ComparisonSamplerProps): TgpuComparisonSampler;
|
745
|
+
declare function isSampler(resource: unknown): resource is TgpuSampler;
|
746
|
+
declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler;
|
747
|
+
|
654
748
|
interface Unwrapper {
|
655
749
|
readonly device: GPUDevice;
|
656
750
|
unwrap(resource: TgpuComputePipeline): GPUComputePipeline;
|
@@ -661,6 +755,8 @@ interface Unwrapper {
|
|
661
755
|
unwrap(resource: TgpuTexture): GPUTexture;
|
662
756
|
unwrap(resource: TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture): GPUTextureView;
|
663
757
|
unwrap(resource: TgpuVertexLayout): GPUVertexBufferLayout;
|
758
|
+
unwrap(resource: TgpuSampler): GPUSampler;
|
759
|
+
unwrap(resource: TgpuComparisonSampler): GPUSampler;
|
664
760
|
}
|
665
761
|
|
666
762
|
interface WithCompute {
|
@@ -959,100 +1055,6 @@ type RestrictVertexUsages<TData extends BaseData> = TData extends {
|
|
959
1055
|
readonly type: WgslTypeLiteral;
|
960
1056
|
} ? ('uniform' | 'storage' | 'vertex')[] : 'vertex'[];
|
961
1057
|
|
962
|
-
interface SamplerProps {
|
963
|
-
addressModeU?: GPUAddressMode;
|
964
|
-
addressModeV?: GPUAddressMode;
|
965
|
-
/**
|
966
|
-
* Specifies the address modes for the texture width, height, and depth
|
967
|
-
* coordinates, respectively.
|
968
|
-
*/
|
969
|
-
addressModeW?: GPUAddressMode;
|
970
|
-
/**
|
971
|
-
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
972
|
-
* texel.
|
973
|
-
*/
|
974
|
-
magFilter?: GPUFilterMode;
|
975
|
-
/**
|
976
|
-
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
977
|
-
*/
|
978
|
-
minFilter?: GPUFilterMode;
|
979
|
-
/**
|
980
|
-
* Specifies behavior for sampling between mipmap levels.
|
981
|
-
*/
|
982
|
-
mipmapFilter?: GPUMipmapFilterMode;
|
983
|
-
lodMinClamp?: number;
|
984
|
-
/**
|
985
|
-
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
986
|
-
* sampling a texture.
|
987
|
-
*/
|
988
|
-
lodMaxClamp?: number;
|
989
|
-
/**
|
990
|
-
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
991
|
-
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
992
|
-
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
993
|
-
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
994
|
-
* anisotropy supported when filtering.
|
995
|
-
*
|
996
|
-
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
997
|
-
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
998
|
-
* will be clamped to the maximum value that the platform supports.
|
999
|
-
* The precise filtering behavior is implementation-dependent.
|
1000
|
-
*/
|
1001
|
-
maxAnisotropy?: number;
|
1002
|
-
}
|
1003
|
-
interface ComparisonSamplerProps {
|
1004
|
-
compare: GPUCompareFunction;
|
1005
|
-
addressModeU?: GPUAddressMode;
|
1006
|
-
addressModeV?: GPUAddressMode;
|
1007
|
-
/**
|
1008
|
-
* Specifies the address modes for the texture width, height, and depth
|
1009
|
-
* coordinates, respectively.
|
1010
|
-
*/
|
1011
|
-
addressModeW?: GPUAddressMode;
|
1012
|
-
/**
|
1013
|
-
* Specifies the sampling behavior when the sample footprint is smaller than or equal to one
|
1014
|
-
* texel.
|
1015
|
-
*/
|
1016
|
-
magFilter?: GPUFilterMode;
|
1017
|
-
/**
|
1018
|
-
* Specifies the sampling behavior when the sample footprint is larger than one texel.
|
1019
|
-
*/
|
1020
|
-
minFilter?: GPUFilterMode;
|
1021
|
-
/**
|
1022
|
-
* Specifies behavior for sampling between mipmap levels.
|
1023
|
-
*/
|
1024
|
-
mipmapFilter?: GPUMipmapFilterMode;
|
1025
|
-
lodMinClamp?: number;
|
1026
|
-
/**
|
1027
|
-
* Specifies the minimum and maximum levels of detail, respectively, used internally when
|
1028
|
-
* sampling a texture.
|
1029
|
-
*/
|
1030
|
-
lodMaxClamp?: number;
|
1031
|
-
/**
|
1032
|
-
* Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
|
1033
|
-
* enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
|
1034
|
-
* Anisotropic filtering improves the image quality of textures sampled at oblique viewing
|
1035
|
-
* angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
|
1036
|
-
* anisotropy supported when filtering.
|
1037
|
-
*
|
1038
|
-
* Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
|
1039
|
-
* between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
|
1040
|
-
* will be clamped to the maximum value that the platform supports.
|
1041
|
-
* The precise filtering behavior is implementation-dependent.
|
1042
|
-
*/
|
1043
|
-
maxAnisotropy?: number;
|
1044
|
-
}
|
1045
|
-
interface TgpuSampler {
|
1046
|
-
readonly resourceType: 'sampler';
|
1047
|
-
}
|
1048
|
-
interface TgpuComparisonSampler {
|
1049
|
-
readonly resourceType: 'sampler-comparison';
|
1050
|
-
}
|
1051
|
-
declare function sampler(props: SamplerProps): TgpuSampler;
|
1052
|
-
declare function comparisonSampler(props: ComparisonSamplerProps): TgpuComparisonSampler;
|
1053
|
-
declare function isSampler(resource: unknown): resource is TgpuSampler;
|
1054
|
-
declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler;
|
1055
|
-
|
1056
1058
|
type TgpuLayoutEntryBase = {
|
1057
1059
|
/**
|
1058
1060
|
* Limits this resource's visibility to specific shader stages.
|