123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import WebGPUBinding from './WebGPUBinding.js';
- import { GPUBindingType, GPUTextureViewDimension, GPUTextureAspect } from './constants.js';
- class WebGPUSampledTexture extends WebGPUBinding {
- constructor( name, texture ) {
- super( name );
- this.isSampledTexture = true;
- this.texture = texture;
- this.dimension = GPUTextureViewDimension.TwoD;
- this.type = GPUBindingType.SampledTexture;
- this.visibility = GPUShaderStage.FRAGMENT;
- this.aspect = texture.isDepthTexture ? GPUTextureAspect.DepthOnly : GPUTextureAspect.All;
- this.textureGPU = null; // set by the renderer
- }
- getTexture() {
- return this.texture;
- }
- }
- class WebGPUSampledArrayTexture extends WebGPUSampledTexture {
- constructor( name, texture ) {
- super( name, texture );
- this.isSampledArrayTexture = true;
- this.dimension = GPUTextureViewDimension.TwoDArray;
- }
- }
- class WebGPUSampled3DTexture extends WebGPUSampledTexture {
- constructor( name, texture ) {
- super( name, texture );
- this.isSampled3DTexture = true;
- this.dimension = GPUTextureViewDimension.ThreeD;
- }
- }
- class WebGPUSampledCubeTexture extends WebGPUSampledTexture {
- constructor( name, texture ) {
- super( name, texture );
- this.isSampledCubeTexture = true;
- this.dimension = GPUTextureViewDimension.Cube;
- }
- }
- export { WebGPUSampledTexture, WebGPUSampledArrayTexture, WebGPUSampled3DTexture, WebGPUSampledCubeTexture };
|