зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Don't store EGLSyncVk::mAttribs as a const ref.
EGLSyncVk::mAttribs is a stack allocated variable in the parent scope. Its usage is currently safe because it is only used in EGLSyncVk::initialize but it is dangerous to have this member present. Bug: angleproject:7637 Change-Id: Idaf2f1a0306e55a5fe00e55c9e72cd71005e3dce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3876889 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Родитель
5fae671c12
Коммит
313956f2b5
|
@ -476,7 +476,10 @@ angle::Result SyncVk::getStatus(const gl::Context *context, GLint *outResult)
|
|||
}
|
||||
|
||||
EGLSyncVk::EGLSyncVk(const egl::AttributeMap &attribs)
|
||||
: EGLSyncImpl(), mSyncHelper(nullptr), mAttribs(attribs)
|
||||
: EGLSyncImpl(),
|
||||
mSyncHelper(nullptr),
|
||||
mNativeFenceFD(
|
||||
attribs.getAsInt(EGL_SYNC_NATIVE_FENCE_FD_ANDROID, EGL_NO_NATIVE_FENCE_FD_ANDROID))
|
||||
{}
|
||||
|
||||
EGLSyncVk::~EGLSyncVk()
|
||||
|
@ -499,7 +502,6 @@ egl::Error EGLSyncVk::initialize(const egl::Display *display,
|
|||
switch (type)
|
||||
{
|
||||
case EGL_SYNC_FENCE_KHR:
|
||||
ASSERT(mAttribs.isEmpty());
|
||||
mSyncHelper = new vk::SyncHelper();
|
||||
if (mSyncHelper->initialize(vk::GetImpl(context), true) == angle::Result::Stop)
|
||||
{
|
||||
|
@ -510,9 +512,7 @@ egl::Error EGLSyncVk::initialize(const egl::Display *display,
|
|||
{
|
||||
vk::SyncHelperNativeFence *syncHelper = new vk::SyncHelperNativeFence();
|
||||
mSyncHelper = syncHelper;
|
||||
int nativeFd = static_cast<EGLint>(mAttribs.getAsInt(EGL_SYNC_NATIVE_FENCE_FD_ANDROID,
|
||||
EGL_NO_NATIVE_FENCE_FD_ANDROID));
|
||||
return angle::ToEGL(syncHelper->initializeWithFd(vk::GetImpl(context), nativeFd),
|
||||
return angle::ToEGL(syncHelper->initializeWithFd(vk::GetImpl(context), mNativeFenceFD),
|
||||
vk::GetImpl(display), EGL_BAD_ALLOC);
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -131,7 +131,7 @@ class EGLSyncVk final : public EGLSyncImpl
|
|||
private:
|
||||
EGLenum mType;
|
||||
vk::SyncHelper *mSyncHelper; // SyncHelper or SyncHelperNativeFence decided at run-time.
|
||||
const egl::AttributeMap &mAttribs;
|
||||
EGLint mNativeFenceFD;
|
||||
};
|
||||
} // namespace rx
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче