Hash :
3e52318c
Author :
Date :
2025-06-26T10:46:00
Vulkan: Ensure always using resolved Window Surface size `WindowSurfaceVk::getWidth/Height()` methods return cached, previously resolved Surface size. Using these methods while current Window Surface size is unresolved may return stale values, causing undesired behavior. Appropriate ASSERTs were added to these methods to prevent such usage. Added ASSERTs revealed few places with incorrect usage: - In `Context::makeCurrent()` to set initial viewport or for capture. - In `IsPartialBlit()` and `ValidateReadPixelsBase()` validations. - In `SerializeFramebufferAttachment()` during capture. Rest of the code was thoroughly checked if it is possible to call `WindowSurfaceVk::getWidth/Height()` when size is unresolved. All other places always call these methods after framebuffer state synchronization, which acquires swapchain images and resolves the surface size. Added `ensureSizeResolved()` method that is called during validation and in the `SerializeFramebufferAttachment()` method. It is possible to use existing `Framebuffer::syncState()` method as alternative, but this solution was discarded since it may potentially interfere with `State::syncDirtyObjects()` method. The `Surface::getUserSize()` replaces old methods as optimization, to prevent calling relatively expensive method twice from `Context::makeCurrent()` to get width and height of the `drawSurface`. Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeBeforeMakeCurrent/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeBeforeMakeCurrentPostSizeQuery/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeAndReadPixelsRobustANGLE/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeAndBlitFramebufferANGLE/* Bug: angleproject:397848903 Change-Id: I082e13d0b8db5fd7d08ff25b102df1f283e1256d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6792928 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@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
//
// Copyright 2019 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.
//
// FrameCapture_mock.cpp:
// ANGLE mock Frame capture implementation.
//
#include "libANGLE/capture/FrameCapture.h"
#if ANGLE_CAPTURE_ENABLED
# error Frame capture must be disabled to include this file.
#endif // ANGLE_CAPTURE_ENABLED
namespace angle
{
CallCapture::~CallCapture() {}
ParamBuffer::~ParamBuffer() {}
ParamCapture::~ParamCapture() {}
ResourceTracker::ResourceTracker() {}
ResourceTracker::~ResourceTracker() {}
#ifdef ANGLE_ENABLE_CL
ResourceTrackerCL::ResourceTrackerCL() {}
ResourceTrackerCL::~ResourceTrackerCL() {}
#endif
TrackedResource::TrackedResource() {}
TrackedResource::~TrackedResource() {}
StateResetHelper::StateResetHelper() {}
StateResetHelper::~StateResetHelper() {}
DataTracker::DataTracker() {}
DataTracker::~DataTracker() {}
DataCounters::DataCounters() {}
DataCounters::~DataCounters() {}
StringCounters::StringCounters() {}
StringCounters::~StringCounters() {}
ReplayWriter::ReplayWriter() {}
ReplayWriter::~ReplayWriter() {}
FrameCapture::FrameCapture() {}
FrameCapture::~FrameCapture() {}
FrameCaptureShared::FrameCaptureShared() : mEnabled(false) {}
FrameCaptureShared::~FrameCaptureShared() {}
void FrameCaptureShared::onEndFrame(gl::Context *context) {}
void FrameCaptureShared::onMakeCurrent(const gl::Context *context,
const egl::Surface *drawSurface,
EGLint surfaceWidth,
EGLint surfaceHeight)
{}
void FrameCaptureShared::onDestroyContext(const gl::Context *context) {}
void *FrameCaptureShared::maybeGetShadowMemoryPointer(gl::Buffer *buffer,
GLsizeiptr length,
GLbitfield access)
{
return buffer->getMapPointer();
}
void FrameCaptureShared::determineMemoryProtectionSupport(gl::Context *context) {}
const ProgramSources &FrameCaptureShared::getProgramSources(gl::ShaderProgramID id) const
{
const auto &foundSources = mCachedProgramSources.find(id);
return foundSources->second;
}
void FrameCaptureShared::setProgramSources(gl::ShaderProgramID id, ProgramSources sources) {}
CoherentBufferTracker::CoherentBufferTracker() {}
CoherentBufferTracker::~CoherentBufferTracker() {}
} // namespace angle