1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "include/private/GrVkTypesPriv.h"
9 
10 #include "src/gpu/GrBackendSurfaceMutableStateImpl.h"
11 #include "src/gpu/vk/GrVkImageLayout.h"
12 
cleanup()13 void GrVkBackendSurfaceInfo::cleanup() {};
14 
assign(const GrVkBackendSurfaceInfo & that,bool isThisValid)15 void GrVkBackendSurfaceInfo::assign(const GrVkBackendSurfaceInfo& that, bool isThisValid) {
16     fImageInfo = that.fImageInfo;
17 }
18 
snapImageInfo(const GrBackendSurfaceMutableStateImpl * mutableState) const19 GrVkImageInfo GrVkBackendSurfaceInfo::snapImageInfo(
20         const GrBackendSurfaceMutableStateImpl* mutableState) const {
21     SkASSERT(mutableState);
22     GrVkImageInfo newInfo = fImageInfo;
23     newInfo.fImageLayout = mutableState->getImageLayout();
24     newInfo.fCurrentQueueFamily = mutableState->getQueueFamilyIndex();
25     return newInfo;
26 }
27 
28 #if GR_TEST_UTILS
operator ==(const GrVkBackendSurfaceInfo & that) const29 bool GrVkBackendSurfaceInfo::operator==(const GrVkBackendSurfaceInfo& that) const {
30     GrVkImageInfo cpyInfoThis = fImageInfo;
31     GrVkImageInfo cpyInfoThat = that.fImageInfo;
32     // We don't care about the fImageLayout or fCurrentQueueFamily here since we require they use
33     // the same mutableState.
34     cpyInfoThis.fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
35     cpyInfoThat.fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
36     cpyInfoThis.fCurrentQueueFamily = VK_QUEUE_FAMILY_IGNORED;
37     cpyInfoThat.fCurrentQueueFamily = VK_QUEUE_FAMILY_IGNORED;
38     return cpyInfoThis == cpyInfoThat;
39 }
40 #endif
41