Hash :
4eb4165b
Author :
Date :
2025-03-07T10:24:05
Roll third_party/dawn/ 8119dbd27..7a8946456 (244 commits; 3 trivial rolls) Need https://dawn-review.googlesource.com/c/dawn/+/229494 to roll https://chromium-review.googlesource.com/c/angle/angle/+/6334483 vulkan_platform.h:152:9: error: 'VK_USE_PLATFORM_XLIB_KHR' macro redefined https://dawn.googlesource.com/dawn.git/+log/8119dbd27471..7a8946456d49 $ git log 8119dbd27..7a8946456 --date=short --no-merges --format='%ad %ae %s' 2025-03-07 cwallez [tint] Add support for binding_array to the IR validator 2025-03-07 hitawala [stream] Check for size invalidity before reserving in Stream::Read 2025-03-07 cwallez Reland "[dawn] Fix detection of __builtin_assume for DAWN_ASSERT" 2025-03-06 dawn-autoroll Roll ANGLE from 99ebd28ad246 to 0cdbc7814e59 (4 revisions) 2025-03-06 jiawei.shao Remove the redefinition of dawn::native::Vulkan::ClampFragDepthArgs 2025-03-06 jiawei.shao Vulkan: Implement PreferNotUsingMappableOrUniformBufferAsStorage() 2025-03-06 rharrison [tint][ir][fuzz] Re-enable SubgroupMatrix in IR binary 2025-03-06 shrekshao [Compat] Remove suppressions for ReadOnlyDepthStencilAttachmentTests 2025-03-06 thomasanderson [X11] Don't redefine VK_USE_PLATFORM_XLIB_KHR 2025-03-06 lokokung [dawn][emscripten] Fix Emscripten bindings for compilation messages. 2025-03-06 lokokung [dawn][native] Add validation for Infinities. 2025-03-06 lokokung [dawn][headers] Update wgpu::Surface APIs to match upstream. 2025-03-06 bsheedy [tools] Convert glob to use dependency injection 2025-03-06 cwallez [dawn][native] Track the set of BGLInternal separately from BGL. 2025-03-06 amaiorano tint: make PreventInfiniteLoops count down from uint32::highest() down to 0 2025-03-06 dsinclair Revert "Vulkan: Allow setting multiple `MemoryKind` bits" 2025-03-06 ynovikov Reland "Roll reclient, siso; update related DEPS to match Chromium" 2025-03-06 dawn-autoroll Roll ANGLE from 1a0c9db3748a to 99ebd28ad246 (8 revisions) 2025-03-06 cwallez Revert "[dawn] Fix detection of __builtin_assume for DAWN_ASSERT" 2025-03-05 zhaoming.jiang Dawn: Remove adapter from shader compilation request 2025-03-05 jiawei.shao Skip the test CreateBufferOOMWithValidationError when no validation 2025-03-05 lokokung [dawn][native] Make error scopes thread local. 2025-03-05 dawn-autoroll Roll ANGLE from 6b10ae3386b7 to 1a0c9db3748a (3 revisions) 2025-03-05 mohamedkhairy0101 tint: Improve error message for module-scope function calls 2025-03-05 mohammedashraf4599 add BOM error message 2025-03-05 cwallez [dawn] Fix detection of __builtin_assume for DAWN_ASSERT 2025-03-05 cwallez [tint] Add binding_array indexing to the resolver. 2025-03-05 kylechar Add SlabAllocator::DeleteEmptySlabs() 2025-03-05 dawn-autoroll Roll ANGLE from 73992d71f9d1 to 6b10ae3386b7 (7 revisions) 2025-03-05 shrekshao Remove enabling core-features-and-limits in backends 2025-03-04 lokokung [dawn][headers] Removes default UTF16 support. 2025-03-04 lokokung Reland "[dawn][headers] Remove obsolete ifdefs." 2025-03-04 jwata build: GN builds use Siso without Reclient in tools/setup-build script 2025-03-04 jrprice [vulkan] Fix subgroup matrix config gathering 2025-03-04 dawn-autoroll Roll ANGLE from bd8bc1055ecd to 73992d71f9d1 (1 revision) 2025-03-04 chrome-branch-day Activate dawn M135 2025-03-04 beaufort.francois Remove maxInterStageShaderComponents limit 2025-03-04 beaufort.francois Refactor Bindgroup constructors 2025-03-04 cwallez [tint] Add binding_array to the resolver 2025-03-04 cwallez Revert "[dawn][headers] Remove obsolete ifdefs." 2025-03-04 lokokung [dawn][headers] Remove obsolete ifdefs. 2025-03-03 zhaoming.jiang Dawn: Cache limits in AdapterBase 2025-03-03 dawn-autoroll Roll ANGLE from 19b35fcbff31 to bd8bc1055ecd (5 revisions) 2025-03-03 lokokung [dawn][headers] Adds extension support for UTF-16 in compilation message. 2025-03-03 jrprice [spirv] Only add explicit layout decorations on types that need them 2025-03-03 kainino [emscripten] Add emsdk to DEPS for Wasm builds 2025-03-03 lokokung [dawn][wire] Adds Dawn wire invalid extension struct and handling. 2025-03-03 jrprice [dawn] Validate workgroup size for subgroup matrix 2025-03-03 jrprice [inspector] Reflect the use of a subgroup matrix 2025-03-03 jrprice [tint] Reject non-compute shaders that use subgroup matrices (...) 2025-02-18 zhjiang Dawn: Tighten the scope of ScopedTintICEHandler 2025-02-18 dawn-autoroll Roll DirectX Shader Compiler from 6b68f3b5832c to fcbd2a184294 (2 revisions) 2025-02-18 jiawei.shao Replace `PipelineCompatibilityToken(0)` with `kExplicitPCT` 2025-02-18 yulong.fs fix memory address value passed to emwgpuDelete() 2025-02-18 dsinclair [spirv-reader][ir] Implement OpConvertFToU 2025-02-18 kainino dawn::DynamicLib: Leak all DLLs on Windows ASan builds 2025-02-18 dsinclair [spirv-reader][ir] Implement ConvertFToS 2025-02-18 petermcneeley Fix for assignment outside the range of representable type 2025-02-18 kainino Refactor TINT_ASAN_ENABLED into common DAWN_ASAN_ENABLED() 2025-02-18 gman Add a trace option to the Metal Backend 2025-02-18 dawn-autoroll Roll ANGLE from ba3dcfa4670d to 8dda514cb833 (3 revisions) 2025-02-18 dsinclair Mark function unused. 2025-02-18 dawn-autoroll Roll DirectX Shader Compiler from 20950d662f4d to 6b68f3b5832c (1 revision) 2025-02-17 dawn-autoroll Roll ANGLE from e0332c861004 to ba3dcfa4670d (1 revision) 2025-02-17 dawn-autoroll Roll vulkan-deps from 2a09ac22553e to 5d08bc0b0e23 (6 revisions) 2025-02-17 yulong.fs fix buffer destroy 2025-02-17 dawn-autoroll Roll ANGLE from 51d2561b5a6b to e0332c861004 (1 revision) 2025-02-17 lehoangquyen D3D: remove dead code used by the old external image API 2025-02-16 dawn-autoroll Roll Depot Tools from 77a800d7294d to 7a0dbd207449 (59 revisions) 2025-02-16 jiawei.shao Enable creating pipeline layout with null bind group layout by default 2025-02-16 dawn-autoroll Roll vulkan-deps from 2365826a66b2 to 2a09ac22553e (1 revision) 2025-02-15 dawn-autoroll Roll vulkan-deps from cc6490ed63e7 to 2365826a66b2 (5 revisions) 2025-02-15 dawn-autoroll Roll ANGLE from bef478f54e6e to 51d2561b5a6b (2 revisions) 2025-02-15 jie.a.chen Fix CooperativeMatrix extension index 2025-02-14 dawn-autoroll Roll ANGLE from 7afa2345f8d2 to bef478f54e6e (3 revisions) 2025-02-14 dsinclair [spirv-reader][ir] Register names instead of using new 2025-02-14 dsinclair [spirv-reader][ir] Support OpBranchConditional after OpSelectionMerge 2025-02-14 dawn-autoroll Roll vulkan-deps from 5cc3a63e8fdb to cc6490ed63e7 (5 revisions) 2025-02-14 gman Emit WGSL errors as part of GPUValidationError 2025-02-14 jimblackler [Kotlin] Update template now WGPUChainedStructOut has been removed. 2025-02-14 dawn-autoroll Roll ANGLE from cd7f92e1ed57 to 7afa2345f8d2 (6 revisions) 2025-02-13 petermcneeley Substitute overrides in IR (vk) 2025-02-13 shaoboyan [Spirv] Remove clamp_frag_depth attribute in Options 2025-02-13 dsinclair [spirv-reader][ir] Handle OpBranch instruction 2025-02-13 jrprice [ir] Add builtin struct support to the protobuf 2025-02-13 rharrison [tint][ir][val] Check Samplers & Textures address space 2025-02-13 jrprice [tint] Add flag for WGSL internal structures 2025-02-13 rharrison [tint] Replace unsafe casting with shift & mask in eval.cc 2025-02-13 rharrison [tint] Narrow warning suppression in table_data.h 2025-02-13 bajones Loosen Viewport validation requirements 2025-02-13 shrekshao [Compat] Add compat-min-es31 tags in expectations 2025-02-13 gman Remove old subgroups from dawn.node 2025-02-13 dawn-autoroll Roll ANGLE from 19c5293e1347 to cd7f92e1ed57 (9 revisions) 2025-02-13 dsinclair [spirv-reader][ir] Add names for functions and function parameters. 2025-02-13 dsinclair [spirv-reader][ir] Support names. 2025-02-13 dsinclair [spirv-reader][ir] Fixup mixed sign binary methods. 2025-02-13 dawn-autoroll Roll vulkan-deps from a88fd25a6a0d to 5cc3a63e8fdb (17 revisions) 2025-02-13 dsinclair Add suppressions for compat failures. 2025-02-13 jrprice [spirv] Emit Matrix*SignedComponents operands 2025-02-13 jrprice [tint] Subgroup matrix component types do not have to match Created with: roll-dep third_party/dawn Bug: chromium:345261080 Change-Id: I9ee360934bcbd838d682ffabe5029cc7baecec9b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6333617 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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
//
// Copyright 2024 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.
//
// SurfaceWgpu.cpp:
// Implements the class methods for SurfaceWgpu.
//
#include "libANGLE/renderer/wgpu/SurfaceWgpu.h"
#include "common/debug.h"
#include "libANGLE/Display.h"
#include "libANGLE/Surface.h"
#include "libANGLE/renderer/wgpu/DisplayWgpu.h"
#include "libANGLE/renderer/wgpu/FramebufferWgpu.h"
namespace rx
{
constexpr wgpu::TextureUsage kSurfaceTextureUsage =
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
SurfaceWgpu::SurfaceWgpu(const egl::SurfaceState &surfaceState) : SurfaceImpl(surfaceState) {}
SurfaceWgpu::~SurfaceWgpu() {}
angle::Result SurfaceWgpu::createDepthStencilAttachment(uint32_t width,
uint32_t height,
const webgpu::Format &webgpuFormat,
wgpu::Device &device,
AttachmentImage *outDepthStencilAttachment)
{
wgpu::TextureDescriptor desc = outDepthStencilAttachment->texture.createTextureDescriptor(
kSurfaceTextureUsage, wgpu::TextureDimension::e2D, {width, height, 1},
webgpuFormat.getActualWgpuTextureFormat(), 1, 1);
constexpr uint32_t level = 0;
constexpr uint32_t layer = 0;
ANGLE_TRY(outDepthStencilAttachment->texture.initImage(webgpuFormat.getIntendedFormatID(),
webgpuFormat.getActualImageFormatID(),
device, gl::LevelIndex(level), desc));
wgpu::TextureView view;
ANGLE_TRY(
outDepthStencilAttachment->texture.createTextureView(gl::LevelIndex(level), layer, view));
outDepthStencilAttachment->renderTarget.set(
&outDepthStencilAttachment->texture, view, webgpu::LevelIndex(level), layer,
outDepthStencilAttachment->texture.toWgpuTextureFormat());
return angle::Result::Continue;
}
OffscreenSurfaceWgpu::OffscreenSurfaceWgpu(const egl::SurfaceState &surfaceState)
: SurfaceWgpu(surfaceState),
mWidth(surfaceState.attributes.getAsInt(EGL_WIDTH, 0)),
mHeight(surfaceState.attributes.getAsInt(EGL_HEIGHT, 0))
{}
OffscreenSurfaceWgpu::~OffscreenSurfaceWgpu() {}
egl::Error OffscreenSurfaceWgpu::initialize(const egl::Display *display)
{
return angle::ResultToEGL(initializeImpl(display));
}
egl::Error OffscreenSurfaceWgpu::swap(const gl::Context *context)
{
UNREACHABLE();
return egl::NoError();
}
egl::Error OffscreenSurfaceWgpu::bindTexImage(const gl::Context *context,
gl::Texture *texture,
EGLint buffer)
{
UNIMPLEMENTED();
return egl::NoError();
}
egl::Error OffscreenSurfaceWgpu::releaseTexImage(const gl::Context *context, EGLint buffer)
{
UNIMPLEMENTED();
return egl::NoError();
}
void OffscreenSurfaceWgpu::setSwapInterval(const egl::Display *display, EGLint interval) {}
EGLint OffscreenSurfaceWgpu::getWidth() const
{
return mWidth;
}
EGLint OffscreenSurfaceWgpu::getHeight() const
{
return mHeight;
}
EGLint OffscreenSurfaceWgpu::getSwapBehavior() const
{
return EGL_BUFFER_DESTROYED;
}
angle::Result OffscreenSurfaceWgpu::initializeContents(const gl::Context *context,
GLenum binding,
const gl::ImageIndex &imageIndex)
{
UNIMPLEMENTED();
return angle::Result::Continue;
}
egl::Error OffscreenSurfaceWgpu::attachToFramebuffer(const gl::Context *context,
gl::Framebuffer *framebuffer)
{
UNIMPLEMENTED();
return egl::NoError();
}
egl::Error OffscreenSurfaceWgpu::detachFromFramebuffer(const gl::Context *context,
gl::Framebuffer *framebuffer)
{
UNIMPLEMENTED();
return egl::NoError();
}
angle::Result OffscreenSurfaceWgpu::getAttachmentRenderTarget(
const gl::Context *context,
GLenum binding,
const gl::ImageIndex &imageIndex,
GLsizei samples,
FramebufferAttachmentRenderTarget **rtOut)
{
if (binding == GL_BACK)
{
*rtOut = &mColorAttachment.renderTarget;
}
else
{
ASSERT(binding == GL_DEPTH || binding == GL_STENCIL || binding == GL_DEPTH_STENCIL);
*rtOut = &mDepthStencilAttachment.renderTarget;
}
return angle::Result::Continue;
}
angle::Result OffscreenSurfaceWgpu::initializeImpl(const egl::Display *display)
{
DisplayWgpu *displayWgpu = webgpu::GetImpl(display);
wgpu::Device &device = displayWgpu->getDevice();
const egl::Config *config = mState.config;
if (config->renderTargetFormat != GL_NONE)
{
const webgpu::Format &webgpuFormat = displayWgpu->getFormat(config->renderTargetFormat);
wgpu::TextureDescriptor desc = mColorAttachment.texture.createTextureDescriptor(
kSurfaceTextureUsage, wgpu::TextureDimension::e2D,
{static_cast<uint32_t>(mWidth), static_cast<uint32_t>(mHeight), 1},
webgpuFormat.getActualWgpuTextureFormat(), 1, 1);
constexpr uint32_t level = 0;
constexpr uint32_t layer = 0;
ANGLE_TRY(mColorAttachment.texture.initImage(webgpuFormat.getIntendedFormatID(),
webgpuFormat.getActualImageFormatID(), device,
gl::LevelIndex(level), desc));
wgpu::TextureView view;
ANGLE_TRY(mColorAttachment.texture.createTextureView(gl::LevelIndex(level), layer, view));
mColorAttachment.renderTarget.set(&mColorAttachment.texture, view,
webgpu::LevelIndex(level), layer,
mColorAttachment.texture.toWgpuTextureFormat());
}
if (config->depthStencilFormat != GL_NONE)
{
const webgpu::Format &webgpuFormat = displayWgpu->getFormat(config->depthStencilFormat);
ANGLE_TRY(createDepthStencilAttachment(static_cast<uint32_t>(mWidth),
static_cast<uint32_t>(mHeight), webgpuFormat, device,
&mDepthStencilAttachment));
}
return angle::Result::Continue;
}
WindowSurfaceWgpu::WindowSurfaceWgpu(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window)
: SurfaceWgpu(surfaceState), mNativeWindow(window)
{}
WindowSurfaceWgpu::~WindowSurfaceWgpu() {}
egl::Error WindowSurfaceWgpu::initialize(const egl::Display *display)
{
return angle::ResultToEGL(initializeImpl(display));
}
void WindowSurfaceWgpu::destroy(const egl::Display *display)
{
mSurface = nullptr;
mColorAttachment.renderTarget.reset();
mColorAttachment.texture.resetImage();
mDepthStencilAttachment.renderTarget.reset();
mDepthStencilAttachment.texture.resetImage();
}
egl::Error WindowSurfaceWgpu::swap(const gl::Context *context)
{
return angle::ResultToEGL(swapImpl(context));
}
egl::Error WindowSurfaceWgpu::bindTexImage(const gl::Context *context,
gl::Texture *texture,
EGLint buffer)
{
UNIMPLEMENTED();
return egl::NoError();
}
egl::Error WindowSurfaceWgpu::releaseTexImage(const gl::Context *context, EGLint buffer)
{
UNIMPLEMENTED();
return egl::NoError();
}
void WindowSurfaceWgpu::setSwapInterval(const egl::Display *display, EGLint interval)
{
UNIMPLEMENTED();
}
EGLint WindowSurfaceWgpu::getWidth() const
{
return mCurrentSurfaceSize.width;
}
EGLint WindowSurfaceWgpu::getHeight() const
{
return mCurrentSurfaceSize.height;
}
EGLint WindowSurfaceWgpu::getSwapBehavior() const
{
UNIMPLEMENTED();
return 0;
}
angle::Result WindowSurfaceWgpu::initializeContents(const gl::Context *context,
GLenum binding,
const gl::ImageIndex &imageIndex)
{
UNIMPLEMENTED();
return angle::Result::Continue;
}
egl::Error WindowSurfaceWgpu::attachToFramebuffer(const gl::Context *context,
gl::Framebuffer *framebuffer)
{
return egl::NoError();
}
egl::Error WindowSurfaceWgpu::detachFromFramebuffer(const gl::Context *context,
gl::Framebuffer *framebuffer)
{
return egl::NoError();
}
angle::Result WindowSurfaceWgpu::getAttachmentRenderTarget(
const gl::Context *context,
GLenum binding,
const gl::ImageIndex &imageIndex,
GLsizei samples,
FramebufferAttachmentRenderTarget **rtOut)
{
if (binding == GL_BACK)
{
*rtOut = &mColorAttachment.renderTarget;
}
else
{
ASSERT(binding == GL_DEPTH || binding == GL_STENCIL || binding == GL_DEPTH_STENCIL);
*rtOut = &mDepthStencilAttachment.renderTarget;
}
return angle::Result::Continue;
}
angle::Result WindowSurfaceWgpu::initializeImpl(const egl::Display *display)
{
DisplayWgpu *displayWgpu = webgpu::GetImpl(display);
wgpu::Adapter &adapter = displayWgpu->getAdapter();
ANGLE_TRY(createWgpuSurface(display, &mSurface));
gl::Extents size;
ANGLE_TRY(getCurrentWindowSize(display, &size));
wgpu::SurfaceCapabilities surfaceCapabilities;
wgpu::Status getCapabilitiesStatus = mSurface.GetCapabilities(adapter, &surfaceCapabilities);
if (getCapabilitiesStatus != wgpu::Status::Success)
{
ERR() << "wgpu::Surface::GetCapabilities failed: "
<< gl::FmtHex(static_cast<uint32_t>(getCapabilitiesStatus));
return angle::Result::Stop;
}
const egl::Config *config = mState.config;
ASSERT(config->renderTargetFormat != GL_NONE);
mSurfaceTextureFormat = &displayWgpu->getFormat(config->renderTargetFormat);
ASSERT(std::find(surfaceCapabilities.formats,
surfaceCapabilities.formats + surfaceCapabilities.formatCount,
mSurfaceTextureFormat->getActualWgpuTextureFormat()) !=
(surfaceCapabilities.formats + surfaceCapabilities.formatCount));
mSurfaceTextureUsage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::CopyDst;
ASSERT((surfaceCapabilities.usages & mSurfaceTextureUsage) == mSurfaceTextureUsage);
// Default to the always supported Fifo present mode. Use Mailbox if it's available.
mPresentMode = wgpu::PresentMode::Fifo;
for (size_t i = 0; i < surfaceCapabilities.presentModeCount; i++)
{
if (surfaceCapabilities.presentModes[i] == wgpu::PresentMode::Mailbox)
{
mPresentMode = wgpu::PresentMode::Mailbox;
}
}
if (config->depthStencilFormat != GL_NONE)
{
mDepthStencilFormat = &displayWgpu->getFormat(config->depthStencilFormat);
}
else
{
mDepthStencilFormat = nullptr;
}
ANGLE_TRY(configureSurface(display, size));
ANGLE_TRY(updateCurrentTexture(display));
return angle::Result::Continue;
}
angle::Result WindowSurfaceWgpu::swapImpl(const gl::Context *context)
{
const egl::Display *display = context->getDisplay();
ContextWgpu *contextWgpu = webgpu::GetImpl(context);
ANGLE_TRY(contextWgpu->flush(webgpu::RenderPassClosureReason::EGLSwapBuffers));
mSurface.Present();
gl::Extents size;
ANGLE_TRY(getCurrentWindowSize(display, &size));
if (size != mCurrentSurfaceSize)
{
ANGLE_TRY(configureSurface(display, size));
}
ANGLE_TRY(updateCurrentTexture(display));
return angle::Result::Continue;
}
angle::Result WindowSurfaceWgpu::configureSurface(const egl::Display *display,
const gl::Extents &size)
{
DisplayWgpu *displayWgpu = webgpu::GetImpl(display);
wgpu::Device &device = displayWgpu->getDevice();
ASSERT(mSurfaceTextureFormat != nullptr);
wgpu::SurfaceConfiguration surfaceConfig = {};
surfaceConfig.device = device;
surfaceConfig.format = mSurfaceTextureFormat->getActualWgpuTextureFormat();
surfaceConfig.usage = mSurfaceTextureUsage;
surfaceConfig.width = size.width;
surfaceConfig.height = size.height;
surfaceConfig.presentMode = mPresentMode;
mSurface.Configure(&surfaceConfig);
if (mDepthStencilFormat)
{
ANGLE_TRY(createDepthStencilAttachment(
static_cast<uint32_t>(size.width), static_cast<uint32_t>(size.height),
*mDepthStencilFormat, device, &mDepthStencilAttachment));
}
mCurrentSurfaceSize = size;
return angle::Result::Continue;
}
angle::Result WindowSurfaceWgpu::updateCurrentTexture(const egl::Display *display)
{
wgpu::SurfaceTexture texture;
mSurface.GetCurrentTexture(&texture);
if (texture.status != wgpu::SurfaceGetCurrentTextureStatus::SuccessOptimal &&
texture.status != wgpu::SurfaceGetCurrentTextureStatus::SuccessSuboptimal)
{
ERR() << "wgpu::Surface::GetCurrentTexture failed: "
<< gl::FmtHex(static_cast<uint32_t>(texture.status));
return angle::Result::Stop;
}
wgpu::TextureFormat wgpuFormat = texture.texture.GetFormat();
angle::FormatID angleFormat = webgpu::GetFormatIDFromWgpuTextureFormat(wgpuFormat);
ANGLE_TRY(mColorAttachment.texture.initExternal(angleFormat, angleFormat, texture.texture));
wgpu::TextureView view;
ANGLE_TRY(mColorAttachment.texture.createTextureView(gl::LevelIndex(0), 0, view));
mColorAttachment.renderTarget.set(&mColorAttachment.texture, view, webgpu::LevelIndex(0), 0,
wgpuFormat);
return angle::Result::Continue;
}
} // namespace rx