Commit c081020c by Yunchao He Committed by Commit Bot

ES3.1: multisample renderbuffer can support interger format.

BUG=angleproject:2315 Change-Id: I3ef289a6043745c822e1c9b0a1b363ac81292c4c Reviewed-on: https://chromium-review.googlesource.com/878021Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 37968133
......@@ -2619,13 +2619,17 @@ bool ValidateRenderbufferStorageMultisample(ValidationContext *context,
}
// The ES3 spec(section 4.4.2) states that the internal format must be sized and not an integer
// format if samples is greater than zero.
// format if samples is greater than zero. In ES3.1(section 9.2.5), it can support integer
// multisample renderbuffer, but the samples should not be greater than MAX_INTEGER_SAMPLES.
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) &&
samples > 0)
if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT))
{
context->handleError(InvalidOperation());
return false;
if ((samples > 0 && context->getClientVersion() == ES_3_0) ||
static_cast<GLuint>(samples) > context->getCaps().maxIntegerSamples)
{
context->handleError(InvalidOperation());
return false;
}
}
// The behavior is different than the ANGLE version, which would generate a GL_OUT_OF_MEMORY.
......
......@@ -72,6 +72,7 @@
'<(angle_path)/src/tests/gl_tests/ProgramParameterTest.cpp',
'<(angle_path)/src/tests/gl_tests/ProgramPipelineTest.cpp',
'<(angle_path)/src/tests/gl_tests/ReadPixelsTest.cpp',
'<(angle_path)/src/tests/gl_tests/RenderbufferMultisampleTest.cpp',
'<(angle_path)/src/tests/gl_tests/RendererTest.cpp',
'<(angle_path)/src/tests/gl_tests/RobustBufferAccessBehaviorTest.cpp',
'<(angle_path)/src/tests/gl_tests/RobustClientMemoryTest.cpp',
......
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// RenderbufferMultisampleTest: Tests of multisampled renderbuffer
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
using namespace angle;
namespace
{
class RenderbufferMultisampleTest : public ANGLETest
{
protected:
RenderbufferMultisampleTest()
{
setWindowWidth(64);
setWindowHeight(64);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
void SetUp() override
{
ANGLETest::SetUp();
glGenRenderbuffers(1, &mRenderbuffer);
ASSERT_GL_NO_ERROR();
}
void TearDown() override
{
glDeleteRenderbuffers(1, &mRenderbuffer);
mRenderbuffer = 0;
ANGLETest::TearDown();
}
GLuint mRenderbuffer = 0;
};
// In GLES 3.0, if internalformat is integer (signed or unsigned), to allocate multisample
// renderbuffer storage for that internalformat is not supported. An INVALID_OPERATION is
// generated. In GLES 3.1, it is OK to allocate multisample renderbuffer storage for interger
// internalformat, but the max samples should be less than MAX_INTEGER_SAMPLES.
// MAX_INTEGER_SAMPLES should be at least 1.
TEST_P(RenderbufferMultisampleTest, IntegerInternalformat)
{
glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, 1, GL_RGBA8I, 64, 64);
if (getClientMajorVersion() < 3 || getClientMinorVersion() < 1)
{
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
}
else
{
ASSERT_GL_NO_ERROR();
GLint maxSamplesRGBA8I = 0;
glGetInternalformativ(GL_RENDERBUFFER, GL_RGBA8I, GL_SAMPLES, 1, &maxSamplesRGBA8I);
GLint maxIntegerSamples = 0;
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &maxIntegerSamples);
ASSERT_GL_NO_ERROR();
EXPECT_GE(maxIntegerSamples, 1);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesRGBA8I + 1, GL_RGBA8I, 64, 64);
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxIntegerSamples + 1, GL_RGBA8I, 64, 64);
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
}
}
ANGLE_INSTANTIATE_TEST(RenderbufferMultisampleTest,
ES3_D3D11(),
ES3_OPENGL(),
ES3_OPENGLES(),
ES31_D3D11(),
ES31_OPENGL(),
ES31_OPENGLES());
}
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