Changeset 58102 in webkit
- Timestamp:
- Apr 22, 2010 9:54:00 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r58099 r58102 1 2010-04-22 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Emulate GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for glGet 6 https://bugs.webkit.org/show_bug.cgi?id=37281 7 8 * fast/canvas/webgl/read-pixels-expected.txt: Add test case for the other supported format/type in readPixels (besides RGBA/UNSIGNED_BYTE); also, changed to a simpler test framework. 9 * fast/canvas/webgl/read-pixels.html: Ditto. 10 1 11 2010-04-22 Marcus Bulach <bulach@chromium.org> 2 12 -
trunk/LayoutTests/fast/canvas/webgl/read-pixels-expected.txt
r57574 r58102 4 4 5 5 PASS gl = initWebGL('example', 'vshader', 'fshader', [ 'pos', 'colorIn' ], [ 0, 0, 0, 1 ], 1) is non-null. 6 Check supported pixel format/type besides RGBA/UNSIGNED_BYTE 7 PASS gl.getError() is gl.NO_ERROR 8 PASS gl.getError() is gl.NO_ERROR 9 PASS pixelFormat == gl.RGBA && pixelType == gl.UNSIGNED_BYTE is false 10 Testing format = RGBA and type = UNSIGNED_BYTE 6 11 Testing PACK_ALIGNMENT = 1, width = 1, height = 2 7 PASS array.length is expectedSize 8 PASS pixel is [ 255, 255, 0, 255] 12 PASS gl.getError() is gl.NO_ERROR 13 PASS gl.getError() is gl.NO_ERROR 14 PASS array.length is expectedSize 15 PASS 255,102,0,255 is non-null. 16 PASS pixel is expectedColor 9 17 Testing PACK_ALIGNMENT = 2, width = 1, height = 2 10 PASS array.length is expectedSize 11 PASS pixel is [ 255, 255, 0, 255] 18 PASS gl.getError() is gl.NO_ERROR 19 PASS gl.getError() is gl.NO_ERROR 20 PASS array.length is expectedSize 21 PASS 255,102,0,255 is non-null. 22 PASS pixel is expectedColor 12 23 Testing PACK_ALIGNMENT = 4, width = 1, height = 2 13 PASS array.length is expectedSize 14 PASS pixel is [ 255, 255, 0, 255] 24 PASS gl.getError() is gl.NO_ERROR 25 PASS gl.getError() is gl.NO_ERROR 26 PASS array.length is expectedSize 27 PASS 255,102,0,255 is non-null. 28 PASS pixel is expectedColor 15 29 Testing PACK_ALIGNMENT = 8, width = 1, height = 2 16 PASS array.length is expectedSize 17 PASS pixel is [ 255, 255, 0, 255] 30 PASS gl.getError() is gl.NO_ERROR 31 PASS gl.getError() is gl.NO_ERROR 32 PASS array.length is expectedSize 33 PASS 255,102,0,255 is non-null. 34 PASS pixel is expectedColor 18 35 Testing PACK_ALIGNMENT = 4, width = 2, height = 2 19 PASS array.length is expectedSize 20 PASS pixel is [ 255, 255, 0, 255] 36 PASS gl.getError() is gl.NO_ERROR 37 PASS gl.getError() is gl.NO_ERROR 38 PASS array.length is expectedSize 39 PASS 255,102,0,255 is non-null. 40 PASS pixel is expectedColor 21 41 Testing PACK_ALIGNMENT = 8, width = 2, height = 2 22 PASS array.length is expectedSize 23 PASS pixel is [ 255, 255, 0, 255] 42 PASS gl.getError() is gl.NO_ERROR 43 PASS gl.getError() is gl.NO_ERROR 44 PASS array.length is expectedSize 45 PASS 255,102,0,255 is non-null. 46 PASS pixel is expectedColor 24 47 Testing PACK_ALIGNMENT = 4, width = 3, height = 2 25 PASS array.length is expectedSize 26 PASS pixel is [ 255, 255, 0, 255] 48 PASS gl.getError() is gl.NO_ERROR 49 PASS gl.getError() is gl.NO_ERROR 50 PASS array.length is expectedSize 51 PASS 255,102,0,255 is non-null. 52 PASS pixel is expectedColor 27 53 Testing PACK_ALIGNMENT = 8, width = 3, height = 2 28 PASS array.length is expectedSize 29 PASS pixel is [ 255, 255, 0, 255] 54 PASS gl.getError() is gl.NO_ERROR 55 PASS gl.getError() is gl.NO_ERROR 56 PASS array.length is expectedSize 57 PASS 255,102,0,255 is non-null. 58 PASS pixel is expectedColor 30 59 Testing PACK_ALIGNMENT = 4, width = 4, height = 2 31 PASS array.length is expectedSize 32 PASS pixel is [ 255, 255, 0, 255] 60 PASS gl.getError() is gl.NO_ERROR 61 PASS gl.getError() is gl.NO_ERROR 62 PASS array.length is expectedSize 63 PASS 255,102,0,255 is non-null. 64 PASS pixel is expectedColor 33 65 Testing PACK_ALIGNMENT = 8, width = 4, height = 2 34 PASS array.length is expectedSize 35 PASS pixel is [ 255, 255, 0, 255] 66 PASS gl.getError() is gl.NO_ERROR 67 PASS gl.getError() is gl.NO_ERROR 68 PASS array.length is expectedSize 69 PASS 255,102,0,255 is non-null. 70 PASS pixel is expectedColor 36 71 Testing PACK_ALIGNMENT = 8, width = 5, height = 1 37 PASS array.length is expectedSize 38 PASS pixel is [ 255, 255, 0, 255] 72 PASS gl.getError() is gl.NO_ERROR 73 PASS gl.getError() is gl.NO_ERROR 74 PASS array.length is expectedSize 75 PASS 255,102,0,255 is non-null. 76 PASS pixel is expectedColor 39 77 Testing PACK_ALIGNMENT = 4, width = 5, height = 2 40 PASS array.length is expectedSize 41 PASS pixel is [ 255, 255, 0, 255] 78 PASS gl.getError() is gl.NO_ERROR 79 PASS gl.getError() is gl.NO_ERROR 80 PASS array.length is expectedSize 81 PASS 255,102,0,255 is non-null. 82 PASS pixel is expectedColor 42 83 Testing PACK_ALIGNMENT = 8, width = 5, height = 2 43 PASS array.length is expectedSize 44 PASS pixel is [ 255, 255, 0, 255] 84 PASS gl.getError() is gl.NO_ERROR 85 PASS gl.getError() is gl.NO_ERROR 86 PASS array.length is expectedSize 87 PASS 255,102,0,255 is non-null. 88 PASS pixel is expectedColor 45 89 Testing PACK_ALIGNMENT = 8, width = 6, height = 2 46 PASS array.length is expectedSize 47 PASS pixel is [ 255, 255, 0, 255] 90 PASS gl.getError() is gl.NO_ERROR 91 PASS gl.getError() is gl.NO_ERROR 92 PASS array.length is expectedSize 93 PASS 255,102,0,255 is non-null. 94 PASS pixel is expectedColor 48 95 Testing PACK_ALIGNMENT = 8, width = 7, height = 2 49 PASS array.length is expectedSize 50 PASS pixel is [ 255, 255, 0, 255] 96 PASS gl.getError() is gl.NO_ERROR 97 PASS gl.getError() is gl.NO_ERROR 98 PASS array.length is expectedSize 99 PASS 255,102,0,255 is non-null. 100 PASS pixel is expectedColor 51 101 Testing PACK_ALIGNMENT = 8, width = 8, height = 2 52 PASS array.length is expectedSize 53 PASS pixel is [ 255, 255, 0, 255] 102 PASS gl.getError() is gl.NO_ERROR 103 PASS gl.getError() is gl.NO_ERROR 104 PASS array.length is expectedSize 105 PASS 255,102,0,255 is non-null. 106 PASS pixel is expectedColor 107 Testing the other supported format/type combination 108 Testing PACK_ALIGNMENT = 1, width = 1, height = 2 109 PASS gl.getError() is gl.NO_ERROR 110 PASS gl.getError() is gl.NO_ERROR 111 PASS array.length is expectedSize 112 PASS 255,102,0,0 is non-null. 113 PASS pixel is expectedColor 114 Testing PACK_ALIGNMENT = 2, width = 1, height = 2 115 PASS gl.getError() is gl.NO_ERROR 116 PASS gl.getError() is gl.NO_ERROR 117 PASS array.length is expectedSize 118 PASS 255,102,0,0 is non-null. 119 PASS pixel is expectedColor 120 Testing PACK_ALIGNMENT = 4, width = 1, height = 2 121 PASS gl.getError() is gl.NO_ERROR 122 PASS gl.getError() is gl.NO_ERROR 123 PASS array.length is expectedSize 124 PASS 255,102,0,0 is non-null. 125 PASS pixel is expectedColor 126 Testing PACK_ALIGNMENT = 8, width = 1, height = 2 127 PASS gl.getError() is gl.NO_ERROR 128 PASS gl.getError() is gl.NO_ERROR 129 PASS array.length is expectedSize 130 PASS 255,102,0,0 is non-null. 131 PASS pixel is expectedColor 132 Testing PACK_ALIGNMENT = 4, width = 2, height = 2 133 PASS gl.getError() is gl.NO_ERROR 134 PASS gl.getError() is gl.NO_ERROR 135 PASS array.length is expectedSize 136 PASS 255,102,0,0 is non-null. 137 PASS pixel is expectedColor 138 Testing PACK_ALIGNMENT = 8, width = 2, height = 2 139 PASS gl.getError() is gl.NO_ERROR 140 PASS gl.getError() is gl.NO_ERROR 141 PASS array.length is expectedSize 142 PASS 255,102,0,0 is non-null. 143 PASS pixel is expectedColor 144 Testing PACK_ALIGNMENT = 4, width = 3, height = 2 145 PASS gl.getError() is gl.NO_ERROR 146 PASS gl.getError() is gl.NO_ERROR 147 PASS array.length is expectedSize 148 PASS 255,102,0,0 is non-null. 149 PASS pixel is expectedColor 150 Testing PACK_ALIGNMENT = 8, width = 3, height = 2 151 PASS gl.getError() is gl.NO_ERROR 152 PASS gl.getError() is gl.NO_ERROR 153 PASS array.length is expectedSize 154 PASS 255,102,0,0 is non-null. 155 PASS pixel is expectedColor 156 Testing PACK_ALIGNMENT = 4, width = 4, height = 2 157 PASS gl.getError() is gl.NO_ERROR 158 PASS gl.getError() is gl.NO_ERROR 159 PASS array.length is expectedSize 160 PASS 255,102,0,0 is non-null. 161 PASS pixel is expectedColor 162 Testing PACK_ALIGNMENT = 8, width = 4, height = 2 163 PASS gl.getError() is gl.NO_ERROR 164 PASS gl.getError() is gl.NO_ERROR 165 PASS array.length is expectedSize 166 PASS 255,102,0,0 is non-null. 167 PASS pixel is expectedColor 168 Testing PACK_ALIGNMENT = 8, width = 5, height = 1 169 PASS gl.getError() is gl.NO_ERROR 170 PASS gl.getError() is gl.NO_ERROR 171 PASS array.length is expectedSize 172 PASS 255,102,0,0 is non-null. 173 PASS pixel is expectedColor 174 Testing PACK_ALIGNMENT = 4, width = 5, height = 2 175 PASS gl.getError() is gl.NO_ERROR 176 PASS gl.getError() is gl.NO_ERROR 177 PASS array.length is expectedSize 178 PASS 255,102,0,0 is non-null. 179 PASS pixel is expectedColor 180 Testing PACK_ALIGNMENT = 8, width = 5, height = 2 181 PASS gl.getError() is gl.NO_ERROR 182 PASS gl.getError() is gl.NO_ERROR 183 PASS array.length is expectedSize 184 PASS 255,102,0,0 is non-null. 185 PASS pixel is expectedColor 186 Testing PACK_ALIGNMENT = 8, width = 6, height = 2 187 PASS gl.getError() is gl.NO_ERROR 188 PASS gl.getError() is gl.NO_ERROR 189 PASS array.length is expectedSize 190 PASS 255,102,0,0 is non-null. 191 PASS pixel is expectedColor 192 Testing PACK_ALIGNMENT = 8, width = 7, height = 2 193 PASS gl.getError() is gl.NO_ERROR 194 PASS gl.getError() is gl.NO_ERROR 195 PASS array.length is expectedSize 196 PASS 255,102,0,0 is non-null. 197 PASS pixel is expectedColor 198 Testing PACK_ALIGNMENT = 8, width = 8, height = 2 199 PASS gl.getError() is gl.NO_ERROR 200 PASS gl.getError() is gl.NO_ERROR 201 PASS array.length is expectedSize 202 PASS 255,102,0,0 is non-null. 203 PASS pixel is expectedColor 54 204 PASS successfullyParsed is true 55 205 -
trunk/LayoutTests/fast/canvas/webgl/read-pixels.html
r57574 r58102 25 25 } 26 26 </script> 27 27 </head> 28 <body> 29 <canvas id="example" width="32px" height="32px"></canvas> 30 <div id="description"></div> 31 <div id="console"></div> 28 32 <script> 29 33 var successfullyParsed = false; 30 34 31 // The se fourdeclarations need to be global for "shouldBe" to see them35 // The below declarations need to be global for "shouldBe" to see them 32 36 var gl = null; 33 37 var array = null; 34 38 var expectedSize = 0; 35 var pixel = [ 0, 0, 0, 1 ]; 36 37 function init() 38 { 39 if (window.layoutTestController) { 40 layoutTestController.overridePreference("WebKitWebGLEnabled", "1"); 41 layoutTestController.dumpAsText(); 42 layoutTestController.waitUntilDone(); 43 } 44 45 description('Verify readPixels() works fine with various PACK_ALIGNMENT values.'); 46 47 runTest(); 48 } 49 50 function runTestIteration(packAlignment, width, height, size) 39 var pixel = [ 0, 0, 0, 0 ]; 40 var expectedColor = [ 0, 0, 0, 0 ]; 41 var pixelFormat = 0; 42 var pixelType = 0; 43 44 function calculatePixelBytes(format, type) 45 { 46 var size = 0; 47 switch (format) { 48 case gl.ALPHA: 49 size = 1; 50 break; 51 case gl.RGB: 52 size = 3; 53 break; 54 case gl.RGBA: 55 size = 4; 56 break; 57 default: 58 return -1; 59 } 60 switch (type) { 61 case gl.UNSIGNED_BYTE: 62 break; 63 case gl.UNSIGNED_SHORT_5_6_5: 64 if (format != gl.RGB) 65 return -1; 66 size = 2; 67 break; 68 case gl.UNSIGNED_SHORT_4_4_4_4: 69 case gl.UNSIGNED_SHORT_5_5_5_1: 70 if (format != gl.RGBA) 71 return -1; 72 size = 2; 73 break; 74 default: 75 return -1; 76 } 77 return size; 78 } 79 80 function calculatePaddingBytes(bytesPerPixel, packAlignment, width) 81 { 82 var padding = 0; 83 switch (packAlignment) { 84 case 1: 85 case 2: 86 case 4: 87 case 8: 88 padding = (bytesPerPixel * width) % packAlignment; 89 if (padding > 0) 90 padding = packAlignment - padding; 91 break; 92 default: 93 return -1; 94 } 95 return padding; 96 } 97 98 function packColor(format, type, r, g, b, a) 99 { 100 // FIXME: not sure if the color packing is correct for UNSIGNED_SHORT_*. 101 var color = [ 0, 0, 0, 0 ]; 102 switch (type) { 103 case gl.UNSIGNED_BYTE: 104 switch (format) { 105 case gl.ALPHA: 106 color[0] = a; 107 break; 108 case gl.RGB: 109 color[0] = r; 110 color[1] = g; 111 color[2] = b; 112 break; 113 case gl.RGBA: 114 color[0] = r; 115 color[1] = g; 116 color[2] = b; 117 color[3] = a; 118 break; 119 default: 120 return null; 121 } 122 break; 123 case gl.UNSIGNED_SHORT_5_6_5: 124 if (format != gl.RGB) 125 return null; 126 r >>= 3; 127 g >>= 2; 128 b >>= 3; 129 color[0] = (r << 11) + (g << 5) + b; 130 break; 131 case gl.UNSIGNED_SHORT_4_4_4_4: 132 if (format != gl.RGBA) 133 return null; 134 r >>= 4; 135 g >>= 4; 136 b >>= 4; 137 a >>= 4; 138 color[0] = (r << 12) + (g << 8) + (b << 4) + a; 139 break; 140 case gl.UNSIGNED_SHORT_5_5_5_1: 141 if (format != gl.RGBA) 142 return null; 143 r >>= 3; 144 g >>= 3; 145 b >>= 3; 146 a >>= 7; 147 color[0] = (r << 11) + (g << 6) + (b << 1) + a; 148 break; 149 Default: 150 return null; 151 } 152 return color; 153 } 154 155 function runTestIteration(format, type, packAlignment, width, height) 51 156 { 52 157 debug("Testing PACK_ALIGNMENT = " + packAlignment + ", width = " + width + ", height = " + height); 53 gl.clearColor(1, 1, 0, 1);158 gl.clearColor(1, 0.4, 0, 1); 54 159 gl.clear(gl.COLOR_BUFFER_BIT); 55 160 gl.pixelStorei(gl.PACK_ALIGNMENT, packAlignment); 56 array = gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE); 57 expectedSize = size; 161 shouldBe("gl.getError()", "gl.NO_ERROR"); 162 array = gl.readPixels(0, 0, width, height, format, type); 163 shouldBe("gl.getError()", "gl.NO_ERROR"); 164 var bytesPerPixel = calculatePixelBytes(format, type); 165 var padding = calculatePaddingBytes(bytesPerPixel, packAlignment, width); 166 expectedSize = bytesPerPixel * width * height + padding * (height - 1); 167 var isShort = false; 168 switch (type) { 169 case gl.UNSIGNED_SHORT_5_6_5: 170 case gl.UNSIGNED_SHORT_4_4_4_4: 171 case gl.UNSIGNED_SHORT_5_5_5_1: 172 isShort = true; 173 } 174 if (isShort) 175 expectedSize /= 2; 58 176 shouldBe("array.length", "expectedSize"); 59 177 // Check the last pixel of the last row. 60 var padding = 0; 61 if (height > 1) 62 padding = (size - width * height * 4) / (height - 1); 63 var bytesPerRow = width * 4 + padding; 64 var pos = bytesPerRow * (height - 1) + (width - 1) * 4; 65 pixel[0] = array[pos]; 66 pixel[1] = array[pos + 1]; 67 pixel[2] = array[pos + 2]; 68 pixel[3] = array[pos + 3]; 69 shouldBe("pixel", "[ 255, 255, 0, 255]"); 70 } 71 72 function runTest() 73 { 74 shouldBeNonNull("gl = initWebGL('example', 'vshader', 'fshader', [ 'pos', 'colorIn' ], [ 0, 0, 0, 1 ], 1)"); 75 gl.disable(gl.BLEND); 76 77 runTestIteration(1, 1, 2, 8); 78 runTestIteration(2, 1, 2, 8); 79 runTestIteration(4, 1, 2, 8); 80 runTestIteration(8, 1, 2, 12); 81 runTestIteration(4, 2, 2, 16); 82 runTestIteration(8, 2, 2, 16); 83 runTestIteration(4, 3, 2, 24); 84 runTestIteration(8, 3, 2, 28); 85 runTestIteration(4, 4, 2, 32); 86 runTestIteration(8, 4, 2, 32); 87 runTestIteration(8, 5, 1, 20); 88 runTestIteration(4, 5, 2, 40); 89 runTestIteration(8, 5, 2, 44); 90 runTestIteration(8, 6, 2, 48); 91 runTestIteration(8, 7, 2, 60); 92 runTestIteration(8, 8, 2, 64); 93 94 successfullyParsed = true; 95 var epilogue = document.createElement("script"); 96 epilogue.onload = finish; 97 epilogue.src = "../../js/resources/js-test-post.js"; 98 document.body.appendChild(epilogue); 99 } 100 101 function finish() { 102 if (window.layoutTestController) { 103 layoutTestController.notifyDone(); 104 } 105 } 178 var bytesPerRow = width * bytesPerPixel + padding; 179 var pos = bytesPerRow * (height - 1) + (width - 1) * bytesPerPixel; 180 var numComponents = bytesPerPixel; 181 if (isShort) { 182 pos /= 2; 183 numComponents /= 2; 184 } 185 for (var i = 0; i < numComponents; ++i) 186 pixel[i] = array[pos + i]; 187 for (var i = numComponents; i < 4; ++i) 188 pixel[i] = 0; 189 expectedColor = packColor(format, type, 255, 102, 0, 255); 190 shouldBeNonNull(expectedColor); 191 shouldBe("pixel", "expectedColor"); 192 } 193 194 function checkSupportedPixelFormatAndType() 195 { 196 debug("Check supported pixel format/type besides RGBA/UNSIGNED_BYTE"); 197 shouldBe("gl.getError()", "gl.NO_ERROR"); 198 pixelFormat = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT); 199 pixelType = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE); 200 shouldBe("gl.getError()", "gl.NO_ERROR"); 201 shouldBeFalse("pixelFormat == gl.RGBA && pixelType == gl.UNSIGNED_BYTE"); 202 } 203 204 description('Verify readPixels() works fine with various PACK_ALIGNMENT values.'); 205 206 shouldBeNonNull("gl = initWebGL('example', 'vshader', 'fshader', [ 'pos', 'colorIn' ], [ 0, 0, 0, 1 ], 1)"); 207 gl.disable(gl.BLEND); 208 209 checkSupportedPixelFormatAndType(); 210 211 debug("Testing format = RGBA and type = UNSIGNED_BYTE"); 212 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 1, 1, 2); 213 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 2, 1, 2); 214 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 4, 1, 2); 215 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 1, 2); 216 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 4, 2, 2); 217 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 2, 2); 218 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 4, 3, 2); 219 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 3, 2); 220 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 4, 4, 2); 221 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 4, 2); 222 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 5, 1); 223 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 4, 5, 2); 224 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 5, 2); 225 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 6, 2); 226 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 7, 2); 227 runTestIteration(gl.RGBA, gl.UNSIGNED_BYTE, 8, 8, 2); 228 229 debug("Testing the other supported format/type combination"); 230 runTestIteration(pixelFormat, pixelType, 1, 1, 2); 231 runTestIteration(pixelFormat, pixelType, 2, 1, 2); 232 runTestIteration(pixelFormat, pixelType, 4, 1, 2); 233 runTestIteration(pixelFormat, pixelType, 8, 1, 2); 234 runTestIteration(pixelFormat, pixelType, 4, 2, 2); 235 runTestIteration(pixelFormat, pixelType, 8, 2, 2); 236 runTestIteration(pixelFormat, pixelType, 4, 3, 2); 237 runTestIteration(pixelFormat, pixelType, 8, 3, 2); 238 runTestIteration(pixelFormat, pixelType, 4, 4, 2); 239 runTestIteration(pixelFormat, pixelType, 8, 4, 2); 240 runTestIteration(pixelFormat, pixelType, 8, 5, 1); 241 runTestIteration(pixelFormat, pixelType, 4, 5, 2); 242 runTestIteration(pixelFormat, pixelType, 8, 5, 2); 243 runTestIteration(pixelFormat, pixelType, 8, 6, 2); 244 runTestIteration(pixelFormat, pixelType, 8, 7, 2); 245 runTestIteration(pixelFormat, pixelType, 8, 8, 2); 246 247 successfullyParsed = true; 106 248 </script> 107 </head> 108 <body onload="init()"> 109 <canvas id="example" width="32px" height="32px"></canvas> 110 <div id="description"></div> 111 <div id="console"></div> 249 <script src="../../js/resources/js-test-post.js"></script> 112 250 </body> 113 251 </html> -
trunk/WebCore/ChangeLog
r58097 r58102 1 2010-04-22 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Emulate GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for glGet 6 https://bugs.webkit.org/show_bug.cgi?id=37281 7 8 * html/canvas/WebGLRenderingContext.cpp: 9 (WebCore::WebGLRenderingContext::WebGLRenderingContext): Remove error check because two enums are supported now. 10 (WebCore::WebGLRenderingContext::getParameter): Add two enums. 11 (WebCore::WebGLRenderingContext::readPixels): Fix a tiny bug. 12 * platform/graphics/mac/GraphicsContext3DMac.cpp: 13 (WebCore::GraphicsContext3D::getIntegerv): Emulate two enums. 14 1 15 2010-04-22 Diego Escalante Urrelo <descalante@igalia.com> 2 16 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r57747 r58102 102 102 int implementationColorReadType = GraphicsContext3D::UNSIGNED_BYTE; 103 103 m_context->getIntegerv(GraphicsContext3D::IMPLEMENTATION_COLOR_READ_TYPE, &implementationColorReadType); 104 // FIXME: remove the getError() when IMPLEMENTATION_COLOR_READ_FORMAT/TYPE are supported.105 m_context->getError();106 104 m_implementationColorReadType = implementationColorReadType; 107 105 m_context->reshape(canvas()->width(), canvas()->height()); … … 1070 1068 return getUnsignedLongParameter(pname); 1071 1069 case GraphicsContext3D::GREEN_BITS: 1070 return getLongParameter(pname); 1071 case GraphicsContext3D::IMPLEMENTATION_COLOR_READ_FORMAT: 1072 return getLongParameter(pname); 1073 case GraphicsContext3D::IMPLEMENTATION_COLOR_READ_TYPE: 1072 1074 return getLongParameter(pname); 1073 1075 case GraphicsContext3D::LINE_WIDTH: … … 1640 1642 return 0; 1641 1643 } 1642 if (!(format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE || format == m_implementationColorReadFormat && type == m_implementationColorRead Format)) {1644 if (!(format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE || format == m_implementationColorReadFormat && type == m_implementationColorReadType)) { 1643 1645 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1644 1646 return 0; -
trunk/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
r57852 r58102 1142 1142 void GraphicsContext3D::getIntegerv(unsigned long pname, int* value) 1143 1143 { 1144 ensureContext(m_contextObj); 1145 ::glGetIntegerv(pname, value); 1144 // Need to emulate IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for GL. Any valid 1145 // combination should work, but GL_RGB/GL_UNSIGNED_BYTE might be the most 1146 // useful for desktop WebGL users. 1147 ensureContext(m_contextObj); 1148 switch (pname) { 1149 case IMPLEMENTATION_COLOR_READ_FORMAT: 1150 *value = GL_RGB; 1151 break; 1152 case IMPLEMENTATION_COLOR_READ_TYPE: 1153 *value = GL_UNSIGNED_BYTE; 1154 break; 1155 default: 1156 ::glGetIntegerv(pname, value); 1157 } 1146 1158 } 1147 1159 -
trunk/WebKit/chromium/ChangeLog
r58072 r58102 1 2010-04-22 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Emulate GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for glGet 6 https://bugs.webkit.org/show_bug.cgi?id=37281 7 8 * src/WebGraphicsContext3DDefaultImpl.cpp: 9 (WebKit::WebGraphicsContext3DDefaultImpl::getIntegerv): Emulate two enums. 10 1 11 2010-04-22 Adam Barth <abarth@webkit.org> 2 12 -
trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
r57694 r58102 1051 1051 } 1052 1052 1053 DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, unsigned long, int*) 1053 void WebGraphicsContext3DDefaultImpl::getIntegerv(unsigned long pname, int* value) 1054 { 1055 // Need to emulate IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for GL. Any valid 1056 // combination should work, but GL_RGB/GL_UNSIGNED_BYTE might be the most 1057 // useful for desktop WebGL users. 1058 makeContextCurrent(); 1059 switch (pname) { 1060 case 0x8B9B: // IMPLEMENTATION_COLOR_READ_FORMAT 1061 *value = GL_RGB; 1062 break; 1063 case 0x8B9A: // IMPLEMENTATION_COLOR_READ_TYPE 1064 *value = GL_UNSIGNED_BYTE; 1065 break; 1066 default: 1067 glGetIntegerv(pname, value); 1068 } 1069 } 1054 1070 1055 1071 DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, unsigned long, int*)
Note: See TracChangeset
for help on using the changeset viewer.