Commit 0c5a9e22 by Olli Etuaho Committed by Commit Bot

Implement TexStorage3DMultisample on the GL backend

BUG=angleproject:2775 TEST=angle_end2end_tests Change-Id: Ic980d86cd787bcf29f622e68b0c38b0eb6ca5688 Reviewed-on: https://chromium-review.googlesource.com/1190182Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 80aa5592
......@@ -5010,7 +5010,10 @@ void Context::texStorage3DMultisample(TextureType target,
GLsizei depth,
GLboolean fixedsamplelocations)
{
UNIMPLEMENTED();
Extents size(width, height, depth);
Texture *texture = getTargetTexture(target);
handleError(texture->setStorageMultisample(this, target, samples, internalformat, size,
ConvertToBool(fixedsamplelocations)));
}
void Context::getMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
......
......@@ -561,9 +561,9 @@ void TextureState::setImageDescChainMultisample(Extents baseSize,
bool fixedSampleLocations,
InitState initState)
{
ASSERT(mType == TextureType::_2DMultisample);
ASSERT(mType == TextureType::_2DMultisample || mType == TextureType::_2DMultisampleArray);
ImageDesc levelInfo(baseSize, format, samples, fixedSampleLocations, initState);
setImageDesc(TextureTarget::_2DMultisample, 0, levelInfo);
setImageDesc(NonCubeTextureTypeToTarget(mType), 0, levelInfo);
}
void TextureState::clearImageDesc(TextureTarget target, size_t level)
......
......@@ -1031,11 +1031,23 @@ gl::Error TextureGL::setStorageMultisample(const gl::Context *context,
stateManager->bindTexture(getType(), mTextureID);
ASSERT(size.depth == 1);
functions->texStorage2DMultisample(ToGLenum(type), samples, texStorageFormat.internalFormat,
size.width, size.height,
gl::ConvertToGLBoolean(fixedSampleLocations));
if (nativegl::UseTexImage2D(getType()))
{
ASSERT(size.depth == 1);
functions->texStorage2DMultisample(ToGLenum(type), samples, texStorageFormat.internalFormat,
size.width, size.height,
gl::ConvertToGLBoolean(fixedSampleLocations));
}
else if (nativegl::UseTexImage3D(getType()))
{
functions->texStorage3DMultisample(ToGLenum(type), samples, texStorageFormat.internalFormat,
size.width, size.height, size.depth,
gl::ConvertToGLBoolean(fixedSampleLocations));
}
else
{
UNREACHABLE();
}
setLevelInfo(type, 0, 1, GetLevelInfo(internalFormat, texStorageFormat.internalFormat));
......
......@@ -1269,12 +1269,14 @@ bool SupportsNativeRendering(const FunctionsGL *functions,
bool UseTexImage2D(gl::TextureType textureType)
{
return textureType == gl::TextureType::_2D || textureType == gl::TextureType::CubeMap ||
textureType == gl::TextureType::Rectangle;
textureType == gl::TextureType::Rectangle ||
textureType == gl::TextureType::_2DMultisample;
}
bool UseTexImage3D(gl::TextureType textureType)
{
return textureType == gl::TextureType::_2DArray || textureType == gl::TextureType::_3D;
return textureType == gl::TextureType::_2DArray || textureType == gl::TextureType::_3D ||
textureType == gl::TextureType::_2DMultisampleArray;
}
}
......
......@@ -380,6 +380,37 @@ TEST_P(TextureMultisampleArrayWebGLTest, InvalidTexParameteri)
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
// Test a valid TexStorage3DMultisample call and check that the queried texture level parameters
// match. Does not do any drawing.
TEST_P(TextureMultisampleArrayWebGLTest, TexStorage3DMultisample)
{
ANGLE_SKIP_TEST_IF(!requestArrayExtension());
GLint maxSamplesRGBA8 = 0;
glGetInternalformativ(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, GL_RGBA8, GL_SAMPLES, 1,
&maxSamplesRGBA8);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, mTexture);
ASSERT_GL_NO_ERROR();
glTexStorage3DMultisampleANGLE(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, maxSamplesRGBA8, GL_RGBA8,
8, 4, 2, GL_TRUE);
ASSERT_GL_NO_ERROR();
GLint width = 0, height = 0, depth = 0, samples = 0;
glGetTexLevelParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, 0, GL_TEXTURE_WIDTH, &width);
glGetTexLevelParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, 0, GL_TEXTURE_HEIGHT, &height);
glGetTexLevelParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, 0, GL_TEXTURE_DEPTH, &depth);
glGetTexLevelParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_ANGLE, 0, GL_TEXTURE_SAMPLES,
&samples);
ASSERT_GL_NO_ERROR();
EXPECT_EQ(8, width);
EXPECT_EQ(4, height);
EXPECT_EQ(2, depth);
EXPECT_EQ(maxSamplesRGBA8, samples);
}
ANGLE_INSTANTIATE_TEST(TextureMultisampleTest,
ES31_D3D11(),
ES3_OPENGL(),
......
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