WebKit Bugzilla
Attachment 348801 Details for
Bug 188940
: [WHLSL] Implement texture types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Needs tests for SampleCmpLevelZero
bug-188940-20180903195641.patch (text/plain), 459.30 KB, created by
Myles C. Maxfield
on 2018-09-03 19:56:42 PDT
(
hide
)
Description:
Needs tests for SampleCmpLevelZero
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-09-03 19:56:42 PDT
Size:
459.30 KB
patch
obsolete
>Subversion Revision: 235589 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 5a433aeef506b6f46556013bfbb4361bf219ac1a..29081d61c2e03de6f0b195a66c3488958c5bb06c 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,179 @@ >+2018-09-03 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [WHLSL] Implement texture types >+ https://bugs.webkit.org/show_bug.cgi?id=188940 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebGPUShadingLanguageRI/All.js: >+ * WebGPUShadingLanguageRI/Casts.js: Added. >+ (cast): >+ (bitwiseCast): >+ (castToUchar): >+ (castToUshort): >+ (castToUint): >+ (castToChar): >+ (castToShort): >+ (castToInt): >+ (castToHalf): >+ (castToFloat): >+ * WebGPUShadingLanguageRI/Intrinsics.js: >+ (Intrinsics.): >+ (Intrinsics.checkFalse): >+ (Intrinsics.boxVector): >+ (Intrinsics.unboxVector): >+ (Intrinsics): >+ (Intrinsics.cast): Deleted. >+ (Intrinsics.bitwiseCast): Deleted. >+ (Intrinsics.castToHalf): Deleted. >+ * WebGPUShadingLanguageRI/SPIRV.html: >+ * WebGPUShadingLanguageRI/Sampler.js: Added. >+ (Sampler): >+ (Sampler.prototype.get rAddressMode): >+ (Sampler.prototype.get sAddressMode): >+ (Sampler.prototype.get tAddressMode): >+ (Sampler.prototype.get minFilter): >+ (Sampler.prototype.get magFilter): >+ (Sampler.prototype.get mipmapFilter): >+ (Sampler.prototype.get lodMinClamp): >+ (Sampler.prototype.get lodMaxClamp): >+ (Sampler.prototype.get maxAnisotropy): >+ (Sampler.prototype.get compareFunction): >+ (Sampler.prototype.get borderColor): >+ (Sampler.prototype.calculateBorderColor.computeValues): >+ (Sampler.prototype.calculateBorderColor): >+ * WebGPUShadingLanguageRI/StandardLibrary.js: >+ (let.standardLibrary): >+ * WebGPUShadingLanguageRI/Test.html: >+ * WebGPUShadingLanguageRI/Test.js: >+ (makeSampler): >+ (make1DTexture): >+ (make1DTextureArray): >+ (make2DTexture): >+ (make2DTextureArray): >+ (make3DTexture): >+ (makeTextureCube): >+ (makeRW1DTexture): >+ (makeRW1DTextureArray): >+ (makeRW2DTexture): >+ (makeRW2DTextureArray): >+ (makeRW3DTexture): >+ (make2DDepthTexture): >+ (make2DDepthTextureArray): >+ (makeDepthTextureCube): >+ (makeRW2DDepthTexture): >+ (makeRW2DDepthTextureArray): >+ (checkFloat4): >+ * WebGPUShadingLanguageRI/Texture.js: Added. >+ (Texture): >+ (Texture.prototype.get dimension): >+ (Texture.prototype.get width): >+ (Texture.prototype.get height): >+ (Texture.prototype.get depth): >+ (Texture.prototype.get levelCount): >+ (Texture.prototype.get layerCount): >+ (Texture.prototype.get innerType): >+ (Texture.prototype.get data): >+ (Texture.prototype.elementChecked): >+ (Texture.prototype.setElementChecked): >+ (Texture1D): >+ (Texture1D.prototype.widthAtLevel): >+ (Texture1D.prototype.heightAtLevel): >+ (Texture1D.prototype.depthAtLevel): >+ (Texture1D.prototype.element): >+ (Texture1D.prototype.setElement): >+ (Texture1DArray): >+ (Texture1DArray.prototype.widthAtLevel): >+ (Texture1DArray.prototype.heightAtLevel): >+ (Texture1DArray.prototype.depthAtLevel): >+ (Texture1DArray.prototype.element): >+ (Texture1DArray.prototype.setElement): >+ (Texture2D): >+ (Texture2D.prototype.widthAtLevel): >+ (Texture2D.prototype.heightAtLevel): >+ (Texture2D.prototype.depthAtLevel): >+ (Texture2D.prototype.element): >+ (Texture2D.prototype.setElement): >+ (Texture2DArray): >+ (Texture2DArray.prototype.widthAtLevel): >+ (Texture2DArray.prototype.heightAtLevel): >+ (Texture2DArray.prototype.depthAtLevel): >+ (Texture2DArray.prototype.element): >+ (Texture2DArray.prototype.setElement): >+ (Texture3D): >+ (Texture3D.prototype.widthAtLevel): >+ (Texture3D.prototype.heightAtLevel): >+ (Texture3D.prototype.depthAtLevel): >+ (Texture3D.prototype.element): >+ (Texture3D.prototype.setElement): >+ (TextureCube): >+ (TextureCube.prototype.widthAtLevel): >+ (TextureCube.prototype.heightAtLevel): >+ (TextureCube.prototype.depthAtLevel): >+ (TextureCube.prototype.element): >+ (TextureCube.prototype.setElement): >+ (Texture1DRW): >+ (Texture1DRW.prototype.widthAtLevel): >+ (Texture1DRW.prototype.heightAtLevel): >+ (Texture1DRW.prototype.depthAtLevel): >+ (Texture1DRW.prototype.element): >+ (Texture1DRW.prototype.setElement): >+ (Texture1DArrayRW): >+ (Texture1DArrayRW.prototype.widthAtLevel): >+ (Texture1DArrayRW.prototype.heightAtLevel): >+ (Texture1DArrayRW.prototype.depthAtLevel): >+ (Texture1DArrayRW.prototype.element): >+ (Texture1DArrayRW.prototype.setElement): >+ (Texture2DRW): >+ (Texture2DRW.prototype.widthAtLevel): >+ (Texture2DRW.prototype.heightAtLevel): >+ (Texture2DRW.prototype.depthAtLevel): >+ (Texture2DRW.prototype.element): >+ (Texture2DRW.prototype.setElement): >+ (Texture2DArrayRW): >+ (Texture2DArrayRW.prototype.widthAtLevel): >+ (Texture2DArrayRW.prototype.heightAtLevel): >+ (Texture2DArrayRW.prototype.depthAtLevel): >+ (Texture2DArrayRW.prototype.element): >+ (Texture2DArrayRW.prototype.setElement): >+ (let.TextureDepth2DArrayRW.Texture2DArrayRW.Texture3DRW): >+ (let.TextureDepth2DArrayRW.Texture2DArrayRW.Texture3DRW.prototype.widthAtLevel): >+ (let.TextureDepth2DArrayRW.Texture2DArrayRW.Texture3DRW.prototype.heightAtLevel): >+ (let.TextureDepth2DArrayRW.Texture2DArrayRW.Texture3DRW.prototype.depthAtLevel): >+ (let.TextureDepth2DArrayRW.Texture2DArrayRW.Texture3DRW.prototype.element): >+ (let.TextureDepth2DArrayRW.Texture2DArrayRW.Texture3DRW.prototype.setElement): >+ * WebGPUShadingLanguageRI/TextureOperations.js: Added. >+ (depthCompareOperation): >+ (conversionToRGBA): >+ (projectionOperation): >+ (cubeMapFaceSelection): >+ (cubeMapCoordinateTransformation): >+ (cubeMapDerivativeTransformation): >+ (scaleFactorOperation): >+ (levelOfDetailOperation): >+ (nearest): >+ (imageLevelSelection): >+ (strqaToUVWATransformation): >+ (rne): >+ (uvwaToIJKLNTransformationAndArrayLayerSelection): >+ (integerTexelCoordinateOperations): >+ (mirror): >+ (transform): >+ (wrappingOperation): >+ (calculateLambda): >+ (shouldBeBorder): >+ (accessColor): >+ (computeTau): >+ (reduce): >+ (texelGathering): >+ (computeColorFromLevel): >+ (texelFiltering): >+ (castToInnerTypeForGather): >+ (gatherTexture): >+ (castToInnerType): >+ (sampleTexture): >+ * WebGPUShadingLanguageRI/index.html: >+ > 2018-09-01 Michael Catanzaro <mcatanzaro@igalia.com> > > [WPE] 2.21.91 fails to build with ENABLE_MINIBROWSER >diff --git a/Tools/WebGPUShadingLanguageRI/All.js b/Tools/WebGPUShadingLanguageRI/All.js >index 9c2a37150c1e976b926cfbee23437520a8de4a47..90fc8413a65122446bf01fd967dd65139a0f87e9 100644 >--- a/Tools/WebGPUShadingLanguageRI/All.js >+++ b/Tools/WebGPUShadingLanguageRI/All.js >@@ -51,6 +51,7 @@ load("BuiltinVectorGetter.js"); > load("BuiltinVectorSetter.js"); > load("CallExpression.js"); > load("CallFunction.js"); >+load("Casts.js"); > load("Check.js"); > load("CheckLiteralTypes.js"); > load("CheckLoops.js"); >@@ -138,6 +139,7 @@ load("ResolveTypeDefs.js"); > load("Return.js"); > load("ReturnChecker.js"); > load("ReturnException.js"); >+load("Sampler.js"); > load("StandardLibrary.js"); > load("StatementCloner.js"); > load("StructLayoutBuilder.js"); >@@ -150,6 +152,8 @@ load("SynthesizeStructAccessors.js"); > load("SynthesizeCopyConstructorOperator.js"); > load("SynthesizeDefaultConstructorOperator.js"); > load("TernaryExpression.js"); >+load("Texture.js"); >+load("TextureOperations.js"); > load("TrapStatement.js"); > load("TypeDef.js"); > load("TypeDefResolver.js"); >diff --git a/Tools/WebGPUShadingLanguageRI/Casts.js b/Tools/WebGPUShadingLanguageRI/Casts.js >new file mode 100644 >index 0000000000000000000000000000000000000000..acbb2ea028535b4670423097f7a5b57caf6b8b1c >--- /dev/null >+++ b/Tools/WebGPUShadingLanguageRI/Casts.js >@@ -0,0 +1,115 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+"use strict"; >+ >+function cast(typedArrayConstructor, number) >+{ >+ var array = new typedArrayConstructor(1); >+ array[0] = number; >+ return array[0]; >+} >+ >+function bitwiseCast(typedArrayConstructor1, typedArrayConstructor2, value) >+{ >+ let typedArray1 = new typedArrayConstructor1(1); >+ let typedArray2 = new typedArrayConstructor2(typedArray1.buffer); >+ typedArray1[0] = value; >+ return typedArray2[0]; >+} >+ >+function castToUchar(number) >+{ >+ return number & 0xFF; >+} >+ >+function castToUshort(number) >+{ >+ return number & 0xFFFF; >+} >+ >+function castToUint(number) >+{ >+ return number >>> 0; >+} >+ >+function castToChar(number) >+{ >+ return cast(Int8Array, number); >+} >+ >+function castToShort(number) >+{ >+ return cast(Int16Array, number); >+} >+ >+function castToInt(number) >+{ >+ return number | 0; >+} >+ >+function castToHalf(number) >+{ >+ // FIXME: Make this math obey IEEE 754. >+ if (Number.isNaN(number)) >+ return number >+ if (number > 65504) >+ return Number.POSITIVE_INFINITY; >+ if (number < -65504) >+ return Number.NEGATIVE_INFINITY; >+ if (number > 0 && number < Math.pow(2, -24)) >+ return 0; >+ if (number < 0 && number > -Math.pow(2, -24)) >+ return -0; >+ let doubleArray = new Float64Array(1); >+ let uintArray = new Uint8Array(doubleArray.buffer); >+ doubleArray[0] = number; >+ let sign = uintArray[7] & 0x80; >+ let exponent = ((uintArray[7] & 0x7f) << 4) | ((uintArray[6] & 0xf0) >>> 4); >+ let significand = ((uintArray[6] & 0x0f) << 6) | ((uintArray[5] & 0xfc) >>> 2); >+ >+ if ((exponent - 1023) < -14) { >+ exponent = 0; >+ significand = (Math.abs(number) * Math.pow(2, 24)) >>> 0; >+ let value = Math.pow(2, -14) * significand / 1024; >+ if (sign != 0) >+ value *= -1; >+ return value; >+ } >+ >+ doubleArray[0] = 0; >+ >+ uintArray[7] |= sign; >+ uintArray[7] |= (exponent >>> 4); >+ uintArray[6] |= ((exponent << 4) & 0xf0); >+ uintArray[6] |= (significand >>> 6); >+ uintArray[5] |= ((significand << 2) & 0xfc); >+ >+ return doubleArray[0]; >+} >+ >+function castToFloat(number) >+{ >+ return Math.fround(number); >+} >diff --git a/Tools/WebGPUShadingLanguageRI/Intrinsics.js b/Tools/WebGPUShadingLanguageRI/Intrinsics.js >index b004067f5ebfb3a8b4bd98e437a8c0768be26f1e..1b0a12af4002a90be635e738f1d5e7d90dcb04d3 100644 >--- a/Tools/WebGPUShadingLanguageRI/Intrinsics.js >+++ b/Tools/WebGPUShadingLanguageRI/Intrinsics.js >@@ -48,61 +48,6 @@ class Intrinsics { > return true; > } > >- function cast(typedArrayConstructor, number) >- { >- var array = new typedArrayConstructor(1); >- array[0] = number; >- return array[0]; >- } >- >- function bitwiseCast(typedArrayConstructor1, typedArrayConstructor2, value) >- { >- let typedArray1 = new typedArrayConstructor1(1); >- let typedArray2 = new typedArrayConstructor2(typedArray1.buffer); >- typedArray1[0] = value; >- return typedArray2[0]; >- } >- >- function castToHalf(number) >- { >- // FIXME: Make this math obey IEEE 754. >- if (Number.isNaN(number)) >- return number >- if (number > 65504) >- return Number.POSITIVE_INFINITY; >- if (number < -65504) >- return Number.NEGATIVE_INFINITY; >- if (number > 0 && number < Math.pow(2, -24)) >- return 0; >- if (number < 0 && number > -Math.pow(2, -24)) >- return -0; >- let doubleArray = new Float64Array(1); >- let uintArray = new Uint8Array(doubleArray.buffer); >- doubleArray[0] = number; >- let sign = uintArray[7] & 0x80; >- let exponent = ((uintArray[7] & 0x7f) << 4) | ((uintArray[6] & 0xf0) >>> 4); >- let significand = ((uintArray[6] & 0x0f) << 6) | ((uintArray[5] & 0xfc) >>> 2); >- >- if ((exponent - 1023) < -14) { >- exponent = 0; >- significand = (Math.abs(number) * Math.pow(2, 24)) >>> 0; >- let value = Math.pow(2, -14) * significand / 1024; >- if (sign != 0) >- value *= -1; >- return value; >- } >- >- doubleArray[0] = 0; >- >- uintArray[7] |= sign; >- uintArray[7] |= (exponent >>> 4); >- uintArray[6] |= ((exponent << 4) & 0xf0); >- uintArray[6] |= (significand >>> 6); >- uintArray[5] |= ((significand << 2) & 0xfc); >- >- return doubleArray[0]; >- } >- > this._map.set( > "native typedef void", > type => { >@@ -128,15 +73,15 @@ class Intrinsics { > type.isInt = true; > type.isNumber = true; > type.isSigned = false; >- type.canRepresent = value => isBitwiseEquivalent(value & 0xff, value); >+ type.canRepresent = value => isBitwiseEquivalent(castToUchar(value), value); > type.size = 1; > type.defaultValue = 0; >- type.createLiteral = (origin, value) => IntLiteral.withType(origin, value & 0xff, type); >- type.successorValue = value => (value + 1) & 0xff; >+ type.createLiteral = (origin, value) => IntLiteral.withType(origin, castToUchar(value), type); >+ type.successorValue = value => castToUchar(value + 1); > type.valuesEqual = (a, b) => a === b; > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); >- type.formatValueFromIntLiteral = value => value & 0xff; >- type.formatValueFromUintLiteral = value => value & 0xff; >+ type.formatValueFromIntLiteral = value => castToUchar(value); >+ type.formatValueFromUintLiteral = value => castToUchar(value); > type.allValues = function*() { > for (let i = 0; i <= 0xff; ++i) > yield {value: i, name: i}; >@@ -152,15 +97,15 @@ class Intrinsics { > type.isInt = true; > type.isNumber = true; > type.isSigned = false; >- type.canRepresent = value => isBitwiseEquivalent(value & 0xffff, value); >+ type.canRepresent = value => isBitwiseEquivalent(castToUshort(value), value); > type.size = 1; > type.defaultValue = 0; >- type.createLiteral = (origin, value) => IntLiteral.withType(origin, value & 0xffff, type); >- type.successorValue = value => (value + 1) & 0xffff; >+ type.createLiteral = (origin, value) => IntLiteral.withType(origin, castToUshort(value), type); >+ type.successorValue = value => castToUshort(value + 1); > type.valuesEqual = (a, b) => a === b; > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); >- type.formatValueFromIntLiteral = value => value & 0xffff; >- type.formatValueFromUintLiteral = value => value & 0xffff; >+ type.formatValueFromIntLiteral = value => castToUshort(value); >+ type.formatValueFromUintLiteral = value => castToUshort(value); > type.allValues = function*() { > for (let i = 0; i <= 0xffff; ++i) > yield {value: i, name: i}; >@@ -175,15 +120,15 @@ class Intrinsics { > type.isInt = true; > type.isNumber = true; > type.isSigned = false; >- type.canRepresent = value => isBitwiseEquivalent(value >>> 0, value); >+ type.canRepresent = value => isBitwiseEquivalent(castToUint(value), value); > type.size = 1; > type.defaultValue = 0; >- type.createLiteral = (origin, value) => IntLiteral.withType(origin, value >>> 0, type); >- type.successorValue = value => (value + 1) >>> 0; >+ type.createLiteral = (origin, value) => IntLiteral.withType(origin, castToUint(value), type); >+ type.successorValue = value => castToUint(value + 1); > type.valuesEqual = (a, b) => a === b; > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); >- type.formatValueFromIntLiteral = value => value >>> 0; >- type.formatValueFromUintLiteral = value => value >>> 0; >+ type.formatValueFromIntLiteral = value => castToUint(value); >+ type.formatValueFromUintLiteral = value => castToUint(value); > type.allValues = function*() { > for (let i = 0; i <= 0xffffffff; ++i) > yield {value: i, name: i}; >@@ -198,18 +143,18 @@ class Intrinsics { > type.isInt = true; > type.isNumber = true; > type.isSigned = true; >- type.canRepresent = value => isBitwiseEquivalent(cast(Int8Array, value), value); >+ type.canRepresent = value => isBitwiseEquivalent(castToChar(value), value); > type.size = 1; > type.defaultValue = 0; >- type.createLiteral = (origin, value) => IntLiteral.withType(origin, cast(Int8Array, value), type); >- type.successorValue = value => cast(Int8Array, value + 1); >+ type.createLiteral = (origin, value) => IntLiteral.withType(origin, castToChar(value), type); >+ type.successorValue = value => castToChar(value + 1); > type.valuesEqual = (a, b) => a === b; > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); >- type.formatValueFromIntLiteral = value => cast(Int8Array, value); >- type.formatValueFromUintLiteral = value => cast(Int8Array, value); >+ type.formatValueFromIntLiteral = value => castToChar(value); >+ type.formatValueFromUintLiteral = value => castToChar(value); > type.allValues = function*() { > for (let i = 0; i <= 0xff; ++i) { >- let value = cast(Int8Array, i); >+ let value = castToChar(i); > yield {value: value, name: value}; > } > }; >@@ -223,18 +168,18 @@ class Intrinsics { > type.isInt = true; > type.isNumber = true; > type.isSigned = true; >- type.canRepresent = value => isBitwiseEquivalent(cast(Int16Array, value), value); >+ type.canRepresent = value => isBitwiseEquivalent(castToShort(value), value); > type.size = 1; > type.defaultValue = 0; >- type.createLiteral = (origin, value) => IntLiteral.withType(origin, cast(Int16Array, value), type); >- type.successorValue = value => cast(Int16Array, value + 1); >+ type.createLiteral = (origin, value) => IntLiteral.withType(origin, castToShort(value), type); >+ type.successorValue = value => castToShort(value + 1); > type.valuesEqual = (a, b) => a === b; > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); >- type.formatValueFromIntLiteral = value => cast(Int16Array, value); >- type.formatValueFromUintLiteral = value => cast(Int16Array, value); >+ type.formatValueFromIntLiteral = value => castToShort(value); >+ type.formatValueFromUintLiteral = value => castToShort(value); > type.allValues = function*() { > for (let i = 0; i <= 0xffff; ++i) { >- let value = cast(Int16Array, i); >+ let value = castToShort(i); > yield {value: value, name: value}; > } > }; >@@ -248,18 +193,18 @@ class Intrinsics { > type.isInt = true; > type.isNumber = true; > type.isSigned = true; >- type.canRepresent = value => isBitwiseEquivalent(value | 0, value); >+ type.canRepresent = value => isBitwiseEquivalent(castToInt(value), value); > type.size = 1; > type.defaultValue = 0; >- type.createLiteral = (origin, value) => IntLiteral.withType(origin, value | 0, type); >- type.successorValue = value => (value + 1) | 0; >+ type.createLiteral = (origin, value) => IntLiteral.withType(origin, castToInt(value), type); >+ type.successorValue = value => castToInt(value + 1); > type.valuesEqual = (a, b) => a === b; > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); >- type.formatValueFromIntLiteral = value => value | 0; >- type.formatValueFromUintLiteral = value => value | 0; >+ type.formatValueFromIntLiteral = value => castToInt(value); >+ type.formatValueFromUintLiteral = value => castToInt(value); > type.allValues = function*() { > for (let i = 0; i <= 0xffffffff; ++i) { >- let value = i | 0; >+ let value = castToInt(i); > yield {value: value, name: value}; > } > }; >@@ -292,7 +237,7 @@ class Intrinsics { > type.populateDefaultValue = (buffer, offset) => buffer.set(offset, 0); > type.formatValueFromIntLiteral = value => value; > type.formatValueFromUintLiteral = value => value; >- type.formatValueFromFloatLiteral = value => Math.fround(value); >+ type.formatValueFromFloatLiteral = value => castToFloat(value); > }); > > this._map.set( >@@ -330,7 +275,8 @@ class Intrinsics { > "native typedef sampler", > type => { > this.sampler = type; >- // FIXME: Figure out what to put here. >+ type.size = 1; >+ type.populateDefaultValue = (buffer, offset) => buffer.set(offset, {}); > }); > > for (let textureType of ["Texture1D", "RWTexture1D", "Texture1DArray", "RWTexture1DArray", "Texture2D", "RWTexture2D", "Texture2DArray", "RWTexture2DArray", "Texture3D", "RWTexture3D", "TextureCube"]) { >@@ -339,12 +285,16 @@ class Intrinsics { > `native typedef ${textureType}<${typeArgument}>`, > type => { > this[`${textureType}<${typeArgument}>`] = type; >+ type.size = 1; >+ type.populateDefaultValue = (buffer, offset) => buffer.set(offset, {}); > }); > for (let i = 2; i <= 4; ++i) { > this._map.set( > `native typedef ${textureType}<${typeArgument}${i}>`, > type => { > this[`${textureType}<${typeArgument}${i}>`] = type; >+ type.size = 1; >+ type.populateDefaultValue = (buffer, offset) => buffer.set(offset, {}); > }); > } > } >@@ -356,6 +306,8 @@ class Intrinsics { > `native typedef ${textureType}<${typeArgument}>`, > type => { > this[`${textureType}<${typeArgument}>`] = type; >+ type.size = 1; >+ type.populateDefaultValue = (buffer, offset) => buffer.set(offset, {}); > }); > } > } >@@ -364,7 +316,7 @@ class Intrinsics { > this._map.set( > `native operator uchar(${primitiveType})`, > func => { >- func.implementation = ([value]) => EPtr.box(value.loadValue() & 0xff); >+ func.implementation = ([value]) => EPtr.box(castToUchar(value.loadValue())); > }); > } > >@@ -372,7 +324,7 @@ class Intrinsics { > this._map.set( > `native operator ushort(${primitiveType})`, > func => { >- func.implementation = ([value]) => EPtr.box(value.loadValue() & 0xffff); >+ func.implementation = ([value]) => EPtr.box(castToUshort(value.loadValue())); > }); > } > >@@ -380,7 +332,7 @@ class Intrinsics { > this._map.set( > `native operator uint(${primitiveType})`, > func => { >- func.implementation = ([value]) => EPtr.box(value.loadValue() >>> 0); >+ func.implementation = ([value]) => EPtr.box(castToUint(value.loadValue())); > }); > } > >@@ -388,7 +340,7 @@ class Intrinsics { > this._map.set( > `native operator char(${primitiveType})`, > func => { >- func.implementation = ([value]) => EPtr.box(cast(Int8Array, value.loadValue())); >+ func.implementation = ([value]) => EPtr.box(castToChar(value.loadValue())); > }); > } > >@@ -396,7 +348,7 @@ class Intrinsics { > this._map.set( > `native operator short(${primitiveType})`, > func => { >- func.implementation = ([value]) => EPtr.box(cast(Int16Array, value.loadValue())); >+ func.implementation = ([value]) => EPtr.box(castToShort(value.loadValue())); > }); > } > >@@ -420,7 +372,7 @@ class Intrinsics { > this._map.set( > `native operator float(${primitiveType})`, > func => { >- func.implementation = ([value]) => EPtr.box(Math.fround(value.loadValue())); >+ func.implementation = ([value]) => EPtr.box(castToFloat(value.loadValue())); > }); > } > >@@ -484,292 +436,292 @@ class Intrinsics { > "native int operator-(int)", > func => { > func.implementation = ([value]) => >- EPtr.box((-value.loadValue()) | 0); >+ EPtr.box(castToInt(-value.loadValue())); > }); > > this._map.set( > "native float operator-(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(-value.loadValue())); >+ EPtr.box(castToFloat(-value.loadValue())); > }); > > this._map.set( > "native int operator+(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() + right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() + right.loadValue())); > }); > > this._map.set( > "native int operator-(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() - right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() - right.loadValue())); > }); > > this._map.set( > "native int operator*(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() * right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() * right.loadValue())); > }); > > this._map.set( > "native int operator/(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() / right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() / right.loadValue())); > }); > > this._map.set( > "native uint operator+(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() + right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() + right.loadValue())); > }); > > this._map.set( > "native uint operator-(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() - right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() - right.loadValue())); > }); > > this._map.set( > "native uint operator*(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() * right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() * right.loadValue())); > }); > > this._map.set( > "native uint operator/(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() / right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() / right.loadValue())); > }); > > this._map.set( > "native float operator+(float,float)", > func => { > func.implementation = ([left, right]) => >- EPtr.box(Math.fround(left.loadValue() + right.loadValue())); >+ EPtr.box(castToFloat(left.loadValue() + right.loadValue())); > }); > > this._map.set( > "native float operator-(float,float)", > func => { > func.implementation = ([left, right]) => >- EPtr.box(Math.fround(left.loadValue() - right.loadValue())); >+ EPtr.box(castToFloat(left.loadValue() - right.loadValue())); > }); > > this._map.set( > "native float operator*(float,float)", > func => { > func.implementation = ([left, right]) => >- EPtr.box(Math.fround(left.loadValue() * right.loadValue())); >+ EPtr.box(castToFloat(left.loadValue() * right.loadValue())); > }); > > this._map.set( > "native float operator/(float,float)", > func => { > func.implementation = ([left, right]) => >- EPtr.box(Math.fround(left.loadValue() / right.loadValue())); >+ EPtr.box(castToFloat(left.loadValue() / right.loadValue())); > }); > > this._map.set( > "native int operator&(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() & right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() & right.loadValue())); > }); > > this._map.set( > "native int operator|(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() | right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() | right.loadValue())); > }); > > this._map.set( > "native int operator^(int,int)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() ^ right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() ^ right.loadValue())); > }); > > this._map.set( > "native int operator~(int)", > func => { >- func.implementation = ([value]) => EPtr.box((~value.loadValue()) | 0); >+ func.implementation = ([value]) => EPtr.box(castToInt(~value.loadValue())); > }); > > this._map.set( > "native int operator<<(int,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() << right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() << right.loadValue())); > }); > > this._map.set( > "native int operator>>(int,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() >> right.loadValue()) | 0); >+ EPtr.box(castToInt(left.loadValue() >> right.loadValue())); > }); > > this._map.set( > "native uint operator&(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() & right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() & right.loadValue())); > }); > > this._map.set( > "native uint operator|(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() | right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() | right.loadValue())); > }); > > this._map.set( > "native uint operator^(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() ^ right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() ^ right.loadValue())); > }); > > this._map.set( > "native uint operator~(uint)", > func => { >- func.implementation = ([value]) => EPtr.box((~value.loadValue()) >>> 0); >+ func.implementation = ([value]) => EPtr.box(castToUint(~value.loadValue())); > }); > > this._map.set( > "native uint operator<<(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() << right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() << right.loadValue())); > }); > > this._map.set( > "native uint operator>>(uint,uint)", > func => { > func.implementation = ([left, right]) => >- EPtr.box((left.loadValue() >>> right.loadValue()) >>> 0); >+ EPtr.box(castToUint(left.loadValue() >>> right.loadValue())); > }); > > this._map.set( > "native float cos(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.cos(value.loadValue()))); >+ EPtr.box(castToFloat(Math.cos(value.loadValue()))); > }); > > this._map.set( > "native float sin(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.sin(value.loadValue()))); >+ EPtr.box(castToFloat(Math.sin(value.loadValue()))); > }); > > this._map.set( > "native float tan(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.tan(value.loadValue()))); >+ EPtr.box(castToFloat(Math.tan(value.loadValue()))); > }); > > this._map.set( > "native float acos(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.acos(value.loadValue()))); >+ EPtr.box(castToFloat(Math.acos(value.loadValue()))); > }); > > this._map.set( > "native float asin(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.asin(value.loadValue()))); >+ EPtr.box(castToFloat(Math.asin(value.loadValue()))); > }); > > this._map.set( > "native float atan(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.atan(value.loadValue()))); >+ EPtr.box(castToFloat(Math.atan(value.loadValue()))); > }); > > this._map.set( > "native float cosh(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.cosh(value.loadValue()))); >+ EPtr.box(castToFloat(Math.cosh(value.loadValue()))); > }); > > this._map.set( > "native float sinh(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.sinh(value.loadValue()))); >+ EPtr.box(castToFloat(Math.sinh(value.loadValue()))); > }); > > this._map.set( > "native float tanh(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.tanh(value.loadValue()))); >+ EPtr.box(castToFloat(Math.tanh(value.loadValue()))); > }); > > this._map.set( > "native float ceil(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.ceil(value.loadValue()))); >+ EPtr.box(castToFloat(Math.ceil(value.loadValue()))); > }); > > this._map.set( > "native float exp(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.exp(value.loadValue()))); >+ EPtr.box(castToFloat(Math.exp(value.loadValue()))); > }); > > this._map.set( > "native float floor(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.floor(value.loadValue()))); >+ EPtr.box(castToFloat(Math.floor(value.loadValue()))); > }); > > this._map.set( > "native float log(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.log(value.loadValue()))); >+ EPtr.box(castToFloat(Math.log(value.loadValue()))); > }); > > this._map.set( > "native float round(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.round(value.loadValue()))); >+ EPtr.box(castToFloat(Math.round(value.loadValue()))); > }); > > this._map.set( > "native float sqrt(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.sqrt(value.loadValue()))); >+ EPtr.box(castToFloat(Math.sqrt(value.loadValue()))); > }); > > this._map.set( > "native float trunc(float)", > func => { > func.implementation = ([value]) => >- EPtr.box(Math.fround(Math.trunc(value.loadValue()))); >+ EPtr.box(castToFloat(Math.trunc(value.loadValue()))); > }); > > this._map.set( >@@ -788,7 +740,7 @@ class Intrinsics { > "native float pow(float,float)", > func => { > func.implementation = ([left, right]) => >- EPtr.box(Math.fround(Math.pow(left.loadValue(), right.loadValue()))); >+ EPtr.box(castToFloat(Math.pow(left.loadValue(), right.loadValue()))); > }); > > this._map.set( >@@ -832,7 +784,7 @@ class Intrinsics { > "native float atan2(float,float)", > func => { > func.implementation = ([left, right]) => >- EPtr.box(Math.fround(Math.atan2(left.loadValue(), right.loadValue()))); >+ EPtr.box(castToFloat(Math.atan2(left.loadValue(), right.loadValue()))); > }); > > this._map.set( >@@ -914,6 +866,1395 @@ class Intrinsics { > > for (let setter of BuiltinMatrixSetter.functions()) > this._map.set(setter.toString(), func => setter.instantiateImplementation(func)); >+ >+ function checkUndefined(origin, explanation, value) >+ { >+ if (value == undefined) >+ throw new WTrapError("[Load]", "Texture read out of bounds"); >+ return value; >+ } >+ >+ function checkFalse(origin, explanation, value) >+ { >+ if (value == false) >+ throw new WTrapError("[Store]", "Texture store out of bounds"); >+ } >+ >+ function boxVector(a) >+ { >+ if (a instanceof Array) { >+ let result = new EPtr(new EBuffer(a.length), 0); >+ for (let i = 0; i < a.length; ++i) >+ result.set(i, a[i]); >+ return result; >+ } else >+ return EPtr.box(a); >+ } >+ >+ function unboxVector(a, length) >+ { >+ if (length != "") { >+ length = Number.parseInt(length); >+ let result = []; >+ for (let i = 0; i < length; ++i) >+ result.push(a.get(i)); >+ return result; >+ } else >+ return a.loadValue(); >+ } >+ >+ for (let type of ["uchar", "ushort", "uint", "char", "short", "int", "half", "float"]) { >+ for (var lengthVariable of [``, `2`, `3`, `4`]) { >+ let length = lengthVariable; >+ this._map.set( >+ `native ${type}${length} Sample(Texture1D<${type}${length}>,sampler,float location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.loadValue(), 0, 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Sample(Texture1D<${type}${length}>,sampler,float location,int offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.loadValue(), 0, 0, 1, 0]; >+ let deltaArray = [offset.loadValue(), 0, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture1D<${type}${length}>,int2 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(1), 0, 0, location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture1D<${type}${length}>,int2 location,int offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(1), 0, 0, location.get(0) + offset.loadValue()))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(Texture1D<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function([texture, miplevel, width, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ >+ this._map.set( >+ `native ${type}${length} Sample(Texture1DArray<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), 0, 0, 1, location.get(1)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Sample(Texture1DArray<${type}${length}>,sampler,float2 location,int offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), 0, 0, 1, location.get(1)]; >+ let deltaArray = [offset.loadValue(), 0, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture1DArray<${type}${length}>,int3 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), location.get(1), 0, 0, location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture1DArray<${type}${length}>,int3 location,int offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), location.get(1), 0, 0, location.get(0) + offset.loadValue()))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(Texture1DArray<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Elements,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function([texture, miplevel, width, elements, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ >+ this._map.set( >+ `native ${type}${length} Sample(Texture2D<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Sample(Texture2D<${type}${length}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleBias(Texture2D<${type}${length}>,sampler,float2 location,float Bias)`, >+ func => { >+ func.implementation = function([texture, sampler, location, bias]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleBias(Texture2D<${type}${length}>,sampler,float2 location,float Bias,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, bias, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleGrad(Texture2D<${type}${length}>,sampler,float2 location,float2 DDX,float2 DDY)`, >+ func => { >+ func.implementation = function([texture, sampler, location, ddx, ddy]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleGrad(Texture2D<${type}${length}>,sampler,float2 location,float2 DDX,float2 DDY,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, ddx, ddy, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleLevel(Texture2D<${type}${length}>,sampler,float2 location,float LOD)`, >+ func => { >+ func.implementation = function([texture, sampler, location, lod]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleLevel(Texture2D<${type}${length}>,sampler,float2 location,float LOD,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, lod, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(Texture2D<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(Texture2D<${type}${length}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(Texture2D<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(Texture2D<${type}${length}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ if (length == "2" || length == "3" || length == "4") { >+ this._map.set( >+ `native ${type}4 GatherGreen(Texture2D<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 1)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherGreen(Texture2D<${type}${length}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 1)); >+ } >+ }); >+ if (length == "3" || length == "4") { >+ this._map.set( >+ `native ${type}4 GatherBlue(Texture2D<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 2)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherBlue(Texture2D<${type}${length}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 2)); >+ } >+ }); >+ if (length == "4") { >+ this._map.set( >+ `native ${type}4 GatherAlpha(Texture2D<${type}${length}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 3)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherAlpha(Texture2D<${type}${length}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 3)); >+ } >+ }); >+ } >+ } >+ } >+ this._map.set( >+ `native ${type}${length} Load(Texture2D<${type}${length}>,int3 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture2D<${type}${length}>,int3 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(Texture2D<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function([texture, miplevel, width, height, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ >+ this._map.set( >+ `native ${type}${length} Sample(Texture2DArray<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Sample(Texture2DArray<${type}${length}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleBias(Texture2DArray<${type}${length}>,sampler,float3 location,float Bias)`, >+ func => { >+ func.implementation = function([texture, sampler, location, bias]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleBias(Texture2DArray<${type}${length}>,sampler,float3 location,float Bias,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, bias, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleGrad(Texture2DArray<${type}${length}>,sampler,float3 location,float2 DDX,float2 DDY)`, >+ func => { >+ func.implementation = function([texture, sampler, location, ddx, ddy]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleGrad(Texture2DArray<${type}${length}>,sampler,float3 location,float2 DDX,float2 DDY,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, ddx, ddy, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleLevel(Texture2DArray<${type}${length}>,sampler,float3 location,float LOD)`, >+ func => { >+ func.implementation = function([texture, sampler, location, lod]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleLevel(Texture2DArray<${type}${length}>,sampler,float3 location,float LOD,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, lod, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(Texture2DArray<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(Texture2DArray<${type}${length}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(Texture2DArray<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(Texture2DArray<${type}${length}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ if (length == "2" || length == "3" || length == "4") { >+ this._map.set( >+ `native ${type}4 GatherGreen(Texture2DArray<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 1)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherGreen(Texture2DArray<${type}${length}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 1)); >+ } >+ }); >+ if (length == "3" || length == "4") { >+ this._map.set( >+ `native ${type}4 GatherBlue(Texture2DArray<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 2)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherBlue(Texture2DArray<${type}${length}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 2)); >+ } >+ }); >+ if (length == "4") { >+ this._map.set( >+ `native ${type}4 GatherAlpha(Texture2DArray<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 3)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherAlpha(Texture2DArray<${type}${length}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 4)); >+ } >+ }); >+ } >+ } >+ } >+ this._map.set( >+ `native ${type}${length} Load(Texture2DArray<${type}${length}>,int4 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture2DArray<${type}${length}>,int4 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(Texture2DArray<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread Elements,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function([texture, miplevel, width, height, elements, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ >+ this._map.set( >+ `native ${type}${length} Sample(Texture3D<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Sample(Texture3D<${type}${length}>,sampler,float3 location,int3 offset)`, >+ func => { >+ func.implementation = function([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), offset.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture3D<${type}${length}>,int4 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(3), location.get(2), location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(Texture3D<${type}${length}>,int4 location,int3 offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(3), location.get(2) + offset.get(2), location.get(1) + offset.get(1), location.get(0) + offset.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(Texture3D<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread Depth,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function([texture, miplevel, width, height, depth, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ depth.loadValue().copyFrom(EPtr.box(tex.depthAtLevel(mipID)), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ >+ this._map.set( >+ `native ${type}${length} Sample(TextureCube<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleBias(TextureCube<${type}${length}>,sampler,float3 location,float Bias)`, >+ func => { >+ func.implementation = function([texture, sampler, location, bias]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleGrad(TextureCube<${type}${length}>,sampler,float3 location,float3 DDX,float3 DDY)`, >+ func => { >+ func.implementation = function([texture, sampler, location, ddx, ddy]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ let ddxArray = [ddx.get(0), ddx.get(1), ddx.get(2)]; >+ let ddyArray = [ddy.get(0), ddy.get(1), ddy.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} SampleLevel(TextureCube<${type}${length}>,sampler,float3 location,float LOD)`, >+ func => { >+ func.implementation = function([texture, sampler, location, lod]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(TextureCube<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(TextureCube<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ if (length == "2" || length == "3" || length == "4") { >+ this._map.set( >+ `native ${type}4 GatherGreen(TextureCube<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 1)); >+ } >+ }); >+ if (length == "3" || length == "4") { >+ this._map.set( >+ `native ${type}4 GatherBlue(TextureCube<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 2)); >+ } >+ }); >+ if (length == "4") { >+ this._map.set( >+ `native ${type}4 GatherAlpha(TextureCube<${type}${length}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 3)); >+ } >+ }); >+ } >+ } >+ } >+ this._map.set( >+ `native void GetDimensions(TextureCube<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function([texture, miplevel, width, height, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (tex.layerCount != 6) >+ throw new Error("Cube texture doesn't have 6 faces"); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ >+ this._map.set( >+ `native void GetDimensions(RWTexture1D<${type}${length}>,uint* thread Width)`, >+ func => { >+ func.implementation = function([texture, width]) { >+ width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTexture1D<${type}${length}>,float* thread Width)`, >+ func => { >+ func.implementation = function([texture, width]) { >+ width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(RWTexture1D<${type}${length}>,int location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, 0, location.loadValue()))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTexture1D<${type}${length}>,${type}${length},uint location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, 0, location.loadValue(), unboxVector(value, length))); >+ } >+ }); >+ >+ this._map.set( >+ `native void GetDimensions(RWTexture1DArray<${type}${length}>,uint* thread Width,uint* thread Elements)`, >+ func => { >+ func.implementation = function([texture, width, elements]) { >+ let tex = texture.loadValue(); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTexture1DArray<${type}${length}>,float* thread Width,uint* thread Elements)`, >+ func => { >+ func.implementation = function([texture, width, elements]) { >+ let tex = texture.loadValue(); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(RWTexture1DArray<${type}${length}>,int2 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(1), 0, 0, 0, location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTexture1DArray<${type}${length}>,${type}${length},uint2 location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(1), 0, 0, 0, location.get(0), unboxVector(value, length))); >+ } >+ }); >+ >+ this._map.set( >+ `native void GetDimensions(RWTexture2D<${type}${length}>,uint* thread Width,uint* thread Height)`, >+ func => { >+ func.implementation = function([texture, width, height]) { >+ let tex = texture.loadValue(); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTexture2D<${type}${length}>,float* thread Width,float* thread Height)`, >+ func => { >+ func.implementation = function([texture, width, height]) { >+ let tex = texture.loadValue(); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(RWTexture2D<${type}${length}>,int2 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTexture2D<${type}${length}>,${type}${length},uint2 location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, location.get(1), location.get(0), unboxVector(value, length))); >+ } >+ }); >+ >+ this._map.set( >+ `native void GetDimensions(RWTexture2DArray<${type}${length}>,uint* thread Width,uint* thread Height,uint* thread Elements)`, >+ func => { >+ func.implementation = function([texture, width, height, elements]) { >+ let tex = texture.loadValue(); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTexture2DArray<${type}${length}>,float* thread Width,float* thread Height,float* thread Elements)`, >+ func => { >+ func.implementation = function([texture, width, height, elements]) { >+ let tex = texture.loadValue(); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(RWTexture2DArray<${type}${length}>,int3 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), 0, 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTexture2DArray<${type}${length}>,${type}${length},uint3 location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(2), 0, 0, location.get(1), location.get(0), unboxVector(value, length))); >+ } >+ }); >+ >+ this._map.set( >+ `native void GetDimensions(RWTexture3D<${type}${length}>,uint* thread Width,uint* thread Height,uint* thread Depth)`, >+ func => { >+ func.implementation = function([texture, width, height, depth]) { >+ let tex = texture.loadValue(); >+ depth.loadValue().copyFrom(EPtr.box(tex.depth), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTexture3D<${type}${length}>,float* thread Width,float* thread Height,float* thread Depth)`, >+ func => { >+ func.implementation = function([texture, width, height, depth]) { >+ let tex = texture.loadValue(); >+ depth.loadValue().copyFrom(EPtr.box(tex.depth), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type}${length} Load(RWTexture3D<${type}${length}>,int3 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, location.get(2), location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTexture3D<${type}${length}>,${type}${length},uint3 location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, location.get(2), location.get(1), location.get(0), unboxVector(value, length))); >+ } >+ }); >+ } >+ } >+ >+ for (let type of ["half", "float"]) { >+ this._map.set( >+ `native ${type} Sample(TextureDepth2D<${type}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} Sample(TextureDepth2D<${type}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmp(TextureDepth2D<${type}>,sampler,float2 location,${type} CompareValue)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmp(TextureDepth2D<${type}>,sampler,float2 location,${type} CompareValue,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmpLevelZero(TextureDepth2D<${type}>,sampler,float2 location,${type} CompareValue)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, 0, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmpLevelZero(TextureDepth2D<${type}>,sampler,float2 location,${type} CompareValue,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, 0, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleBias(TextureDepth2D<${type}>,sampler,float2 location,float Bias)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, bias]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleBias(TextureDepth2D<${type}>,sampler,float2 location,float Bias,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, bias, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleGrad(TextureDepth2D<${type}>,sampler,float2 location,float2 DDX,float2 DDY)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, ddx, ddy]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleGrad(TextureDepth2D<${type}>,sampler,float2 location,float2 DDX,float2 DDY,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, ddx, ddy, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleLevel(TextureDepth2D<${type}>,sampler,float2 location,float LOD)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, lod]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleLevel(TextureDepth2D<${type}>,sampler,float2 location,float LOD,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, lod, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(TextureDepth2D<${type}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(TextureDepth2D<${type}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(TextureDepth2D<${type}>,sampler,float2 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(TextureDepth2D<${type}>,sampler,float2 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmp(TextureDepth2D<${type}>,sampler,float2 location,float compare_value)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmp(TextureDepth2D<${type}>,sampler,float2 location,float compare_value,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmpRed(TextureDepth2D<${type}>,sampler,float2 location,float compare_value)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmpRed(TextureDepth2D<${type}>,sampler,float2 location,float compare_value,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type} Load(TextureDepth2D<${type}>,int3 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type} Load(TextureDepth2D<${type}>,int3 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(TextureDepth2D<${type}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function ([texture, miplevel, width, height, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type} Sample(TextureDepth2DArray<${type}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} Sample(TextureDepth2DArray<${type}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmp(TextureDepth2DArray<${type}>,sampler,float3 location,${type} CompareValue)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmp(TextureDepth2DArray<${type}>,sampler,float3 location,${type} CompareValue,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmpLevelZero(TextureDepth2DArray<${type}>,sampler,float3 location,${type} CompareValue)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, 0, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmpLevelZero(TextureDepth2DArray<${type}>,sampler,float3 location,${type} CompareValue,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, 0, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleBias(TextureDepth2DArray<${type}>,sampler,float3 location,float Bias)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, bias]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleBias(TextureDepth2DArray<${type}>,sampler,float3 location,float Bias,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, bias, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleGrad(TextureDepth2DArray<${type}>,sampler,float3 location,float2 DDX,float2 DDY)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, ddx, ddy]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleGrad(TextureDepth2DArray<${type}>,sampler,float3 location,float2 DDX,float2 DDY,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, ddx, ddy, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let ddxArray = [ddx.get(0), ddx.get(1), 0]; >+ let ddyArray = [ddy.get(0), ddy.get(1), 0]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleLevel(TextureDepth2DArray<${type}>,sampler,float3 location,float LOD)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, lod]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleLevel(TextureDepth2DArray<${type}>,sampler,float3 location,float LOD,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, lod, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(TextureDepth2DArray<${type}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(TextureDepth2DArray<${type}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(TextureDepth2DArray<${type}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(TextureDepth2DArray<${type}>,sampler,float3 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmp(TextureDepth2DArray<${type}>,sampler,float3 location,float compare_value)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmp(TextureDepth2DArray<${type}>,sampler,float3 location,float compare_value,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmpRed(TextureDepth2DArray<${type}>,sampler,float3 location,float compare_value)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmpRed(TextureDepth2DArray<${type}>,sampler,float3 location,float compare_value,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue, offset]) { >+ let locationArray = [location.get(0), location.get(1), 0, 1, location.get(2)]; >+ let deltaArray = [offset.get(0), offset.get(1), 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, deltaArray, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type} Load(TextureDepth2DArray<${type}>,int4 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native ${type} Load(TextureDepth2DArray<${type}>,int4 location,int2 offset)`, >+ func => { >+ func.implementation = function ([texture, location, offset]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(TextureDepth2DArray<${type}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread Elements,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function ([texture, miplevel, width, height, elements, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type} Sample(TextureDepthCube<${type}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmp(TextureDepthCube<${type}>,sampler,float3 location,${type} CompareValue)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleCmpLevelZero(TextureDepthCube<${type}>,sampler,float3 location,${type} CompareValue)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, 0, compareValue.loadValue())); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleBias(TextureDepthCube<${type}>,sampler,float3 location,float Bias)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, bias]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, bias.loadValue(), undefined, undefined, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleGrad(TextureDepthCube<${type}>,sampler,float3 location,float3 DDX,float3 DDY)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, ddx, ddy]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ let ddxArray = [ddx.get(0), ddx.get(1), ddx.get(2)]; >+ let ddyArray = [ddy.get(0), ddy.get(1), ddy.get(2)]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, ddxArray, ddyArray, undefined, undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type} SampleLevel(TextureDepthCube<${type}>,sampler,float3 location,float LOD)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, lod]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(sampleTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, lod.loadValue(), undefined)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 Gather(TextureDepthCube<${type}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherRed(TextureDepthCube<${type}>,sampler,float3 location)`, >+ func => { >+ func.implementation = function ([texture, sampler, location]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, undefined, 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmp(TextureDepthCube<${type}>,sampler,float3 location,float compare_value)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native ${type}4 GatherCmpRed(TextureDepthCube<${type}>,sampler,float3 location,float compare_value)`, >+ func => { >+ func.implementation = function ([texture, sampler, location, compareValue]) { >+ let locationArray = [location.get(0), location.get(1), location.get(2), 1, 0]; >+ return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0)); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(TextureDepthCube<${type}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`, >+ func => { >+ func.implementation = function ([texture, miplevel, width, height, numberOfLevels]) { >+ let tex = texture.loadValue(); >+ let mipID = miplevel.loadValue(); >+ if (tex.layerCount != 6) >+ throw new Error("Cube texture doesn't have 6 faces"); >+ if (mipID >= tex.levelCount) >+ throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture"); >+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1); >+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTextureDepth2D<${type}>,uint* thread Width,uint* thread Height)`, >+ func => { >+ func.implementation = function ([texture, width, height]) { >+ let tex = texture.loadValue(); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTextureDepth2D<${type}>,float* thread Width,float* thread Height)`, >+ func => { >+ func.implementation = function ([texture, width, height]) { >+ let tex = texture.loadValue(); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type} Load(RWTextureDepth2D<${type}>,int2 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTextureDepth2D<${type}>,${type},uint2 location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, location.get(1), location.get(0), unboxVector(value, ""))); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTextureDepth2DArray<${type}>,uint* thread Width,uint* thread Height,uint* thread Elements)`, >+ func => { >+ func.implementation = function ([texture, width, height, elements]) { >+ let tex = texture.loadValue(); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native void GetDimensions(RWTextureDepth2DArray<${type}>,float* thread Width,float* thread Height,float* thread Elements)`, >+ func => { >+ func.implementation = function ([texture, width, height, elements]) { >+ let tex = texture.loadValue(); >+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1); >+ height.loadValue().copyFrom(EPtr.box(tex.height), 1); >+ width.loadValue().copyFrom(EPtr.box(tex.width), 1); >+ } >+ }); >+ this._map.set( >+ `native ${type} Load(RWTextureDepth2DArray<${type}>,int3 location)`, >+ func => { >+ func.implementation = function ([texture, location]) { >+ return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), 0, 0, location.get(1), location.get(0)))); >+ } >+ }); >+ this._map.set( >+ `native void Store(RWTextureDepth2DArray<${type}>,${type},uint3 location)`, >+ func => { >+ func.implementation = function ([texture, value, location]) { >+ checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(2), 0, 0, location.get(1), location.get(0), unboxVector(value, ""))); >+ } >+ }); >+ } > } > > add(thing) >diff --git a/Tools/WebGPUShadingLanguageRI/SPIRV.html b/Tools/WebGPUShadingLanguageRI/SPIRV.html >index 78d008f835f9e9c234ef2df6d6deea3f7426ce65..1b26cf2b2e651527a152ee8d92ff25beda61d339 100644 >--- a/Tools/WebGPUShadingLanguageRI/SPIRV.html >+++ b/Tools/WebGPUShadingLanguageRI/SPIRV.html >@@ -34,6 +34,7 @@ td { > <script src="BuiltinVectorSetter.js"></script> > <script src="CallExpression.js"></script> > <script src="CallFunction.js"></script> >+ <script src="Casts.js"></script> > <script src="Check.js"></script> > <script src="CheckLiteralTypes.js"></script> > <script src="CheckLoops.js"></script> >@@ -121,6 +122,7 @@ td { > <script src="Return.js"></script> > <script src="ReturnChecker.js"></script> > <script src="ReturnException.js"></script> >+ <script src="Sampler.js"></script> > <script src="StandardLibrary.js"></script> > <script src="StatementCloner.js"></script> > <script src="StructLayoutBuilder.js"></script> >@@ -133,6 +135,8 @@ td { > <script src="SynthesizeCopyConstructorOperator.js"></script> > <script src="SynthesizeDefaultConstructorOperator.js"></script> > <script src="TernaryExpression.js"></script> >+ <script src="Texture.js"></script> >+ <script src="TextureOperations.js"></script> > <script src="TrapStatement.js"></script> > <script src="TypeDef.js"></script> > <script src="TypeDefResolver.js"></script> >diff --git a/Tools/WebGPUShadingLanguageRI/Sampler.js b/Tools/WebGPUShadingLanguageRI/Sampler.js >new file mode 100644 >index 0000000000000000000000000000000000000000..ee7713dfc81f83c58473621217564f39572b14b8 >--- /dev/null >+++ b/Tools/WebGPUShadingLanguageRI/Sampler.js >@@ -0,0 +1,163 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+"use strict"; >+ >+class Sampler { >+ constructor(options) >+ { >+ if (options.rAddressMode == undefined) >+ this._rAddressMode = "clampToEdge"; >+ else >+ this._rAddressMode = options.rAddressMode; >+ if (options.sAddressMode == undefined) >+ this._sAddressMode = "clampToEdge"; >+ else >+ this._sAddressMode = options.sAddressMode; >+ if (options.tAddressMode == undefined) >+ this._tAddressMode = "clampToEdge"; >+ else >+ this._tAddressMode = options.tAddressMode; >+ if (options.minFilter == undefined) >+ this._minFilter = "nearest"; >+ else >+ this._minFilter = options.minFilter; >+ if (options.magFilter == undefined) >+ this._magFilter = "nearest"; >+ else >+ this._magFilter = options.magFilter; >+ if (options.mipmapFilter == undefined) >+ this._mipmapFilter = "nearest"; >+ else >+ this._mipmapFilter = options.mipmapFilter; >+ if (options.lodMinClamp == undefined) >+ this._lodMinClamp = -Number.MAX_VALUE; >+ else >+ this._lodMinClamp = options.lodMinClamp; >+ if (options.lodMaxClamp == undefined) >+ this._lodMaxClamp = Number.MAX_VALUE; >+ else >+ this._lodMaxClamp = options.lodMaxClamp; >+ if (options.maxAnisotropy == undefined) >+ this._maxAnisotropy = 1; >+ else >+ this._maxAnisotropy = options.maxAnisotropy; >+ if (options.compareFunction == undefined) >+ this._compareFunction = "never"; >+ else >+ this._compareFunction = options.compareFunction; >+ if (options.borderColor == undefined) >+ this._borderColor = "transparentBlack"; >+ else >+ this._borderColor = options.borderColor; >+ } >+ >+ get rAddressMode() { return this._rAddressMode; } >+ get sAddressMode() { return this._sAddressMode; } >+ get tAddressMode() { return this._tAddressMode; } >+ get minFilter() { return this._minFilter; } >+ get magFilter() { return this._magFilter; } >+ get mipmapFilter() { return this._mipmapFilter; } >+ get lodMinClamp() { return this._lodMinClamp; } >+ get lodMaxClamp() { return this._lodMaxClamp; } >+ get maxAnisotropy() { return this._maxAnisotropy; } >+ get compareFunction() { return this._compareFunction; } >+ get borderColor() { return this._borderColor; } >+ >+ calculateBorderColor(innerType) >+ { >+ // Vulkan 1.1.83 section 15.3.3 >+ function computeValues() { >+ switch (innerType) { >+ case "uchar": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 0xFF}; >+ case "ushort": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 0xFFFF}; >+ case "uint": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 0xFFFFFFFF}; >+ case "char": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 0x7F}; >+ case "short": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 0x7FFF}; >+ case "int": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 0x7FFFFFFF}; >+ case "half": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 1}; >+ case "float": >+ return {transparentBlack: 0, opaqueBlack: 0, opaqueWhite: 1}; >+ case "uchar2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [0xFF, 0xFF]}; >+ case "ushort2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [0xFFFF, 0xFFFF]}; >+ case "uint2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [0xFFFFFFFF, 0xFFFFFFFF]}; >+ case "char2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [0x7F, 0x7F]}; >+ case "short2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [0x7FFF, 0x7FFF]}; >+ case "int2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [0x7FFFFFFF, 0x7FFFFFFF]}; >+ case "half2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [1, 1]}; >+ case "float2": >+ return {transparentBlack: [0, 0], opaqueBlack: [0, 0], opaqueWhite: [1, 1]}; >+ case "uchar3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [0xFF, 0xFF, 0xFF]}; >+ case "ushort3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [0xFFFF, 0xFFFF, 0xFFFF]}; >+ case "uint3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF]}; >+ case "char3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [0x7F, 0x7F, 0x7F]}; >+ case "short3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [0x7FFF, 0x7FFF, 0x7FFF]}; >+ case "int3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF]}; >+ case "half3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [1, 1, 1]}; >+ case "float3": >+ return {transparentBlack: [0, 0, 0], opaqueBlack: [0, 0, 0], opaqueWhite: [1, 1, 1]}; >+ case "uchar4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 0xFF], opaqueWhite: [0xFF, 0xFF, 0xFF, 0xFF]}; >+ case "ushort4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 0xFFFF], opaqueWhite: [0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF]}; >+ case "uint4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 0xFFFFFFFF], opaqueWhite: [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF]}; >+ case "char4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 0x7F], opaqueWhite: [0x7F, 0x7F, 0x7F, 0x7F]}; >+ case "short4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 0x7FFF], opaqueWhite: [0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF]}; >+ case "int4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 0x7FFFFFFF], opaqueWhite: [0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF]}; >+ case "half4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 1], opaqueWhite: [1, 1, 1, 1]}; >+ case "float4": >+ return {transparentBlack: [0, 0, 0, 0], opaqueBlack: [0, 0, 0, 1], opaqueWhite: [1, 1, 1, 1]}; >+ default: >+ throw new Error("Unknown texture inner type"); >+ } >+ } >+ return computeValues()[this.borderColor]; >+ } >+} >diff --git a/Tools/WebGPUShadingLanguageRI/StandardLibrary.js b/Tools/WebGPUShadingLanguageRI/StandardLibrary.js >index 3dd4fee18600d5cd2a895ad5a479721da7788cc1..81816df1c5ea86de56fc3aa4cd0db5d67d0fcbda 100644 >--- a/Tools/WebGPUShadingLanguageRI/StandardLibrary.js >+++ b/Tools/WebGPUShadingLanguageRI/StandardLibrary.js >@@ -57,7 +57,7 @@ let standardLibrary = (function() { > } > print(`native typedef sampler;`); > for (var type of [`Texture1D`, `RWTexture1D`, `Texture1DArray`, `RWTexture1DArray`, `Texture2D`, `RWTexture2D`, `Texture2DArray`, `RWTexture2DArray`, `Texture3D`, `RWTexture3D`, `TextureCube`]) { >- for (var typeArgumentBase of [`bool`, `uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) { >+ for (var typeArgumentBase of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) { > for (var size of [``, `2`, `3`, `4`]) { > print(`native typedef ${type}<${typeArgumentBase}${size}>;`); > } >@@ -1897,7 +1897,8 @@ let standardLibrary = (function() { > print(`native void InterlockedCompareExchange(thread atomic_${type}*, ${type}, ${type}, thread ${type}*);`); > } > print(); >- >+ */ >+ > for (var type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) { > for (var length of [``, `2`, `3`, `4`]) { > print(`native ${type}${length} Sample(Texture1D<${type}${length}>, sampler, float location);`); >@@ -1924,12 +1925,18 @@ let standardLibrary = (function() { > print(`native ${type}4 Gather(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); > print(`native ${type}4 GatherRed(Texture2D<${type}${length}>, sampler, float2 location);`); > print(`native ${type}4 GatherRed(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >- print(`native ${type}4 GatherGreen(Texture2D<${type}${length}>, sampler, float2 location);`); >- print(`native ${type}4 GatherGreen(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >- print(`native ${type}4 GatherBlue(Texture2D<${type}${length}>, sampler, float2 location);`); >- print(`native ${type}4 GatherBlue(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >- print(`native ${type}4 GatherAlpha(Texture2D<${type}${length}>, sampler, float2 location);`); >- print(`native ${type}4 GatherAlpha(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >+ if (length == "2" || length == "3" || length == "4") { >+ print(`native ${type}4 GatherGreen(Texture2D<${type}${length}>, sampler, float2 location);`); >+ print(`native ${type}4 GatherGreen(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >+ if (length == "3" || length == "4") { >+ print(`native ${type}4 GatherBlue(Texture2D<${type}${length}>, sampler, float2 location);`); >+ print(`native ${type}4 GatherBlue(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >+ if (length == "4") { >+ print(`native ${type}4 GatherAlpha(Texture2D<${type}${length}>, sampler, float2 location);`); >+ print(`native ${type}4 GatherAlpha(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`); >+ } >+ } >+ } > print(`native ${type}${length} Load(Texture2D<${type}${length}>, int3 location);`); > print(`native ${type}${length} Load(Texture2D<${type}${length}>, int3 location, int2 offset);`); > print(`native void GetDimensions(Texture2D<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`); >@@ -1946,28 +1953,24 @@ let standardLibrary = (function() { > print(`native ${type}4 Gather(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); > print(`native ${type}4 GatherRed(Texture2DArray<${type}${length}>, sampler, float3 location);`); > print(`native ${type}4 GatherRed(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >- print(`native ${type}4 GatherGreen(Texture2DArray<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherGreen(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >- print(`native ${type}4 GatherBlue(Texture2DArray<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherBlue(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >- print(`native ${type}4 GatherAlpha(Texture2DArray<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherAlpha(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >+ if (length == "2" || length == "3" || length == "4") { >+ print(`native ${type}4 GatherGreen(Texture2DArray<${type}${length}>, sampler, float3 location);`); >+ print(`native ${type}4 GatherGreen(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >+ if (length == "3" || length == "4") { >+ print(`native ${type}4 GatherBlue(Texture2DArray<${type}${length}>, sampler, float3 location);`); >+ print(`native ${type}4 GatherBlue(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >+ if (length == "4") { >+ print(`native ${type}4 GatherAlpha(Texture2DArray<${type}${length}>, sampler, float3 location);`); >+ print(`native ${type}4 GatherAlpha(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`); >+ } >+ } >+ } > print(`native ${type}${length} Load(Texture2DArray<${type}${length}>, int4 location);`); > print(`native ${type}${length} Load(Texture2DArray<${type}${length}>, int4 location, int2 offset);`); > print(`native void GetDimensions(Texture2DArray<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* Elements, thread uint* NumberOfLevels);`); > print(); > print(`native ${type}${length} Sample(Texture3D<${type}${length}>, sampler, float3 location);`); > print(`native ${type}${length} Sample(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`); >- print(`native ${type}4 Gather(Texture3D<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 Gather(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`); >- print(`native ${type}4 GatherRed(Texture3D<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherRed(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`); >- print(`native ${type}4 GatherGreen(Texture3D<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherGreen(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`); >- print(`native ${type}4 GatherBlue(Texture3D<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherBlue(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`); >- print(`native ${type}4 GatherAlpha(Texture3D<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherAlpha(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`); > print(`native ${type}${length} Load(Texture3D<${type}${length}>, int4 location);`); > print(`native ${type}${length} Load(Texture3D<${type}${length}>, int4 location, int3 offset);`); > print(`native void GetDimensions(Texture3D<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* Depth, thread uint* NumberOfLevels);`); >@@ -1978,9 +1981,14 @@ let standardLibrary = (function() { > print(`native ${type}${length} SampleLevel(TextureCube<${type}${length}>, sampler, float3 location, float LOD);`); > print(`native ${type}4 Gather(TextureCube<${type}${length}>, sampler, float3 location);`); > print(`native ${type}4 GatherRed(TextureCube<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherGreen(TextureCube<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherBlue(TextureCube<${type}${length}>, sampler, float3 location);`); >- print(`native ${type}4 GatherAlpha(TextureCube<${type}${length}>, sampler, float3 location);`); >+ if (length == "2" || length == "3" || length == "4") { >+ print(`native ${type}4 GatherGreen(TextureCube<${type}${length}>, sampler, float3 location);`); >+ if (length == "3" || length == "4") { >+ print(`native ${type}4 GatherBlue(TextureCube<${type}${length}>, sampler, float3 location);`); >+ if (length == "4") >+ print(`native ${type}4 GatherAlpha(TextureCube<${type}${length}>, sampler, float3 location);`); >+ } >+ } > print(`native void GetDimensions(TextureCube<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`); > print(); > print(`native void GetDimensions(RWTexture1D<${type}${length}>, thread uint* Width);`); >@@ -2010,97 +2018,66 @@ let standardLibrary = (function() { > print(); > } > } >- >+ > for (var type of [`half`, `float`]) { > print(`native ${type} Sample(TextureDepth2D<${type}>, sampler, float2 location);`); > print(`native ${type} Sample(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >- print(`native ${type} SampleCmp(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float CompareValue);`); >- print(`native ${type} SampleCmp(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float CompareValue, int2 offset);`); >- print(`native ${type} SampleCmpLevelZero(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float CompareValue);`); >- print(`native ${type} SampleCmpLevelZero(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float CompareValue, int2 offset);`); >+ print(`native ${type} SampleCmp(TextureDepth2D<${type}>, sampler, float2 location, ${type} CompareValue);`); >+ print(`native ${type} SampleCmp(TextureDepth2D<${type}>, sampler, float2 location, ${type} CompareValue, int2 offset);`); >+ print(`native ${type} SampleCmpLevelZero(TextureDepth2D<${type}>, sampler, float2 location, ${type} CompareValue);`); >+ print(`native ${type} SampleCmpLevelZero(TextureDepth2D<${type}>, sampler, float2 location, ${type} CompareValue, int2 offset);`); > print(`native ${type} SampleBias(TextureDepth2D<${type}>, sampler, float2 location, float Bias);`); > print(`native ${type} SampleBias(TextureDepth2D<${type}>, sampler, float2 location, float Bias, int2 offset);`); > print(`native ${type} SampleGrad(TextureDepth2D<${type}>, sampler, float2 location, float2 DDX, float2 DDY);`); > print(`native ${type} SampleGrad(TextureDepth2D<${type}>, sampler, float2 location, float2 DDX, float2 DDY, int2 offset);`); > print(`native ${type} SampleLevel(TextureDepth2D<${type}>, sampler, float2 location, float LOD);`); > print(`native ${type} SampleLevel(TextureDepth2D<${type}>, sampler, float2 location, float LOD, int2 offset);`); >- print(`native ${type} Gather(TextureDepth2D<${type}>, sampler, float2 location);`); >- print(`native ${type} Gather(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >- print(`native ${type} GatherRed(TextureDepth2D<${type}>, sampler, float2 location);`); >- print(`native ${type} GatherRed(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >- print(`native ${type} GatherGreen(TextureDepth2D<${type}>, sampler, float2 location);`); >- print(`native ${type} GatherGreen(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >- print(`native ${type} GatherBlue(TextureDepth2D<${type}>, sampler, float2 location);`); >- print(`native ${type} GatherBlue(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >- print(`native ${type} GatherAlpha(TextureDepth2D<${type}>, sampler, float2 location);`); >- print(`native ${type} GatherAlpha(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >- print(`native ${type} GatherCmp(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value);`); >- print(`native ${type} GatherCmp(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpRed(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value);`); >- print(`native ${type} GatherCmpRed(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpGreen(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value);`); >- print(`native ${type} GatherCmpGreen(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpBlue(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value);`); >- print(`native ${type} GatherCmpBlue(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpAlpha(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value);`); >- print(`native ${type} GatherCmpAlpha(TextureDepth2D<${type}>, SamplerComparisonState, float2 location, float compare_value, int2 offset);`); >+ print(`native ${type}4 Gather(TextureDepth2D<${type}>, sampler, float2 location);`); >+ print(`native ${type}4 Gather(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >+ print(`native ${type}4 GatherRed(TextureDepth2D<${type}>, sampler, float2 location);`); >+ print(`native ${type}4 GatherRed(TextureDepth2D<${type}>, sampler, float2 location, int2 offset);`); >+ print(`native ${type}4 GatherCmp(TextureDepth2D<${type}>, sampler, float2 location, float compare_value);`); >+ print(`native ${type}4 GatherCmp(TextureDepth2D<${type}>, sampler, float2 location, float compare_value, int2 offset);`); >+ print(`native ${type}4 GatherCmpRed(TextureDepth2D<${type}>, sampler, float2 location, float compare_value);`); >+ print(`native ${type}4 GatherCmpRed(TextureDepth2D<${type}>, sampler, float2 location, float compare_value, int2 offset);`); > print(`native ${type} Load(TextureDepth2D<${type}>, int3 location);`); > print(`native ${type} Load(TextureDepth2D<${type}>, int3 location, int2 offset);`); > print(`native void GetDimensions(TextureDepth2D<${type}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`); > print(); > print(`native ${type} Sample(TextureDepth2DArray<${type}>, sampler, float3 location);`); > print(`native ${type} Sample(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >- print(`native ${type} SampleCmp(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float CompareValue);`); >- print(`native ${type} SampleCmp(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float CompareValue, int2 offset);`); >- print(`native ${type} SampleCmpLevelZero(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float CompareValue);`); >- print(`native ${type} SampleCmpLevelZero(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float CompareValue, int2 offset);`); >+ print(`native ${type} SampleCmp(TextureDepth2DArray<${type}>, sampler, float3 location, ${type} CompareValue);`); >+ print(`native ${type} SampleCmp(TextureDepth2DArray<${type}>, sampler, float3 location, ${type} CompareValue, int2 offset);`); >+ print(`native ${type} SampleCmpLevelZero(TextureDepth2DArray<${type}>, sampler, float3 location, ${type} CompareValue);`); >+ print(`native ${type} SampleCmpLevelZero(TextureDepth2DArray<${type}>, sampler, float3 location, ${type} CompareValue, int2 offset);`); > print(`native ${type} SampleBias(TextureDepth2DArray<${type}>, sampler, float3 location, float Bias);`); > print(`native ${type} SampleBias(TextureDepth2DArray<${type}>, sampler, float3 location, float Bias, int2 offset);`); > print(`native ${type} SampleGrad(TextureDepth2DArray<${type}>, sampler, float3 location, float2 DDX, float2 DDY);`); > print(`native ${type} SampleGrad(TextureDepth2DArray<${type}>, sampler, float3 location, float2 DDX, float2 DDY, int2 offset);`); > print(`native ${type} SampleLevel(TextureDepth2DArray<${type}>, sampler, float3 location, float LOD);`); > print(`native ${type} SampleLevel(TextureDepth2DArray<${type}>, sampler, float3 location, float LOD, int2 offset);`); >- print(`native ${type} Gather(TextureDepth2DArray<${type}>, sampler, float3 location);`); >- print(`native ${type} Gather(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >- print(`native ${type} GatherRed(TextureDepth2DArray<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherRed(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >- print(`native ${type} GatherGreen(TextureDepth2DArray<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherGreen(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >- print(`native ${type} GatherBlue(TextureDepth2DArray<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherBlue(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >- print(`native ${type} GatherAlpha(TextureDepth2DArray<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherAlpha(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >- print(`native ${type} GatherCmp(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmp(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpRed(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpRed(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpGreen(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpGreen(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpBlue(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpBlue(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value, int2 offset);`); >- print(`native ${type} GatherCmpAlpha(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpAlpha(TextureDepth2DArray<${type}>, SamplerComparisonState, float3 location, float compare_value, int2 offset);`); >+ print(`native ${type}4 Gather(TextureDepth2DArray<${type}>, sampler, float3 location);`); >+ print(`native ${type}4 Gather(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >+ print(`native ${type}4 GatherRed(TextureDepth2DArray<${type}>, sampler, float3 location);`); >+ print(`native ${type}4 GatherRed(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`); >+ print(`native ${type}4 GatherCmp(TextureDepth2DArray<${type}>, sampler, float3 location, float compare_value);`); >+ print(`native ${type}4 GatherCmp(TextureDepth2DArray<${type}>, sampler, float3 location, float compare_value, int2 offset);`); >+ print(`native ${type}4 GatherCmpRed(TextureDepth2DArray<${type}>, sampler, float3 location, float compare_value);`); >+ print(`native ${type}4 GatherCmpRed(TextureDepth2DArray<${type}>, sampler, float3 location, float compare_value, int2 offset);`); > print(`native ${type} Load(TextureDepth2DArray<${type}>, int4 location);`); > print(`native ${type} Load(TextureDepth2DArray<${type}>, int4 location, int2 offset);`); > print(`native void GetDimensions(TextureDepth2DArray<${type}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* Elements, thread uint* NumberOfLevels);`); > print(); > print(`native ${type} Sample(TextureDepthCube<${type}>, sampler, float3 location);`); >- print(`native ${type} SampleCmp(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float CompareValue);`); >- print(`native ${type} SampleCmpLevelZero(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float CompareValue);`); >+ print(`native ${type} SampleCmp(TextureDepthCube<${type}>, sampler, float3 location, ${type} CompareValue);`); >+ print(`native ${type} SampleCmpLevelZero(TextureDepthCube<${type}>, sampler, float3 location, ${type} CompareValue);`); > print(`native ${type} SampleBias(TextureDepthCube<${type}>, sampler, float3 location, float Bias);`); >- print(`native ${type} SampleGrad(TextureDepthCube<${type}>, sampler, float3 location, float2 DDX, float2 DDY);`); >+ print(`native ${type} SampleGrad(TextureDepthCube<${type}>, sampler, float3 location, float3 DDX, float3 DDY);`); > print(`native ${type} SampleLevel(TextureDepthCube<${type}>, sampler, float3 location, float LOD);`); >- print(`native ${type} Gather(TextureDepthCube<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherRed(TextureDepthCube<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherGreen(TextureDepthCube<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherBlue(TextureDepthCube<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherAlpha(TextureDepthCube<${type}>, sampler, float3 location);`); >- print(`native ${type} GatherCmp(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpRed(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpGreen(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpBlue(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} GatherCmpAlpha(TextureDepthCube<${type}>, SamplerComparisonState, float3 location, float compare_value);`); >- print(`native ${type} Load(TextureDepthCube<${type}>, int4 location);`); >+ print(`native ${type}4 Gather(TextureDepthCube<${type}>, sampler, float3 location);`); >+ print(`native ${type}4 GatherRed(TextureDepthCube<${type}>, sampler, float3 location);`); >+ print(`native ${type}4 GatherCmp(TextureDepthCube<${type}>, sampler, float3 location, float compare_value);`); >+ print(`native ${type}4 GatherCmpRed(TextureDepthCube<${type}>, sampler, float3 location, float compare_value);`); > print(`native void GetDimensions(TextureDepthCube<${type}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`); > print(); > print(`native void GetDimensions(RWTextureDepth2D<${type}>, thread uint* Width, thread uint* Height);`); >@@ -2114,7 +2091,6 @@ let standardLibrary = (function() { > print(`native void Store(RWTextureDepth2DArray<${type}>, ${type}, uint3 location);`); > print(); > } >- */ > })(); > return result; > })(); >diff --git a/Tools/WebGPUShadingLanguageRI/Test.html b/Tools/WebGPUShadingLanguageRI/Test.html >index 607a6953253da727b1de37678ec388b4fa240405..fb1015f19381cf6eac7317b485ef00c3ec1cb96e 100644 >--- a/Tools/WebGPUShadingLanguageRI/Test.html >+++ b/Tools/WebGPUShadingLanguageRI/Test.html >@@ -28,6 +28,7 @@ > <script src="BuiltinVectorSetter.js"></script> > <script src="CallExpression.js"></script> > <script src="CallFunction.js"></script> >+<script src="Casts.js"></script> > <script src="Check.js"></script> > <script src="CheckLiteralTypes.js"></script> > <script src="CheckLoops.js"></script> >@@ -115,6 +116,7 @@ > <script src="Return.js"></script> > <script src="ReturnChecker.js"></script> > <script src="ReturnException.js"></script> >+<script src="Sampler.js"></script> > <script src="StandardLibrary.js"></script> > <script src="StatementCloner.js"></script> > <script src="StructLayoutBuilder.js"></script> >@@ -127,6 +129,8 @@ > <script src="SynthesizeCopyConstructorOperator.js"></script> > <script src="SynthesizeDefaultConstructorOperator.js"></script> > <script src="TernaryExpression.js"></script> >+<script src="Texture.js"></script> >+<script src="TextureOperations.js"></script> > <script src="TrapStatement.js"></script> > <script src="TypeDef.js"></script> > <script src="TypeDefResolver.js"></script> >diff --git a/Tools/WebGPUShadingLanguageRI/Test.js b/Tools/WebGPUShadingLanguageRI/Test.js >index 4a11c1858599778ff391b04f2635c5b71005df7f..af86852367fddd5665869b3c2471e904b6e062a1 100644 >--- a/Tools/WebGPUShadingLanguageRI/Test.js >+++ b/Tools/WebGPUShadingLanguageRI/Test.js >@@ -94,6 +94,133 @@ function makeEnum(program, enumName, value) > return TypedValue.box(enumType, enumMember.value.unifyNode.valueForSelectedType); > } > >+function makeSampler(program, options) >+{ >+ // enum WebGPUAddressMode { >+ // "clampToEdge", >+ // "repeat", >+ // "mirrorRepeat", >+ // "clampToBorderColor" >+ // } >+ // >+ // enum WebGPUFilterMode { >+ // "nearest", >+ // "linear" >+ // } >+ // >+ // enum WebGPUCompareFunction { >+ // "never", >+ // "less", >+ // "equal", >+ // "lessEqual", >+ // "greater", >+ // "notEqual", >+ // "greaterEqual", >+ // "always" >+ // } >+ // >+ // enum WebGPUBorderColor { >+ // "transparentBlack", >+ // "opaqueBlack", >+ // "opaqueWhite" >+ // } >+ // >+ // dictionary WebGPUSamplerDescriptor { >+ // WebGPUddressMode rAddressMode = "clampToEdge"; >+ // WebGPUddressMode sAddressMode = "clampToEdge"; >+ // WebGPUddressMode tAddressMode = "clampToEdge"; >+ // WebGPUFilterModeEnum magFilter = "nearest"; >+ // WebGPUFilterModeEnum minFilter = "nearest"; >+ // WebGPUFilterModeEnum mipmapFilter = "nearest"; >+ // float lodMinClamp = 0; >+ // float lodMaxClamp = Number.MAX_VALUE; >+ // unsigned long maxAnisotropy = 1; >+ // WebGPUCompareFunction compareFunction = "never"; >+ // WebGPUBorderColor borderColor = "transparentBlack"; >+ // }; >+ return TypedValue.box(program.intrinsics.sampler, new Sampler(options)); >+} >+ >+function make1DTexture(program, mipmaps, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`Texture1D<${elementType}>`], new Texture1D(elementType, mipmaps)); >+} >+ >+function make1DTextureArray(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`Texture1DArray<${elementType}>`], new Texture1DArray(elementType, array)); >+} >+ >+function make2DTexture(program, mipmaps, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`Texture2D<${elementType}>`], new Texture2D(elementType, mipmaps)); >+} >+ >+function make2DTextureArray(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`Texture2DArray<${elementType}>`], new Texture2DArray(elementType, array)); >+} >+ >+function make3DTexture(program, mipmaps, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`Texture3D<${elementType}>`], new Texture3D(elementType, mipmaps)); >+} >+ >+function makeTextureCube(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`TextureCube<${elementType}>`], new TextureCube(elementType, array)); >+} >+ >+function makeRW1DTexture(program, elements, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTexture1D<${elementType}>`], new Texture1DRW(elementType, elements)); >+} >+ >+function makeRW1DTextureArray(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTexture1DArray<${elementType}>`], new Texture1DArrayRW(elementType, array)); >+} >+ >+function makeRW2DTexture(program, rows, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTexture2D<${elementType}>`], new Texture2DRW(elementType, rows)); >+} >+ >+function makeRW2DTextureArray(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTexture2DArray<${elementType}>`], new Texture2DArrayRW(elementType, array)); >+} >+ >+function makeRW3DTexture(program, depthSlices, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTexture3D<${elementType}>`], new Texture3DRW(elementType, depthSlices)); >+} >+ >+function make2DDepthTexture(program, mipmaps, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`TextureDepth2D<${elementType}>`], new TextureDepth2D(elementType, mipmaps)); >+} >+ >+function make2DDepthTextureArray(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`TextureDepth2DArray<${elementType}>`], new TextureDepth2DArray(elementType, array)); >+} >+ >+function makeDepthTextureCube(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`TextureDepthCube<${elementType}>`], new TextureDepthCube(elementType, array)); >+} >+ >+function makeRW2DDepthTexture(program, rows, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTextureDepth2D<${elementType}>`], new TextureDepth2DRW(elementType, rows)); >+} >+ >+function makeRW2DDepthTextureArray(program, array, elementType) >+{ >+ return TypedValue.box(program.intrinsics[`RWTextureDepth2DArray<${elementType}>`], new TextureDepth2DArrayRW(elementType, array)); >+} >+ > function checkNumber(program, result, expected) > { > if (!result.type.unifyNode.isNumber) >@@ -157,6 +284,14 @@ function checkHalf(program, result, expected) > throw new Error("Wrong result: " + result.value + " (expected " + expected + ")"); > } > >+function checkFloat4(program, result, expected) >+{ >+ if (!result.type.equals(program.intrinsics["vector<float, 4>"])) >+ throw new Error("Wrong result type: " + result.type); >+ if (result.ePtr.get(0) != expected[0] || result.ePtr.get(1) != expected[1] || result.ePtr.get(2) != expected[2] || result.ePtr.get(3) != expected[3]) >+ throw new Error("Wrong result: [" + result.ePtr.get(0) + ", " + result.ePtr.get(1) + ", " + result.ePtr.get(2) + ", " + result.ePtr.get(3) + "] (expected [" + expected[0] + ", " + expected[1] + ", " + expected[2] + ", " + expected[3] + "])"); >+} >+ > function checkLexerToken(result, expectedIndex, expectedKind, expectedText) > { > if (result._index != expectedIndex) >@@ -5582,7 +5717,1797 @@ tests.arrayIndex = function() { > checkInt(program, callFunction(program, "arrayIndexing", [ makeUint(program, 0), makeUint(program, 2) ]), 3); > checkInt(program, callFunction(program, "arrayIndexing", [ makeUint(program, 1), makeUint(program, 0) ]), 4); > checkInt(program, callFunction(program, "arrayIndexing", [ makeUint(program, 1), makeUint(program, 1) ]), 5); >- checkInt(program, callFunction(program, "arrayIndexing", [ makeUint(program, 1), makeUint(program, 2) ]), 6); >+ checkInt(program, callFunction(program, "arrayIndexing", [ makeUint(program, 1), makeUint(program, 2) ]), 6); >+} >+ >+function createTexturesForTesting(program) >+{ >+ let texture1D = make1DTexture(program, [[1, 7, 14, 79], [13, 16], [15]], "float"); >+ let texture1DArray = make1DTextureArray(program, [[[1, 7, 14, 79], [13, 16], [15]], [[16, 17, 18, 19], [20, 21], [22]]], "float"); >+ let texture2D = make2DTexture(program, [ >+ [[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]] >+ ], "float"); >+ let texture2DArray = make2DTextureArray(program, [[ >+ [[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]] >+ ]], "float"); >+ let texture3D = make3DTexture(program, [ >+ [[[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]]] >+ ], "float"); >+ let textureCube = makeTextureCube(program, [[ >+ [[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]], >+ ]], "float"); >+ let rwTexture1D = makeRW1DTexture(program, [1, 2, 3, 4, 5, 6, 7, 8], "float"); >+ let rwTexture1DArray = makeRW1DTextureArray(program, [[1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22, 23, 24]], "float"); >+ let rwTexture2D = makeRW2DTexture(program, [ >+ [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]], "float"); >+ let rwTexture2DArray = makeRW2DTextureArray(program, [ >+ [[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]]], "float"); >+ let rwTexture3D = makeRW3DTexture(program, [ >+ [[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]]], "float"); >+ let textureDepth2D = make2DDepthTexture(program, [ >+ [[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]] >+ ], "float"); >+ let textureDepth2DArray = make2DDepthTextureArray(program, [[ >+ [[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]] >+ ]], "float"); >+ let textureDepthCube = makeDepthTextureCube(program, [[ >+ [[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]], >+ ]], "float"); >+ let rwTextureDepth2D = makeRW2DDepthTexture(program, [ >+ [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]], "float"); >+ let rwTextureDepth2DArray = makeRW2DDepthTextureArray(program, [ >+ [[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]]], "float"); >+ return [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray]; >+} >+ >+tests.textureDimensions = function() { >+ let program = doPrep(` >+ uint foo1(Texture1D<float> texture) { >+ uint width; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &numberOfLevels); >+ return width; >+ } >+ uint foo2(Texture1D<float> texture) { >+ uint width; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo3(Texture1DArray<float> texture) { >+ uint width; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &elements, &numberOfLevels); >+ return width; >+ } >+ uint foo4(Texture1DArray<float> texture) { >+ uint width; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &elements, &numberOfLevels); >+ return elements; >+ } >+ uint foo5(Texture1DArray<float> texture) { >+ uint width; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &elements, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo6(Texture2D<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return width; >+ } >+ uint foo7(Texture2D<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return height; >+ } >+ uint foo8(Texture2D<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo9(Texture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return width; >+ } >+ uint foo10(Texture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return height; >+ } >+ uint foo11(Texture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return elements; >+ } >+ uint foo12(Texture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo13(Texture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &depth, &numberOfLevels); >+ return width; >+ } >+ uint foo14(Texture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &depth, &numberOfLevels); >+ return height; >+ } >+ uint foo15(Texture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &depth, &numberOfLevels); >+ return depth; >+ } >+ uint foo16(Texture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &depth, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo17(TextureCube<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return width; >+ } >+ uint foo18(TextureCube<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return height; >+ } >+ uint foo19(TextureCube<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo20(RWTexture1D<float> texture) { >+ uint width; >+ GetDimensions(texture, &width); >+ return width; >+ } >+ uint foo21(RWTexture1DArray<float> texture) { >+ uint width; >+ uint elements; >+ GetDimensions(texture, &width, &elements); >+ return width; >+ } >+ uint foo22(RWTexture1DArray<float> texture) { >+ uint width; >+ uint elements; >+ GetDimensions(texture, &width, &elements); >+ return elements; >+ } >+ uint foo23(RWTexture2D<float> texture) { >+ uint width; >+ uint height; >+ GetDimensions(texture, &width, &height); >+ return width; >+ } >+ uint foo24(RWTexture2D<float> texture) { >+ uint width; >+ uint height; >+ GetDimensions(texture, &width, &height); >+ return height; >+ } >+ uint foo25(RWTexture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ GetDimensions(texture, &width, &height, &elements); >+ return width; >+ } >+ uint foo26(RWTexture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ GetDimensions(texture, &width, &height, &elements); >+ return height; >+ } >+ uint foo27(RWTexture2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ GetDimensions(texture, &width, &height, &elements); >+ return elements; >+ } >+ uint foo28(RWTexture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ GetDimensions(texture, &width, &height, &depth); >+ return width; >+ } >+ uint foo29(RWTexture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ GetDimensions(texture, &width, &height, &depth); >+ return height; >+ } >+ uint foo30(RWTexture3D<float> texture) { >+ uint width; >+ uint height; >+ uint depth; >+ GetDimensions(texture, &width, &height, &depth); >+ return depth; >+ } >+ uint foo31(TextureDepth2D<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return width; >+ } >+ uint foo32(TextureDepth2D<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return height; >+ } >+ uint foo33(TextureDepth2D<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo34(TextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return width; >+ } >+ uint foo35(TextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return height; >+ } >+ uint foo36(TextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return elements; >+ } >+ uint foo37(TextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &elements, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo38(TextureDepthCube<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return width; >+ } >+ uint foo39(TextureDepthCube<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return height; >+ } >+ uint foo40(TextureDepthCube<float> texture) { >+ uint width; >+ uint height; >+ uint numberOfLevels; >+ GetDimensions(texture, 0, &width, &height, &numberOfLevels); >+ return numberOfLevels; >+ } >+ uint foo41(RWTextureDepth2D<float> texture) { >+ uint width; >+ uint height; >+ GetDimensions(texture, &width, &height); >+ return width; >+ } >+ uint foo42(RWTextureDepth2D<float> texture) { >+ uint width; >+ uint height; >+ GetDimensions(texture, &width, &height); >+ return height; >+ } >+ uint foo43(RWTextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ GetDimensions(texture, &width, &height, &elements); >+ return width; >+ } >+ uint foo44(RWTextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ GetDimensions(texture, &width, &height, &elements); >+ return height; >+ } >+ uint foo45(RWTextureDepth2DArray<float> texture) { >+ uint width; >+ uint height; >+ uint elements; >+ GetDimensions(texture, &width, &height, &elements); >+ return elements; >+ } >+ `); >+ let [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray] = createTexturesForTesting(program); >+ checkUint(program, callFunction(program, "foo1", [texture1D]), 4); >+ checkUint(program, callFunction(program, "foo2", [texture1D]), 3); >+ checkUint(program, callFunction(program, "foo3", [texture1DArray]), 4); >+ checkUint(program, callFunction(program, "foo4", [texture1DArray]), 2); >+ checkUint(program, callFunction(program, "foo5", [texture1DArray]), 3); >+ checkUint(program, callFunction(program, "foo6", [texture2D]), 8); >+ checkUint(program, callFunction(program, "foo7", [texture2D]), 4); >+ checkUint(program, callFunction(program, "foo8", [texture2D]), 3); >+ checkUint(program, callFunction(program, "foo9", [texture2DArray]), 8); >+ checkUint(program, callFunction(program, "foo10", [texture2DArray]), 4); >+ checkUint(program, callFunction(program, "foo11", [texture2DArray]), 2); >+ checkUint(program, callFunction(program, "foo12", [texture2DArray]), 3); >+ checkUint(program, callFunction(program, "foo13", [texture3D]), 8); >+ checkUint(program, callFunction(program, "foo14", [texture3D]), 4); >+ checkUint(program, callFunction(program, "foo15", [texture3D]), 2); >+ checkUint(program, callFunction(program, "foo16", [texture3D]), 2); >+ checkUint(program, callFunction(program, "foo17", [textureCube]), 2); >+ checkUint(program, callFunction(program, "foo18", [textureCube]), 4); >+ checkUint(program, callFunction(program, "foo19", [textureCube]), 2); >+ checkUint(program, callFunction(program, "foo20", [rwTexture1D]), 8); >+ checkUint(program, callFunction(program, "foo21", [rwTexture1DArray]), 8); >+ checkUint(program, callFunction(program, "foo22", [rwTexture1DArray]), 3); >+ checkUint(program, callFunction(program, "foo23", [rwTexture2D]), 8); >+ checkUint(program, callFunction(program, "foo24", [rwTexture2D]), 4); >+ checkUint(program, callFunction(program, "foo25", [rwTexture2DArray]), 8); >+ checkUint(program, callFunction(program, "foo26", [rwTexture2DArray]), 4); >+ checkUint(program, callFunction(program, "foo27", [rwTexture2DArray]), 2); >+ checkUint(program, callFunction(program, "foo28", [rwTexture3D]), 8); >+ checkUint(program, callFunction(program, "foo29", [rwTexture3D]), 4); >+ checkUint(program, callFunction(program, "foo30", [rwTexture3D]), 2); >+ checkUint(program, callFunction(program, "foo31", [textureDepth2D]), 8); >+ checkUint(program, callFunction(program, "foo32", [textureDepth2D]), 4); >+ checkUint(program, callFunction(program, "foo33", [textureDepth2D]), 3); >+ checkUint(program, callFunction(program, "foo34", [textureDepth2DArray]), 8); >+ checkUint(program, callFunction(program, "foo35", [textureDepth2DArray]), 4); >+ checkUint(program, callFunction(program, "foo36", [textureDepth2DArray]), 2); >+ checkUint(program, callFunction(program, "foo37", [textureDepth2DArray]), 3); >+ checkUint(program, callFunction(program, "foo38", [textureDepthCube]), 2); >+ checkUint(program, callFunction(program, "foo39", [textureDepthCube]), 4); >+ checkUint(program, callFunction(program, "foo40", [textureDepthCube]), 2); >+ checkUint(program, callFunction(program, "foo41", [rwTextureDepth2D]), 8); >+ checkUint(program, callFunction(program, "foo42", [rwTextureDepth2D]), 4); >+ checkUint(program, callFunction(program, "foo43", [rwTextureDepth2DArray]), 8); >+ checkUint(program, callFunction(program, "foo44", [rwTextureDepth2DArray]), 4); >+ checkUint(program, callFunction(program, "foo45", [rwTextureDepth2DArray]), 2); >+} >+ >+tests.textureLoad = function() { >+ let program = doPrep(` >+ float foo1(Texture1D<float> texture, int location, int mipmap) { >+ return Load(texture, int2(location, mipmap)); >+ } >+ float foo2(Texture1D<float> texture, int location, int mipmap, int offset) { >+ return Load(texture, int2(location, mipmap), offset); >+ } >+ float foo3(Texture1DArray<float> texture, int location, int mipmap, int layer) { >+ return Load(texture, int3(location, mipmap, layer)); >+ } >+ float foo4(Texture1DArray<float> texture, int location, int mipmap, int layer, int offset) { >+ return Load(texture, int3(location, mipmap, layer), offset); >+ } >+ float foo5(Texture2D<float> texture, int x, int y, int mipmap) { >+ return Load(texture, int3(x, y, mipmap)); >+ } >+ float foo6(Texture2D<float> texture, int x, int y, int mipmap, int offsetX, int offsetY) { >+ return Load(texture, int3(x, y, mipmap), int2(offsetX, offsetY)); >+ } >+ float foo7(Texture2DArray<float> texture, int x, int y, int mipmap, int layer) { >+ return Load(texture, int4(x, y, mipmap, layer)); >+ } >+ float foo8(Texture2DArray<float> texture, int x, int y, int mipmap, int layer, int offsetX, int offsetY) { >+ return Load(texture, int4(x, y, mipmap, layer), int2(offsetX, offsetY)); >+ } >+ float foo9(Texture3D<float> texture, int x, int y, int z, int mipmap) { >+ return Load(texture, int4(x, y, z, mipmap)); >+ } >+ float foo10(Texture3D<float> texture, int x, int y, int z, int mipmap, int offsetX, int offsetY, int offsetZ) { >+ return Load(texture, int4(x, y, z, mipmap), int3(offsetX, offsetY, offsetZ)); >+ } >+ float foo11(RWTexture1D<float> texture, int location) { >+ return Load(texture, location); >+ } >+ float foo12(RWTexture1DArray<float> texture, int location, int layer) { >+ return Load(texture, int2(location, layer)); >+ } >+ float foo13(RWTexture2D<float> texture, int x, int y) { >+ return Load(texture, int2(x, y)); >+ } >+ float foo14(RWTexture2DArray<float> texture, int x, int y, int layer) { >+ return Load(texture, int3(x, y, layer)); >+ } >+ float foo15(RWTexture3D<float> texture, int x, int y, int z) { >+ return Load(texture, int3(x, y, z)); >+ } >+ float foo16(TextureDepth2D<float> texture, int x, int y, int mipmap) { >+ return Load(texture, int3(x, y, mipmap)); >+ } >+ float foo17(TextureDepth2D<float> texture, int x, int y, int mipmap, int offsetX, int offsetY) { >+ return Load(texture, int3(x, y, mipmap), int2(offsetX, offsetY)); >+ } >+ float foo18(TextureDepth2DArray<float> texture, int x, int y, int mipmap, int layer) { >+ return Load(texture, int4(x, y, mipmap, layer)); >+ } >+ float foo19(TextureDepth2DArray<float> texture, int x, int y, int mipmap, int layer, int offsetX, int offsetY) { >+ return Load(texture, int4(x, y, mipmap, layer), int2(offsetX, offsetY)); >+ } >+ float foo20(RWTextureDepth2D<float> texture, int x, int y) { >+ return Load(texture, int2(x, y)); >+ } >+ float foo21(RWTextureDepth2DArray<float> texture, int x, int y, int layer) { >+ return Load(texture, int3(x, y, layer)); >+ } >+ `); >+ let [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray] = createTexturesForTesting(program); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeInt(program, 1), makeInt(program, 0)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeInt(program, 0), makeInt(program, 1)]), 13); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeInt(program, 1), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo2", [texture1D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 7); >+ checkFloat(program, callFunction(program, "foo2", [texture1D, makeInt(program, 1), makeInt(program, 0), makeInt(program, -1)]), 1); >+ checkFloat(program, callFunction(program, "foo2", [texture1D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo2", [texture1D, makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 13); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 7); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 13); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 16); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 17); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 20); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 21); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 7); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1)]), 1); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1)]), 13); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 17); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1)]), 16); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 21); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 20); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 33); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 34); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 37); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 38); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1), makeInt(program, 1)]), 9); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 18); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1), makeInt(program, 1)]), 17); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 38); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1), makeInt(program, 0)]), 33); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1), makeInt(program, 1)]), 37); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 38); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 34); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1), makeInt(program, 0)]), 37); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1), makeInt(program, -1)]), 33); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 33); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 37); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 38); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 43); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 44); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 51); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 52); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 75); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 76); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 79); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 80); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 3); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 11); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 18); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 11); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 19); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 38); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 35); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 39); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 38); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1)]), 34); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 39); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1)]), 35); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 44); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 52); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 45); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 53); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 52); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 60); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 53); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 61); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 76); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 80); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 77); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 81); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 80); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 76); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 81); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 77); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 33); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 41); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 42); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 65); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 66); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 69); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 70); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 33); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 3); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 34); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 17); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 41); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 11); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 18); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 42); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 41); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1)]), 1); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 35); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 42); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1)]), 2); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 42); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 49); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1)]), 9); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 43); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 50); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1)]), 10); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 66); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 69); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 67); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 70); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 70); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1), makeInt(program, 0)]), 65); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 71); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1), makeInt(program, 0)]), 66); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 1)]), 2); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 2)]), 3); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 3)]), 4); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 4)]), 5); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 5)]), 6); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 6)]), 7); >+ checkFloat(program, callFunction(program, "foo11", [rwTexture1D, makeInt(program, 7)]), 8); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 2), makeInt(program, 0)]), 3); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 3), makeInt(program, 0)]), 4); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 4), makeInt(program, 0)]), 5); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 5), makeInt(program, 0)]), 6); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 6), makeInt(program, 0)]), 7); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 7), makeInt(program, 0)]), 8); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 0), makeInt(program, 1)]), 9); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 2), makeInt(program, 1)]), 11); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 3), makeInt(program, 1)]), 12); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 4), makeInt(program, 1)]), 13); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 5), makeInt(program, 1)]), 14); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 6), makeInt(program, 1)]), 15); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 7), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 0), makeInt(program, 2)]), 17); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 1), makeInt(program, 2)]), 18); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 2), makeInt(program, 2)]), 19); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 3), makeInt(program, 2)]), 20); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 4), makeInt(program, 2)]), 21); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 5), makeInt(program, 2)]), 22); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 6), makeInt(program, 2)]), 23); >+ checkFloat(program, callFunction(program, "foo12", [rwTexture1DArray, makeInt(program, 7), makeInt(program, 2)]), 24); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 2), makeInt(program, 0)]), 3); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 3), makeInt(program, 0)]), 4); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 4), makeInt(program, 0)]), 5); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 5), makeInt(program, 0)]), 6); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 6), makeInt(program, 0)]), 7); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 7), makeInt(program, 0)]), 8); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 0), makeInt(program, 1)]), 9); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 2), makeInt(program, 1)]), 11); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 3), makeInt(program, 1)]), 12); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 4), makeInt(program, 1)]), 13); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 5), makeInt(program, 1)]), 14); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 6), makeInt(program, 1)]), 15); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 7), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 0), makeInt(program, 2)]), 17); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 1), makeInt(program, 2)]), 18); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 2), makeInt(program, 2)]), 19); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 3), makeInt(program, 2)]), 20); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 4), makeInt(program, 2)]), 21); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 5), makeInt(program, 2)]), 22); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 6), makeInt(program, 2)]), 23); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 7), makeInt(program, 2)]), 24); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 0), makeInt(program, 3)]), 25); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 1), makeInt(program, 3)]), 26); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 2), makeInt(program, 3)]), 27); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 3), makeInt(program, 3)]), 28); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 4), makeInt(program, 3)]), 29); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 5), makeInt(program, 3)]), 30); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 6), makeInt(program, 3)]), 31); >+ checkFloat(program, callFunction(program, "foo13", [rwTexture2D, makeInt(program, 7), makeInt(program, 3)]), 32); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 33); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 34); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 41); >+ checkFloat(program, callFunction(program, "foo14", [rwTexture2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 42); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 33); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 34); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 41); >+ checkFloat(program, callFunction(program, "foo15", [rwTexture3D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 42); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 33); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 34); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 37); >+ checkFloat(program, callFunction(program, "foo16", [textureDepth2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 38); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, -1), makeInt(program, 1)]), 9); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 18); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, -1), makeInt(program, 1)]), 17); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 38); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1), makeInt(program, 0)]), 33); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1), makeInt(program, 1)]), 37); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 38); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 34); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1), makeInt(program, 0)]), 37); >+ checkFloat(program, callFunction(program, "foo17", [textureDepth2D, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1), makeInt(program, -1)]), 33); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 33); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 37); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 38); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 43); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 44); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 51); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 52); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 75); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 76); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 79); >+ checkFloat(program, callFunction(program, "foo18", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 80); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 3); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 11); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 18); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 11); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 19); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 34); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 38); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 35); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 39); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 38); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1)]), 34); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 39); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, -1)]), 35); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 44); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 52); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 45); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 53); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 52); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 60); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 53); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 61); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 76); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 80); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 77); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 81); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 80); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 76); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 81); >+ checkFloat(program, callFunction(program, "foo19", [textureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, 1), makeInt(program, -1)]), 77); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 1), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 2), makeInt(program, 0)]), 3); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 3), makeInt(program, 0)]), 4); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 4), makeInt(program, 0)]), 5); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 5), makeInt(program, 0)]), 6); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 6), makeInt(program, 0)]), 7); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 7), makeInt(program, 0)]), 8); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 0), makeInt(program, 1)]), 9); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 1), makeInt(program, 1)]), 10); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 2), makeInt(program, 1)]), 11); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 3), makeInt(program, 1)]), 12); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 4), makeInt(program, 1)]), 13); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 5), makeInt(program, 1)]), 14); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 6), makeInt(program, 1)]), 15); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 7), makeInt(program, 1)]), 16); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 0), makeInt(program, 2)]), 17); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 1), makeInt(program, 2)]), 18); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 2), makeInt(program, 2)]), 19); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 3), makeInt(program, 2)]), 20); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 4), makeInt(program, 2)]), 21); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 5), makeInt(program, 2)]), 22); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 6), makeInt(program, 2)]), 23); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 7), makeInt(program, 2)]), 24); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 0), makeInt(program, 3)]), 25); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 1), makeInt(program, 3)]), 26); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 2), makeInt(program, 3)]), 27); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 3), makeInt(program, 3)]), 28); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 4), makeInt(program, 3)]), 29); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 5), makeInt(program, 3)]), 30); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 6), makeInt(program, 3)]), 31); >+ checkFloat(program, callFunction(program, "foo20", [rwTextureDepth2D, makeInt(program, 7), makeInt(program, 3)]), 32); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 0)]), 1); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), 2); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), 9); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 0)]), 10); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), 33); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 1), makeInt(program, 0), makeInt(program, 1)]), 34); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 0), makeInt(program, 1), makeInt(program, 1)]), 41); >+ checkFloat(program, callFunction(program, "foo21", [rwTextureDepth2DArray, makeInt(program, 1), makeInt(program, 1), makeInt(program, 1)]), 42); >+} >+ >+tests.textureStore = function() { >+ let program = doPrep(` >+ float foo1(RWTexture1D<float> texture, uint location, float value) { >+ Store(texture, value, location); >+ return Load(texture, int(location)); >+ } >+ float foo2(RWTexture1DArray<float> texture, uint location, uint layer, float value) { >+ Store(texture, value, uint2(location, layer)); >+ return Load(texture, int2(int(location), int(layer))); >+ } >+ float foo3(RWTexture2D<float> texture, uint x, uint y, float value) { >+ Store(texture, value, uint2(x, y)); >+ return Load(texture, int2(int(x), int(y))); >+ } >+ float foo4(RWTexture2DArray<float> texture, uint x, uint y, uint layer, float value) { >+ Store(texture, value, uint3(x, y, layer)); >+ return Load(texture, int3(int(x), int(y), int(layer))); >+ } >+ float foo5(RWTexture3D<float> texture, uint x, uint y, uint z, float value) { >+ Store(texture, value, uint3(x, y, z)); >+ return Load(texture, int3(int(x), int(y), int(z))); >+ } >+ float foo6(RWTextureDepth2D<float> texture, uint x, uint y, float value) { >+ Store(texture, value, uint2(x, y)); >+ return Load(texture, int2(int(x), int(y))); >+ } >+ float foo7(RWTextureDepth2DArray<float> texture, uint x, uint y, uint layer, float value) { >+ Store(texture, value, uint3(x, y, layer)); >+ return Load(texture, int3(int(x), int(y), int(layer))); >+ } >+ `); >+ let [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray] = createTexturesForTesting(program); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 4), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 5), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 6), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo1", [rwTexture1D, makeUint(program, 7), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 2), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 3), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 4), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 5), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 6), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 7), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 2), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 3), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 4), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 5), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 6), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 7), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 0), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 1), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 2), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 3), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 4), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 5), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 6), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo2", [rwTexture1DArray, makeUint(program, 7), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 2), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 3), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 4), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 5), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 6), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 7), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 2), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 3), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 4), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 5), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 6), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 7), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 0), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 1), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 2), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 3), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 4), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 5), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 6), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 7), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 0), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 1), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 2), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 3), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 4), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 5), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 6), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo3", [rwTexture2D, makeUint(program, 7), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 0), makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 1), makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 0), makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 1), makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 0), makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 1), makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 0), makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo4", [rwTexture2DArray, makeUint(program, 1), makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 0), makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 1), makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 0), makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 1), makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 0), makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 1), makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 0), makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo5", [rwTexture3D, makeUint(program, 1), makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 2), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 3), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 4), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 5), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 6), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 7), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 2), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 3), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 4), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 5), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 6), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 7), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 0), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 1), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 2), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 3), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 4), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 5), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 6), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 7), makeUint(program, 2), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 0), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 1), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 2), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 3), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 4), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 5), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 6), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo6", [rwTextureDepth2D, makeUint(program, 7), makeUint(program, 3), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 0), makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 1), makeUint(program, 0), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 0), makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 1), makeUint(program, 1), makeUint(program, 0), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 0), makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 1), makeUint(program, 0), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 0), makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+ checkFloat(program, callFunction(program, "foo7", [rwTextureDepth2DArray, makeUint(program, 1), makeUint(program, 1), makeUint(program, 1), makeFloat(program, 999)]), 999); >+} >+ >+tests.textureSample = function() { >+ let program = doPrep(` >+ float foo1(Texture1D<float> texture, sampler s, float location) { >+ return Sample(texture, s, location); >+ } >+ float foo2(Texture1D<float> texture, sampler s, float location, int offset) { >+ return Sample(texture, s, location, offset); >+ } >+ float foo3(Texture1DArray<float> texture, sampler s, float x, float layer) { >+ return Sample(texture, s, float2(x, layer)); >+ } >+ float foo4(Texture1DArray<float> texture, sampler s, float x, float layer, int offset) { >+ return Sample(texture, s, float2(x, layer), offset); >+ } >+ float foo5(Texture2D<float> texture, sampler s, float x, float y) { >+ return Sample(texture, s, float2(x, y)); >+ } >+ float foo6(Texture2D<float> texture, sampler s, float x, float y, int offsetX, int offsetY) { >+ return Sample(texture, s, float2(x, y), int2(offsetX, offsetY)); >+ } >+ float foo7(Texture2DArray<float> texture, sampler s, float x, float y, float layer) { >+ return Sample(texture, s, float3(x, y, layer)); >+ } >+ float foo8(Texture2DArray<float> texture, sampler s, float x, float y, float layer, int offsetX, int offsetY) { >+ return Sample(texture, s, float3(x, y, layer), int2(offsetX, offsetY)); >+ } >+ float foo9(Texture3D<float> texture, sampler s, float x, float y, float z) { >+ return Sample(texture, s, float3(x, y, z)); >+ } >+ float foo10(Texture3D<float> texture, sampler s, float x, float y, float z, int offsetX, int offsetY, int offsetZ) { >+ return Sample(texture, s, float3(x, y, z), int3(offsetX, offsetY, offsetZ)); >+ } >+ float foo11(TextureCube<float> texture, sampler s, float x, float y, float z) { >+ return Sample(texture, s, float3(x, y, z)); >+ } >+ float foo12(Texture2D<float> texture, sampler s, float x, float y, float Bias) { >+ return SampleBias(texture, s, float2(x, y), Bias); >+ } >+ float foo13(Texture2D<float> texture, sampler s, float x, float y, float Bias, int offsetX, int offsetY) { >+ return SampleBias(texture, s, float2(x, y), Bias, int2(offsetX, offsetY)); >+ } >+ float foo14(Texture2D<float> texture, sampler s, float x, float y, float ddx0, float ddx1, float ddy0, float ddy1) { >+ return SampleGrad(texture, s, float2(x, y), float2(ddx0, ddx1), float2(ddy0, ddy1)); >+ } >+ float foo15(Texture2D<float> texture, sampler s, float x, float y, float ddx0, float ddx1, float ddy0, float ddy1, int offsetX, int offsetY) { >+ return SampleGrad(texture, s, float2(x, y), float2(ddx0, ddx1), float2(ddy0, ddy1), int2(offsetX, offsetY)); >+ } >+ float foo16(Texture2D<float> texture, sampler s, float x, float y, float LOD) { >+ return SampleLevel(texture, s, float2(x, y), LOD); >+ } >+ float foo17(Texture2D<float> texture, sampler s, float x, float y, float LOD, int offsetX, int offsetY) { >+ return SampleLevel(texture, s, float2(x, y), LOD, int2(offsetX, offsetY)); >+ } >+ float foo18(Texture2DArray<float> texture, sampler s, float x, float y, float layer, float Bias) { >+ return SampleBias(texture, s, float3(x, y, layer), Bias); >+ } >+ float foo19(Texture2DArray<float> texture, sampler s, float x, float y, float layer, float Bias, int offsetX, int offsetY) { >+ return SampleBias(texture, s, float3(x, y, layer), Bias, int2(offsetX, offsetY)); >+ } >+ float foo20(Texture2DArray<float> texture, sampler s, float x, float y, float layer, float ddx0, float ddx1, float ddy0, float ddy1) { >+ return SampleGrad(texture, s, float3(x, y, layer), float2(ddx0, ddx1), float2(ddy0, ddy1)); >+ } >+ float foo21(Texture2DArray<float> texture, sampler s, float x, float y, float layer, float ddx0, float ddx1, float ddy0, float ddy1, int offsetX, int offsetY) { >+ return SampleGrad(texture, s, float3(x, y, layer), float2(ddx0, ddx1), float2(ddy0, ddy1), int2(offsetX, offsetY)); >+ } >+ float foo22(Texture2DArray<float> texture, sampler s, float x, float y, float layer, float LOD) { >+ return SampleLevel(texture, s, float3(x, y, layer), LOD); >+ } >+ float foo23(Texture2DArray<float> texture, sampler s, float x, float y, float layer, float LOD, int offsetX, int offsetY) { >+ return SampleLevel(texture, s, float3(x, y, layer), LOD, int2(offsetX, offsetY)); >+ } >+ int foo24(Texture1D<int4> texture, sampler s, float location) { >+ return Sample(texture, s, location).x; >+ } >+ int foo25(Texture1D<int4> texture, sampler s, float location) { >+ return Sample(texture, s, location).y; >+ } >+ int foo26(Texture1D<int4> texture, sampler s, float location) { >+ return Sample(texture, s, location).z; >+ } >+ int foo27(Texture1D<int4> texture, sampler s, float location) { >+ return Sample(texture, s, location).w; >+ } >+ float foo28(TextureDepth2D<float> texture, sampler s, float x, float y) { >+ return Sample(texture, s, float2(x, y)); >+ } >+ float foo29(TextureDepth2D<float> texture, sampler s, float x, float y, int offsetX, int offsetY) { >+ return Sample(texture, s, float2(x, y), int2(offsetX, offsetY)); >+ } >+ float foo30(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer) { >+ return Sample(texture, s, float3(x, y, layer)); >+ } >+ float foo31(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, int offsetX, int offsetY) { >+ return Sample(texture, s, float3(x, y, layer), int2(offsetX, offsetY)); >+ } >+ float foo32(TextureDepthCube<float> texture, sampler s, float x, float y, float z) { >+ return Sample(texture, s, float3(x, y, z)); >+ } >+ float foo33(TextureDepth2D<float> texture, sampler s, float x, float y, float Bias) { >+ return SampleBias(texture, s, float2(x, y), Bias); >+ } >+ float foo34(TextureDepth2D<float> texture, sampler s, float x, float y, float Bias, int offsetX, int offsetY) { >+ return SampleBias(texture, s, float2(x, y), Bias, int2(offsetX, offsetY)); >+ } >+ float foo35(TextureDepth2D<float> texture, sampler s, float x, float y, float ddx0, float ddx1, float ddy0, float ddy1) { >+ return SampleGrad(texture, s, float2(x, y), float2(ddx0, ddx1), float2(ddy0, ddy1)); >+ } >+ float foo36(TextureDepth2D<float> texture, sampler s, float x, float y, float ddx0, float ddx1, float ddy0, float ddy1, int offsetX, int offsetY) { >+ return SampleGrad(texture, s, float2(x, y), float2(ddx0, ddx1), float2(ddy0, ddy1), int2(offsetX, offsetY)); >+ } >+ float foo37(TextureDepth2D<float> texture, sampler s, float x, float y, float LOD) { >+ return SampleLevel(texture, s, float2(x, y), LOD); >+ } >+ float foo38(TextureDepth2D<float> texture, sampler s, float x, float y, float LOD, int offsetX, int offsetY) { >+ return SampleLevel(texture, s, float2(x, y), LOD, int2(offsetX, offsetY)); >+ } >+ float foo39(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float Bias) { >+ return SampleBias(texture, s, float3(x, y, layer), Bias); >+ } >+ float foo40(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float Bias, int offsetX, int offsetY) { >+ return SampleBias(texture, s, float3(x, y, layer), Bias, int2(offsetX, offsetY)); >+ } >+ float foo41(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float ddx0, float ddx1, float ddy0, float ddy1) { >+ return SampleGrad(texture, s, float3(x, y, layer), float2(ddx0, ddx1), float2(ddy0, ddy1)); >+ } >+ float foo42(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float ddx0, float ddx1, float ddy0, float ddy1, int offsetX, int offsetY) { >+ return SampleGrad(texture, s, float3(x, y, layer), float2(ddx0, ddx1), float2(ddy0, ddy1), int2(offsetX, offsetY)); >+ } >+ float foo43(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float LOD) { >+ return SampleLevel(texture, s, float3(x, y, layer), LOD); >+ } >+ float foo44(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float LOD, int offsetX, int offsetY) { >+ return SampleLevel(texture, s, float3(x, y, layer), LOD, int2(offsetX, offsetY)); >+ } >+ float foo45(TextureDepth2D<float> texture, sampler s, float x, float y, float compareValue) { >+ return SampleCmp(texture, s, float2(x, y), compareValue); >+ } >+ float foo46(TextureDepth2D<float> texture, sampler s, float x, float y, float compareValue, int offsetX, int offsetY) { >+ return SampleCmp(texture, s, float2(x, y), compareValue, int2(offsetX, offsetY)); >+ } >+ float foo47(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float compareValue) { >+ return SampleCmp(texture, s, float3(x, y, layer), compareValue); >+ } >+ float foo48(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float compareValue, int offsetX, int offsetY) { >+ return SampleCmp(texture, s, float3(x, y, layer), compareValue, int2(offsetX, offsetY)); >+ } >+ float foo49(TextureCube<float> texture, sampler s, float x, float y, float z, float bias) { >+ return SampleBias(texture, s, float3(x, y, z), bias); >+ } >+ float foo50(TextureCube<float> texture, sampler s, float x, float y, float z, float ddx0, float ddx1, float ddx2, float ddy0, float ddy1, float ddy2) { >+ return SampleGrad(texture, s, float3(x, y, z), float3(ddx0, ddx1, ddx2), float3(ddy0, ddy1, ddy2)); >+ } >+ float foo51(TextureCube<float> texture, sampler s, float x, float y, float z, float lod) { >+ return SampleLevel(texture, s, float3(x, y, z), lod); >+ } >+ float foo52(TextureDepthCube<float> texture, sampler s, float x, float y, float z, float bias) { >+ return SampleBias(texture, s, float3(x, y, z), bias); >+ } >+ float foo53(TextureDepthCube<float> texture, sampler s, float x, float y, float z, float ddx0, float ddx1, float ddx2, float ddy0, float ddy1, float ddy2) { >+ return SampleGrad(texture, s, float3(x, y, z), float3(ddx0, ddx1, ddx2), float3(ddy0, ddy1, ddy2)); >+ } >+ float foo54(TextureDepthCube<float> texture, sampler s, float x, float y, float z, float lod) { >+ return SampleLevel(texture, s, float3(x, y, z), lod); >+ } >+ `); >+ let [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray] = createTexturesForTesting(program); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {}), makeFloat(program, 0.375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {}), makeFloat(program, 0.4375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {}), makeFloat(program, 0.5625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {}), makeFloat(program, 0.625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.4375)]), (3 * 7 + 1 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5625)]), (1 * 7 + 3 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, 0.375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, 0.4375)]), (3 * 7 + 1 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, 0.5)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, 0.5625)]), (1 * 7 + 3 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, 0.625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 1 + 0.375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 1 + 0.4375)]), (3 * 7 + 1 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 1 + 0.5)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 1 + 0.5625)]), (1 * 7 + 3 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 1 + 0.625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 2 + 0.375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 2 + 0.4375)]), (3 * 7 + 1 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 2 + 0.5)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 2 + 0.5625)]), (1 * 7 + 3 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "repeat"}), makeFloat(program, 2 + 0.625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 1 + 0.625)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 1 + 0.5625)]), (3 * 7 + 1 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 1 + 0.5)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 1 + 0.4375)]), (1 * 7 + 3 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 1 + 0.375)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 2 + 0.375)]), 7); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 2 + 0.4375)]), (3 * 7 + 1 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 2 + 0.5)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 2 + 0.5625)]), (1 * 7 + 3 * 14) / 4); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "mirrorRepeat"}), makeFloat(program, 2 + 0.625)]), 14); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -0.375)]), 1); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1.375)]), 79); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, -0.375)]), 0); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor"}), makeFloat(program, 1.375)]), 0); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor", borderColor: "opaqueBlack"}), makeFloat(program, -0.375)]), 0); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor", borderColor: "opaqueBlack"}), makeFloat(program, 1.375)]), 0); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor", borderColor: "opaqueWhite"}), makeFloat(program, -0.375)]), 1); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor", borderColor: "opaqueWhite"}), makeFloat(program, 1.375)]), 1); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {magFilter: "linear", rAddressMode: "clampToBorderColor", borderColor: "opaqueWhite"}), makeFloat(program, 1)]), (79 + 1) / 2); >+ checkFloat(program, callFunction(program, "foo1", [texture1D, makeSampler(program, {minFilter: "linear", lodMinClamp: 1}), makeFloat(program, 0.5)]), (13 + 16) / 2); >+ checkFloat(program, callFunction(program, "foo2", [texture1D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeInt(program, 1)]), (14 + 79) / 2); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0)]), (7 + 14) / 2); >+ checkFloat(program, callFunction(program, "foo3", [texture1DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 1)]), (17 + 18) / 2); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1)]), (14 + 79) / 2); >+ checkFloat(program, callFunction(program, "foo4", [texture1DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1)]), (18 + 19) / 2); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo5", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo6", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo7", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo8", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 1)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21 + 44 + 45 + 52 + 53) / 8); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (13 + 14 + 21 + 22 + 45 + 46 + 53 + 54) / 8); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 0.5)]), (20 + 21 + 28 + 29 + 52 + 53 + 60 + 61) / 8); >+ checkFloat(program, callFunction(program, "foo9", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 5 / 8)]), (12 + 13 + 20 + 21 + (44 + 45 + 52 + 53) * 3) / 16); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0), makeInt(program, 0)]), (13 + 14 + 21 + 22 + 45 + 46 + 53 + 54) / 8); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 1), makeInt(program, 0)]), (20 + 21 + 28 + 29 + 52 + 53 + 60 + 61) / 8); >+ checkFloat(program, callFunction(program, "foo10", [texture3D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.25), makeInt(program, 0), makeInt(program, 0), makeInt(program, 1)]), (44 + 45 + 52 + 53) / 4); >+ checkFloat(program, callFunction(program, "foo11", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo11", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo11", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo11", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo11", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo11", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1)]), (53 + 54 + 55 + 56) / 4); >+ // Unfortunately, we can't actually test the "Bias" argument, because it is supposed to be applied >+ // to the unclamped LOD, which for us is -Infinity (because our derivatives are all 0) >+ checkFloat(program, callFunction(program, "foo12", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo12", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo12", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 0)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo13", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo13", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo15", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo15", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo15", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo15", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo15", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo15", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo16", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo16", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo16", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo16", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 0)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo17", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo18", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo18", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo18", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 0), makeFloat(program, 0)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo18", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo18", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo18", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 1), makeFloat(program, 0)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo19", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo19", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo19", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo19", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height)]), (76 + 77 + 80 + 81) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo20", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height)]), (((54 + 55 + 62 + 63) / 4) + ((76 + 77 + 80 + 81) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (77 + 78 + 81 + 82) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo21", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (((55 + 56 + 63 + 64) / 4) + ((77 + 78 + 81 + 82) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1)]), (76 + 77 + 80 + 81) / 4); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo22", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5)]), (((54 + 55 + 62 + 63) / 4) + ((76 + 77 + 80 + 81) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 0)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 0)]), (76 + 77 + 80 + 81) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (((54 + 55 + 62 + 63) / 4) + ((76 + 77 + 80 + 81) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (77 + 78 + 81 + 82) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo23", [texture2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (((55 + 56 + 63 + 64) / 4) + ((77 + 78 + 81 + 82) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo16", [texture2D, makeSampler(program, {minFilter: "linear", lodMinClamp: 1, lodMaxClamp: 1}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 2)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo16", [texture2D, makeSampler(program, {minFilter: "linear", lodMinClamp: 1, lodMaxClamp: 1}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo14", [texture2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear", maxAnisotropy: 2}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 4 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, (4/3) / texture2D.ePtr.loadValue().height)]), (34 + 35 + 38 + 39) / 4); >+ let texture1DInt4 = make1DTexture(program, [[[1, 2, 3, 4], [100, 200, 300, 400], [101, 202, 301, 401], [13, 14, 15, 16]], [[17, 18, 19, 20], [21, 22, 23, 24]], [[25, 26, 27, 28]]], "int4"); >+ checkInt(program, callFunction(program, "foo24", [texture1DInt4, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5)]), 100); >+ checkInt(program, callFunction(program, "foo25", [texture1DInt4, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5)]), 201); >+ checkInt(program, callFunction(program, "foo26", [texture1DInt4, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5)]), 300); >+ checkInt(program, callFunction(program, "foo27", [texture1DInt4, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5)]), 400); >+ checkFloat(program, callFunction(program, "foo28", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo28", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo28", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo29", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo29", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo30", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo30", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 1)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo32", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo32", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo32", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo32", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo32", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo32", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo28", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo28", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo28", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo29", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo29", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo30", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo30", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo31", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 1)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo33", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo33", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo33", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 0)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo34", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo34", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo35", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo35", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo35", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo35", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo35", [textureDepth2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo36", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo36", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo36", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo36", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo36", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo36", [textureDepth2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo37", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo37", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo37", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo37", [textureDepth2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 0)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo38", [textureDepth2D, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo39", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo39", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo39", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 0), makeFloat(program, 0)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo39", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo39", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo39", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8), makeFloat(program, 1), makeFloat(program, 0)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo40", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo40", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (20 + 21 + 28 + 29) / 4); >+ checkFloat(program, callFunction(program, "foo40", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo40", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), (62 + 63 + 70 + 71) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height)]), (76 + 77 + 80 + 81) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo41", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height)]), (((54 + 55 + 62 + 63) / 4) + ((76 + 77 + 80 + 81) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 2 / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 2 / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (77 + 78 + 81 + 82) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.25) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo42", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, Math.pow(2, 0.5) / texture2D.ePtr.loadValue().height), makeInt(program, 1), makeInt(program, 0)]), (((55 + 56 + 63 + 64) / 4) + ((77 + 78 + 81 + 82) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1)]), (76 + 77 + 80 + 81) / 4); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo43", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5)]), (((54 + 55 + 62 + 63) / 4) + ((76 + 77 + 80 + 81) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 0)]), (34 + 35 + 38 + 39) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (12 + 13 + 20 + 21) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (((12 + 13 + 20 + 21) / 4) + ((34 + 35 + 38 + 39) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (35 + 36 + 39 + 40) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (13 + 14 + 21 + 22) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (((13 + 14 + 21 + 22) / 4) + ((35 + 36 + 39 + 40) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 0)]), (76 + 77 + 80 + 81) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (54 + 55 + 62 + 63) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 0)]), (((54 + 55 + 62 + 63) / 4) + ((76 + 77 + 80 + 81) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), (77 + 78 + 81 + 82) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (55 + 56 + 63 + 64) / 4); >+ checkFloat(program, callFunction(program, "foo44", [textureDepth2DArray, makeSampler(program, {minFilter: "linear", mipmapFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), (((55 + 56 + 63 + 64) / 4) + ((77 + 78 + 81 + 82) / 4)) / 2); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo45", [make2DDepthTexture(program, [[[17]]], "float"), makeSampler(program, {compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 0); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 11)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 17)]), 1); >+ checkFloat(program, callFunction(program, "foo47", [make2DDepthTextureArray(program, [[[[17]]]], "float"), makeSampler(program, {compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeFloat(program, 23)]), 1); >+ checkFloat(program, callFunction(program, "foo49", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo49", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo49", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo49", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo49", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo49", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().height), makeFloat(program, 0)]), (9 + 10) / 2); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0, 0, 4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().height), makeFloat(program, 0)]), (19 + 20) / 2); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 4 / textureCube.ePtr.loadValue().height)]), (29 + 30) / 2); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().height)]), (39 + 40) / 2); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().height), makeFloat(program, 0)]), (49 + 50) / 2); >+ checkFloat(program, callFunction(program, "foo50", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, -4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().height), makeFloat(program, 0)]), (59 + 60) / 2); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), (9 + 10) / 2); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), (19 + 20) / 2); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 1)]), (29 + 30) / 2); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 1)]), (39 + 40) / 2); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 1)]), (49 + 50) / 2); >+ checkFloat(program, callFunction(program, "foo51", [textureCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 1)]), (59 + 60) / 2); >+ checkFloat(program, callFunction(program, "foo52", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo52", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo52", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo52", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo52", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo52", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, -4 / textureCube.ePtr.loadValue().height), makeFloat(program, 0)]), (9 + 10) / 2); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0, 0, 4 / textureDepthCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, -4 / textureDepthCube.ePtr.loadValue().height), makeFloat(program, 0)]), (19 + 20) / 2); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 4 / textureDepthCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 4 / textureDepthCube.ePtr.loadValue().height)]), (29 + 30) / 2); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 4 / textureDepthCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureDepthCube.ePtr.loadValue().height)]), (39 + 40) / 2); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 4 / textureDepthCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureDepthCube.ePtr.loadValue().height), makeFloat(program, 0)]), (49 + 50) / 2); >+ checkFloat(program, callFunction(program, "foo53", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, -4 / textureDepthCube.ePtr.loadValue().width), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -4 / textureDepthCube.ePtr.loadValue().height), makeFloat(program, 0)]), (59 + 60) / 2); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (3 + 4 + 5 + 6) / 4); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 0)]), (13 + 14 + 15 + 16) / 4); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), (23 + 24 + 25 + 26) / 4); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), (33 + 34 + 35 + 36) / 4); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), (43 + 44 + 45 + 46) / 4); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), (53 + 54 + 55 + 56) / 4); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), (9 + 10) / 2); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), (19 + 20) / 2); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 1)]), (29 + 30) / 2); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 1)]), (39 + 40) / 2); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 1)]), (49 + 50) / 2); >+ checkFloat(program, callFunction(program, "foo54", [textureDepthCube, makeSampler(program, {minFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 1)]), (59 + 60) / 2); >+} >+ >+tests.textureGather = function() { >+ let program = doPrep(` >+ float4 foo1(Texture2D<float> texture, sampler s, float x, float y) { >+ return Gather(texture, s, float2(x, y)); >+ } >+ float4 foo2(Texture2D<float> texture, sampler s, float x, float y, int offsetX, int offsetY) { >+ return Gather(texture, s, float2(x, y), int2(offsetX, offsetY)); >+ } >+ float4 foo3(Texture2DArray<float> texture, sampler s, float x, float y, float layer) { >+ return Gather(texture, s, float3(x, y, layer)); >+ } >+ float4 foo4(Texture2DArray<float> texture, sampler s, float x, float y, float layer, int offsetX, int offsetY) { >+ return Gather(texture, s, float3(x, y, layer), int2(offsetX, offsetY)); >+ } >+ float4 foo5(TextureCube<float> texture, sampler s, float x, float y, float z) { >+ return Gather(texture, s, float3(x, y, z)); >+ } >+ float4 foo6(TextureDepth2D<float> texture, sampler s, float x, float y) { >+ return Gather(texture, s, float2(x, y)); >+ } >+ float4 foo7(TextureDepth2D<float> texture, sampler s, float x, float y, int offsetX, int offsetY) { >+ return Gather(texture, s, float2(x, y), int2(offsetX, offsetY)); >+ } >+ float4 foo8(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer) { >+ return Gather(texture, s, float3(x, y, layer)); >+ } >+ float4 foo9(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, int offsetX, int offsetY) { >+ return Gather(texture, s, float3(x, y, layer), int2(offsetX, offsetY)); >+ } >+ float4 foo10(TextureDepthCube<float> texture, sampler s, float x, float y, float z) { >+ return Gather(texture, s, float3(x, y, z)); >+ } >+ float4 foo11(TextureDepth2D<float> texture, sampler s, float x, float y, float compareValue) { >+ return GatherCmp(texture, s, float2(x, y), compareValue); >+ } >+ float4 foo12(TextureDepth2D<float> texture, sampler s, float x, float y, float compareValue, int offsetX, int offsetY) { >+ return GatherCmp(texture, s, float2(x, y), compareValue, int2(offsetX, offsetY)); >+ } >+ float4 foo13(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float compareValue) { >+ return GatherCmp(texture, s, float3(x, y, layer), compareValue); >+ } >+ float4 foo14(TextureDepth2DArray<float> texture, sampler s, float x, float y, float layer, float compareValue, int offsetX, int offsetY) { >+ return GatherCmp(texture, s, float3(x, y, layer), compareValue, int2(offsetX, offsetY)); >+ } >+ `); >+ let [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray] = createTexturesForTesting(program); >+ checkFloat4(program, callFunction(program, "foo1", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5)]), [20, 21, 13, 12]); >+ checkFloat4(program, callFunction(program, "foo1", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5)]), [21, 22, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo1", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8)]), [28, 29, 21, 20]); >+ checkFloat4(program, callFunction(program, "foo2", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), [21, 22, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo2", [texture2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 1)]), [28, 29, 21, 20]); >+ checkFloat4(program, callFunction(program, "foo3", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), [20, 21, 13, 12]); >+ checkFloat4(program, callFunction(program, "foo3", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), [62, 63, 55, 54]); >+ checkFloat4(program, callFunction(program, "foo4", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), [21, 22, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo4", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), [28, 29, 21, 20]); >+ checkFloat4(program, callFunction(program, "foo4", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), [63, 64, 56, 55]); >+ checkFloat4(program, callFunction(program, "foo4", [texture2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 1)]), [70, 71, 63, 62]); >+ checkFloat4(program, callFunction(program, "foo5", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), [5, 6, 4, 3]); >+ checkFloat4(program, callFunction(program, "foo5", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), [15, 16, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo5", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), [25, 26, 24, 23]); >+ checkFloat4(program, callFunction(program, "foo5", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), [35, 36, 34, 33]); >+ checkFloat4(program, callFunction(program, "foo5", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), [45, 46, 44, 43]); >+ checkFloat4(program, callFunction(program, "foo5", [textureCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1)]), [55, 56, 54, 53]); >+ checkFloat4(program, callFunction(program, "foo6", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5)]), [20, 21, 13, 12]); >+ checkFloat4(program, callFunction(program, "foo6", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 10 / 16), makeFloat(program, 0.5)]), [21, 22, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo6", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 6 / 8)]), [28, 29, 21, 20]); >+ checkFloat4(program, callFunction(program, "foo7", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 1), makeInt(program, 0)]), [21, 22, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo7", [textureDepth2D, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeInt(program, 0), makeInt(program, 1)]), [28, 29, 21, 20]); >+ checkFloat4(program, callFunction(program, "foo8", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0)]), [20, 21, 13, 12]); >+ checkFloat4(program, callFunction(program, "foo8", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1)]), [62, 63, 55, 54]); >+ checkFloat4(program, callFunction(program, "foo9", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 1), makeInt(program, 0)]), [21, 22, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo9", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 0), makeInt(program, 0), makeInt(program, 1)]), [28, 29, 21, 20]); >+ checkFloat4(program, callFunction(program, "foo9", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 1), makeInt(program, 0)]), [63, 64, 56, 55]); >+ checkFloat4(program, callFunction(program, "foo9", [textureDepth2DArray, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeInt(program, 0), makeInt(program, 1)]), [70, 71, 63, 62]); >+ checkFloat4(program, callFunction(program, "foo10", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 1), makeFloat(program, 0), makeFloat(program, 0)]), [5, 6, 4, 3]); >+ checkFloat4(program, callFunction(program, "foo10", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, -1), makeFloat(program, 0), makeFloat(program, 0)]), [15, 16, 14, 13]); >+ checkFloat4(program, callFunction(program, "foo10", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 1), makeFloat(program, 0)]), [25, 26, 24, 23]); >+ checkFloat4(program, callFunction(program, "foo10", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, -1), makeFloat(program, 0)]), [35, 36, 34, 33]); >+ checkFloat4(program, callFunction(program, "foo10", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, 1)]), [45, 46, 44, 43]); >+ checkFloat4(program, callFunction(program, "foo10", [textureDepthCube, makeSampler(program, {magFilter: "linear"}), makeFloat(program, 0), makeFloat(program, 0), makeFloat(program, -1)]), [55, 56, 54, 53]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [0, 0, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [1, 1, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [0, 0, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [1, 1, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [0, 0, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [1, 1, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [0, 0, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo11", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 13)]), [1, 1, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo12", [textureDepth2D, makeSampler(program, {magFilter: "linear", compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 14), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [0, 0, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [1, 1, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [0, 0, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [1, 1, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [0, 0, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [1, 1, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [0, 0, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo13", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 55)]), [1, 1, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "never"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "less"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 0, 0]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "equal"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "lessEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 1, 0]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "greater"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "notEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 0, 1]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "greaterEqual"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [0, 0, 1, 1]); >+ checkFloat4(program, callFunction(program, "foo14", [textureDepth2DArray, makeSampler(program, {magFilter: "linear", compareFunction: "always"}), makeFloat(program, 0.5), makeFloat(program, 0.5), makeFloat(program, 1), makeFloat(program, 56), makeInt(program, 1), makeInt(program, 0)]), [1, 1, 1, 1]); >+ // FIXME: Gather other components > } > > okToTest = true; >diff --git a/Tools/WebGPUShadingLanguageRI/Texture.js b/Tools/WebGPUShadingLanguageRI/Texture.js >new file mode 100644 >index 0000000000000000000000000000000000000000..d07694fac267a778365b94a68c021370254ca50f >--- /dev/null >+++ b/Tools/WebGPUShadingLanguageRI/Texture.js >@@ -0,0 +1,544 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+"use strict"; >+ >+class Texture { >+ constructor(dimension, width, height, depth, levelCount, layerCount, innerType, data) >+ { >+ this._dimension = dimension; >+ this._width = width; >+ this._height = height; >+ this._depth = depth; >+ this._levelCount = levelCount; >+ this._layerCount = layerCount; >+ this._innerType = innerType; >+ this._data = data; >+ } >+ >+ get dimension() { return this._dimension; } >+ get width() { return this._width; } >+ get height() { return this._height; } >+ get depth() { return this._depth; } >+ get levelCount() { return this._levelCount; } >+ get layerCount() { return this._layerCount; } >+ get innerType() { return this._innerType; } >+ get data() { return this._data; } >+ >+ elementChecked(layer, level, k, j, i) >+ { >+ if (layer < 0 || layer >= this.layerCount >+ || level < 0 || level >= this.levelCount >+ || k < 0 || k >= this.depth >+ || j < 0 || j >= this.height >+ || i < 0 || i >= this.width) >+ return undefined; >+ return this.element(layer, level, k, j, i); >+ } >+ >+ setElementChecked(layer, level, k, j, i, value) >+ { >+ if (layer < 0 || layer >= this.layerCount >+ || level < 0 || level >= this.levelCount >+ || k < 0 || k >= this.depth >+ || j < 0 || j >= this.height >+ || i < 0 || i >= this.width) >+ return false; >+ this.setElement(layer, level, k, j, i, value); >+ return true; >+ } >+} >+ >+class Texture1D extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of mipmaps. >+ // The first mipmap is an array of elements. >+ // Each element may be a scalar or an array of 2-4 scalars. >+ // The width must be a power-of-two. >+ // Each mipmap is half-size of the previous size. >+ >+ let dimension = 1; >+ let width = data[0].length; >+ let height = 1; >+ let depth = 1; >+ let levelCount = data.length; >+ let layerCount = 1; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[level].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return 1; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[level][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[level][i] = value; >+ } >+} >+ >+class Texture1DArray extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of 1D textures. >+ // All textures must have the same width and number of mipmaps. >+ >+ let dimension = 1; >+ let width = data[0][0].length; >+ let height = 1; >+ let depth = 1; >+ let levelCount = data[0].length; >+ let layerCount = data.length; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0][level].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return 1; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[layer][level][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[layer][level][i] = value; >+ } >+} >+ >+class Texture2D extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of mipmaps. >+ // The first mipmap is a rectangular array of rows, where each row is an array of elements. >+ // Each element may be a scalar or an array of 2-4 scalars. >+ // The width and height must be powers-of-two. >+ // Each mipmap is half-width and half-height of the previous size. >+ >+ let dimension = 2; >+ let width = data[0][0].length; >+ let height = data[0].length; >+ let depth = 1; >+ let levelCount = data.length; >+ let layerCount = 1; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[level][0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data[level].length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[level][j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[level][j][i] = value; >+ } >+} >+ >+let TextureDepth2D = Texture2D; >+ >+class Texture2DArray extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of 2D textures. >+ // All textures must have the same width, height and number of mipmaps. >+ >+ let dimension = 2; >+ let width = data[0][0][0].length; >+ let height = data[0][0].length; >+ let depth = 1; >+ let levelCount = data[0].length; >+ let layerCount = data.length; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0][level][0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data[0][level].length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[layer][level][j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[layer][level][j][i] = value; >+ } >+} >+ >+let TextureDepth2DArray = Texture2DArray; >+ >+class Texture3D extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of mipmaps. >+ // The first mipmap is an array of depth slices, each depth slice is an array of rows, and each row is an array of elements. >+ // Each element may be a scalar or an array of 2-4 scalars. >+ // The width, height, and depth must be powers-of-two. >+ // Each mipmap is half-width, half-height, and half-depth of the previous size. >+ >+ let dimension = 3; >+ let width = data[0][0][0].length; >+ let height = data[0][0].length; >+ let depth = data[0].length; >+ let levelCount = data.length; >+ let layerCount = 1; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[level][0][0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data[level][0].length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return this.data[level].length; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[level][k][j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[level][k][j][i] = value; >+ } >+} >+ >+class TextureCube extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of 6 2D textures. >+ // All textures must have the same width, height, depth, and number of mipmaps. >+ >+ let dimension = 2; >+ let width = data[0][0][0].length; >+ let height = data[0][0].length; >+ let depth = 1; >+ let levelCount = data[0].length; >+ let layerCount = data.length; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0][level][0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data[0][level].length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[layer][level][j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[layer][level][j][i] = value; >+ } >+} >+ >+let TextureDepthCube = TextureCube; >+ >+class Texture1DRW extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of elements. >+ // Each element may be a scalar or an array of 2-4 scalars. >+ // The width must be a power-of-two. >+ >+ let dimension = 1; >+ let width = data.length; >+ let height = 1; >+ let depth = 1; >+ let levelCount = 1; >+ let layerCount = 1; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data.length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return 1; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[i] = value; >+ } >+} >+ >+class Texture1DArrayRW extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of 1D RW textures. >+ // All textures must have the same size. >+ >+ let dimension = 1; >+ let width = data[0].length; >+ let height = 1; >+ let depth = 1; >+ let levelCount = 1; >+ let layerCount = data.length; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return 1; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[layer][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[layer][i] = value; >+ } >+} >+ >+class Texture2DRW extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is a rectangular array of rows, where each row is an array of elements. >+ // Each element may be a scalar or an array of 2-4 scalars. >+ // The width and height must be powers-of-two. >+ >+ let dimension = 2; >+ let width = data[0].length; >+ let height = data.length; >+ let depth = 1; >+ let levelCount = 1; >+ let layerCount = 1; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data.length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[j][i] = value; >+ } >+} >+ >+let TextureDepth2DRW = Texture2DRW; >+ >+class Texture2DArrayRW extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of 2D RW textures. >+ // All textures must have the same width and height. >+ >+ let dimension = 2; >+ let width = data[0][0].length; >+ let height = data[0].length; >+ let depth = 1; >+ let levelCount = 1; >+ let layerCount = data.length; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0][0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data[0].length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return 1; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[layer][j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[layer][j][i] = value; >+ } >+} >+ >+let TextureDepth2DArrayRW = Texture2DArrayRW >+ >+class Texture3DRW extends Texture { >+ constructor(innerType, data) >+ { >+ // "data" is an array of depth slices, each depth slice is an array of rows, and each row is an array of elements. >+ // Each element may be a scalar or an array of 2-4 scalars. >+ // The width, height, and depth must be powers-of-two. >+ >+ let dimension = 3; >+ let width = data[0][0].length; >+ let height = data[0].length; >+ let depth = data.length; >+ let levelCount = 1; >+ let layerCount = 1; >+ super(dimension, width, height, depth, levelCount, layerCount, innerType, data); >+ } >+ >+ widthAtLevel(level) >+ { >+ return this.data[0][0].length; >+ } >+ >+ heightAtLevel(level) >+ { >+ return this.data[0].length; >+ } >+ >+ depthAtLevel(level) >+ { >+ return this.data.length; >+ } >+ >+ element(layer, level, k, j, i) >+ { >+ return this.data[k][j][i]; >+ } >+ >+ setElement(layer, level, k, j, i, value) >+ { >+ this.data[k][j][i] = value; >+ } >+} >diff --git a/Tools/WebGPUShadingLanguageRI/TextureOperations.js b/Tools/WebGPUShadingLanguageRI/TextureOperations.js >new file mode 100644 >index 0000000000000000000000000000000000000000..2dadb8500904101bfe4b47802895309dee8d1782 >--- /dev/null >+++ b/Tools/WebGPUShadingLanguageRI/TextureOperations.js >@@ -0,0 +1,784 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+"use strict"; >+ >+function depthCompareOperation(dref, d, compareFunction) >+{ >+ // Vulkan 1.1.83 section 15.3.4 >+ switch (compareFunction) { >+ case "never": >+ return 0; >+ case "less": >+ return dref < d ? 1 : 0; >+ case "equal": >+ return dref == d ? 1 : 0; >+ case "lessEqual": >+ return dref <= d ? 1 : 0; >+ case "greater": >+ return dref > d ? 1 : 0; >+ case "notEqual": >+ return dref != d ? 1 : 0; >+ case "greaterEqual": >+ return dref >= d ? 1 : 0; >+ case "always": >+ return 1; >+ default: >+ throw new Error("Unknown depth comparison function"); >+ } >+} >+ >+function conversionToRGBA(value) >+{ >+ // Vulkan 1.1.83 section 15.3.5 >+ if (value instanceof Array) { >+ let result = []; >+ for (let i = 0; i < value.length; ++i) >+ result.push(value[i]); >+ while (result.length != 4) >+ result.push(result.length == 3 ? 1 : 0); >+ return result; >+ } else >+ return [value, 0, 0, 1]; >+} >+ >+function projectionOperation(s, t, r, dref, q) >+{ >+ // Vulkan 1.1.83 section 15.6.1 >+ return [s / q, t / q, r / q, dref != undefined ? dref / q : undefined]; >+} >+ >+function cubeMapFaceSelection(s, t, r, partialRxWithRespectToX, partialRxWithRespectToY, partialRyWithRespectToX, partialRyWithRespectToY, partialRzWithRespectToX, partialRzWithRespectToY) >+{ >+ // Vulkan 1.1.83 section 15.6.4 >+ let rx = s; >+ let ry = t; >+ let rz = r; >+ let winner = 0; >+ if (Math.abs(rz) >= Math.abs(ry) && Math.abs(rz) >= Math.abs(rx)) >+ winner = 2; >+ else if (Math.abs(ry) >= Math.abs(rx) && Math.abs(ry) >= Math.abs(rz)) >+ winner = 1; >+ >+ let layerNumber; >+ let sc; >+ let tc; >+ let rc; >+ let partialScWithRespectToX; >+ let partialScWithRespectToY; >+ let partialTcWithRespectToX; >+ let partialTcWithRespectToY; >+ let partialRcWithRespectToX; >+ let partialRcWithRespectToY; >+ if (winner == 0 && rx >= 0) { >+ layerNumber = 0; >+ sc = -rz; >+ tc = -ry; >+ rc = rx; >+ partialScWithRespectToX = -partialRzWithRespectToX; >+ partialScWithRespectToY = -partialRzWithRespectToY; >+ partialTcWithRespectToX = -partialRyWithRespectToX; >+ partialTcWithRespectToY = -partialRyWithRespectToY; >+ partialRcWithRespectToX = partialRxWithRespectToX; >+ partialRcWithRespectToY = partialRxWithRespectToY; >+ } else if (winner == 0) { >+ layerNumber = 1; >+ sc = rz; >+ tc = -ry; >+ rc = rx; >+ partialScWithRespectToX = partialRzWithRespectToX; >+ partialScWithRespectToY = partialRzWithRespectToY; >+ partialTcWithRespectToX = -partialRyWithRespectToX; >+ partialTcWithRespectToY = -partialRyWithRespectToY; >+ partialRcWithRespectToX = -partialRxWithRespectToX; >+ partialRcWithRespectToY = -partialRxWithRespectToY; >+ } else if (winner == 1 && ry >= 0) { >+ layerNumber = 2; >+ sc = rx; >+ tc = -rz; >+ rc = ry; >+ partialScWithRespectToX = partialRxWithRespectToX; >+ partialScWithRespectToY = partialRxWithRespectToY; >+ partialTcWithRespectToX = partialRzWithRespectToX; >+ partialTcWithRespectToY = partialRzWithRespectToY; >+ partialRcWithRespectToX = partialRyWithRespectToX; >+ partialRcWithRespectToY = partialRyWithRespectToY; >+ } else if (winner == 1) { >+ layerNumber = 3; >+ sc = rx; >+ tc = -rz; >+ rc = ry; >+ partialScWithRespectToX = partialRxWithRespectToX; >+ partialScWithRespectToY = partialRxWithRespectToY; >+ partialTcWithRespectToX = -partialRzWithRespectToX; >+ partialTcWithRespectToY = -partialRzWithRespectToY; >+ partialRcWithRespectToX = -partialRyWithRespectToX; >+ partialRcWithRespectToY = -partialRyWithRespectToY; >+ } else if (winner == 2 && rz >= 0) { >+ layerNumber = 4; >+ sc = rx; >+ tc = -ry; >+ rc = rz; >+ partialScWithRespectToX = partialRxWithRespectToX; >+ partialScWithRespectToY = partialRxWithRespectToY; >+ partialTcWithRespectToX = -partialRyWithRespectToX; >+ partialTcWithRespectToY = -partialRyWithRespectToY; >+ partialRcWithRespectToX = partialRzWithRespectToX; >+ partialRcWithRespectToY = partialRzWithRespectToY; >+ } else { >+ layerNumber = 5; >+ sc = -rx; >+ tc = -ry; >+ rc = rz; >+ partialScWithRespectToX = -partialRxWithRespectToX; >+ partialScWithRespectToY = -partialRxWithRespectToY; >+ partialTcWithRespectToX = -partialRyWithRespectToX; >+ partialTcWithRespectToY = -partialRyWithRespectToY; >+ partialRcWithRespectToX = -partialRzWithRespectToX; >+ partialRcWithRespectToY = -partialRzWithRespectToY; >+ } >+ return [layerNumber, sc, tc, rc, partialScWithRespectToX, partialScWithRespectToY, partialTcWithRespectToX, partialTcWithRespectToY, partialRcWithRespectToX, partialRcWithRespectToY] >+} >+ >+function cubeMapCoordinateTransformation(sc, tc, rc) >+{ >+ // Vulkan 1.1.83 section 15.6.5 >+ let sFace = (1 / 2) * sc / Math.abs(rc) + (1 / 2); >+ let tFace = (1 / 2) * tc / Math.abs(rc) + (1 / 2); >+ return [sFace, tFace]; >+} >+ >+function cubeMapDerivativeTransformation(sc, tc, rc, partialScWithRespectToX, partialScWithRespectToY, partialTcWithRespectToX, partialTcWithRespectToY, partialRcWithRespectToX, partialRcWithRespectToY) >+{ >+ // Vulkan 1.1.83 section 15.6.6 >+ let partialSFaceWithRespectToX = (1 / 2) * ((Math.abs(rc) * partialScWithRespectToX - sc * partialRcWithRespectToX) / Math.pow(rc, 2)); >+ let partialSFaceWithRespectToY = (1 / 2) * ((Math.abs(rc) * partialScWithRespectToY - sc * partialRcWithRespectToY) / Math.pow(rc, 2)); >+ let partialTFaceWithRespectToX = (1 / 2) * ((Math.abs(rc) * partialTcWithRespectToX - tc * partialRcWithRespectToX) / Math.pow(rc, 2)); >+ let partialTFaceWithRespectToY = (1 / 2) * ((Math.abs(rc) * partialTcWithRespectToY - tc * partialRcWithRespectToY) / Math.pow(rc, 2)); >+ return [partialSFaceWithRespectToX, partialSFaceWithRespectToY, partialTFaceWithRespectToX, partialTFaceWithRespectToY]; >+} >+ >+function scaleFactorOperation(deviceMaxAnisotropy, width, height, depth, samplerMaxAnisotropy, partialSWithRespectToX, partialTWithRespectToX, partialRWithRespectToX, partialSWithRespectToY, partialTWithRespectToY, partialRWithRespectToY) >+{ >+ // Vulkan 1.1.83 section 15.6.7 >+ let mux = Math.abs(partialSWithRespectToX) * width; >+ let mvx = Math.abs(partialTWithRespectToX) * height; >+ let mwx = Math.abs(partialRWithRespectToX) * depth; >+ let muy = Math.abs(partialSWithRespectToY) * width; >+ let mvy = Math.abs(partialTWithRespectToY) * height; >+ let mwy = Math.abs(partialRWithRespectToY) * depth; >+ >+ // I made this up. The formula isn't listed in the spec. >+ let fx = Math.sqrt(mux * mux + mvx * mvx + mwx * mwx); >+ let fy = Math.sqrt(muy * muy + mvy * mvy + mwy * mwy); >+ >+ let rhoX = fx; >+ let rhoY = fy; >+ let rhoMax = Math.max(rhoX, rhoY); >+ let rhoMin = Math.min(rhoX, rhoY); >+ >+ let maxAniso = Math.min(samplerMaxAnisotropy, deviceMaxAnisotropy); >+ >+ let eta; >+ if (rhoMax == 0 && rhoMin == 0) >+ eta = 1; >+ else if (rhoMin == 0) >+ eta = maxAniso; >+ else >+ eta = Math.min(rhoMax / rhoMin, maxAniso); >+ >+ let N = Math.ceil(eta); >+ return [rhoMax, rhoMin, eta, N]; >+} >+ >+function levelOfDetailOperation(deviceMaxSamplerLodBias, lodFromFunctionOperand, lodMinFromFunctionOperand, biasFromFunctionOperand, samplerBias, samplerLodMin, samplerLodMax, rhoMax, eta) >+{ >+ // Vulkan 1.1.83 section 15.6.7 >+ if (biasFromFunctionOperand == undefined) >+ biasFromFunctionOperand = 0; >+ >+ let lambdaBase = lodFromFunctionOperand != undefined ? lodFromFunctionOperand : Math.log2(rhoMax / eta); >+ let lambdaPrime = lambdaBase + Math.min(Math.max(samplerBias + biasFromFunctionOperand, -deviceMaxSamplerLodBias), deviceMaxSamplerLodBias); >+ let lodMin = Math.max(samplerLodMin, lodMinFromFunctionOperand); >+ let lodMax = samplerLodMax; >+ let lambda; >+ if (lambdaPrime > lodMax) >+ lambda = lodMax; >+ else if (lodMin <= lambdaPrime && lambdaPrime <= lodMax) >+ lambda = lambdaPrime; >+ else if (lambdaPrime < lodMin) >+ lambda = lodMin; >+ else >+ throw new Error("lodMin >= lodMax"); >+ return lambda; >+} >+ >+function imageLevelSelection(baseMipLevel, levelCount, mipmapMode, lambda) >+{ >+ // Vulkan 1.1.83 section 15.6.7 >+ function nearest(dPrime) >+ { >+ return Math.ceil(dPrime + 0.5) - 1; >+ } >+ >+ let q = levelCount - 1; >+ let dPrime = baseMipLevel + Math.min(Math.max(lambda, 0), q); >+ let dl; >+ if (mipmapMode == "nearest") >+ dl = nearest(dPrime); >+ else >+ dl = dPrime; >+ if (mipmapMode == "nearest") >+ return dl; >+ else { >+ let dHi = Math.floor(dl); >+ let dLow = Math.min(dHi + 1, q); >+ let delta = dl - dHi; >+ return [dHi, dLow, delta]; >+ } >+} >+ >+function strqaToUVWATransformation(s, t, r, width, height, depth) >+{ >+ // Vulkan 1.1.83 section 15.6.8 >+ let u = s * width; >+ let v = t * height; >+ let w = r * depth; >+ return [u, v, w]; >+} >+ >+function uvwaToIJKLNTransformationAndArrayLayerSelection(layerCount, baseArrayLayer, filter, u, v, w, a, deltaI, deltaJ, deltaK) >+{ >+ // Vulkan 1.1.83 section 15.7.1 >+ >+ if (deltaI == undefined) >+ deltaI = 0; >+ if (deltaJ == undefined) >+ deltaJ = 0; >+ if (deltaK == undefined) >+ deltaK = 0; >+ >+ function rne(a) >+ { >+ return Math.floor(a + 0.5); >+ } >+ let l = Math.min(Math.max(rne(a), 0), layerCount - 1) + baseArrayLayer; >+ let i; >+ let j; >+ let k; >+ if (filter == "nearest") { >+ i = Math.floor(u); >+ j = Math.floor(v); >+ k = Math.floor(w); >+ >+ i += deltaI; >+ j += deltaJ; >+ k += deltaK; >+ >+ return [i, j, k, l]; >+ } else { >+ if (filter != "linear") >+ throw new Error("Unknown filter"); >+ let i0 = Math.floor(u - 0.5); >+ let i1 = i0 + 1; >+ let j0 = Math.floor(v - 0.5); >+ let j1 = j0 + 1; >+ let k0 = Math.floor(w - 0.5); >+ let k1 = k0 + 1; >+ let alpha = (u - 0.5) - i0; >+ let beta = (v - 0.5) - j0; >+ let gamma = (w - 0.5) - k0; >+ >+ i0 += deltaI; >+ i1 += deltaI; >+ j0 += deltaJ; >+ j1 += deltaJ; >+ k0 += deltaK; >+ k1 += deltaK; >+ >+ return [i0, i1, j0, j1, k0, k1, l, alpha, beta, gamma]; >+ } >+} >+ >+function integerTexelCoordinateOperations(baseMipLevel, levelCount, levelBase, lodFromFunctionOperand) >+{ >+ // Vulkan 1.1.83 section 15.8 >+ let d = levelBase + lodFromFunctionOperand; >+ if (d < baseMipLevel || d >= baseMipLevel + levelCount) >+ throw new Error("Selected level does not lie inside the image"); >+ return d; >+} >+ >+function wrappingOperation(width, height, depth, addressModeU, addressModeV, addressModeW, i, j, k) >+{ >+ // Vulkan 1.1.83 section 15.9.1 >+ // FIXME: "Cube images ignore the wrap modes specified in the sampler. Instead, if VK_FILTER_NEAREST is used within a mip level then VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE is used, and if VK_FILTER_LINEAR is used within a mip level then sampling at the edges is performed as described earlier in the Cube map edge handling section." >+ function transform(addressMode, size, i) >+ { >+ function mirror(n) { >+ if (n >= 0) >+ return n; >+ else >+ return -(1 + n); >+ } >+ switch (addressMode) { >+ case "clampToEdge": >+ return Math.min(Math.max(i, 0), size - 1); >+ case "repeat": >+ return i % size; >+ case "mirrorRepeat": >+ return (size - 1) - mirror((i % (2 * size)) - size); >+ case "clampToBorderColor": >+ return Math.min(Math.max(i, -1), size); >+ default: >+ throw new Error("Unknown address mode"); >+ } >+ } >+ return [transform(addressModeU, width, i), transform(addressModeV, height, j), transform(addressModeW, depth, k)]; >+} >+ >+function calculateLambda(deviceMaxAnisotropy, deviceMaxSamplerLodBias, texture, sampler, samplerBias, s, t, r, a, lodFromFunctionOperand, lodMinFromFunctionOperand, biasFromFunctionOperand, ddx, ddy) >+{ >+ let partialSWithRespectToX = 0; >+ let partialTWithRespectToX = 0; >+ let partialRWithRespectToX = 0; >+ if (ddx != undefined) { >+ partialSWithRespectToX = ddx[0]; >+ partialTWithRespectToX = ddx[1]; >+ partialRWithRespectToX = ddx[2]; >+ } >+ let partialSWithRespectToY = 0; >+ let partialTWithRespectToY = 0; >+ let partialRWithRespectToY = 0; >+ if (ddy != undefined) { >+ partialSWithRespectToY = ddy[0]; >+ partialTWithRespectToY = ddy[1]; >+ partialRWithRespectToY = ddy[2]; >+ } >+ >+ if (texture instanceof TextureCube) { >+ // FIXME: Handle cubemap edge/corners correctly >+ let [layerNumber, sc, tc, rc, partialScWithRespectToX, partialScWithRespectToY, partialTcWithRespectToX, partialTcWithRespectToY, partialRcWithRespectToX, partialRcWithRespectToY] = cubeMapFaceSelection(s, t, r, partialSWithRespectToX, partialSWithRespectToY, partialTWithRespectToX, partialTWithRespectToY, partialRWithRespectToX, partialRWithRespectToY) >+ let [sFace, tFace] = cubeMapCoordinateTransformation(sc, tc, rc) >+ let [partialSFaceWithRespectToX, partialSFaceWithRespectToY, partialTFaceWithRespectToX, partialTFaceWithRespectToY] = cubeMapDerivativeTransformation(sc, tc, rc, partialScWithRespectToX, partialScWithRespectToY, partialTcWithRespectToX, partialTcWithRespectToY, partialRcWithRespectToX, partialRcWithRespectToY) >+ s = sFace; >+ t = tFace; >+ r = 0; >+ a = layerNumber; >+ partialSWithRespectToX = partialSFaceWithRespectToX; >+ partialSWithRespectToY = partialSFaceWithRespectToY; >+ partialTWithRespectToX = partialTFaceWithRespectToX; >+ partialTWithRespectToY = partialTFaceWithRespectToY; >+ partialRWithRespectToX = 0; >+ partialRWithRespectToY = 0; >+ } >+ >+ let [rhoMax, rhoMin, eta, N] = scaleFactorOperation(deviceMaxAnisotropy, texture.width, texture.height, texture.depth, sampler.maxAnisotropy, partialSWithRespectToX, partialTWithRespectToX, partialRWithRespectToX, partialSWithRespectToY, partialTWithRespectToY, partialRWithRespectToY); >+ let lambda = levelOfDetailOperation(deviceMaxSamplerLodBias, lodFromFunctionOperand, lodMinFromFunctionOperand, biasFromFunctionOperand, samplerBias, sampler.lodMinClamp, sampler.lodMaxClamp, rhoMax, eta); >+ return [s, t, r, a, lambda]; >+} >+ >+function computeTau(level, baseArrayLayer, texture, sampler, addressModeU, addressModeV, addressModeW, filter, s, t, r, a, deltaI, deltaJ, deltaK) >+{ >+ function accessColor(width, height, depth, l, i, j, k) >+ { >+ function shouldBeBorder(value, max) >+ { >+ if (value < -1 || value > max) >+ throw new Error("Out-of-bounds texture read"); >+ return value == -1 || value == max; >+ } >+ >+ let [wrappedI, wrappedJ, wrappedK] = wrappingOperation(width, height, depth, addressModeU, addressModeV, addressModeW, i, j, k) >+ if (shouldBeBorder(wrappedI, width) || shouldBeBorder(wrappedJ, height) || shouldBeBorder(wrappedK, depth)) >+ return sampler.calculateBorderColor(texture.innerType); >+ else >+ return texture.element(l, level, wrappedK, wrappedJ, wrappedI); >+ } >+ >+ let [u, v, w] = strqaToUVWATransformation(s, t, r, texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level)); >+ if (filter == "nearest") { >+ let [i, j, k, l] = uvwaToIJKLNTransformationAndArrayLayerSelection(texture.layerCount, baseArrayLayer, filter, u, v, w, a, deltaI, deltaJ, deltaK); >+ return accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i, j, k); >+ } else { >+ if (filter != "linear") >+ throw new Error("Unknown filter"); >+ let [i0, i1, j0, j1, k0, k1, l, alpha, beta, gamma] = uvwaToIJKLNTransformationAndArrayLayerSelection(texture.layerCount, baseArrayLayer, filter, u, v, w, a, deltaI, deltaJ, deltaK); >+ let color000 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i0, j0, k0); >+ let color100 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i1, j0, k0); >+ let color010 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i0, j1, k0); >+ let color110 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i1, j1, k0); >+ let color001 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i0, j0, k1); >+ let color101 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i1, j0, k1); >+ let color011 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i0, j1, k1); >+ let color111 = accessColor(texture.widthAtLevel(level), texture.heightAtLevel(level), texture.depthAtLevel(level), l, i1, j1, k1); >+ return [color000, color100, color010, color110, color001, color101, color011, color111, alpha, beta, gamma]; >+ } >+} >+ >+function reduce(...values) >+{ >+ if (values.length % 2 != 0) >+ throw new Error("Don't have a weight corresponding to each value"); >+ if (values.length < 2) >+ throw new Error("Don't have enough things to calculate an average"); >+ let sum; >+ if (values[1] instanceof Array) { >+ sum = []; >+ for (let i = 0; i < values[1].length; ++i) >+ sum.push(0); >+ } else >+ sum = 0; >+ for (let i = 0; i < values.length / 2; ++i) { >+ let weight = values[2 * i]; >+ let color = values[2 * i + 1]; >+ if (color instanceof Array) { >+ for (let i = 0; i < color.length; ++i) >+ sum[i] += weight * color[i]; >+ } else >+ sum += weight * color; >+ } >+ return sum; >+} >+ >+function texelGathering( >+ deviceMaxAnisotropy, >+ deviceMaxSamplerLodBias, >+ baseMipLevel, >+ baseArrayLayer, >+ texture, >+ sampler, >+ samplerBias, >+ s, t, r, a, >+ deltaI, deltaJ, deltaK, >+ lodFromFunctionOperand, >+ lodMinFromFunctionOperand, >+ biasFromFunctionOperand, >+ ddx, ddy, >+ channel) >+{ >+ // Vulkan 1.1.83 section 15.9.2 >+ >+ // The spec uses different names than WebGPU does. >+ let addressModeU = sampler.rAddressMode; >+ let addressModeV = sampler.sAddressMode; >+ let addressModeW = sampler.tAddressMode; >+ >+ let lambda; >+ [s, t, r, a, lambda] = calculateLambda(deviceMaxAnisotropy, deviceMaxSamplerLodBias, texture, sampler, samplerBias, s, t, r, a, lodFromFunctionOperand, lodMinFromFunctionOperand, biasFromFunctionOperand, ddx, ddy); >+ >+ let filter = "linear"; >+ >+ let imageLevel = imageLevelSelection(baseMipLevel, texture.levelCount, "nearest", lambda); >+ >+ let [color000, color100, color010, color110, color001, color101, color011, color111, alpha, beta, gamma] = computeTau(imageLevel, baseArrayLayer, texture, sampler, addressModeU, addressModeV, addressModeW, filter, s, t, r, a, deltaI, deltaJ, deltaK); >+ >+ if (texture.dimension != 2) >+ throw new Error("Cannot gather from a non-2D image"); >+ >+ let color00 = color001; >+ let color10 = color101; >+ let color01 = color011; >+ let color11 = color111; >+ >+ switch (channel) { >+ case 0: >+ if (color00 instanceof Array) >+ return [color01[0], color11[0], color10[0], color00[0]]; >+ else >+ return [color01, color11, color10, color00]; >+ case 1: >+ return [color01[1], color11[1], color10[1], color00[1]]; >+ case 2: >+ return [color01[2], color11[2], color10[2], color00[2]]; >+ case 3: >+ return [color01[3], color11[3], color10[3], color00[3]]; >+ default: >+ throw new Error("Unknown channel to gather from"); >+ } >+} >+ >+function texelFiltering( >+ deviceMaxAnisotropy, >+ deviceMaxSamplerLodBias, >+ baseMipLevel, >+ baseArrayLayer, >+ texture, >+ sampler, >+ samplerBias, >+ s, t, r, a, >+ deltaI, deltaJ, deltaK, >+ lodFromFunctionOperand, >+ lodMinFromFunctionOperand, >+ biasFromFunctionOperand, >+ ddx, ddy) >+{ >+ // Vulkan 1.1.83 section 15.9.3 >+ >+ // The spec uses different names than WebGPU does. >+ let addressModeU = sampler.rAddressMode; >+ let addressModeV = sampler.sAddressMode; >+ let addressModeW = sampler.tAddressMode; >+ >+ let lambda; >+ [s, t, r, a, lambda] = calculateLambda(deviceMaxAnisotropy, deviceMaxSamplerLodBias, texture, sampler, samplerBias, s, t, r, a, lodFromFunctionOperand, lodMinFromFunctionOperand, biasFromFunctionOperand, ddx, ddy); >+ >+ let filter; >+ if (lambda <= 0) >+ filter = sampler.magFilter; >+ else >+ filter = sampler.minFilter; >+ >+ function computeColorFromLevel(level) >+ { >+ if (filter == "nearest") { >+ return computeTau(level, baseArrayLayer, texture, sampler, addressModeU, addressModeV, addressModeW, filter, s, t, r, a, deltaI, deltaJ, deltaK); >+ } else { >+ if (filter != "linear") >+ throw new Error("Unknown filter"); >+ let [color000, color100, color010, color110, color001, color101, color011, color111, alpha, beta, gamma] = computeTau(level, baseArrayLayer, texture, sampler, addressModeU, addressModeV, addressModeW, filter, s, t, r, a, deltaI, deltaJ, deltaK); >+ switch (texture.dimension) { >+ case 1: >+ let color0 = color011; >+ let color1 = color111; >+ return reduce(1 - alpha, color0, alpha, color1); >+ case 2: >+ let color00 = color001; >+ let color10 = color101; >+ let color01 = color011; >+ let color11 = color111; >+ return reduce((1 - alpha) * (1 - beta), color00, alpha * (1 - beta), color10, (1 - alpha) * beta, color01, alpha * beta, color11); >+ case 3: >+ return reduce( >+ (1 - alpha) * (1 - beta) * (1 - gamma), color000, >+ alpha * (1 - beta) * (1 - gamma), color100, >+ (1 - alpha) * beta * (1 - gamma), color010, >+ alpha * beta * (1 - gamma), color110, >+ (1 - alpha) * (1 - beta) * gamma, color001, >+ alpha * (1 - beta) * gamma, color101, >+ (1 - alpha) * beta * gamma, color011, >+ alpha * beta * gamma, color111); >+ default: >+ throw new Error("Unknown dimension"); >+ } >+ } >+ } >+ >+ if (sampler.mipmapFilter == "nearest") { >+ let imageLevel = imageLevelSelection(baseMipLevel, texture.levelCount, sampler.mipmapFilter, lambda); >+ return computeColorFromLevel(imageLevel); >+ } else { >+ if (sampler.mipmapFilter != "linear") >+ throw new Error("Unknown filter"); >+ let [dHi, dLow, delta] = imageLevelSelection(baseMipLevel, texture.levelCount, sampler.mipmapFilter, lambda); >+ return reduce(1 - delta, computeColorFromLevel(dHi), delta, computeColorFromLevel(dLow)); >+ } >+} >+ >+function castToInnerTypeForGather(value, innerType) >+{ >+ switch (innerType) { >+ case "uchar": >+ case "uchar2": >+ case "uchar3": >+ case "uchar4": >+ return value.map(castToUchar); >+ case "ushort": >+ case "ushort2": >+ case "ushort3": >+ case "ushort4": >+ return value.map(castToUshort); >+ case "uint": >+ case "uint2": >+ case "uint3": >+ case "uint4": >+ return value.map(castToUint); >+ case "char": >+ case "char2": >+ case "char3": >+ case "char4": >+ return value.map(castToChar); >+ case "short": >+ case "short2": >+ case "short3": >+ case "short4": >+ return value.map(castToShort); >+ case "int": >+ case "int2": >+ case "int3": >+ case "int4": >+ return value.map(castToInt); >+ case "half": >+ case "half2": >+ case "half3": >+ case "half4": >+ return value.map(castToHalf); >+ case "float": >+ case "float2": >+ case "float3": >+ case "float4": >+ return value.map(castToFloat); >+ default: >+ throw new Error("Unknown texture inner type"); >+ } >+} >+ >+function gatherTexture(texture, sampler, location, delta, biasFromFunctionOperand, ddx, ddy, lodFromFunctionOperand, dref, channel) >+{ >+ let s = location[0]; >+ let t = location[1]; >+ let r = location[2]; >+ let q = location[3]; >+ let a = location[4]; >+ >+ let deltaI = undefined; >+ let deltaJ = undefined; >+ let deltaK = undefined; >+ if (delta != undefined) { >+ deltaI = delta[0]; >+ deltaJ = delta[1]; >+ deltaK = delta[2]; >+ } >+ >+ [s, t, r, dref] = projectionOperation(s, t, r, dref, q); >+ let result = texelGathering( >+ Number.MAX_VALUE, >+ Number.MAX_VALUE, >+ 0, >+ 0, >+ texture, >+ sampler, >+ 0, >+ s, t, r, a, >+ deltaI, deltaJ, deltaK, >+ lodFromFunctionOperand, >+ -Number.MAX_VALUE, >+ biasFromFunctionOperand, >+ ddx, ddy, >+ channel); >+ if (dref != undefined) >+ result = result.map(v => depthCompareOperation(dref, v, sampler.compareFunction)); >+ return castToInnerTypeForGather(result, texture.innerType); >+ // FIXME: Figure out what to do with anisotropy >+ // FIXME: Figure out how to do multisampling. >+} >+ >+function castToInnerType(value, innerType) >+{ >+ switch (innerType) { >+ case "uchar": >+ return castToUchar(value); >+ case "ushort": >+ return castToUshort(value); >+ case "uint": >+ return castToUint(value); >+ case "char": >+ return castToChar(value); >+ case "short": >+ return castToShort(value); >+ case "int": >+ return castToInt(value); >+ case "half": >+ return castToHalf(value); >+ case "float": >+ return castToFloat(value); >+ >+ case "uchar2": >+ case "uchar3": >+ case "uchar4": >+ return value.map(castToUchar); >+ case "ushort2": >+ case "ushort3": >+ case "ushort4": >+ return value.map(castToUshort); >+ case "uint2": >+ case "uint3": >+ case "uint4": >+ return value.map(castToUint); >+ case "char2": >+ case "char3": >+ case "char4": >+ return value.map(castToChar); >+ case "short2": >+ case "short3": >+ case "short4": >+ return value.map(castToShort); >+ case "int2": >+ case "int3": >+ case "int4": >+ return value.map(castToInt); >+ case "half2": >+ case "half3": >+ case "half4": >+ return value.map(castToHalf); >+ case "float2": >+ case "float3": >+ case "float4": >+ return value.map(castToFloat); >+ default: >+ throw new Error("Unknown texture inner type"); >+ } >+} >+ >+function sampleTexture(texture, sampler, location, delta, biasFromFunctionOperand, ddx, ddy, lodFromFunctionOperand, dref) >+{ >+ let s = location[0]; >+ let t = location[1]; >+ let r = location[2]; >+ let q = location[3]; >+ let a = location[4]; >+ >+ let deltaI = undefined; >+ let deltaJ = undefined; >+ let deltaK = undefined; >+ if (delta != undefined) { >+ deltaI = delta[0]; >+ deltaJ = delta[1]; >+ deltaK = delta[2]; >+ } >+ >+ [s, t, r, dref] = projectionOperation(s, t, r, dref, q); >+ let result = texelFiltering( >+ Number.MAX_VALUE, >+ Number.MAX_VALUE, >+ 0, >+ 0, >+ texture, >+ sampler, >+ 0, >+ s, t, r, a, >+ deltaI, deltaJ, deltaK, >+ lodFromFunctionOperand, >+ -Number.MAX_VALUE, >+ biasFromFunctionOperand, >+ ddx, ddy); >+ if (dref != undefined) { >+ if (result instanceof Array) >+ throw new Error("Depth comparison not supported on multichannel textures"); >+ result = depthCompareOperation(dref, result, sampler.compareFunction); >+ } >+ return castToInnerType(result, texture.innerType); >+ // FIXME: Figure out what to do with anisotropy >+ // FIXME: Figure out how to do multisampling. >+} >diff --git a/Tools/WebGPUShadingLanguageRI/index.html b/Tools/WebGPUShadingLanguageRI/index.html >index 65a86411b3e770b557b41acc7e414def42403013..e6e13dfe8dfa5c5332ad9ef049ecea359b7e3a42 100644 >--- a/Tools/WebGPUShadingLanguageRI/index.html >+++ b/Tools/WebGPUShadingLanguageRI/index.html >@@ -28,6 +28,7 @@ > <script src="BuiltinVectorSetter.js"></script> > <script src="CallExpression.js"></script> > <script src="CallFunction.js"></script> >+<script src="Casts.js"></script> > <script src="Check.js"></script> > <script src="CheckLiteralTypes.js"></script> > <script src="CheckLoops.js"></script> >@@ -115,6 +116,7 @@ > <script src="Return.js"></script> > <script src="ReturnChecker.js"></script> > <script src="ReturnException.js"></script> >+<script src="Sampler.js"></script> > <script src="StandardLibrary.js"></script> > <script src="StatementCloner.js"></script> > <script src="StructLayoutBuilder.js"></script> >@@ -127,6 +129,8 @@ > <script src="SynthesizeCopyConstructorOperator.js"></script> > <script src="SynthesizeDefaultConstructorOperator.js"></script> > <script src="TernaryExpression.js"></script> >+<script src="Texture.js"></script> >+<script src="TextureOperations.js"></script> > <script src="TrapStatement.js"></script> > <script src="TypeDef.js"></script> > <script src="TypeDefResolver.js"></script>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188940
:
348066
|
348347
|
348365
|
348376
|
348433
|
348459
|
348464
|
348467
|
348521
|
348581
|
348582
|
348607
|
348661
|
348687
|
348695
|
348698
|
348705
|
348717
|
348718
|
348723
|
348724
|
348726
|
348727
|
348752
|
348758
|
348775
|
348791
|
348797
|
348798
|
348800
|
348801
|
348804