Hash :
25a22dec
Author :
Date :
2025-02-24T14:32:42
Manual roll VK-GL-CTS from 69ec1790cb7c to ba86fb950043 (18 revisions) https://chromium.googlesource.com/external/github.com/KhronosGroup/VK-GL-CTS.git/+log/69ec1790cb7c..ba86fb950043 2025-02-21 lorenzo@khronosgroup.org Merge vk-gl-cts/opengl-cts-4.6.6 into vk-gl-cts/main 2025-02-21 lorenzo@khronosgroup.org Merge vk-gl-cts/opengl-es-cts-3.2.12 into vk-gl-cts/main 2025-02-21 rgarcia@igalia.com Test "remaining array layers" and cube images with HIC 2025-02-21 javed@igalia.com Add coverage for tess shader IO 2025-02-21 marcin.zajac@cognizant.com Complex acceleration structure updates 2025-02-21 jbolz@nvidia.com Add tests for VK_NV_cooperative_vector 2025-02-21 syoussefi@google.com Remove last references to DE_NULL 2025-02-21 abdolrashidi@google.com Fix non-zero offset added to nullptr 2025-02-21 zzoon@igalia.com Vulkan Video Decode: Increase MAX_BOUND_MEMORY 2025-02-21 lionel.g.landwerlin@intel.com Fix incorrect structure type check 2025-02-21 gleese@broadcom.com Fix test data generation for copy tests 2025-02-21 javed@igalia.com Add tests for differing mutable format 2025-02-21 gleese@broadcom.com Stop querying device address from unbound buffers 2025-02-21 scerveau@igalia.com video: rename clip description names 2025-02-21 kamil.goras@mobica.com Add test that redeclaring gl_FragDepth is not permitted in ES 2025-02-21 kamil.goras@mobica.com Fix KHR-GLES31.core.nearest_edge.* tests that fail with EXT_read_format_bgra formats. If BGRA format and type 1_5_5_5 are preffered by device use BGRA_EXT and UNSIGNED_SHORT_1_5_5_5_REV_EXT in ReadPixels and swizzle colors. 2025-02-21 mateusz.bahyrycz@mobica.com Add support for sparse mode for ray tracing utils 2025-02-21 lorenzo@khronosgroup.org Merge vk-gl-cts/vulkan-cts-1.4.1 into vk-gl-cts/main If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/vk-gl-cts-angle-autoroll Please CC angle-team@google.com,yuxinhu@google.com on the revert to ensure that a human is aware of the problem. To file a bug in ANGLE: https://bugs.chromium.org/p/angleproject/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Bug: b/398956813 Tbr: yuxinhu@google.com Change-Id: I8d2de8b6f8671b5cf66d6b4210877ca8f187528b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6298534 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Yuxin Hu <yuxinhu@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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
/*-------------------------------------------------------------------------
* drawElements Quality Program Tester Core
* ----------------------------------------
*
* Copyright 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "egluNativeDisplay.hpp"
#include "tcuANGLENativeDisplayFactory.h"
#include "deClock.h"
#include "deMemory.h"
#include "egluDefs.hpp"
#include "eglwLibrary.hpp"
#include "tcuTexture.hpp"
#include "util/OSPixmap.h"
#include "util/OSWindow.h"
#include "util/autogen/angle_features_autogen.h"
// clang-format off
#if (DE_OS == DE_OS_WIN32)
#define ANGLE_EGL_LIBRARY_FULL_NAME ANGLE_EGL_LIBRARY_NAME ".dll"
#elif (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID)
#define ANGLE_EGL_LIBRARY_FULL_NAME ANGLE_EGL_LIBRARY_NAME ".so"
#elif (DE_OS == DE_OS_OSX)
#define ANGLE_EGL_LIBRARY_FULL_NAME ANGLE_EGL_LIBRARY_NAME ".dylib"
#else
#error "Unsupported platform"
#endif
// clang-format on
#if defined(ANGLE_USE_X11)
# include <X11/Xlib.h>
#endif
#if defined(ANGLE_USE_WAYLAND)
# include <wayland-client.h>
# include <wayland-egl-backend.h>
#endif
#if (DE_OS == DE_OS_ANDROID)
# define NATIVE_EGL_LIBRARY_FULL_NAME "libEGL.so"
#endif
namespace tcu
{
namespace
{
template <typename destType, typename sourceType>
destType bitCast(sourceType source)
{
constexpr size_t copySize =
sizeof(destType) < sizeof(sourceType) ? sizeof(destType) : sizeof(sourceType);
destType output(0);
memcpy(&output, &source, copySize);
return output;
}
enum
{
DEFAULT_SURFACE_WIDTH = 400,
DEFAULT_SURFACE_HEIGHT = 300,
};
constexpr eglu::NativeDisplay::Capability kDisplayCapabilities =
static_cast<eglu::NativeDisplay::Capability>(
eglu::NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM |
eglu::NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM_EXT);
constexpr eglu::NativePixmap::Capability kBitmapCapabilities =
eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY;
constexpr eglu::NativeWindow::Capability kWindowCapabilities =
static_cast<eglu::NativeWindow::Capability>(
#if (DE_OS == DE_OS_WIN32)
eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS |
#endif
eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY |
eglu::NativeWindow::CAPABILITY_GET_SURFACE_SIZE |
eglu::NativeWindow::CAPABILITY_GET_SCREEN_SIZE |
eglu::NativeWindow::CAPABILITY_SET_SURFACE_SIZE |
eglu::NativeWindow::CAPABILITY_CHANGE_VISIBILITY |
eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION);
class ANGLENativeDisplay : public eglu::NativeDisplay
{
public:
explicit ANGLENativeDisplay(EGLNativeDisplayType display,
std::vector<eglw::EGLAttrib> attribs,
const EGLenum platformType,
const char *eglLibraryName);
~ANGLENativeDisplay() override = default;
void *getPlatformNative() override
{
// On OSX 64bits mDeviceContext is a 32 bit integer, so we can't simply
// use reinterpret_cast<void*>.
return bitCast<void *>(mDeviceContext);
}
const eglw::EGLAttrib *getPlatformAttributes() const override
{
return &mPlatformAttributes[0];
}
const eglw::Library &getLibrary() const override { return mLibrary; }
EGLNativeDisplayType getDeviceContext() const { return mDeviceContext; }
private:
EGLNativeDisplayType mDeviceContext;
eglw::DefaultLibrary mLibrary;
std::vector<eglw::EGLAttrib> mPlatformAttributes;
};
class NativePixmapFactory : public eglu::NativePixmapFactory
{
public:
NativePixmapFactory();
~NativePixmapFactory() override = default;
eglu::NativePixmap *createPixmap(eglu::NativeDisplay *nativeDisplay,
int width,
int height) const override;
eglu::NativePixmap *createPixmap(eglu::NativeDisplay *nativeDisplay,
eglw::EGLDisplay display,
eglw::EGLConfig config,
const eglw::EGLAttrib *attribList,
int width,
int height) const override;
};
class NativePixmap : public eglu::NativePixmap
{
public:
NativePixmap(EGLNativeDisplayType display, int width, int height, int bitDepth);
virtual ~NativePixmap();
eglw::EGLNativePixmapType getLegacyNative() override;
private:
OSPixmap *mPixmap;
};
class NativeWindowFactory : public eglu::NativeWindowFactory
{
public:
explicit NativeWindowFactory(EventState *eventState, uint32_t preRotation);
~NativeWindowFactory() override = default;
eglu::NativeWindow *createWindow(eglu::NativeDisplay *nativeDisplay,
const eglu::WindowParams ¶ms) const override;
eglu::NativeWindow *createWindow(eglu::NativeDisplay *nativeDisplay,
eglw::EGLDisplay display,
eglw::EGLConfig config,
const eglw::EGLAttrib *attribList,
const eglu::WindowParams ¶ms) const override;
private:
EventState *mEvents;
uint32_t mPreRotation;
};
class NativeWindow : public eglu::NativeWindow
{
public:
NativeWindow(ANGLENativeDisplay *nativeDisplay,
const eglu::WindowParams ¶ms,
EventState *eventState,
uint32_t preRotation);
~NativeWindow() override;
eglw::EGLNativeWindowType getLegacyNative() override;
void *getPlatformExtension() override;
IVec2 getSurfaceSize() const override;
IVec2 getScreenSize() const override { return getSurfaceSize(); }
void processEvents() override;
void setSurfaceSize(IVec2 size) override;
void setVisibility(eglu::WindowParams::Visibility visibility) override;
void readScreenPixels(tcu::TextureLevel *dst) const override;
private:
OSWindow *mWindow;
EventState *mEvents;
uint32_t mPreRotation;
};
// ANGLE NativeDisplay
ANGLENativeDisplay::ANGLENativeDisplay(EGLNativeDisplayType display,
std::vector<EGLAttrib> attribs,
const EGLenum platformType,
const char *eglLibraryName)
: eglu::NativeDisplay(kDisplayCapabilities, platformType, "EGL_EXT_platform_base"),
mDeviceContext(display),
mLibrary(eglLibraryName),
mPlatformAttributes(std::move(attribs))
{}
// NativePixmap
NativePixmap::NativePixmap(EGLNativeDisplayType display, int width, int height, int bitDepth)
: eglu::NativePixmap(kBitmapCapabilities), mPixmap(CreateOSPixmap())
{
#if (DE_OS != DE_OS_UNIX)
throw tcu::NotSupportedError("Pixmap not supported");
#else
if (!mPixmap)
{
throw ResourceError("Failed to create pixmap", nullptr, __FILE__, __LINE__);
}
if (!mPixmap->initialize(display, width, height, bitDepth))
{
throw ResourceError("Failed to initialize pixmap", nullptr, __FILE__, __LINE__);
}
#endif
}
NativePixmap::~NativePixmap()
{
delete mPixmap;
}
eglw::EGLNativePixmapType NativePixmap::getLegacyNative()
{
return reinterpret_cast<eglw::EGLNativePixmapType>(mPixmap->getNativePixmap());
}
// NativePixmapFactory
NativePixmapFactory::NativePixmapFactory()
: eglu::NativePixmapFactory("bitmap", "ANGLE Bitmap", kBitmapCapabilities)
{}
eglu::NativePixmap *NativePixmapFactory::createPixmap(eglu::NativeDisplay *nativeDisplay,
eglw::EGLDisplay display,
eglw::EGLConfig config,
const eglw::EGLAttrib *attribList,
int width,
int height) const
{
const eglw::Library &egl = nativeDisplay->getLibrary();
int nativeVisual = 0;
DE_ASSERT(display != EGL_NO_DISPLAY);
egl.getConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &nativeVisual);
EGLU_CHECK_MSG(egl, "eglGetConfigAttrib()");
return new NativePixmap(dynamic_cast<ANGLENativeDisplay *>(nativeDisplay)->getDeviceContext(),
width, height, nativeVisual);
}
eglu::NativePixmap *NativePixmapFactory::createPixmap(eglu::NativeDisplay *nativeDisplay,
int width,
int height) const
{
const int defaultDepth = 32;
return new NativePixmap(dynamic_cast<ANGLENativeDisplay *>(nativeDisplay)->getDeviceContext(),
width, height, defaultDepth);
}
// NativeWindowFactory
NativeWindowFactory::NativeWindowFactory(EventState *eventState, uint32_t preRotation)
: eglu::NativeWindowFactory("window", "ANGLE Window", kWindowCapabilities),
mEvents(eventState),
mPreRotation(preRotation)
{}
eglu::NativeWindow *NativeWindowFactory::createWindow(eglu::NativeDisplay *nativeDisplay,
const eglu::WindowParams ¶ms) const
{
DE_ASSERT(false);
return nullptr;
}
eglu::NativeWindow *NativeWindowFactory::createWindow(eglu::NativeDisplay *nativeDisplay,
eglw::EGLDisplay display,
eglw::EGLConfig config,
const eglw::EGLAttrib *attribList,
const eglu::WindowParams ¶ms) const
{
return new NativeWindow(dynamic_cast<ANGLENativeDisplay *>(nativeDisplay), params, mEvents,
mPreRotation);
}
// NativeWindow
NativeWindow::NativeWindow(ANGLENativeDisplay *nativeDisplay,
const eglu::WindowParams ¶ms,
EventState *eventState,
uint32_t preRotation)
: eglu::NativeWindow(kWindowCapabilities),
mWindow(OSWindow::New()),
mEvents(eventState),
mPreRotation(preRotation)
{
int osWindowWidth =
params.width == eglu::WindowParams::SIZE_DONT_CARE ? DEFAULT_SURFACE_WIDTH : params.width;
int osWindowHeight = params.height == eglu::WindowParams::SIZE_DONT_CARE
? DEFAULT_SURFACE_HEIGHT
: params.height;
if (mPreRotation == 90 || mPreRotation == 270)
{
std::swap(osWindowWidth, osWindowHeight);
}
mWindow->setNativeDisplay(nativeDisplay->getDeviceContext());
bool initialized = mWindow->initialize("dEQP ANGLE Tests", osWindowWidth, osWindowHeight);
TCU_CHECK(initialized);
if (params.visibility != eglu::WindowParams::VISIBILITY_DONT_CARE)
NativeWindow::setVisibility(params.visibility);
}
void NativeWindow::setVisibility(eglu::WindowParams::Visibility visibility)
{
switch (visibility)
{
case eglu::WindowParams::VISIBILITY_HIDDEN:
mWindow->setVisible(false);
break;
case eglu::WindowParams::VISIBILITY_VISIBLE:
case eglu::WindowParams::VISIBILITY_FULLSCREEN:
mWindow->setVisible(true);
break;
default:
DE_ASSERT(false);
}
}
NativeWindow::~NativeWindow()
{
OSWindow::Delete(&mWindow);
}
eglw::EGLNativeWindowType NativeWindow::getLegacyNative()
{
return reinterpret_cast<eglw::EGLNativeWindowType>(mWindow->getNativeWindow());
}
void *NativeWindow::getPlatformExtension()
{
return mWindow->getPlatformExtension();
}
IVec2 NativeWindow::getSurfaceSize() const
{
int width = mWindow->getWidth();
int height = mWindow->getHeight();
if (mPreRotation == 90 || mPreRotation == 270)
{
// Return the original dimensions dEQP asked for. This ensures that the dEQP code is never
// aware of the window actually being rotated.
std::swap(width, height);
}
return IVec2(width, height);
}
void NativeWindow::processEvents()
{
mWindow->messageLoop();
// Look for a quit event to forward to the EventState
Event event = {};
while (mWindow->popEvent(&event))
{
if (event.Type == Event::EVENT_CLOSED)
{
mEvents->signalQuitEvent();
}
}
}
void NativeWindow::setSurfaceSize(IVec2 size)
{
int osWindowWidth = size.x();
int osWindowHeight = size.y();
if (mPreRotation == 90 || mPreRotation == 270)
{
std::swap(osWindowWidth, osWindowHeight);
}
mWindow->resize(osWindowWidth, osWindowHeight);
}
void NativeWindow::readScreenPixels(tcu::TextureLevel *dst) const
{
dst->setStorage(TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_INT8),
mWindow->getWidth(), mWindow->getHeight());
if (!mWindow->takeScreenshot(reinterpret_cast<uint8_t *>(dst->getAccess().getDataPtr())))
{
throw InternalError("Failed to read screen pixels", nullptr, __FILE__, __LINE__);
}
if (mPreRotation != 0)
{
throw InternalError("Read screen pixels with prerotation is not supported", nullptr,
__FILE__, __LINE__);
}
}
} // namespace
ANGLENativeDisplayFactory::ANGLENativeDisplayFactory(
const std::string &name,
const std::string &description,
std::vector<eglw::EGLAttrib> platformAttributes,
EventState *eventState,
const EGLenum platformType)
: eglu::NativeDisplayFactory(name,
description,
kDisplayCapabilities,
platformType,
"EGL_EXT_platform_base"),
mNativeDisplay(bitCast<eglw::EGLNativeDisplayType>(EGL_DEFAULT_DISPLAY)),
mPlatformAttributes(std::move(platformAttributes)),
mPlatformType(platformType)
{
#if (DE_OS == DE_OS_UNIX)
# if defined(ANGLE_USE_X11)
// Make sure to only open the X display once so that it can be used by the EGL display as well
// as pixmaps
mNativeDisplay = bitCast<eglw::EGLNativeDisplayType>(XOpenDisplay(nullptr));
# endif // ANGLE_USE_X11
# if defined(ANGLE_USE_WAYLAND)
if (mNativeDisplay == 0)
{
mNativeDisplay = bitCast<eglw::EGLNativeDisplayType>(wl_display_connect(nullptr));
}
# endif // ANGLE_USE_WAYLAND
#endif // (DE_OS == DE_OS_UNIX)
// If pre-rotating, let NativeWindowFactory know.
uint32_t preRotation = 0;
for (size_t attrIndex = 0;
attrIndex < mPlatformAttributes.size() && mPlatformAttributes[attrIndex] != EGL_NONE;
attrIndex += 2)
{
if (mPlatformAttributes[attrIndex] != EGL_FEATURE_OVERRIDES_ENABLED_ANGLE)
{
continue;
}
const char **enabledFeatures =
reinterpret_cast<const char **>(mPlatformAttributes[attrIndex + 1]);
DE_ASSERT(enabledFeatures != nullptr && *enabledFeatures != nullptr);
for (; *enabledFeatures; ++enabledFeatures)
{
if (strcmp(enabledFeatures[0],
angle::GetFeatureName(angle::Feature::EmulatedPrerotation90)) == 0)
{
preRotation = 90;
}
else if (strcmp(enabledFeatures[0],
angle::GetFeatureName(angle::Feature::EmulatedPrerotation180)) == 0)
{
preRotation = 180;
}
else if (strcmp(enabledFeatures[0],
angle::GetFeatureName(angle::Feature::EmulatedPrerotation270)) == 0)
{
preRotation = 270;
}
}
break;
}
m_nativeWindowRegistry.registerFactory(new NativeWindowFactory(eventState, preRotation));
m_nativePixmapRegistry.registerFactory(new NativePixmapFactory());
}
ANGLENativeDisplayFactory::~ANGLENativeDisplayFactory() = default;
eglu::NativeDisplay *ANGLENativeDisplayFactory::createDisplay(
const eglw::EGLAttrib *attribList) const
{
DE_UNREF(attribList);
if (mPlatformType == EGL_PLATFORM_ANGLE_ANGLE)
{
return new ANGLENativeDisplay(bitCast<EGLNativeDisplayType>(mNativeDisplay),
mPlatformAttributes, mPlatformType,
ANGLE_EGL_LIBRARY_FULL_NAME);
}
#if (DE_OS == DE_OS_ANDROID)
else if (mPlatformType == EGL_PLATFORM_ANDROID_KHR)
{
return new ANGLENativeDisplay(bitCast<EGLNativeDisplayType>(mNativeDisplay),
mPlatformAttributes, mPlatformType,
NATIVE_EGL_LIBRARY_FULL_NAME);
}
#endif
else
{
throw InternalError("unsupported platform type", nullptr, __FILE__, __LINE__);
}
}
} // namespace tcu