Native functions which accept pointers need to do null checks
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Sep 2018 23:34:50 +0000 (23:34 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Sep 2018 23:34:50 +0000 (23:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189883

Reviewed by Dean Jackson.

Simply guard all the places where we write through an author-provided pointer.

* WebGPUShadingLanguageRI/Intrinsics.js:
(Intrinsics.):
* WebGPUShadingLanguageRI/Test.js:
(tests.textureDimensionsNull):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/Intrinsics.js
Tools/WebGPUShadingLanguageRI/StandardLibrary.js
Tools/WebGPUShadingLanguageRI/Test.js

index 4f1fab2..a6025d8 100644 (file)
@@ -1,5 +1,19 @@
 2018-09-22  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        Native functions which accept pointers need to do null checks
+        https://bugs.webkit.org/show_bug.cgi?id=189883
+
+        Reviewed by Dean Jackson.
+
+        Simply guard all the places where we write through an author-provided pointer.
+
+        * WebGPUShadingLanguageRI/Intrinsics.js:
+        (Intrinsics.):
+        * WebGPUShadingLanguageRI/Test.js:
+        (tests.textureDimensionsNull):
+
+2018-09-22  Myles C. Maxfield  <mmaxfield@apple.com>
+
         [WHLSL] Implement atomic operations and barriers
         https://bugs.webkit.org/show_bug.cgi?id=189025
 
index b5b2b6e..47373ea 100644 (file)
@@ -1177,8 +1177,10 @@ class Intrinsics {
                             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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                            if (numberOfLevels.loadValue())
+                                numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                         }
                     });
 
@@ -1221,9 +1223,12 @@ class Intrinsics {
                             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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                            if (elements.loadValue())
+                                elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+                            if (numberOfLevels.loadValue())
+                                numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                         }
                     });
 
@@ -1412,9 +1417,12 @@ class Intrinsics {
                             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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                            if (numberOfLevels.loadValue())
+                                numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                         }
                     });
 
@@ -1603,10 +1611,14 @@ class Intrinsics {
                             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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                            if (elements.loadValue())
+                                elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+                            if (numberOfLevels.loadValue())
+                                numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                         }
                     });
 
@@ -1649,10 +1661,14 @@ class Intrinsics {
                             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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                            if (depth.loadValue())
+                                depth.loadValue().copyFrom(EPtr.box(tex.depthAtLevel(mipID)), 1);
+                            if (numberOfLevels.loadValue())
+                                numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                         }
                     });
 
@@ -1746,9 +1762,12 @@ class Intrinsics {
                                 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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                            if (numberOfLevels.loadValue())
+                                numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                         }
                     });
 
@@ -1756,14 +1775,16 @@ class Intrinsics {
                     `native void GetDimensions(RWTexture1D<${type}${length}>,uint* thread Width)`,
                     func => {
                         func.implementation = function([texture, width]) {
-                            width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1);
+                            if (width.loadValue())
+                                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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1);
                         }
                     });
                 this._map.set(
@@ -1786,8 +1807,10 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (elements.loadValue())
+                                elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
                         }
                     });
                 this._map.set(
@@ -1795,8 +1818,10 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (elements.loadValue())
+                                elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
                         }
                     });
                 this._map.set(
@@ -1819,8 +1844,10 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.height), 1);
                         }
                     });
                 this._map.set(
@@ -1828,8 +1855,10 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.height), 1);
                         }
                     });
                 this._map.set(
@@ -1852,9 +1881,12 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+                            if (elements.loadValue())
+                                elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
                         }
                     });
                 this._map.set(
@@ -1862,9 +1894,12 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+                            if (elements.loadValue())
+                                elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
                         }
                     });
                 this._map.set(
@@ -1887,9 +1922,12 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+                            if (depth.loadValue())
+                                depth.loadValue().copyFrom(EPtr.box(tex.depth), 1);
                         }
                     });
                 this._map.set(
@@ -1897,9 +1935,12 @@ class Intrinsics {
                     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);
+                            if (width.loadValue())
+                                width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                            if (height.loadValue())
+                                height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+                            if (depth.loadValue())
+                                depth.loadValue().copyFrom(EPtr.box(tex.depth), 1);
                         }
                     });
                 this._map.set(
@@ -2116,9 +2157,12 @@ class Intrinsics {
                         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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                        if (numberOfLevels.loadValue())
+                            numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                     }
                 });
             this._map.set(
@@ -2317,10 +2361,14 @@ class Intrinsics {
                         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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                        if (elements.loadValue())
+                            elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+                        if (numberOfLevels.loadValue())
+                            numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                     }
                 });
             this._map.set(
@@ -2415,9 +2463,12 @@ class Intrinsics {
                             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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+                        if (numberOfLevels.loadValue())
+                            numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
                     }
                 });
             this._map.set(
@@ -2425,8 +2476,10 @@ class Intrinsics {
                 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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.height), 1);
                     }
                 });
             this._map.set(
@@ -2434,8 +2487,10 @@ class Intrinsics {
                 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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.height), 1);
                     }
                 });
             this._map.set(
@@ -2457,9 +2512,12 @@ class Intrinsics {
                 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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+                        if (elements.loadValue())
+                            elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
                     }
                 });
             this._map.set(
@@ -2467,9 +2525,12 @@ class Intrinsics {
                 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);
+                        if (width.loadValue())
+                            width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+                        if (height.loadValue())
+                            height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+                        if (elements.loadValue())
+                            elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
                     }
                 });
             this._map.set(
index ad5a588..9662cad 100644 (file)
@@ -1086,8 +1086,10 @@ let standardLibrary = (function() {
         
         for (let type of [`half`, `float`]) {
             print(`void sincos(${type} x, thread ${type}* y, thread ${type}* z) {`);
-            print(`    *y = sin(x);`);
-            print(`    *z = cos(x);`);
+            print(`    if (y != null)`);
+            print(`        *y = sin(x);`);
+            print(`    if (z != null)`);
+            print(`        *z = cos(x);`);
             print(`}`);
             for (let size of [2, 3, 4]) {
                 print(`void sincos(${type}${size} x, thread ${type}${size}* y, thread ${type}${size}* z) {`);
@@ -1096,8 +1098,10 @@ let standardLibrary = (function() {
                 print(`    ${type} cosResult;`);
                 for (let i = 0; i < size; ++i) {
                     print(`    sincos(x[${i}], &sinResult, &cosResult);`);
-                    print(`    (*y)[${i}] = sinResult;`);
-                    print(`    (*z)[${i}] = cosResult;`);
+                    print(`    if (y != null)`);
+                    print(`        (*y)[${i}] = sinResult;`);
+                    print(`    if (z != null)`);
+                    print(`        (*z)[${i}] = cosResult;`);
                 }
                 print(`}`);
             }
@@ -1110,8 +1114,10 @@ let standardLibrary = (function() {
                     for (let m = 0; m < i; ++m) {
                         for (let n = 0; n < j; ++n) {
                             print(`    sincos(x[${m}][${n}], &sinResult, &cosResult);`);
-                            print(`    (*y)[${m}][${n}] = sinResult;`);
-                            print(`    (*z)[${m}][${n}] = cosResult;`);
+                            print(`    if (y != null)`);
+                            print(`        (*y)[${m}][${n}] = sinResult;`);
+                            print(`    if (z != null)`);
+                            print(`        (*z)[${m}][${n}] = cosResult;`);
                         }
                     }
                     print(`}`);
@@ -1325,7 +1331,8 @@ let standardLibrary = (function() {
         for (let type of [`half`, `float`]) {
             print(`${type} modf(${type} x, thread ${type}* ip) {`);
             print(`    uint result = uint(x);`);
-            print(`    *ip = x - ${type}(result);`);
+            print(`    if (ip != null)`);
+            print(`        *ip = x - ${type}(result);`);
             print(`    return ${type}(result);`);
             print(`}`);
         
@@ -1336,7 +1343,8 @@ let standardLibrary = (function() {
                 print(`    ${type} buffer;`);
                 for (let i = 0; i < size; ++i) {
                     print(`    result[${i}] = modf(x[${i}], &buffer);`);
-                    print(`    (*y)[${i}] = buffer;`);
+                    print(`    if (y != null)`);
+                    print(`        (*y)[${i}] = buffer;`);
                 }
                 print(`    return result;`);
                 print(`}`);
@@ -1350,7 +1358,8 @@ let standardLibrary = (function() {
                     for (let m = 0; m < i; ++m) {
                         for (let n = 0; n < j; ++n) {
                             print(`    result[${m}][${n}] = modf(x[${m}][${n}], &buffer);`);
-                            print(`    (*y)[${m}][${n}] = buffer;`);
+                            print(`    if (y != null)`);
+                            print(`        (*y)[${m}][${n}] = buffer;`);
                         }
                     }
                     print(`    return result;`);
index f2527e8..d562008 100644 (file)
@@ -7330,6 +7330,99 @@ tests.textureDimensions = function() {
     checkUint(program, callFunction(program, "foo45", [rwTextureDepth2DArray]), 2);
 }
 
+tests.textureDimensionsNull = function() {
+    let program = doPrep(`
+        test bool foo1(Texture1D<float> texture) {
+            GetDimensions(texture, 0, null, null);
+            return true;
+        }
+        test bool foo2(Texture1DArray<float> texture) {
+            GetDimensions(texture, 0, null, null, null);
+            return true;
+        }
+        test bool foo3(Texture2D<float> texture) {
+            GetDimensions(texture, 0, null, null, null);
+            return true;
+        }
+        test bool foo4(Texture2DArray<float> texture) {
+            GetDimensions(texture, 0, null, null, null, null);
+            return true;
+        }
+        test bool foo5(Texture3D<float> texture) {
+            GetDimensions(texture, 0, null, null, null, null);
+            return true;
+        }
+        test bool foo6(TextureCube<float> texture) {
+            GetDimensions(texture, 0, null, null, null);
+            return true;
+        }
+        test bool foo7(RWTexture1D<float> texture) {
+            thread float* ptr = null;
+            GetDimensions(texture, ptr);
+            return true;
+        }
+        test bool foo8(RWTexture1DArray<float> texture) {
+            thread uint* ptr = null;
+            GetDimensions(texture, ptr, ptr);
+            return true;
+        }
+        test bool foo9(RWTexture2D<float> texture) {
+            thread uint* ptr = null;
+            GetDimensions(texture, ptr, ptr);
+            return true;
+        }
+        test bool foo10(RWTexture2DArray<float> texture) {
+            thread uint* ptr = null;
+            GetDimensions(texture, ptr, ptr, ptr);
+            return true;
+        }
+        test bool foo11(RWTexture3D<float> texture) {
+            thread uint* ptr = null;
+            GetDimensions(texture, ptr, ptr, ptr);
+            return true;
+        }
+        test bool foo12(TextureDepth2D<float> texture) {
+            GetDimensions(texture, 0, null, null, null);
+            return true;
+        }
+        test bool foo13(TextureDepth2DArray<float> texture) {
+            GetDimensions(texture, 0, null, null, null, null);
+            return true;
+        }
+        test bool foo14(TextureDepthCube<float> texture) {
+            GetDimensions(texture, 0, null, null, null);
+            return true;
+        }
+        test bool foo15(RWTextureDepth2D<float> texture) {
+            thread uint* ptr = null;
+            GetDimensions(texture, ptr, ptr);
+            return true;
+        }
+        test bool foo16(RWTextureDepth2DArray<float> texture) {
+            thread uint* ptr = null;
+            GetDimensions(texture, ptr, ptr, ptr);
+            return true;
+        }
+    `);
+    let [texture1D, texture1DArray, texture2D, texture2DArray, texture3D, textureCube, rwTexture1D, rwTexture1DArray, rwTexture2D, rwTexture2DArray, rwTexture3D, textureDepth2D, textureDepth2DArray, textureDepthCube, rwTextureDepth2D, rwTextureDepth2DArray] = createTexturesForTesting(program);
+    checkBool(program, callFunction(program, "foo1", [texture1D]), true);
+    checkBool(program, callFunction(program, "foo2", [texture1DArray]), true);
+    checkBool(program, callFunction(program, "foo3", [texture2D]), true);
+    checkBool(program, callFunction(program, "foo4", [texture2DArray]), true);
+    checkBool(program, callFunction(program, "foo5", [texture3D]), true);
+    checkBool(program, callFunction(program, "foo6", [textureCube]), true);
+    checkBool(program, callFunction(program, "foo7", [rwTexture1D]), true);
+    checkBool(program, callFunction(program, "foo8", [rwTexture1DArray]), true);
+    checkBool(program, callFunction(program, "foo9", [rwTexture2D]), true);
+    checkBool(program, callFunction(program, "foo10", [rwTexture2DArray]), true);
+    checkBool(program, callFunction(program, "foo11", [rwTexture3D]), true);
+    checkBool(program, callFunction(program, "foo12", [textureDepth2D]), true);
+    checkBool(program, callFunction(program, "foo13", [textureDepth2DArray]), true);
+    checkBool(program, callFunction(program, "foo14", [textureDepthCube]), true);
+    checkBool(program, callFunction(program, "foo15", [rwTextureDepth2D]), true);
+    checkBool(program, callFunction(program, "foo16", [rwTextureDepth2DArray]), true);
+}
+
 tests.textureLoad = function() {
     let program = doPrep(`
         test float foo1(Texture1D<float> texture, int location, int mipmap) {