Bug 1228711 - Cubemap images must be square. - r=benwa

This commit is contained in:
Jeff Gilbert 2015-12-03 15:38:06 -08:00
parent eeb9653e5f
commit 3621b07f35
3 changed files with 43 additions and 0 deletions

View File

@ -365,6 +365,13 @@ WebGLTexture::ValidateTexImageSpecification(const char* funcName, TexImageTarget
return false;
}
if (mTarget == LOCAL_GL_TEXTURE_CUBE_MAP &&
width != height)
{
mContext->ErrorInvalidValue("%s: Cube map images must be square.", funcName);
return false;
}
/* GLES 3.0.4, p133-134:
* GL_MAX_TEXTURE_SIZE is *not* the max allowed texture size. Rather, it is the
* max (width/height) size guaranteed not to generate an INVALID_VALUE for too-large

View File

@ -11,6 +11,7 @@ fail-if = (os == 'b2g')
[webgl-mochitest/test_depth_readpixels.html]
[webgl-mochitest/test_capture.html]
support-files = captureStream_common.js
[webgl-mochitest/test_cubemap_must_be_square.html]
[webgl-mochitest/test_draw.html]
[webgl-mochitest/test_fb_param.html]
[webgl-mochitest/test_fb_param_crash.html]

View File

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=utf-8'/>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
<script src='webgl-util.js'></script>
</head>
<body>
<script>
'use strict';
(function() {
var c = document.createElement('canvas');
var gl = c.getContext('webgl');
ok(!gl.getError(), 'No error before.');
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, 4, 3, 0, gl.RGBA,
gl.UNSIGNED_BYTE, null);
var err = gl.getError();
ok(err == gl.INVALID_VALUE,
'Should be INVALID_VALUE (0x501) after, was 0x' + err.toString(16) + '.');
})();
ok(true, 'Test complete.');
</script>
</body>
</html>