Changeset 76988 in webkit


Ignore:
Timestamp:
Jan 28, 2011 2:20:31 PM (13 years ago)
Author:
zmo@google.com
Message:

2011-01-28 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

uniformN*v should generate INVALID_VALUE of the array size is not a multiple of N
https://bugs.webkit.org/show_bug.cgi?id=53306

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateUniformMatrixParameters):

2011-01-28 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

uniformN*v should generate INVALID_VALUE of the array size is not a multiple of N
https://bugs.webkit.org/show_bug.cgi?id=53306

  • fast/canvas/webgl/gl-uniform-arrays-expected.txt:
  • fast/canvas/webgl/gl-uniform-arrays.html:
  • fast/canvas/webgl/gl-uniformmatrix4fv-expected.txt:
  • fast/canvas/webgl/gl-uniformmatrix4fv.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76987 r76988  
     12011-01-28  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        uniformN*v should generate INVALID_VALUE of the array size is not a multiple of N
     6        https://bugs.webkit.org/show_bug.cgi?id=53306
     7
     8        * fast/canvas/webgl/gl-uniform-arrays-expected.txt:
     9        * fast/canvas/webgl/gl-uniform-arrays.html:
     10        * fast/canvas/webgl/gl-uniformmatrix4fv-expected.txt:
     11        * fast/canvas/webgl/gl-uniformmatrix4fv.html:
     12
    1132011-01-28  Tom Sepez  <tsepez@chromium.org>
    214
  • trunk/LayoutTests/fast/canvas/webgl/gl-uniform-arrays-expected.txt

    r74499 r76988  
    3030PASS getError was expected value: INVALID_OPERATION : should fail if there is no current program
    3131PASS getError was expected value: INVALID_VALUE : should fail with insufficient array size with gl.uniform2fv
     32PASS getError was expected value: INVALID_VALUE : should fail with non-multiple array size with gl.uniform2fv
    3233PASS getError was expected value: NO_ERROR : can set an array of uniforms with gl.uniform2fv
    3334PASS getError was expected value: NO_ERROR : can call gl.getUniform
     
    5152PASS getError was expected value: INVALID_OPERATION : should fail if there is no current program
    5253PASS getError was expected value: INVALID_VALUE : should fail with insufficient array size with gl.uniform3fv
     54PASS getError was expected value: INVALID_VALUE : should fail with non-multiple array size with gl.uniform3fv
    5355PASS getError was expected value: NO_ERROR : can set an array of uniforms with gl.uniform3fv
    5456PASS getError was expected value: NO_ERROR : can call gl.getUniform
     
    7274PASS getError was expected value: INVALID_OPERATION : should fail if there is no current program
    7375PASS getError was expected value: INVALID_VALUE : should fail with insufficient array size with gl.uniform4fv
     76PASS getError was expected value: INVALID_VALUE : should fail with non-multiple array size with gl.uniform4fv
    7477PASS getError was expected value: NO_ERROR : can set an array of uniforms with gl.uniform4fv
    7578PASS getError was expected value: NO_ERROR : can call gl.getUniform
  • trunk/LayoutTests/fast/canvas/webgl/gl-uniform-arrays.html

    r74499 r76988  
    110110    },
    111111    srcValues: [16, 15, 14],
    112     srcValuesBad: [],
     112    srcValuesLess: [],
     113    srcValuesNonMultiple: null,
    113114  },
    114115  { type: 'vec2',
     
    141142    },
    142143    srcValues: [16, 15, 14, 13, 12, 11],
    143     srcValuesBad: [16],
     144    srcValuesLess: [16],
     145    srcValuesNonMultiple: [16, 15, 14, 13, 12, 11, 10],
    144146  },
    145147  { type: 'vec3',
     
    175177    },
    176178    srcValues: [16, 15, 14, 13, 12, 11, 10, 9, 8],
    177     srcValuesBad: [16, 15],
     179    srcValuesLess: [16, 15],
     180    srcValuesNonMultiple: [16, 15, 14, 13, 12, 11, 10, 9, 8, 7],
    178181  },
    179182  { type: 'vec4',
     
    212215    },
    213216    srcValues: [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5],
    214     srcValuesBad: [16, 15, 14],
     217    srcValuesLess: [16, 15, 14],
     218    srcValuesNonMultiple: [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4],
    215219  }
    216220];
     
    232236  var loc = gl.getUniformLocation(program, "color[0]");
    233237  var srcValues = typeInfo.srcValues;
    234   var srcValuesBad = typeInfo.srcValuesBad;
     238  var srcValuesLess = typeInfo.srcValuesLess;
     239  var srcValuesNonMultiple = typeInfo.srcValuesNonMultiple;
    235240
    236241  // Try setting the value before using the program
    237242  gl[typeInfo.setter](loc, srcValues);
    238243  glErrorShouldBe(gl, gl.INVALID_OPERATION,
    239             "should fail if there is no current program");
     244                  "should fail if there is no current program");
    240245
    241246  gl.useProgram(program);
    242   gl[typeInfo.setter](loc, srcValuesBad);
     247  gl[typeInfo.setter](loc, srcValuesLess);
    243248  glErrorShouldBe(gl, gl.INVALID_VALUE,
    244             "should fail with insufficient array size with gl." + typeInfo.setter);
     249                  "should fail with insufficient array size with gl." + typeInfo.setter);
     250  if (srcValuesNonMultiple) {
     251    gl[typeInfo.setter](loc, srcValuesNonMultiple);
     252    glErrorShouldBe(gl, gl.INVALID_VALUE,
     253                    "should fail with non-multiple array size with gl." + typeInfo.setter);
     254  }
    245255  gl[typeInfo.setter](loc, srcValues);
    246256  glErrorShouldBe(gl, gl.NO_ERROR,
    247             "can set an array of uniforms with gl." + typeInfo.setter);
     257                  "can set an array of uniforms with gl." + typeInfo.setter);
    248258  var values = gl.getUniform(program, loc);
    249259  glErrorShouldBe(gl, gl.NO_ERROR,
    250             "can call gl.getUniform");
     260                  "can call gl.getUniform");
    251261  assertMsg(typeInfo.checkType(values),
    252262            "gl.getUniform returns the correct type.");
     
    254264    var elemLoc = gl.getUniformLocation(program, "color[" + ii + "]");
    255265    glErrorShouldBe(gl, gl.NO_ERROR,
    256               "can get location of element " + ii +
    257               " of array from gl.getUniformLocation");
     266                    "can get location of element " + ii +
     267                    " of array from gl.getUniformLocation");
    258268    var value = gl.getUniform(program, elemLoc);
    259269    glErrorShouldBe(gl, gl.NO_ERROR,
    260               "can get value of element " + ii + " of array from gl.getUniform");
     270                    "can get value of element " + ii + " of array from gl.getUniform");
    261271    assertMsg(typeInfo.checkValue(typeInfo, ii, value),
    262272              "value put in (" + typeInfo.srcValueAsString(ii, srcValues) +
     
    266276  typeInfo.invalidSet(loc);
    267277  glErrorShouldBe(gl, gl.INVALID_OPERATION,
    268             "using the wrong size of gl.Uniform fails");
     278                  "using the wrong size of gl.Uniform fails");
    269279  var exceptionCaught = false;
    270280  if (typeInfo.illegalSet) {
     
    279289  gl.useProgram(null);
    280290  glErrorShouldBe(gl, gl.NO_ERROR,
    281             "can call gl.useProgram(null)");
     291                  "can call gl.useProgram(null)");
    282292}
    283293debug("");
  • trunk/LayoutTests/fast/canvas/webgl/gl-uniformmatrix4fv-expected.txt

    r62384 r76988  
    55
    66Checking gl.uniformMatrix.
    7 PASS should fail with insufficient array size for uniformMatrix2fv
    8 PASS can call uniformMatrix2fvwith transpose = false
    9 PASS uniformMatrix2fv should return INVALID_VALUE with transpose = true
    10 PASS should fail with insufficient array size for uniformMatrix3fv
    11 PASS can call uniformMatrix3fvwith transpose = false
    12 PASS uniformMatrix3fv should return INVALID_VALUE with transpose = true
    13 PASS should fail with insufficient array size for uniformMatrix4fv
    14 PASS can call uniformMatrix4fvwith transpose = false
    15 PASS uniformMatrix4fv should return INVALID_VALUE with transpose = true
     7PASS getError was expected value: INVALID_VALUE : should fail with insufficient array size for uniformMatrix2fv
     8PASS getError was expected value: NO_ERROR : should succeed with correct array size for uniformMatrix2fv
     9PASS getError was expected value: INVALID_VALUE : should fail with more than 1 array size for uniformMatrix2fv
     10PASS getError was expected value: NO_ERROR : can call uniformMatrix2fvwith transpose = false
     11PASS getError was expected value: INVALID_VALUE : uniformMatrix2fv should return INVALID_VALUE with transpose = true
     12PASS getError was expected value: INVALID_VALUE : should fail with insufficient array size for uniformMatrix3fv
     13PASS getError was expected value: NO_ERROR : should succeed with correct array size for uniformMatrix3fv
     14PASS getError was expected value: INVALID_VALUE : should fail with more than 1 array size for uniformMatrix3fv
     15PASS getError was expected value: NO_ERROR : can call uniformMatrix3fvwith transpose = false
     16PASS getError was expected value: INVALID_VALUE : uniformMatrix3fv should return INVALID_VALUE with transpose = true
     17PASS getError was expected value: INVALID_VALUE : should fail with insufficient array size for uniformMatrix4fv
     18PASS getError was expected value: NO_ERROR : should succeed with correct array size for uniformMatrix4fv
     19PASS getError was expected value: INVALID_VALUE : should fail with more than 1 array size for uniformMatrix4fv
     20PASS getError was expected value: NO_ERROR : can call uniformMatrix4fvwith transpose = false
     21PASS getError was expected value: INVALID_VALUE : uniformMatrix4fv should return INVALID_VALUE with transpose = true
    1622
    1723PASS successfullyParsed is true
  • trunk/LayoutTests/fast/canvas/webgl/gl-uniformmatrix4fv.html

    r63444 r76988  
    4141for (var ii = 2; ii <= 4; ++ii) {
    4242  var loc = gl.getUniformLocation(gl.program, "world" + ii);
    43   var mat = [];
     43  var matLess = [];
    4444  for (var jj = 0; jj < ii; ++jj) {
    4545    for (var ll = 0; ll < ii; ++ll) {
    4646      if (jj == ii - 1 && ll == ii - 1)
    4747        continue;
    48       mat[jj * ii + ll] = (jj == ll) ? 1 : 0;
     48      matLess[jj * ii + ll] = (jj == ll) ? 1 : 0;
    4949    }
    5050  }
     51  var mat = matLess.concat([1]);
     52  var matMore = mat.concat([1]);
    5153  name = "uniformMatrix" + ii + "fv";
     54  gl[name](loc, false, matLess);
     55  glErrorShouldBe(gl, gl.INVALID_VALUE, "should fail with insufficient array size for " + name);
    5256  gl[name](loc, false, mat);
    53   assertMsg(gl.getError() == gl.INVALID_VALUE, "should fail with insufficient array size for " + name);
     57  glErrorShouldBe(gl, gl.NO_ERROR, "should succeed with correct array size for " + name);
     58  gl[name](loc, false, matMore);
     59  glErrorShouldBe(gl, gl.INVALID_VALUE, "should fail with more than 1 array size for " + name);
     60
    5461  mat[ii * ii - 1] = 1;
    5562  gl[name](loc, false, mat);
    56   assertMsg(gl.getError() == gl.NO_ERROR, "can call " + name + "with transpose = false");
     63  glErrorShouldBe(gl, gl.NO_ERROR, "can call " + name + "with transpose = false");
    5764  gl[name](loc, true, mat);
    58   assertMsg(gl.getError() == gl.INVALID_VALUE, name + " should return INVALID_VALUE with transpose = true");
     65  glErrorShouldBe(gl, gl.INVALID_VALUE, name + " should return INVALID_VALUE with transpose = true");
    5966}
    6067
  • trunk/Source/WebCore/ChangeLog

    r76987 r76988  
     12011-01-28  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        uniformN*v should generate INVALID_VALUE of the array size is not a multiple of N
     6        https://bugs.webkit.org/show_bug.cgi?id=53306
     7
     8        * html/canvas/WebGLRenderingContext.cpp:
     9        (WebCore::WebGLRenderingContext::validateUniformMatrixParameters):
     10
    1112011-01-28  Tom Sepez  <tsepez@chromium.org>
    212
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r76944 r76988  
    43914391        return false;
    43924392    }
    4393     if (size < requiredMinSize) {
     4393    if (size < requiredMinSize || (size % requiredMinSize)) {
    43944394        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    43954395        return false;
Note: See TracChangeset for help on using the changeset viewer.