Commit c6458072 by Ian Elliott Committed by Commit Bot

Fix multisample renderbuffer compliance (e.g. 3->4 samples)

This change ensures that the following spec language is correctly implemented: the resulting value for RENDERBUFFER_SAMPLES is guaranteed to be greater than or equal to samples and no more than the next larger sample count supported by the implementation. For example, if 2, 4, and 8 samples are supported, and if 5 samples are requested, ANGLE should use 8 samples, and return 8 when GL_RENDERBUFFER_SAMPLES is queried. Note: There is a known problem with NVIDIA OpenGL driver that causes another test to be expected to fail. Bug: angleproject:2222 Bug: angleproject:4196 Change-Id: I28921badf9568427799b0af347198b5df06c2aaa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1954444Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 63c15519
......@@ -114,14 +114,11 @@ angle::Result Renderbuffer::setStorageMultisample(const Context *context,
size_t height)
{
ANGLE_TRY(orphanImages(context));
// TODO (ianelliott): Ensure that the following spec language is correctly implemented:
//
// the resulting value for RENDERBUFFER_SAMPLES is guaranteed to be greater than or equal to
// samples and no more than the next larger sample count supported by the implementation.
//
// For example, if 2, 4, and 8 samples are supported, and if 5 samples are requested, ANGLE
// should use 8 samples, and return 8 when GL_RENDERBUFFER_SAMPLES is queried.
// http://anglebug.com/4196
// Potentially adjust "samples" to a supported value
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
samples = formatCaps.getNearestSamples(static_cast<GLuint>(samples));
ANGLE_TRY(
mImplementation->setStorageMultisample(context, samples, internalformat, width, height));
......
......@@ -803,6 +803,7 @@ void OverrideFeaturesWithDisplayState(angle::FeatureSetBase *features,
void GetSamplePosition(GLsizei sampleCount, size_t index, GLfloat *xy)
{
ASSERT(gl::isPow2(sampleCount));
if (sampleCount > 16)
{
// Vulkan (and D3D11) doesn't have standard sample positions for 32 and 64 samples (and no
......
......@@ -101,36 +101,6 @@ angle::Result RenderbufferVk::setStorageMultisample(const gl::Context *context,
size_t width,
size_t height)
{
// If the specific number of samples requested is not supported, the smallest number that's at
// least that many needs to be selected.
const RendererVk *renderer = vk::GetImpl(context)->getRenderer();
const angle::Format &format = renderer->getFormat(internalformat).actualImageFormat();
const VkPhysicalDeviceLimits &limits = renderer->getPhysicalDeviceProperties().limits;
const uint32_t colorSampleCounts = limits.framebufferColorSampleCounts;
const uint32_t depthSampleCounts = limits.framebufferDepthSampleCounts;
const uint32_t stencilSampleCounts = limits.framebufferStencilSampleCounts;
const uint32_t depthStencilSampleCounts = depthSampleCounts & stencilSampleCounts;
uint32_t formatSampleCounts = colorSampleCounts;
if (format.depthBits > 0)
{
if (format.stencilBits > 0)
{
formatSampleCounts = depthStencilSampleCounts;
}
else
{
formatSampleCounts = depthSampleCounts;
}
}
else if (format.stencilBits > 0)
{
formatSampleCounts = stencilSampleCounts;
}
samples = vk_gl::GetSampleCount(formatSampleCounts, static_cast<uint32_t>(samples));
return setStorageImpl(context, samples, internalformat, width, height);
}
......
......@@ -527,6 +527,7 @@
// Fails on Windows + Linux.
2222 OPENGL NVIDIA : dEQP-GLES3.functional.fbo.completeness.samples.rbo2_rbo2_rbo0 = FAIL
2222 OPENGL NVIDIA : dEQP-GLES3.functional.fbo.completeness.samples.rbo1_rbo2_rbo0 = FAIL
// General Vulkan failures
......
......@@ -114,9 +114,7 @@ TEST_P(RenderbufferMultisampleTest, OddSampleCount)
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES,
&renderbufferSamples);
ASSERT_GL_NO_ERROR();
// TODO (ianelliott): Uncomment the following line once the implementation is fixed.
// http://anglebug.com/4196
// EXPECT_EQ(renderbufferSamples, sampleCounts[i-1]);
EXPECT_EQ(renderbufferSamples, sampleCounts[i - 1]);
break;
}
}
......
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