mirror of
https://github.com/utmapp/angle.git
synced 2026-12-01 14:00:09 -10:00
We weren't properly checking the x and y offsets against the texture boundary, and were in some cases producing D3D errors with out-of-bounds writes. This was popping up in IncompleteTextureTest. The test itself was also bugged. BUG=angle:610 Change-Id: Id58cac088fed03cae2aabbf00bce234f17208753 Reviewed-on: https://chromium-review.googlesource.com/195410 Reviewed-by: Geoff Lang <[email protected]> Tested-by: Jamie Madill <[email protected]>
47 lines
1017 B
C++
47 lines
1017 B
C++
#include "ANGLETest.h"
|
|
|
|
class TextureTest : public ANGLETest
|
|
{
|
|
protected:
|
|
TextureTest()
|
|
{
|
|
setWindowWidth(128);
|
|
setWindowHeight(128);
|
|
setConfigRedBits(8);
|
|
setConfigGreenBits(8);
|
|
setConfigBlueBits(8);
|
|
setConfigAlphaBits(8);
|
|
}
|
|
|
|
virtual void SetUp()
|
|
{
|
|
ANGLETest::SetUp();
|
|
glGenTextures(1, &mTexture);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, mTexture);
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
|
EXPECT_GL_NO_ERROR();
|
|
|
|
ASSERT_GL_NO_ERROR();
|
|
}
|
|
|
|
virtual void TearDown()
|
|
{
|
|
glDeleteTextures(1, &mTexture);
|
|
|
|
ANGLETest::TearDown();
|
|
}
|
|
|
|
GLuint mTexture;
|
|
};
|
|
|
|
TEST_F(TextureTest, negative_api_subimage)
|
|
{
|
|
glBindTexture(GL_TEXTURE_2D, mTexture);
|
|
EXPECT_GL_ERROR(GL_NO_ERROR);
|
|
|
|
const GLubyte *pixels[20] = { 0 };
|
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
|
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
|
}
|