diff --git a/src/libANGLE/validationEGL.h b/src/libANGLE/validationEGL.h index 7380382bac0..e3433151aeb 100644 --- a/src/libANGLE/validationEGL.h +++ b/src/libANGLE/validationEGL.h @@ -100,6 +100,13 @@ GetDefaultReturnValue(Thread *thre return thread->getError(); } +template <> +ANGLE_INLINE EGLint +GetDefaultReturnValue(Thread *thread) +{ + return EGL_NO_NATIVE_FENCE_FD_ANDROID; +} + template ANGLE_INLINE ReturnType GetDefaultReturnValue(Thread *thread) { diff --git a/src/tests/egl_tests/EGLSyncTest.cpp b/src/tests/egl_tests/EGLSyncTest.cpp index 8c22bbd4ad3..29648a2427e 100644 --- a/src/tests/egl_tests/EGLSyncTest.cpp +++ b/src/tests/egl_tests/EGLSyncTest.cpp @@ -367,6 +367,21 @@ TEST_P(EGLSyncTest, AndroidNativeFence_DupNativeFenceFD) EXPECT_EGL_TRUE(eglDestroySyncKHR(display, syncWithGeneratedFD)); } +// Test the validation errors for bad parameters for eglDupNativeFenceFDANDROID +TEST_P(EGLSyncTest, AndroidNativeFence_DupNativeFenceFD_NegativeValidation) +{ + ANGLE_SKIP_TEST_IF(!hasFenceSyncExtension()); + ANGLE_SKIP_TEST_IF(!hasFenceSyncExtension() || !hasGLSyncExtension()); + ANGLE_SKIP_TEST_IF(!hasAndroidNativeFenceSyncExtension()); + + EGLDisplay display = getEGLWindow()->getDisplay(); + + int fd; + fd = eglDupNativeFenceFDANDROID(display, EGL_NO_SYNC_KHR); + EXPECT_EGL_ERROR(EGL_BAD_PARAMETER); + EXPECT_EQ(fd, EGL_NO_NATIVE_FENCE_FD_ANDROID); +} + // Verify CreateSync and ClientWait for EGL_ANDROID_native_fence_sync TEST_P(EGLSyncTest, AndroidNativeFence_ClientWait) {