Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js

Issue 2026803002: Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout test timeout in a strange way Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 function checkCanvasRect(buf, x, y, width, height, color, tolerance, bufWidth, r etVal) 1 function checkCanvasRect(buf, x, y, width, height, color, tolerance, bufWidth, r etVal)
2 { 2 {
3 for (var px = x; px < x + width; px++) { 3 for (var px = x; px < x + width; px++) {
4 for (var py = y; py < y + height; py++) { 4 for (var py = y; py < y + height; py++) {
5 var offset = (py * bufWidth + px) * 4; 5 var offset = (py * bufWidth + px) * 4;
6 for (var j = 0; j < color.length; j++) { 6 for (var j = 0; j < color.length; j++) {
7 if (Math.abs(buf[offset + j] - color[j]) > tolerance) { 7 if (Math.abs(buf[offset + j] - color[j]) > tolerance) {
8 retVal.testPassed = false; 8 retVal.testPassed = false;
9 return; 9 return;
10 } 10 }
11 } 11 }
12 } 12 }
13 } 13 }
14 } 14 }
15 15
16 function runOneIteration(useTexSubImage2D, bindingTarget, program, bitmap, flipY , premultiplyAlpha, retVal, colorSpace = 'empty') 16 function runOneIteration(useTexSubImage2D, bindingTarget, program, bitmap, flipY , premultiplyAlpha, retVal, colorSpace = 'empty')
17 { 17 {
18 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); 18 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
19 // Enable writes to the RGBA channels 19 // Enable writes to the RGBA channels
20 gl.colorMask(1, 1, 1, 0); 20 gl.colorMask(1, 1, 1, 0);
21 var texture = gl.createTexture(); 21 var texture = gl.createTexture();
22 // Bind the texture to texture unit 0 22 // Bind the texture to texture unit 0
23 gl.bindTexture(bindingTarget, texture); 23 gl.bindTexture(bindingTarget, texture);
24 // Set up texture parameters 24 // Set up texture parameters
25 gl.texParameteri(bindingTarget, gl.TEXTURE_MIN_FILTER, gl.NEAREST); 25 gl.texParameteri(bindingTarget, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
26 gl.texParameteri(bindingTarget, gl.TEXTURE_MAG_FILTER, gl.NEAREST); 26 gl.texParameteri(bindingTarget, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
27 gl.texParameteri(bindingTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
28 gl.texParameteri(bindingTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
27 29
28 var targets = [gl.TEXTURE_2D]; 30 var targets = [gl.TEXTURE_2D];
29 if (bindingTarget == gl.TEXTURE_CUBE_MAP) { 31 if (bindingTarget == gl.TEXTURE_CUBE_MAP) {
30 targets = [gl.TEXTURE_CUBE_MAP_POSITIVE_X, 32 targets = [gl.TEXTURE_CUBE_MAP_POSITIVE_X,
31 gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 33 gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
32 gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 34 gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
33 gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 35 gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
34 gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 36 gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
35 gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; 37 gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];
36 } 38 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 runOneIteration(cases[i].sub, bindingTarget, program, cases[i].bitmap, c ases[i].flipY, 126 runOneIteration(cases[i].sub, bindingTarget, program, cases[i].bitmap, c ases[i].flipY,
125 cases[i].premultiply, retVal, cases[i].colorSpace); 127 cases[i].premultiply, retVal, cases[i].colorSpace);
126 } 128 }
127 } 129 }
128 130
129 function runTest(bitmaps, alphaVal, colorSpaceEffective) 131 function runTest(bitmaps, alphaVal, colorSpaceEffective)
130 { 132 {
131 var retVal = {testPassed: true, alpha: alphaVal, colorSpaceEffect: colorSpac eEffective}; 133 var retVal = {testPassed: true, alpha: alphaVal, colorSpaceEffect: colorSpac eEffective};
132 var program = tiu.setupTexturedQuad(gl, internalFormat); 134 var program = tiu.setupTexturedQuad(gl, internalFormat);
133 runTestOnBindingTarget(gl.TEXTURE_2D, program, bitmaps, retVal); 135 runTestOnBindingTarget(gl.TEXTURE_2D, program, bitmaps, retVal);
134 program = tiu.setupTexturedQuadWithCubeMap(gl, internalFormat); 136 // program = tiu.setupTexturedQuadWithCubeMap(gl, internalFormat);
135 runTestOnBindingTarget(gl.TEXTURE_CUBE_MAP, program, bitmaps, retVal); 137 // runTestOnBindingTarget(gl.TEXTURE_CUBE_MAP, program, bitmaps, retVal);
xidachen 2016/06/15 12:18:47 kbr@: could you give some suggestions? This js fil
136 return retVal.testPassed; 138 return retVal.testPassed;
137 } 139 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.h » ('j') | third_party/WebKit/Source/platform/graphics/Image.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698