Commit 5116d687 by Shao Committed by Commit Bot

ES31: Add missing initialization of MAX_*_SAMPLES on D3D

This patch intends to add missing initialization of MAX_INTEGER_SAMPLES, MAX_DEPTH_TEXTURE_SAMPLES and MAX_COLOR_TEXTURE_SAMPLES required for multisampled textures on D3D backends. Since MAX_*_SAMPLES cannot be queried directly from D3D APIs, these values are initially assigned a large value in renderer11.cpp and re-calculated in context::updateCaps(). This patch also adds tests to ensure these values are greater than 1 as required in OpenGL ES3.1 spec. BUG=angleproject:1592 TEST=angle_end2end_tests Change-Id: Iba586e311d40d2da4569816902f96e40bbd6935b Reviewed-on: https://chromium-review.googlesource.com/597411 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 936ea325
...@@ -1171,7 +1171,6 @@ bool IsMultiviewSupported(D3D_FEATURE_LEVEL featureLevel) ...@@ -1171,7 +1171,6 @@ bool IsMultiviewSupported(D3D_FEATURE_LEVEL featureLevel)
void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const Renderer11DeviceCaps &renderer11DeviceCaps, gl::Caps *caps, void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const Renderer11DeviceCaps &renderer11DeviceCaps, gl::Caps *caps,
gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, gl::Limitations *limitations) gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, gl::Limitations *limitations)
{ {
GLuint maxSamples = 0;
D3D_FEATURE_LEVEL featureLevel = renderer11DeviceCaps.featureLevel; D3D_FEATURE_LEVEL featureLevel = renderer11DeviceCaps.featureLevel;
const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats(); const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats();
for (GLenum internalFormat : allFormats) for (GLenum internalFormat : allFormats)
...@@ -1180,8 +1179,6 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons ...@@ -1180,8 +1179,6 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons
GetMaximumClientVersion(featureLevel), internalFormat, device, renderer11DeviceCaps); GetMaximumClientVersion(featureLevel), internalFormat, device, renderer11DeviceCaps);
textureCapsMap->insert(internalFormat, textureCaps); textureCapsMap->insert(internalFormat, textureCaps);
maxSamples = std::max(maxSamples, textureCaps.getMaxSamples());
if (gl::GetSizedInternalFormatInfo(internalFormat).compressed) if (gl::GetSizedInternalFormatInfo(internalFormat).compressed)
{ {
caps->compressedTextureFormats.push_back(internalFormat); caps->compressedTextureFormats.push_back(internalFormat);
...@@ -1324,9 +1321,12 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons ...@@ -1324,9 +1321,12 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons
caps->maxTransformFeedbackSeparateComponents = caps->maxTransformFeedbackSeparateComponents =
static_cast<GLuint>(GetMaximumStreamOutputSeparateComponents(featureLevel)); static_cast<GLuint>(GetMaximumStreamOutputSeparateComponents(featureLevel));
// Multisample limits // Defer the computation of multisample limits to Context::updateCaps() where max*Samples values
caps->maxSamples = maxSamples; // are determined according to available sample counts for each individual format.
caps->maxColorTextureSamples = maxSamples; caps->maxSamples = std::numeric_limits<GLint>::max();
caps->maxColorTextureSamples = std::numeric_limits<GLint>::max();
caps->maxDepthTextureSamples = std::numeric_limits<GLint>::max();
caps->maxIntegerSamples = std::numeric_limits<GLint>::max();
// GL extension support // GL extension support
extensions->setTextureExtensionSupport(*textureCapsMap); extensions->setTextureExtensionSupport(*textureCapsMap);
......
...@@ -140,6 +140,36 @@ TEST_P(TextureMultisampleTestES31, ValidateTextureStorageMultisampleParameters) ...@@ -140,6 +140,36 @@ TEST_P(TextureMultisampleTestES31, ValidateTextureStorageMultisampleParameters)
ASSERT_GL_ERROR(GL_INVALID_OPERATION); ASSERT_GL_ERROR(GL_INVALID_OPERATION);
} }
// Tests the value of MAX_INTEGER_SAMPLES is no less than 1.
// [OpenGL ES 3.1 SPEC Table 20.40]
TEST_P(TextureMultisampleTestES31, MaxIntegerSamples)
{
GLint maxIntegerSamples;
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &maxIntegerSamples);
EXPECT_GE(maxIntegerSamples, 1);
EXPECT_NE(std::numeric_limits<GLint>::max(), maxIntegerSamples);
}
// Tests the value of MAX_COLOR_TEXTURE_SAMPLES is no less than 1.
// [OpenGL ES 3.1 SPEC Table 20.40]
TEST_P(TextureMultisampleTestES31, MaxColorTextureSamples)
{
GLint maxColorTextureSamples;
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &maxColorTextureSamples);
EXPECT_GE(maxColorTextureSamples, 1);
EXPECT_NE(std::numeric_limits<GLint>::max(), maxColorTextureSamples);
}
// Tests the value of MAX_DEPTH_TEXTURE_SAMPLES is no less than 1.
// [OpenGL ES 3.1 SPEC Table 20.40]
TEST_P(TextureMultisampleTestES31, MaxDepthTextureSamples)
{
GLint maxDepthTextureSamples;
glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &maxDepthTextureSamples);
EXPECT_GE(maxDepthTextureSamples, 1);
EXPECT_NE(std::numeric_limits<GLint>::max(), maxDepthTextureSamples);
}
ANGLE_INSTANTIATE_TEST(TextureMultisampleTest, ANGLE_INSTANTIATE_TEST(TextureMultisampleTest,
ES31_D3D11(), ES31_D3D11(),
ES3_OPENGL(), 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