Commit c4e93668 by Geoff Lang Committed by Commit Bot

Update end2end tests to function without EXT_texture_storage.

This also exposed an issue in our glTexSubImage2D validation where the sized format would be used for the texture support check when the unsized format was provided. The GL_ALPHA32F format is not valid unless EXT_texture_storage is present but using GL_ALPHA + GL_FLOAT is valid. BUG=angleproject:1958 Change-Id: Ice0b7549c39559990942176481c5175df17aaf92 Reviewed-on: https://chromium-review.googlesource.com/491246 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent f231232b
...@@ -199,15 +199,16 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -199,15 +199,16 @@ bool ValidateES3TexImageParametersBase(Context *context,
// Validate texture formats // Validate texture formats
GLenum actualInternalFormat = GLenum actualInternalFormat =
isSubImage ? texture->getFormat(target, level).info->sizedInternalFormat : internalformat; isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat;
if (isSubImage && actualInternalFormat == GL_NONE) if (isSubImage && actualInternalFormat == GL_NONE)
{ {
context->handleError(Error(GL_INVALID_OPERATION, "Texture level does not exist.")); context->handleError(Error(GL_INVALID_OPERATION, "Texture level does not exist."));
return false; return false;
} }
const gl::InternalFormat &actualFormatInfo = const gl::InternalFormat &actualFormatInfo = isSubImage
gl::GetSizedInternalFormatInfo(actualInternalFormat); ? *texture->getFormat(target, level).info
: GetInternalFormatInfo(internalformat, type);
if (isCompressed) if (isCompressed)
{ {
if (!actualFormatInfo.compressed) if (!actualFormatInfo.compressed)
......
...@@ -119,15 +119,16 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -119,15 +119,16 @@ class BlitFramebufferANGLETest : public ANGLETest
mOriginalFBO = (GLuint)originalFBO; mOriginalFBO = (GLuint)originalFBO;
} }
GLenum format = GL_BGRA8_EXT; GLenum format = GL_BGRA_EXT;
glGenFramebuffers(1, &mUserFBO); glGenFramebuffers(1, &mUserFBO);
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO); glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
glGenTextures(1, &mUserColorBuffer); glGenTextures(1, &mUserColorBuffer);
glGenRenderbuffers(1, &mUserDepthStencilBuffer); glGenRenderbuffers(1, &mUserDepthStencilBuffer);
glBindTexture(GL_TEXTURE_2D, mUserColorBuffer); glBindTexture(GL_TEXTURE_2D, mUserColorBuffer);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, getWindowWidth(), getWindowHeight());
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mUserColorBuffer, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mUserColorBuffer, 0);
glTexImage2D(GL_TEXTURE_2D, 0, format, getWindowWidth(), getWindowHeight(), 0, format,
GL_UNSIGNED_BYTE, nullptr);
glBindRenderbuffer(GL_RENDERBUFFER, mUserDepthStencilBuffer); glBindRenderbuffer(GL_RENDERBUFFER, mUserDepthStencilBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, getWindowWidth(), getWindowHeight()); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, getWindowWidth(), getWindowHeight());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mUserDepthStencilBuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mUserDepthStencilBuffer);
...@@ -141,7 +142,8 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -141,7 +142,8 @@ class BlitFramebufferANGLETest : public ANGLETest
glGenTextures(1, &mSmallColorBuffer); glGenTextures(1, &mSmallColorBuffer);
glGenRenderbuffers(1, &mSmallDepthStencilBuffer); glGenRenderbuffers(1, &mSmallDepthStencilBuffer);
glBindTexture(GL_TEXTURE_2D, mSmallColorBuffer); glBindTexture(GL_TEXTURE_2D, mSmallColorBuffer);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, getWindowWidth() / 2, getWindowHeight() / 2); glTexImage2D(GL_TEXTURE_2D, 0, format, getWindowWidth() / 2, getWindowHeight() / 2, 0,
format, GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mSmallColorBuffer, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mSmallColorBuffer, 0);
glBindRenderbuffer(GL_RENDERBUFFER, mSmallDepthStencilBuffer); glBindRenderbuffer(GL_RENDERBUFFER, mSmallDepthStencilBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, getWindowWidth() / 2, getWindowHeight() / 2); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, getWindowWidth() / 2, getWindowHeight() / 2);
...@@ -155,7 +157,8 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -155,7 +157,8 @@ class BlitFramebufferANGLETest : public ANGLETest
glBindFramebuffer(GL_FRAMEBUFFER, mColorOnlyFBO); glBindFramebuffer(GL_FRAMEBUFFER, mColorOnlyFBO);
glGenTextures(1, &mColorOnlyColorBuffer); glGenTextures(1, &mColorOnlyColorBuffer);
glBindTexture(GL_TEXTURE_2D, mColorOnlyColorBuffer); glBindTexture(GL_TEXTURE_2D, mColorOnlyColorBuffer);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, getWindowWidth(), getWindowHeight()); glTexImage2D(GL_TEXTURE_2D, 0, format, getWindowWidth(), getWindowHeight(), 0, format,
GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mColorOnlyColorBuffer, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mColorOnlyColorBuffer, 0);
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
...@@ -165,7 +168,8 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -165,7 +168,8 @@ class BlitFramebufferANGLETest : public ANGLETest
glBindFramebuffer(GL_FRAMEBUFFER, mDiffFormatFBO); glBindFramebuffer(GL_FRAMEBUFFER, mDiffFormatFBO);
glGenTextures(1, &mDiffFormatColorBuffer); glGenTextures(1, &mDiffFormatColorBuffer);
glBindTexture(GL_TEXTURE_2D, mDiffFormatColorBuffer); glBindTexture(GL_TEXTURE_2D, mDiffFormatColorBuffer);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGB565, getWindowWidth(), getWindowHeight()); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, getWindowWidth(), getWindowHeight(), 0, GL_RGB,
GL_UNSIGNED_SHORT_5_6_5, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mDiffFormatColorBuffer, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mDiffFormatColorBuffer, 0);
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
...@@ -175,7 +179,8 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -175,7 +179,8 @@ class BlitFramebufferANGLETest : public ANGLETest
glBindFramebuffer(GL_FRAMEBUFFER, mDiffSizeFBO); glBindFramebuffer(GL_FRAMEBUFFER, mDiffSizeFBO);
glGenTextures(1, &mDiffSizeColorBuffer); glGenTextures(1, &mDiffSizeColorBuffer);
glBindTexture(GL_TEXTURE_2D, mDiffSizeColorBuffer); glBindTexture(GL_TEXTURE_2D, mDiffSizeColorBuffer);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, getWindowWidth()*2, getWindowHeight()*2); glTexImage2D(GL_TEXTURE_2D, 0, format, getWindowWidth() * 2, getWindowHeight() * 2, 0,
format, GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mDiffSizeColorBuffer, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mDiffSizeColorBuffer, 0);
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
...@@ -188,10 +193,12 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -188,10 +193,12 @@ class BlitFramebufferANGLETest : public ANGLETest
glGenTextures(1, &mMRTColorBuffer0); glGenTextures(1, &mMRTColorBuffer0);
glGenTextures(1, &mMRTColorBuffer1); glGenTextures(1, &mMRTColorBuffer1);
glBindTexture(GL_TEXTURE_2D, mMRTColorBuffer0); glBindTexture(GL_TEXTURE_2D, mMRTColorBuffer0);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, getWindowWidth(), getWindowHeight()); glTexImage2D(GL_TEXTURE_2D, 0, format, getWindowWidth(), getWindowHeight(), 0, format,
GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, mMRTColorBuffer0, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, mMRTColorBuffer0, 0);
glBindTexture(GL_TEXTURE_2D, mMRTColorBuffer1); glBindTexture(GL_TEXTURE_2D, mMRTColorBuffer1);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, format, getWindowWidth(), getWindowHeight()); glTexImage2D(GL_TEXTURE_2D, 0, format, getWindowWidth(), getWindowHeight(), 0, format,
GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, mMRTColorBuffer1, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, mMRTColorBuffer1, 0);
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
...@@ -203,7 +210,8 @@ class BlitFramebufferANGLETest : public ANGLETest ...@@ -203,7 +210,8 @@ class BlitFramebufferANGLETest : public ANGLETest
// Test blit between RGBA and multisampled BGRA // Test blit between RGBA and multisampled BGRA
glGenTextures(1, &mRGBAColorbuffer); glGenTextures(1, &mRGBAColorbuffer);
glBindTexture(GL_TEXTURE_2D, mRGBAColorbuffer); glBindTexture(GL_TEXTURE_2D, mRGBAColorbuffer);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, getWindowWidth(), getWindowHeight()); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr);
glGenFramebuffers(1, &mRGBAFBO); glGenFramebuffers(1, &mRGBAFBO);
glBindFramebuffer(GL_FRAMEBUFFER, mRGBAFBO); glBindFramebuffer(GL_FRAMEBUFFER, mRGBAFBO);
......
...@@ -90,7 +90,11 @@ TEST_P(CubeMapTextureTest, RenderToFacesConsecutively) ...@@ -90,7 +90,11 @@ TEST_P(CubeMapTextureTest, RenderToFacesConsecutively)
GLuint tex = 0; GLuint tex = 0;
glGenTextures(1, &tex); glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_CUBE_MAP, tex); glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
glTexStorage2DEXT(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8_OES, 1, 1); for (GLenum face = 0; face < 6; face++)
{
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr);
}
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
GLuint fbo = 0; GLuint fbo = 0;
......
...@@ -66,7 +66,15 @@ class FramebufferFormatsTest : public ANGLETest ...@@ -66,7 +66,15 @@ class FramebufferFormatsTest : public ANGLETest
{ {
glGenTextures(1, &mTexture); glGenTextures(1, &mTexture);
glBindTexture(GL_TEXTURE_2D, mTexture); glBindTexture(GL_TEXTURE_2D, mTexture);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
if (getClientMajorVersion() >= 3)
{
glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
}
else
{
glTexStorage2DEXT(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
}
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0);
...@@ -180,19 +188,34 @@ class FramebufferFormatsTest : public ANGLETest ...@@ -180,19 +188,34 @@ class FramebufferFormatsTest : public ANGLETest
TEST_P(FramebufferFormatsTest, RGBA4) TEST_P(FramebufferFormatsTest, RGBA4)
{ {
if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"))
{
std::cout << "Test skipped due to missing ES3 or GL_EXT_texture_storage." << std::endl;
return;
}
testTextureFormat(GL_RGBA4, 4, 4, 4, 4); testTextureFormat(GL_RGBA4, 4, 4, 4, 4);
} }
TEST_P(FramebufferFormatsTest, RGB565) TEST_P(FramebufferFormatsTest, RGB565)
{ {
if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"))
{
std::cout << "Test skipped due to missing ES3 or GL_EXT_texture_storage." << std::endl;
return;
}
testTextureFormat(GL_RGB565, 5, 6, 5, 0); testTextureFormat(GL_RGB565, 5, 6, 5, 0);
} }
TEST_P(FramebufferFormatsTest, RGB8) TEST_P(FramebufferFormatsTest, RGB8)
{ {
if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_rgb8_rgba8")) if (getClientMajorVersion() < 3 &&
(!extensionEnabled("GL_OES_rgb8_rgba8") || !extensionEnabled("GL_EXT_texture_storage")))
{ {
std::cout << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8." << std::endl; std::cout
<< "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8 and GL_EXT_texture_storage."
<< std::endl;
return; return;
} }
...@@ -201,9 +224,12 @@ TEST_P(FramebufferFormatsTest, RGB8) ...@@ -201,9 +224,12 @@ TEST_P(FramebufferFormatsTest, RGB8)
TEST_P(FramebufferFormatsTest, BGRA8) TEST_P(FramebufferFormatsTest, BGRA8)
{ {
if (!extensionEnabled("GL_EXT_texture_format_BGRA8888")) if (!extensionEnabled("GL_EXT_texture_format_BGRA8888") ||
(getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage")))
{ {
std::cout << "Test skipped due to missing GL_EXT_texture_format_BGRA8888." << std::endl; std::cout << "Test skipped due to missing GL_EXT_texture_format_BGRA8888 or "
"GL_EXT_texture_storage."
<< std::endl;
return; return;
} }
...@@ -212,9 +238,12 @@ TEST_P(FramebufferFormatsTest, BGRA8) ...@@ -212,9 +238,12 @@ TEST_P(FramebufferFormatsTest, BGRA8)
TEST_P(FramebufferFormatsTest, RGBA8) TEST_P(FramebufferFormatsTest, RGBA8)
{ {
if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_rgb8_rgba8")) if (getClientMajorVersion() < 3 &&
(!extensionEnabled("GL_OES_rgb8_rgba8") || !extensionEnabled("GL_EXT_texture_storage")))
{ {
std::cout << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8." << std::endl; std::cout
<< "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8 and GL_EXT_texture_storage."
<< std::endl;
return; return;
} }
......
...@@ -167,6 +167,7 @@ TEST_P(StateChangeTest, FramebufferIncompleteWithTexStorage) ...@@ -167,6 +167,7 @@ TEST_P(StateChangeTest, FramebufferIncompleteWithTexStorage)
if (!extensionEnabled("GL_EXT_texture_storage")) if (!extensionEnabled("GL_EXT_texture_storage"))
{ {
std::cout << "Test skipped because TexStorage2DEXT not available." << std::endl; std::cout << "Test skipped because TexStorage2DEXT not available." << std::endl;
return;
} }
glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
......
...@@ -191,6 +191,12 @@ class Texture2DTest : public TexCoordDrawTest ...@@ -191,6 +191,12 @@ class Texture2DTest : public TexCoordDrawTest
if (getClientMajorVersion() < 3) if (getClientMajorVersion() < 3)
{ {
if (!extensionEnabled("GL_EXT_texture_storage"))
{
std::cout << "Test skipped due to missing GL_EXT_texture_storage." << std::endl;
return;
}
if (!extensionEnabled("GL_OES_texture_float")) if (!extensionEnabled("GL_OES_texture_float"))
{ {
std::cout << "Test skipped due to missing GL_OES_texture_float." << std::endl; std::cout << "Test skipped due to missing GL_OES_texture_float." << std::endl;
...@@ -258,7 +264,14 @@ class Texture2DTest : public TexCoordDrawTest ...@@ -258,7 +264,14 @@ class Texture2DTest : public TexCoordDrawTest
GLenum destImageFormat = imageFormats[destImageChannels - 1]; GLenum destImageFormat = imageFormats[destImageChannels - 1];
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, sourceImageFormat, 2, 2); if (getClientMajorVersion() >= 3)
{
glTexStorage2D(GL_TEXTURE_2D, 1, sourceImageFormat, 2, 2);
}
else
{
glTexStorage2DEXT(GL_TEXTURE_2D, 1, sourceImageFormat, 2, 2);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 2, 2, sourceUnsizedFormat, GL_FLOAT, imageData); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 2, 2, sourceUnsizedFormat, GL_FLOAT, imageData);
...@@ -279,7 +292,14 @@ class Texture2DTest : public TexCoordDrawTest ...@@ -279,7 +292,14 @@ class Texture2DTest : public TexCoordDrawTest
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[0], 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[0], 0);
glBindTexture(GL_TEXTURE_2D, textures[1]); glBindTexture(GL_TEXTURE_2D, textures[1]);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, destImageFormat, 2, 2); if (getClientMajorVersion() >= 3)
{
glTexStorage2D(GL_TEXTURE_2D, 1, destImageFormat, 2, 2);
}
else
{
glTexStorage2DEXT(GL_TEXTURE_2D, 1, destImageFormat, 2, 2);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
...@@ -544,7 +564,11 @@ class TextureCubeTest : public TexCoordDrawTest ...@@ -544,7 +564,11 @@ class TextureCubeTest : public TexCoordDrawTest
glGenTextures(1, &mTextureCube); glGenTextures(1, &mTextureCube);
glBindTexture(GL_TEXTURE_CUBE_MAP, mTextureCube); glBindTexture(GL_TEXTURE_CUBE_MAP, mTextureCube);
glTexStorage2DEXT(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 1, 1); for (GLenum face = 0; face < 6; face++)
{
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr);
}
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
mTexture2D = create2DTexture(); mTexture2D = create2DTexture();
...@@ -1395,6 +1419,13 @@ TEST_P(TextureCubeTest, CubeMapFBO) ...@@ -1395,6 +1419,13 @@ TEST_P(TextureCubeTest, CubeMapFBO)
// Test that glTexSubImage2D works properly when glTexStorage2DEXT has initialized the image with a default color. // Test that glTexSubImage2D works properly when glTexStorage2DEXT has initialized the image with a default color.
TEST_P(Texture2DTest, TexStorage) TEST_P(Texture2DTest, TexStorage)
{ {
if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"))
{
std::cout << "Test skipped because ES3 or GL_EXT_texture_storage not available."
<< std::endl;
return;
}
int width = getWindowWidth(); int width = getWindowWidth();
int height = getWindowHeight(); int height = getWindowHeight();
...@@ -1415,7 +1446,14 @@ TEST_P(Texture2DTest, TexStorage) ...@@ -1415,7 +1446,14 @@ TEST_P(Texture2DTest, TexStorage)
// ANGLE internally uses RGBA as the DirectX format for RGB images // ANGLE internally uses RGBA as the DirectX format for RGB images
// therefore glTexStorage2DEXT initializes the image to a default color to get a consistent alpha color. // therefore glTexStorage2DEXT initializes the image to a default color to get a consistent alpha color.
// The data is kept in a CPU-side image and the image is marked as dirty. // The data is kept in a CPU-side image and the image is marked as dirty.
glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16); if (getClientMajorVersion() >= 3)
{
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16);
}
else
{
glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16);
}
// Initializes the color of the upper-left 8x8 pixels, leaves the other pixels untouched. // Initializes the color of the upper-left 8x8 pixels, leaves the other pixels untouched.
// glTexSubImage2D should take into account that the image is dirty. // glTexSubImage2D should take into account that the image is dirty.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment