Hash :
dcbcee8a
Author :
Date :
2025-05-15T10:39:55
Tests: Use eglGetPlatformDisplay()
From the EGL 1.5 spec:
Appendix F
Version 1.5
EGL version 1.5 was voted out of the Khronos Technical Working Group
on January 31, 2014, and formally approved by the Khronos Board of
Promoters on March 14, 2014.
EGL 1.5 is the sixth release of EGL. It introduces the following new
features (the EGL extension(s) each feature is based on are also shown
parenthetically):
* Platform support:
– Providing a mechanism for support of multiple platforms (such as
window systems or offscreen rendering frameworks) in a single EGL
implementation at runtime (EGL_EXT_platform_base).
Many tests use eglGetPlatformDisplayEXT() which is provided by the EGL
extension EGL_EXT_platform_base. With the promotion of the
EGL_EXT_platform_base functions to core EGL in version 1.5 and ANGLE
supporting EGL 1.5 (as of at least 2019), update the calls to use
eglGetPlatformDisplay().
This is in preparation for running the ANGLE end2end tests in Android,
which only exposes the EGL 1.5 functions, and not the
EGL_EXT_platform_base functions.
Bug: b/391967165
Test: angle_end2end_tests
Change-Id: I58109c3afe270f46db952e124ee3f5c11200ca35
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6552257
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Commit-Queue: Tim Van Patten <timvp@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
//
// Copyright 2020 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.
//
// EGLDisplayLuidTest.cpp:
// Tests for the EGL_ANGLE_platform_angle_d3d_luid extension.
//
#include "test_utils/ANGLETest.h"
using namespace angle;
class EGLDisplayLuidTest : public ANGLETest<>
{
protected:
EGLDisplayLuidTest() : mDisplay(EGL_NO_DISPLAY) {}
void testTearDown() override
{
if (mDisplay != EGL_NO_DISPLAY)
{
EXPECT_EGL_TRUE(eglTerminate(mDisplay));
EXPECT_EGL_SUCCESS();
}
}
void testInvalidAttribs(const EGLAttrib displayAttribs[])
{
EXPECT_EQ(
eglGetPlatformDisplay(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttribs),
EGL_NO_DISPLAY);
EXPECT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
}
void testValidAttribs(const EGLAttrib displayAttribs[])
{
mDisplay =
eglGetPlatformDisplay(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttribs);
EXPECT_EGL_SUCCESS();
EXPECT_NE(mDisplay, EGL_NO_DISPLAY);
// eglInitialize should succeed even if the LUID doesn't match an actual
// adapter on the system. The behavior in this case is that the default
// adapter is used.
EXPECT_EGL_TRUE(eglInitialize(mDisplay, nullptr, nullptr));
EXPECT_EGL_SUCCESS();
}
private:
EGLDisplay mDisplay;
};
// EGL_ANGLE_platform_angle_d3d_luid is only supported on D3D11. Verify failure
// if D3D9 is specified in the attributes.
TEST_P(EGLDisplayLuidTest, D3D9Failure)
{
EGLAttrib displayAttribs[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
EGL_PLATFORM_ANGLE_D3D_LUID_HIGH_ANGLE, 1, EGL_NONE};
testInvalidAttribs(displayAttribs);
}
// Verify failure if the specified LUID is zero.
TEST_P(EGLDisplayLuidTest, ZeroLuidFailure)
{
EGLAttrib displayAttribs[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_D3D_LUID_HIGH_ANGLE,
0,
EGL_PLATFORM_ANGLE_D3D_LUID_LOW_ANGLE,
0,
EGL_NONE};
testInvalidAttribs(displayAttribs);
}
TEST_P(EGLDisplayLuidTest, D3D11)
{
EGLAttrib displayAttribs[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_D3D_LUID_HIGH_ANGLE, 1, EGL_NONE};
testValidAttribs(displayAttribs);
}
ANGLE_INSTANTIATE_TEST(EGLDisplayLuidTest, WithNoFixture(ES2_D3D9()), WithNoFixture(ES2_D3D11()));