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

Side by Side Diff: tests/VkClearTests.cpp

Issue 2078483002: Start using GrGpuCommandBuffer in GrDrawTarget. (Closed) Base URL: https://skia.googlesource.com/skia.git@memoryWAR
Patch Set: remove errant lines Created 4 years, 5 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 | « src/gpu/vk/GrVkResourceProvider.cpp ('k') | tests/VkUploadPixelsTests.cpp » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 30 matching lines...) Expand all
41 for (int i = 0; i < width; ++i) { 41 for (int i = 0; i < width; ++i) {
42 if (buffer[j * width + i] != matchColor) { 42 if (buffer[j * width + i] != matchColor) {
43 return false; 43 return false;
44 } 44 }
45 } 45 }
46 } 46 }
47 return true; 47 return true;
48 } 48 }
49 49
50 void basic_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelC onfig config) { 50 void basic_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelC onfig config) {
51 #if 0
51 GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu()); 52 GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
52 gpu->discard(NULL);
53 SkAutoTMalloc<GrColor> buffer(25); 53 SkAutoTMalloc<GrColor> buffer(25);
54 54
55 GrSurfaceDesc surfDesc; 55 GrSurfaceDesc surfDesc;
56 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag; 56 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
57 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; 57 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
58 surfDesc.fWidth = 5; 58 surfDesc.fWidth = 5;
59 surfDesc.fHeight = 5; 59 surfDesc.fHeight = 5;
60 surfDesc.fConfig = config; 60 surfDesc.fConfig = config;
61 surfDesc.fSampleCnt = 0; 61 surfDesc.fSampleCnt = 0;
62 GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); 62 GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo);
(...skipping 25 matching lines...) Expand all
88 88
89 gpu->clear(rect, myColor, tex->asRenderTarget()); 89 gpu->clear(rect, myColor, tex->asRenderTarget());
90 90
91 gpu->readPixels(tex, 0, 0, 5, 5, config, (void*)buffer.get(), 0); 91 gpu->readPixels(tex, 0, 0, 5, 5, config, (void*)buffer.get(), 0);
92 92
93 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(buffer.get( ), 93 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(buffer.get( ),
94 myColor, 94 myColor,
95 config, 95 config,
96 5, 96 5,
97 5)); 97 5));
98 #endif
98 } 99 }
99 100
100 void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon fig config) { 101 void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon fig config) {
102 #if 0
101 const int width = 10; 103 const int width = 10;
102 const int height = 10; 104 const int height = 10;
103 const int subWidth = width/2; 105 const int subWidth = width/2;
104 const int subHeight = height/2; 106 const int subHeight = height/2;
105 GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu()); 107 GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
106 gpu->discard(NULL);
107 SkAutoTMalloc<GrColor> buffer(width * height); 108 SkAutoTMalloc<GrColor> buffer(width * height);
108 SkAutoTMalloc<GrColor> subBuffer(subWidth * subHeight); 109 SkAutoTMalloc<GrColor> subBuffer(subWidth * subHeight);
109 110
110 GrSurfaceDesc surfDesc; 111 GrSurfaceDesc surfDesc;
111 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag; 112 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
112 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; 113 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
113 surfDesc.fWidth = width; 114 surfDesc.fWidth = width;
114 surfDesc.fHeight = height; 115 surfDesc.fHeight = height;
115 surfDesc.fConfig = config; 116 surfDesc.fConfig = config;
116 surfDesc.fSampleCnt = 0; 117 surfDesc.fSampleCnt = 0;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 config, 188 config,
188 subWidth, 189 subWidth,
189 subHeight)) ; 190 subHeight)) ;
190 gpu->readPixels(tex, subWidth, subHeight, subWidth, subHeight, 191 gpu->readPixels(tex, subWidth, subHeight, subWidth, subHeight,
191 config, (void*)subBuffer.get(), 0); 192 config, (void*)subBuffer.get(), 0);
192 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(subBuffer.g et(), 193 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(subBuffer.g et(),
193 subColor4, 194 subColor4,
194 config, 195 config,
195 subWidth, 196 subWidth,
196 subHeight)) ; 197 subHeight)) ;
198 #endif
197 } 199 }
198 200
199 DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkClearTests, reporter, ctxInfo) { 201 DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkClearTests, reporter, ctxInfo) {
200 basic_clear_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig); 202 basic_clear_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig);
201 basic_clear_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig); 203 basic_clear_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig);
202 sub_clear_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig); 204 sub_clear_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig);
203 sub_clear_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig); 205 sub_clear_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig);
204 } 206 }
205 207
206 #endif 208 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkResourceProvider.cpp ('k') | tests/VkUploadPixelsTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698