Commit 86904b81 by Shao Committed by Commit Bot

ES31: Add workaround for illegal MAX_VERTEX_ATTRIB_STRIDE on Linux AMD

Query of MAX_VERTEX_ATTRIB_STRIDE on some Linux AMD OpenGL drivers returns 0 even if the context is OpenGL 4.4 and 4.5, which is against SPEC and will block the implementation of ES3.1 feature Vertex Attrib Binding. This patch adds the workaround for this bug by choosing an emulated value (2048) as the value of MAX_VERTEX_ATTRIB_STRIDE on Linux AMD OpenGL drivers. BUG=angleproject:1936 TEST=angle_end2end_tests Change-Id: I831bda6cb94b2489d09735622150d35aa1948274 Reviewed-on: https://chromium-review.googlesource.com/457254 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 16d4e472
...@@ -128,8 +128,8 @@ RendererGL::RendererGL(const FunctionsGL *functions, const egl::AttributeMap &at ...@@ -128,8 +128,8 @@ RendererGL::RendererGL(const FunctionsGL *functions, const egl::AttributeMap &at
mCapsInitialized(false) mCapsInitialized(false)
{ {
ASSERT(mFunctions); ASSERT(mFunctions);
mStateManager = new StateManagerGL(mFunctions, getNativeCaps());
nativegl_gl::GenerateWorkarounds(mFunctions, &mWorkarounds); nativegl_gl::GenerateWorkarounds(mFunctions, &mWorkarounds);
mStateManager = new StateManagerGL(mFunctions, getNativeCaps());
mBlitter = new BlitGL(functions, mWorkarounds, mStateManager); mBlitter = new BlitGL(functions, mWorkarounds, mStateManager);
mHasDebugOutput = mFunctions->isAtLeastGL(gl::Version(4, 3)) || mHasDebugOutput = mFunctions->isAtLeastGL(gl::Version(4, 3)) ||
...@@ -553,7 +553,8 @@ void RendererGL::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureC ...@@ -553,7 +553,8 @@ void RendererGL::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureC
gl::Extensions *outExtensions, gl::Extensions *outExtensions,
gl::Limitations * /* outLimitations */) const gl::Limitations * /* outLimitations */) const
{ {
nativegl_gl::GenerateCaps(mFunctions, outCaps, outTextureCaps, outExtensions, &mMaxSupportedESVersion); nativegl_gl::GenerateCaps(mFunctions, mWorkarounds, outCaps, outTextureCaps, outExtensions,
&mMaxSupportedESVersion);
} }
GLint RendererGL::getGPUDisjoint() GLint RendererGL::getGPUDisjoint()
......
...@@ -118,6 +118,12 @@ struct WorkaroundsGL ...@@ -118,6 +118,12 @@ struct WorkaroundsGL
// This only seems to affect AMD OpenGL drivers, and some Android devices. // This only seems to affect AMD OpenGL drivers, and some Android devices.
// http://anglebug.com/1637 // http://anglebug.com/1637
bool reapplyUBOBindingsAfterLoadingBinaryProgram = false; bool reapplyUBOBindingsAfterLoadingBinaryProgram = false;
// Some OpenGL drivers return 0 when we query MAX_VERTEX_ATTRIB_STRIDE in an OpenGL 4.4 or
// higher context.
// This only seems to affect AMD OpenGL drivers.
// Tracking bug: http://anglebug.com/1936
bool emulateMaxVertexAttribStride = false;
}; };
} // namespace rx } // namespace rx
......
...@@ -183,8 +183,12 @@ static void LimitVersion(gl::Version *curVersion, const gl::Version &maxVersion) ...@@ -183,8 +183,12 @@ static void LimitVersion(gl::Version *curVersion, const gl::Version &maxVersion)
} }
} }
void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, void GenerateCaps(const FunctionsGL *functions,
gl::Extensions *extensions, gl::Version *maxSupportedESVersion) const WorkaroundsGL &workarounds,
gl::Caps *caps,
gl::TextureCapsMap *textureCapsMap,
gl::Extensions *extensions,
gl::Version *maxSupportedESVersion)
{ {
// Texture format support checks // Texture format support checks
const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats(); const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats();
...@@ -634,7 +638,8 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM ...@@ -634,7 +638,8 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM
// OpenGL 4.3 has no limit on maximum value of stride. // OpenGL 4.3 has no limit on maximum value of stride.
// [OpenGL 4.3 (Core Profile) - February 14, 2013] Chapter 10.3.1 Page 298 // [OpenGL 4.3 (Core Profile) - February 14, 2013] Chapter 10.3.1 Page 298
if (functions->standard == STANDARD_GL_DESKTOP && functions->version == gl::Version(4, 3)) if (workarounds.emulateMaxVertexAttribStride ||
(functions->standard == STANDARD_GL_DESKTOP && functions->version == gl::Version(4, 3)))
{ {
caps->maxVertexAttribStride = 2048; caps->maxVertexAttribStride = 2048;
} }
...@@ -944,6 +949,11 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround ...@@ -944,6 +949,11 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround
workarounds->doesSRGBClearsOnLinearFramebufferAttachments = workarounds->doesSRGBClearsOnLinearFramebufferAttachments =
functions->standard == STANDARD_GL_DESKTOP && (IsIntel(vendor) || IsAMD(vendor)); functions->standard == STANDARD_GL_DESKTOP && (IsIntel(vendor) || IsAMD(vendor));
#if defined(ANGLE_PLATFORM_LINUX)
workarounds->emulateMaxVertexAttribStride =
functions->standard == STANDARD_GL_DESKTOP && IsAMD(vendor);
#endif
#if defined(ANGLE_PLATFORM_APPLE) #if defined(ANGLE_PLATFORM_APPLE)
workarounds->doWhileGLSLCausesGPUHang = true; workarounds->doWhileGLSLCausesGPUHang = true;
workarounds->useUnusedBlocksWithStandardOrSharedLayout = true; workarounds->useUnusedBlocksWithStandardOrSharedLayout = true;
......
...@@ -37,8 +37,12 @@ std::string GetDriverVersion(const FunctionsGL *functions); ...@@ -37,8 +37,12 @@ std::string GetDriverVersion(const FunctionsGL *functions);
namespace nativegl_gl namespace nativegl_gl
{ {
void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, void GenerateCaps(const FunctionsGL *functions,
gl::Extensions *extensions, gl::Version *maxSupportedESVersion); const WorkaroundsGL &workarounds,
gl::Caps *caps,
gl::TextureCapsMap *textureCapsMap,
gl::Extensions *extensions,
gl::Version *maxSupportedESVersion);
void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds); void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds);
} }
......
...@@ -677,15 +677,6 @@ class VertexAttributeTestES31 : public VertexAttributeTestES3 ...@@ -677,15 +677,6 @@ class VertexAttributeTestES31 : public VertexAttributeTestES3
// Verify that MAX_VERTEX_ATTRIB_STRIDE is no less than the minimum required value (2048) in ES3.1. // Verify that MAX_VERTEX_ATTRIB_STRIDE is no less than the minimum required value (2048) in ES3.1.
TEST_P(VertexAttributeTestES31, MaxVertexAttribStride) TEST_P(VertexAttributeTestES31, MaxVertexAttribStride)
{ {
// TODO(ynovikov): AMD Linux GL 4.4.13374 on R5 230 and 4.5.13399 on R7 240
// return 0 for GL_MAX_VERTEX_ATTRIB_STRIDE, not conforming to spec.
// Reenable if AMD fixes their drivers.
if (IsDesktopOpenGL() && IsLinux() && IsAMD())
{
std::cout << "Test disabled on Linux AMD OpenGL." << std::endl;
return;
}
GLint maxStride; GLint maxStride;
glGetIntegerv(GL_MAX_VERTEX_ATTRIB_STRIDE, &maxStride); glGetIntegerv(GL_MAX_VERTEX_ATTRIB_STRIDE, &maxStride);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
......
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