Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tests/VkWrapTests.cpp

Issue 2352173002: Fix VkWrapTests (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 // This is a GPU-backend specific test. It relies on static intializers to work 8 // This is a GPU-backend specific test. It relies on static intializers to work
9 9
10 #include "SkTypes.h" 10 #include "SkTypes.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 GrVkImageInfo backendCopy = *backendTex; 47 GrVkImageInfo backendCopy = *backendTex;
48 backendCopy.fImage = VK_NULL_HANDLE; 48 backendCopy.fImage = VK_NULL_HANDLE;
49 desc.fTextureHandle = (GrBackendObject) &backendCopy; 49 desc.fTextureHandle = (GrBackendObject) &backendCopy;
50 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership); 50 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
51 REPORTER_ASSERT(reporter, !tex); 51 REPORTER_ASSERT(reporter, !tex);
52 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership); 52 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
53 REPORTER_ASSERT(reporter, !tex); 53 REPORTER_ASSERT(reporter, !tex);
54 54
55 // alloc is null 55 // alloc is null
56 backendCopy.fImage = backendTex->fImage; 56 backendCopy.fImage = backendTex->fImage;
57 backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0 }; 57 backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
58 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership); 58 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
59 REPORTER_ASSERT(reporter, !tex); 59 REPORTER_ASSERT(reporter, !tex);
60 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership); 60 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
61 REPORTER_ASSERT(reporter, !tex); 61 REPORTER_ASSERT(reporter, !tex);
62 62
63 // check adopt creation 63 // check adopt creation
64 backendCopy.fAlloc = backendTex->fAlloc; 64 backendCopy.fAlloc = backendTex->fAlloc;
65 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership); 65 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
66 REPORTER_ASSERT(reporter, tex); 66 REPORTER_ASSERT(reporter, tex);
67 tex->unref(); 67 tex->unref();
(...skipping 25 matching lines...) Expand all
93 GrVkImageInfo backendCopy = *backendTex; 93 GrVkImageInfo backendCopy = *backendTex;
94 backendCopy.fImage = VK_NULL_HANDLE; 94 backendCopy.fImage = VK_NULL_HANDLE;
95 desc.fRenderTargetHandle = (GrBackendObject)&backendCopy; 95 desc.fRenderTargetHandle = (GrBackendObject)&backendCopy;
96 rt = gpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership); 96 rt = gpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
97 REPORTER_ASSERT(reporter, !rt); 97 REPORTER_ASSERT(reporter, !rt);
98 rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership); 98 rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership);
99 REPORTER_ASSERT(reporter, !rt); 99 REPORTER_ASSERT(reporter, !rt);
100 100
101 // alloc is null 101 // alloc is null
102 backendCopy.fImage = backendTex->fImage; 102 backendCopy.fImage = backendTex->fImage;
103 backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0 }; 103 backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
104 // can wrap null alloc if borrowing 104 // can wrap null alloc if borrowing
105 rt = gpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership); 105 rt = gpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
106 REPORTER_ASSERT(reporter, rt); 106 REPORTER_ASSERT(reporter, rt);
107 // but not if adopting 107 // but not if adopting
108 rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership); 108 rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership);
109 REPORTER_ASSERT(reporter, !rt); 109 REPORTER_ASSERT(reporter, !rt);
110 110
111 // check adopt creation 111 // check adopt creation
112 backendCopy.fAlloc = backendTex->fAlloc; 112 backendCopy.fAlloc = backendTex->fAlloc;
113 rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership); 113 rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership);
(...skipping 25 matching lines...) Expand all
139 GrVkImageInfo backendCopy = *backendTex; 139 GrVkImageInfo backendCopy = *backendTex;
140 backendCopy.fImage = VK_NULL_HANDLE; 140 backendCopy.fImage = VK_NULL_HANDLE;
141 desc.fTextureHandle = (GrBackendObject)&backendCopy; 141 desc.fTextureHandle = (GrBackendObject)&backendCopy;
142 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership); 142 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
143 REPORTER_ASSERT(reporter, !tex); 143 REPORTER_ASSERT(reporter, !tex);
144 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership); 144 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
145 REPORTER_ASSERT(reporter, !tex); 145 REPORTER_ASSERT(reporter, !tex);
146 146
147 // alloc is null 147 // alloc is null
148 backendCopy.fImage = backendTex->fImage; 148 backendCopy.fImage = backendTex->fImage;
149 backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0 }; 149 backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
150 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership); 150 tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
151 REPORTER_ASSERT(reporter, !tex); 151 REPORTER_ASSERT(reporter, !tex);
152 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership); 152 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
153 REPORTER_ASSERT(reporter, !tex); 153 REPORTER_ASSERT(reporter, !tex);
154 154
155 // check adopt creation 155 // check adopt creation
156 backendCopy.fAlloc = backendTex->fAlloc; 156 backendCopy.fAlloc = backendTex->fAlloc;
157 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership); 157 tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
158 REPORTER_ASSERT(reporter, tex); 158 REPORTER_ASSERT(reporter, tex);
159 tex->unref(); 159 tex->unref();
160 160
161 gpu->deleteTestingOnlyBackendTexture(backendObj, true); 161 gpu->deleteTestingOnlyBackendTexture(backendObj, true);
162 } 162 }
163 163
164 DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkWrapTests, reporter, ctxInfo) { 164 DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkWrapTests, reporter, ctxInfo) {
165 wrap_tex_test(reporter, ctxInfo.grContext()); 165 wrap_tex_test(reporter, ctxInfo.grContext());
166 wrap_rt_test(reporter, ctxInfo.grContext()); 166 wrap_rt_test(reporter, ctxInfo.grContext());
167 wrap_trt_test(reporter, ctxInfo.grContext()); 167 wrap_trt_test(reporter, ctxInfo.grContext());
168 } 168 }
169 169
170 #endif 170 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698