diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/accessors.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/accessors.mdx index 800188c6b7..ca67f8c031 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/accessors.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/accessors.mdx @@ -308,7 +308,7 @@ import tgpu, { d, std } from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'] +const texture = root .createTexture({ format: 'rgba8unorm', size: [100, 100] }) .$usage('storage'); diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/data-schemas.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/data-schemas.mdx index acf2ced879..0b6c043080 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/data-schemas.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/data-schemas.mdx @@ -364,7 +364,7 @@ Texture schemas serve two main purposes: import tgpu, { d, std } from 'typegpu'; const root = await tgpu.init(); -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled', 'storage'); diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/textures.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/textures.mdx index 91ebb1ec68..b303587832 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/textures.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/textures.mdx @@ -21,7 +21,7 @@ import tgpu, { d } from 'typegpu'; const root = await tgpu.init(); -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm' as const, }).$usage('sampled'); @@ -40,7 +40,7 @@ const sampledView = texture.createView(); ## Creating a texture -Textures can be created using the `root['~unstable'].createTexture` method. It accepts a descriptor similar to vanilla `GPUTextureDescriptor`. If specified, the properties will be reflected in the created texture type - this will later help with static checks when creating views or binding the texture in a layout. +Textures can be created using the `root.createTexture` method. It accepts a descriptor similar to vanilla `GPUTextureDescriptor`. If specified, the properties will be reflected in the created texture type - this will later help with static checks when creating views or binding the texture in a layout. ```ts type TextureProps = { @@ -57,7 +57,7 @@ type TextureProps = { import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ // ^? size: [512, 512, 128], format: 'rgba8unorm', @@ -74,7 +74,7 @@ Similar to buffers, textures need usage flags to specify how they will be used. import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }) @@ -89,7 +89,7 @@ You can also add multiple flags at once: import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled', 'storage', 'render'); @@ -122,7 +122,7 @@ You can write various image sources to textures. `ExternalImageSource` includes: import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled'); @@ -155,7 +155,7 @@ declare const imageBitmap1: ImageBitmap; declare const imageBitmap2: ImageBitmap; declare const imageBitmap3: ImageBitmap; // ---cut--- -const texture3d = root['~unstable'].createTexture({ +const texture3d = root.createTexture({ size: [256, 256, 3], format: 'rgba8unorm', dimension: '3d', @@ -173,7 +173,7 @@ You can write raw binary data directly to textures using `ArrayBuffer`, typed ar import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [2, 2], format: 'rgba8unorm', }).$usage('sampled'); @@ -198,12 +198,12 @@ You can also copy from another texture: import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const sourceTexture = root['~unstable'].createTexture({ +const sourceTexture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled'); -const targetTexture = root['~unstable'].createTexture({ +const targetTexture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled'); @@ -220,7 +220,7 @@ import tgpu from 'typegpu'; const root = await tgpu.init(); declare const imageBitmap: ImageBitmap; // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', mipLevelCount: 9, // log2(256) + 1 @@ -242,7 +242,7 @@ To create a view - which will also serve as fixed texture usage - you can use on import tgpu, { d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [512, 512], format: 'rgba8unorm', }).$usage('sampled'); @@ -260,7 +260,7 @@ If type information is available the view schema will be staticly checked agains import tgpu, { d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [512, 512], format: 'rgba8unorm', }); // <-- missing .$usage('sampled') @@ -273,7 +273,7 @@ const sampledView = texture.createView(d.texture2d(d.f32)); import tgpu, { d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [512, 512], format: 'r32float', }).$usage('storage'); @@ -291,7 +291,7 @@ To sample textures in shaders, you'll often need a sampler that defines how the import tgpu from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', mipmapFilter: 'linear', @@ -312,12 +312,12 @@ Textures can be used in shaders through bind groups or as fixed resources, simil import tgpu, { d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled'); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); @@ -343,7 +343,7 @@ For textures that remain consistent across operations, you can create fixed text import tgpu, { d, std } from 'typegpu'; const root = await tgpu.init(); // ---cut--- -const texture = root['~unstable'].createTexture({ +const texture = root.createTexture({ size: [256, 256], format: 'rgba8unorm', }).$usage('sampled'); @@ -351,7 +351,7 @@ const texture = root['~unstable'].createTexture({ // Create a fixed sampled view const sampledView = texture.createView(); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts b/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts index 32c932e0a5..50ab762dd6 100644 --- a/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts @@ -51,7 +51,7 @@ const params = root.createUniform(SimParams, { const ga = createGeneticPopulation(root, params); -const trackTexture = root['~unstable'] +const trackTexture = root .createTexture({ size: [512, 512], format: 'rgba8unorm' }) .$usage('render', 'sampled'); const trackView = trackTexture.createView(); @@ -60,7 +60,7 @@ const carBitmap = await fetch('/TypeGPU/assets/genetic-car/car.png') .then((r) => r.blob()) .then(createImageBitmap); -const carSpriteTexture = root['~unstable'] +const carSpriteTexture = root .createTexture({ size: [carBitmap.width / 2, carBitmap.height / 2], format: 'rgba8unorm', @@ -69,11 +69,11 @@ const carSpriteTexture = root['~unstable'] carSpriteTexture.write(carBitmap); const carSpriteView = carSpriteTexture.createView(); -const linearSampler = root['~unstable'].createSampler({ +const linearSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); -const nearestSampler = root['~unstable'].createSampler({ +const nearestSampler = root.createSampler({ magFilter: 'nearest', minFilter: 'nearest', }); diff --git a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts index d9b15edeeb..468fba1c01 100644 --- a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts @@ -49,14 +49,14 @@ const paramsUniform = root.createUniform(VisualizationParams, { showOutside: 1, }); -const filteringSampler = root['~unstable'].createSampler({ +const filteringSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); function createResources() { const textures = [0, 1].map(() => - root['~unstable'] + root .createTexture({ size: [width, height], format: 'rgba16float', @@ -64,14 +64,14 @@ function createResources() { .$usage('storage'), ) as [FloodTexture, FloodTexture]; - const maskTexture = root['~unstable'] + const maskTexture = root .createTexture({ size: [width, height], format: 'r32uint', }) .$usage('storage') as MaskTexture; - const distanceTexture = root['~unstable'] + const distanceTexture = root .createTexture({ size: [width, height], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts b/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts index 060bd38c58..fa64ed38b4 100644 --- a/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts @@ -55,14 +55,14 @@ type FloodTexture = TgpuTexture<{ size: [number, number, 2]; format: 'rgba16floa SampledFlag & StorageFlag; -const filteringSampler = root['~unstable'].createSampler({ +const filteringSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); function createResources() { const textures = [0, 1].map(() => - root['~unstable'] + root .createTexture({ size: [canvas.width, canvas.height, 2], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts b/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts index a5f18c53db..0adc3b6b4f 100644 --- a/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts @@ -13,7 +13,7 @@ const gammaCorrection = root.createUniform(d.f32); const glyphSize = root.createUniform(d.u32, 8); const uvTransformBuffer = root.createUniform(d.mat2x2f, d.mat2x2f.identity()); -const shaderSampler = root['~unstable'].createSampler({ +const shaderSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts index be696e959f..4497c12a81 100644 --- a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts @@ -70,13 +70,13 @@ const paramsUniform = root.createUniform(Params, { sampleBias: blurStrength, }); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', mipmapFilter: 'linear', }); -const maskTexture = root['~unstable'] +const maskTexture = root .createTexture({ size: [MODEL_WIDTH, MODEL_HEIGHT], format: 'rgba8unorm', @@ -214,7 +214,7 @@ function onVideoChange(size: { width: number; height: number }) { updateCropBounds(aspectRatio); blurredTextures = [0, 1].map(() => - root['~unstable'] + root .createTexture({ size: [size.width, size.height], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/image-processing/blur/index.ts b/apps/typegpu-docs/src/examples/image-processing/blur/index.ts index b16d47e5ff..a6bd7bd0de 100644 --- a/apps/typegpu-docs/src/examples/image-processing/blur/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/blur/index.ts @@ -27,7 +27,7 @@ const Settings = d.struct({ const settingsUniform = root.createUniform(Settings); -const imageTexture = root['~unstable'] +const imageTexture = root .createTexture({ size: [srcWidth, srcHeight], format: 'rgba8unorm', @@ -36,7 +36,7 @@ const imageTexture = root['~unstable'] imageTexture.write(imageBitmap); const textures = [0, 1].map(() => { - return root['~unstable'] + return root .createTexture({ size: [srcWidth, srcHeight], format: 'rgba8unorm', @@ -45,7 +45,7 @@ const textures = [0, 1].map(() => { }); const renderView = textures[1].createView(d.texture2d(d.f32)); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts b/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts index 7aef89830a..b72f79e1fb 100644 --- a/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts @@ -53,7 +53,7 @@ const thresholdBuffer = root.createUniform(d.f32, 0.5); const colorUniform = root.createUniform(d.vec3f, d.vec3f(0, 1.0, 0)); const uvTransformUniform = root.createUniform(d.mat2x2f, d.mat2x2f.identity()); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts b/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts index 2372e12763..498c3cf8b6 100644 --- a/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts @@ -5,7 +5,7 @@ import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); const device = root.device; -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts b/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts index 901af3b406..b2db728109 100644 --- a/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts @@ -34,7 +34,7 @@ const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); const response = await fetch('/TypeGPU/assets/image-tuning/tiger.png'); const imageBitmap = await createImageBitmap(await response.blob()); -const imageTexture = root['~unstable'] +const imageTexture = root .createTexture({ size: [imageBitmap.width, imageBitmap.height], format: 'rgba8unorm', @@ -45,7 +45,7 @@ imageTexture.write(imageBitmap); const imageView = imageTexture.createView(d.texture2d(d.f32)); -const defaultLUTTexture = root['~unstable'] +const defaultLUTTexture = root .createTexture({ size: [1, 1, 1] as [number, number, number], format: 'rgba16float', @@ -62,7 +62,7 @@ const layout = tgpu.bindGroupLayout({ const lut = root.createUniform(LUTParams); const adjustments = root.createUniform(Adjustments); -const lutSampler = root['~unstable'].createSampler({ +const lutSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', addressModeU: 'clamp-to-edge', @@ -70,7 +70,7 @@ const lutSampler = root['~unstable'].createSampler({ addressModeW: 'clamp-to-edge', }); -const imageSampler = root['~unstable'].createSampler({ +const imageSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); @@ -236,7 +236,7 @@ async function updateLUT(file: string) { currentLUTTexture.destroy(); } - currentLUTTexture = root['~unstable'] + currentLUTTexture = root .createTexture({ size: [parsed.size, parsed.size, parsed.size], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/rendering/3d-fish/load-model.ts b/apps/typegpu-docs/src/examples/rendering/3d-fish/load-model.ts index 774348f6ee..e63dacdfab 100644 --- a/apps/typegpu-docs/src/examples/rendering/3d-fish/load-model.ts +++ b/apps/typegpu-docs/src/examples/rendering/3d-fish/load-model.ts @@ -37,7 +37,7 @@ export async function loadModel(root: TgpuRoot, modelPath: string, texturePath: const textureResponse = await fetch(texturePath); const imageBitmap = await createImageBitmap(await textureResponse.blob()); - const texture = root['~unstable'] + const texture = root .createTexture({ size: [imageBitmap.width, imageBitmap.height], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/clouds/index.ts b/apps/typegpu-docs/src/examples/rendering/clouds/index.ts index 2e2dd50ba9..a48563153b 100644 --- a/apps/typegpu-docs/src/examples/rendering/clouds/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/clouds/index.ts @@ -31,14 +31,14 @@ for (let i = 0; i < noiseData.length; i += 1) { noiseData[i] = Math.random() * 255; } -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', addressModeU: 'repeat', addressModeV: 'repeat', }); -const noiseTexture = root['~unstable'] +const noiseTexture = root .createTexture({ size: [NOISE_TEXTURE_SIZE, NOISE_TEXTURE_SIZE], format: 'r8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts index 59cc17524b..5ae56a452f 100644 --- a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts @@ -80,7 +80,7 @@ const materialBuffer = root.createBuffer(Material, materialProps).$usage('unifor let chosenCubemap: CubemapNames = 'campsite'; const size = 2048; -const texture = root['~unstable'] +const texture = root .createTexture({ dimension: '2d', size: [size, size, 6], @@ -90,7 +90,7 @@ const texture = root['~unstable'] await loadCubemap(texture, chosenCubemap); const cubemap = texture.createView(d.textureCube(d.f32)); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts index 786e8185b8..4bcf4e7133 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts @@ -72,7 +72,7 @@ let [width, height] = [canvas.width * qualityScale, canvas.height * qualityScale let textures = createTextures(root, width, height); let backgroundTexture = createBackgroundTexture(root, width, height); -const filteringSampler = root['~unstable'].createSampler({ +const filteringSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); @@ -816,7 +816,7 @@ async function autoSetQuaility() { }); for (let i = 0; i < 8; i++) { - const testTexture = root['~unstable'] + const testTexture = root .createTexture({ size: [canvas.width * resolutionScale, canvas.height * resolutionScale], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/numbers.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/numbers.ts index 38285439c3..385d3e4b85 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/numbers.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/numbers.ts @@ -12,7 +12,7 @@ export class NumberProvider { SampledFlag; constructor(root: TgpuRoot) { - this.digitTextureAtlas = root['~unstable'] + this.digitTextureAtlas = root .createTexture({ size: [PERCENTAGE_WIDTH, PERCENTAGE_HEIGHT, PERCENTAGE_COUNT], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/slider.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/slider.ts index b9de1c0a5d..3576f16942 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/slider.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/slider.ts @@ -99,7 +99,7 @@ export class Slider { .createBuffer(d.arrayOf(d.vec2f, this.n), this.#normals) .$usage('storage'); - this.bezierTexture = this.#root['~unstable'] + this.bezierTexture = this.#root .createTexture({ size: BEZIER_TEXTURE_SIZE, format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts index 7c0c45d801..2e32a023b6 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts @@ -61,7 +61,7 @@ export const taaResolveFn = tgpu.computeFn({ export function createTaaTextures(root: TgpuRoot, width: number, height: number) { return [0, 1].map(() => { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/utils.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/utils.ts index dddc20f00b..a0c31b7faa 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/utils.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/utils.ts @@ -40,7 +40,7 @@ export const intersectBox = ( export function createTextures(root: TgpuRoot, width: number, height: number) { return [0, 1].map(() => { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba8unorm', @@ -55,7 +55,7 @@ export function createTextures(root: TgpuRoot, width: number, height: number) { } export function createBackgroundTexture(root: TgpuRoot, width: number, height: number) { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts b/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts index 913a7a795e..1b4ec1c550 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts @@ -62,7 +62,7 @@ let [width, height] = [canvas.width * qualityScale, canvas.height * qualityScale let textures = createTextures(root, width, height); let backgroundTexture = createBackgroundTexture(root, width, height); -const filteringSampler = root['~unstable'].createSampler({ +const filteringSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); @@ -594,7 +594,7 @@ async function autoSetQuaility() { }); for (let i = 0; i < 8; i++) { - const testTexture = root['~unstable'] + const testTexture = root .createTexture({ size: [canvas.width * resolutionScale, canvas.height * resolutionScale], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts b/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts index 5432677609..3ec98bf46b 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts @@ -44,7 +44,7 @@ export const taaResolveFn = tgpu.computeFn({ export function createTaaTextures(root: TgpuRoot, width: number, height: number) { return [0, 1].map(() => { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-switch/utils.ts b/apps/typegpu-docs/src/examples/rendering/jelly-switch/utils.ts index f8097b24e6..b5ac917254 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-switch/utils.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-switch/utils.ts @@ -35,7 +35,7 @@ export const intersectBox = (rayOrigin: d.v3f, rayDirection: d.v3f, box: Boundin export function createTextures(root: TgpuRoot, width: number, height: number) { return [0, 1].map(() => { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba8unorm', @@ -50,7 +50,7 @@ export function createTextures(root: TgpuRoot, width: number, height: number) { } export function createBackgroundTexture(root: TgpuRoot, width: number, height: number) { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts index 973c4c6487..817faac6a3 100644 --- a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts @@ -41,7 +41,7 @@ floorCube.scale = d.vec3f(10, 0.1, 10); floorCube.position = d.vec3f(0, -0.5, 0); scene.add([cube, floorCube, ...orbitingCubes]); -let depthTexture = root['~unstable'] +let depthTexture = root .createTexture({ size: [canvas.width, canvas.height], format: 'depth24plus', @@ -49,7 +49,7 @@ let depthTexture = root['~unstable'] }) .$usage('render'); -let msaaTexture = root['~unstable'] +let msaaTexture = root .createTexture({ size: [canvas.width, canvas.height], format: presentationFormat as 'bgra8unorm' | 'rgba8unorm', @@ -57,7 +57,7 @@ let msaaTexture = root['~unstable'] }) .$usage('render'); -const shadowSampler = root['~unstable'].createComparisonSampler({ +const shadowSampler = root.createComparisonSampler({ compare: 'less-equal', magFilter: 'linear', minFilter: 'linear', @@ -200,7 +200,7 @@ const fragmentLightIndicator = tgpu.fragmentFn({ out: d.vec4f, })(() => d.vec4f(1.0, 1.0, 0.5, 1.0)); -const previewSampler = root['~unstable'].createSampler({ +const previewSampler = root.createSampler({ minFilter: 'nearest', magFilter: 'nearest', }); @@ -427,14 +427,14 @@ const resizeObserver = new ResizeObserver((entries) => { canvas.width = Math.max(1, Math.min(width, device.limits.maxTextureDimension2D)); canvas.height = Math.max(1, Math.min(height, device.limits.maxTextureDimension2D)); - depthTexture = root['~unstable'] + depthTexture = root .createTexture({ size: [canvas.width, canvas.height], format: 'depth24plus', sampleCount: 4, }) .$usage('render'); - msaaTexture = root['~unstable'] + msaaTexture = root .createTexture({ size: [canvas.width, canvas.height], format: presentationFormat as 'bgra8unorm' | 'rgba8unorm', diff --git a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/point-light.ts b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/point-light.ts index 64a15b1f98..0666391aec 100644 --- a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/point-light.ts +++ b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/point-light.ts @@ -34,7 +34,7 @@ export class PointLight { this.far = options.far ?? 100.0; const shadowMapSize = options.shadowMapSize ?? 512; - this.#depthCubeTexture = root['~unstable'] + this.#depthCubeTexture = root .createTexture({ size: [shadowMapSize, shadowMapSize, 6], dimension: '2d', diff --git a/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts b/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts index 86eddc063e..92ffe43c48 100644 --- a/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts @@ -31,14 +31,14 @@ function makeLightViewProj(lightDir: d.v3f, center: d.v3f = d.vec3f()) { function createCanvasTextures() { return { - msaa: root['~unstable'] + msaa: root .createTexture({ size: [canvas.width, canvas.height], format: presentationFormat, sampleCount: 4, }) .$usage('render'), - depth: root['~unstable'] + depth: root .createTexture({ size: [canvas.width, canvas.height], format: 'depth32float', @@ -53,14 +53,14 @@ function createShadowTextures( sampleCompare: 'less-equal' | 'greater' = 'less-equal', pcf = true, ) { - const shadowMap = root['~unstable'] + const shadowMap = root .createTexture({ size: [size, size], format: 'depth32float', }) .$usage('render', 'sampled'); - const comparisonSampler = root['~unstable'].createComparisonSampler({ + const comparisonSampler = root.createComparisonSampler({ compare: sampleCompare, magFilter: pcf ? 'linear' : 'nearest', minFilter: pcf ? 'linear' : 'nearest', diff --git a/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts b/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts index 4ec5163a26..2dc48346ac 100644 --- a/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts @@ -93,7 +93,7 @@ canvas.addEventListener('touchend', dismissAttribution, { once: true }); const { spriteAtlas, sdfAtlas, contours } = await createAtlases(); const physics = await createPhysicsWorld(WALL_DEFS); -const spriteTexture = root['~unstable'] +const spriteTexture = root .createTexture({ size: [SPRITE_SIZE, SPRITE_SIZE, LEVEL_COUNT], format: 'rgba8unorm', @@ -102,7 +102,7 @@ const spriteTexture = root['~unstable'] spriteTexture.write(spriteAtlas); const spriteView = spriteTexture.createView(d.texture2dArray()); -const sdfTexture = root['~unstable'] +const sdfTexture = root .createTexture({ size: [SPRITE_SIZE, SPRITE_SIZE, LEVEL_COUNT], format: 'rgba16float', @@ -110,7 +110,7 @@ const sdfTexture = root['~unstable'] .$usage('sampled', 'render'); sdfTexture.write(sdfAtlas); -const linSampler = root['~unstable'].createSampler({ +const linSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); @@ -123,9 +123,7 @@ const mergedFieldLayout = tgpu.bindGroupLayout({ function createMergedFieldResources() { const size = [canvas.width, canvas.height].map((v) => Math.ceil(v / 2)) as [number, number]; - return root['~unstable'] - .createTexture({ size, format: 'rgba16float' }) - .$usage('sampled', 'render'); + return root.createTexture({ size, format: 'rgba16float' }).$usage('sampled', 'render'); } let mergedFieldTexture = createMergedFieldResources(); diff --git a/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts b/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts index 0efb571072..861674bf4e 100644 --- a/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts +++ b/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts @@ -174,7 +174,7 @@ export function createSmoothedSdf( ) { const sdfView = sdfTexture.createView(d.texture2dArray()); - const smoothSdfTexture = root['~unstable'] + const smoothSdfTexture = root .createTexture({ size: [SPRITE_SIZE, SPRITE_SIZE, LEVEL_COUNT], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts b/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts index 53c68573ec..feecac1b2a 100644 --- a/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts @@ -198,7 +198,7 @@ function createDepthAndMsaaTextures() { if (depthTexture) { depthTexture.destroy(); } - depthTexture = root['~unstable'] + depthTexture = root .createTexture({ size: [canvas.width, canvas.height], format: 'depth24plus', @@ -209,7 +209,7 @@ function createDepthAndMsaaTextures() { if (msaaTexture) { msaaTexture.destroy(); } - msaaTexture = root['~unstable'] + msaaTexture = root .createTexture({ size: [canvas.width, canvas.height], format: presentationFormat, diff --git a/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts b/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts index 12d49831d8..9cce01d4e9 100644 --- a/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts +++ b/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts @@ -11,7 +11,7 @@ const mousePosUniform = root.createUniform(d.vec2f, d.vec2f(0.5, 0.5)); const response = await fetch('/TypeGPU/plums.jpg'); const imageBitmap = await createImageBitmap(await response.blob()); -const imageTexture = root['~unstable'] +const imageTexture = root .createTexture({ size: [imageBitmap.width, imageBitmap.height, 1], format: 'rgba8unorm', @@ -22,7 +22,7 @@ imageTexture.write(imageBitmap); imageTexture.generateMipmaps(); const sampledView = imageTexture.createView(); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', mipmapFilter: 'linear', diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts index a4fe9d42f7..a7167823ff 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts @@ -98,7 +98,7 @@ export interface BackgroundCubemap { } export function createBackgroundCubemap(root: TgpuRoot): BackgroundCubemap { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [CUBEMAP_SIZE, CUBEMAP_SIZE, 6], format: 'rgba16float', diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts index fbe86b93cc..2da4eba55b 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts @@ -44,7 +44,7 @@ const initialBloom = { }; const blendFactorUniform = root.createUniform(d.f32, 0.03); -const sdfTexture = root['~unstable'] +const sdfTexture = root .createTexture({ size: [GRID_SIZE / 2, GRID_SIZE / 2, GRID_SIZE / 2], format: 'rgba16float', @@ -56,7 +56,7 @@ const sdfWriteView = sdfTexture.createView(d.textureStorage3d('rgba16float')); const sdfBindGroup = root.createBindGroup(sdfLayout, { sdfTexture: sdfTexture, - sdfSampler: root['~unstable'].createSampler({ + sdfSampler: root.createSampler({ magFilter: 'linear', minFilter: 'linear', }), @@ -106,7 +106,7 @@ const backgroundCubemap = createBackgroundCubemap(root); const envMapBindGroup = root.createBindGroup(envMapLayout, { envMap: backgroundCubemap.view, - envSampler: root['~unstable'].createSampler({ + envSampler: root.createSampler({ magFilter: 'linear', minFilter: 'linear', }), diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts index 048c5c3eb5..063c9af504 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts @@ -25,7 +25,7 @@ const compositeLayout = tgpu.bindGroupLayout({ }); function createProcessingTexture(root: TgpuRoot, width: number, height: number) { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [width, height], format: 'rgba16float', @@ -55,7 +55,7 @@ export function createPostProcessingPipelines( const history = createProcessingTexture(root, width, height); const taaOutput = createProcessingTexture(root, width, height); - const sampler = root['~unstable'].createSampler({ + const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/simple/stencil/index.ts b/apps/typegpu-docs/src/examples/simple/stencil/index.ts index c847d55d16..2cfdb28016 100644 --- a/apps/typegpu-docs/src/examples/simple/stencil/index.ts +++ b/apps/typegpu-docs/src/examples/simple/stencil/index.ts @@ -5,7 +5,7 @@ const canvas = document.querySelector('canvas') as HTMLCanvasElement; const context = root.configureContext({ canvas, alphaMode: 'premultiplied' }); const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); -let stencilTexture = root['~unstable'] +let stencilTexture = root .createTexture({ size: [canvas.width, canvas.height], format: 'stencil8', @@ -104,7 +104,7 @@ function frame(timestamp: number) { frameId = requestAnimationFrame(frame); const resizeObserver = new ResizeObserver(() => { - stencilTexture = root['~unstable'] + stencilTexture = root .createTexture({ size: [canvas.width, canvas.height], format: 'stencil8', diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts index 20a2b57b2d..f6276a9478 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts @@ -290,7 +290,7 @@ const recreateResources = (size: number) => { const isBitpacked = chosenPipeline === 'bitpacked'; dataTextures = Array.from({ length: 2 }, () => - root['~unstable'] + root .createTexture({ size: [isBitpacked ? size / 32 : size, size], format: 'r32uint', diff --git a/apps/typegpu-docs/src/examples/simulation/gravity/helpers.ts b/apps/typegpu-docs/src/examples/simulation/gravity/helpers.ts index e7e096aedb..ae2a20fd12 100644 --- a/apps/typegpu-docs/src/examples/simulation/gravity/helpers.ts +++ b/apps/typegpu-docs/src/examples/simulation/gravity/helpers.ts @@ -69,7 +69,7 @@ function getSkyBoxUrls() { export async function loadSkyBox(root: TgpuRoot) { const size = 2048; - const texture = root['~unstable'] + const texture = root .createTexture({ dimension: '2d', size: [size, size, 6], @@ -128,7 +128,7 @@ export async function loadModel(root: TgpuRoot, modelPath: string) { } export async function loadSphereTextures(root: TgpuRoot) { - const texture = root['~unstable'] + const texture = root .createTexture({ dimension: '2d', size: [2048, 1024, sphereTextureNames.length], diff --git a/apps/typegpu-docs/src/examples/simulation/gravity/index.ts b/apps/typegpu-docs/src/examples/simulation/gravity/index.ts index 1a13b8aebb..b7043ddfbf 100644 --- a/apps/typegpu-docs/src/examples/simulation/gravity/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/gravity/index.ts @@ -33,7 +33,7 @@ const context = root.configureContext({ canvas, alphaMode: 'premultiplied' }); // static resources (created on the example load) -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts b/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts index cfed0d162c..ac7573a131 100644 --- a/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts @@ -122,7 +122,7 @@ const params = root.createUniform(Params, { }); const textures = [0, 1].map(() => - root['~unstable'] + root .createTexture({ size: [resolution.x, resolution.y, resolution.z], format: 'r32float', @@ -281,7 +281,7 @@ const updateAgents = tgpu.computeFn({ std.textureStore(computeLayout.$.newState, d.vec3u(newPos), d.vec4f(newState, 0, 0, 1)); }); -const sampler = root['~unstable'].createSampler({ +const sampler = root.createSampler({ magFilter: canFilter ? 'linear' : 'nearest', minFilter: canFilter ? 'linear' : 'nearest', }); diff --git a/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts b/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts index c9f5d52b69..8f183faa86 100644 --- a/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts @@ -49,7 +49,7 @@ const params = root.createUniform(Params, defaultParams); const deltaTime = root.createUniform(d.f32, 0.016); const textures = [0, 1].map(() => - root['~unstable'] + root .createTexture({ size: [resolution.x, resolution.y], format: 'rgba8unorm', @@ -183,7 +183,7 @@ const fullScreenTriangle = tgpu.vertexFn({ }; }); -const filteringSampler = root['~unstable'].createSampler({ +const filteringSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts b/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts index 66ed7fa253..5e20628b93 100644 --- a/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts @@ -21,7 +21,7 @@ const context = root.configureContext({ canvas, alphaMode: 'premultiplied' }); // Helpers function createField(name: string) { - return root['~unstable'] + return root .createTexture({ size: [p.SIM_N, p.SIM_N], format: 'rgba16float' }) .$usage('storage', 'sampled') .$name(name); @@ -92,7 +92,7 @@ const plums = await createImageBitmap(await response.blob(), { resizeQuality: 'high', }); -const backgroundTexture = root['~unstable'] +const backgroundTexture = root .createTexture({ size: [p.N, p.N], format: 'rgba8unorm' }) .$usage('sampled', 'render'); device.queue.copyExternalImageToTexture( @@ -110,7 +110,7 @@ const newInkTex = createField('addedInk'); const forceTex = createField('force'); const divergenceTex = createField('divergence'); -const linSampler = root['~unstable'].createSampler({ +const linSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); diff --git a/apps/typegpu-docs/src/examples/tests/texture-test/index.ts b/apps/typegpu-docs/src/examples/tests/texture-test/index.ts index 054e930d88..9b0f7efccf 100644 --- a/apps/typegpu-docs/src/examples/tests/texture-test/index.ts +++ b/apps/typegpu-docs/src/examples/tests/texture-test/index.ts @@ -50,7 +50,7 @@ function createTestTexture(format: TestFormat, size: readonly [number, number]) }, mips: ${mipLevels}, filterable: ${isFilterable(format)}`, ); - return root['~unstable'] + return root .createTexture({ size, format, @@ -62,13 +62,13 @@ function createTestTexture(format: TestFormat, size: readonly [number, number]) const biasUniform = root.createUniform(d.f32); const channelUniform = root.createUniform(d.i32); -const filteringSampler = root['~unstable'].createSampler({ +const filteringSampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', mipmapFilter: 'linear', }); -const nearestSampler = root['~unstable'].createSampler({ +const nearestSampler = root.createSampler({ magFilter: 'nearest', minFilter: 'nearest', mipmapFilter: 'nearest', diff --git a/packages/typegpu/src/core/root/rootTypes.ts b/packages/typegpu/src/core/root/rootTypes.ts index 05b9c3db32..e640007ab8 100644 --- a/packages/typegpu/src/core/root/rootTypes.ts +++ b/packages/typegpu/src/core/root/rootTypes.ts @@ -950,6 +950,36 @@ export interface TgpuRoot extends Unwrapper, WithBinding { gpuBuffer: GPUBuffer, ): TgpuReadonly; + createTexture< + TWidth extends number, + THeight extends number, + TDepth extends number, + TSize extends + | readonly [TWidth] + | readonly [TWidth, THeight] + | readonly [TWidth, THeight, TDepth], + TFormat extends GPUTextureFormat, + TMipLevelCount extends number, + TSampleCount extends number, + TViewFormats extends GPUTextureFormat[], + TDimension extends GPUTextureDimension, + >( + props: CreateTextureOptions< + TSize, + TFormat, + TMipLevelCount, + TSampleCount, + TViewFormats, + TDimension + >, + ): TgpuTexture< + CreateTextureResult + >; + + createSampler(props: WgslSamplerProps): TgpuFixedSampler; + + createComparisonSampler(props: WgslComparisonSamplerProps): TgpuFixedComparisonSampler; + /** * Creates a query set for collecting timestamps or occlusion queries. * @@ -1033,6 +1063,7 @@ export interface ExperimentalTgpuRoot readonly nameRegistrySetting: 'strict' | 'random'; readonly shaderGenerator?: ShaderGenerator | undefined; + /** @deprecated Use `root.createTexture` instead. */ createTexture< TWidth extends number, THeight extends number, @@ -1078,8 +1109,10 @@ export interface ExperimentalTgpuRoot callback: (pass: RenderBundleEncoderPass) => void, ): GPURenderBundle; + /** @deprecated Use `root.createSampler` instead. */ createSampler(props: WgslSamplerProps): TgpuFixedSampler; + /** @deprecated Use `root.createComparisonSampler` instead. */ createComparisonSampler(props: WgslComparisonSamplerProps): TgpuFixedComparisonSampler; /** diff --git a/packages/typegpu/tests/bindGroupLayout.test.ts b/packages/typegpu/tests/bindGroupLayout.test.ts index 664048858c..b7fe5d5a81 100644 --- a/packages/typegpu/tests/bindGroupLayout.test.ts +++ b/packages/typegpu/tests/bindGroupLayout.test.ts @@ -422,7 +422,7 @@ describe('TgpuBindGroup', () => { }); it('populates a simple layout with a typed sampler', ({ root }) => { - const sampler = root['~unstable'].createSampler({ + const sampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); @@ -464,7 +464,7 @@ describe('TgpuBindGroup', () => { root.createBindGroup(layout, { // @ts-expect-error - foo: root['~unstable'].createComparisonSampler({ compare: 'less' }), + foo: root.createComparisonSampler({ compare: 'less' }), }); }); }); @@ -504,7 +504,7 @@ describe('TgpuBindGroup', () => { }); it('populates a simple layout with a typed sampler', ({ root }) => { - const sampler = root['~unstable'].createComparisonSampler({ + const sampler = root.createComparisonSampler({ compare: 'equal', }); @@ -563,13 +563,13 @@ describe('TgpuBindGroup', () => { }); const bg = root.createBindGroup(layout, { - foo: root['~unstable'] + foo: root .createTexture({ size: [64, 64], format: 'rgba8unorm', }) .$usage('sampled'), - bar: root['~unstable'] + bar: root .createTexture({ size: [64, 64], format: 'bgra8unorm', diff --git a/packages/typegpu/tests/std/texture/textureLoad.test.ts b/packages/typegpu/tests/std/texture/textureLoad.test.ts index 5776af3459..ff498b7e05 100644 --- a/packages/typegpu/tests/std/texture/textureLoad.test.ts +++ b/packages/typegpu/tests/std/texture/textureLoad.test.ts @@ -191,7 +191,7 @@ describe('textureLoad', () => { }); it('does not allow for raw schemas to be passed in', ({ root }) => { - const someTexture = root['~unstable'] + const someTexture = root .createTexture({ size: [256, 256], format: 'rgba8unorm', diff --git a/packages/typegpu/tests/std/texture/textureSample.test.ts b/packages/typegpu/tests/std/texture/textureSample.test.ts index a9f667cd0d..c1886cdb54 100644 --- a/packages/typegpu/tests/std/texture/textureSample.test.ts +++ b/packages/typegpu/tests/std/texture/textureSample.test.ts @@ -12,7 +12,7 @@ describe('textureSample', () => { minFilter: 'linear', magFilter: 'linear', }); - const someTexture = root['~unstable'] + const someTexture = root .createTexture({ size: [256, 256], format: 'rgba8unorm', diff --git a/packages/typegpu/tests/unplugin/autoname.test.ts b/packages/typegpu/tests/unplugin/autoname.test.ts index bd54f40c82..45faa7039b 100644 --- a/packages/typegpu/tests/unplugin/autoname.test.ts +++ b/packages/typegpu/tests/unplugin/autoname.test.ts @@ -43,15 +43,15 @@ describe('autonaming', () => { const myGuardedPipeline = root.createGuardedComputePipeline(() => { 'use gpu'; }); - const myTexture = root['~unstable'].createTexture({ + const myTexture = root.createTexture({ size: [1, 1], format: 'rgba8unorm', }); - const mySampler = root['~unstable'].createSampler({ + const mySampler = root.createSampler({ magFilter: 'linear', minFilter: 'linear', }); - const myComparisonSampler = root['~unstable'].createComparisonSampler({ + const myComparisonSampler = root.createComparisonSampler({ compare: 'equal', }); @@ -79,7 +79,7 @@ describe('autonaming', () => { }); it('names views', ({ root }) => { - const texture = root['~unstable'] + const texture = root .createTexture({ size: [256, 256], format: 'rgba8unorm',