OLD | NEW |
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. | 8 // This is a GPU-backend specific test. |
9 | 9 |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 backendDesc.fHeight = kWidthHeight; | 155 backendDesc.fHeight = kWidthHeight; |
156 backendDesc.fConfig = config; | 156 backendDesc.fConfig = config; |
157 backendDesc.fOrigin = origin; | 157 backendDesc.fOrigin = origin; |
158 backendDesc.fSampleCnt = numSamples; | 158 backendDesc.fSampleCnt = numSamples; |
159 backendDesc.fStencilBits = 8; | 159 backendDesc.fStencilBits = 8; |
160 backendDesc.fRenderTargetHandle = 0; | 160 backendDesc.fRenderTargetHandle = 0; |
161 | 161 |
162 GrGpu* gpu = ctxInfo.grContext()->getGpu(); | 162 GrGpu* gpu = ctxInfo.grContext()->getGpu(); |
163 sk_sp<GrRenderTarget> defaultFBO( | 163 sk_sp<GrRenderTarget> defaultFBO( |
164 gpu->wrapBackendRenderTarget(backendDesc, kBorrow_Gr
WrapOwnership)); | 164 gpu->wrapBackendRenderTarget(backendDesc, kBorrow_Gr
WrapOwnership)); |
165 REPORTER_ASSERT(reporter, | 165 SkASSERT(!defaultFBO->renderTargetPriv().supportsWindowR
ectangles()); |
166 !defaultFBO->renderTargetPriv().maxWindo
wRectangles()); | |
167 | 166 |
168 sk_sp<GrRenderTargetProxy> rtProxy( | 167 sk_sp<GrRenderTargetProxy> rtProxy( |
169 GrRenderTargetProxy::Make(caps, defaultFBO)); | 168 GrRenderTargetProxy::Make(caps, defaultFBO)); |
170 check_surface(reporter, rtProxy.get(), origin, | 169 check_surface(reporter, rtProxy.get(), origin, |
171 kWidthHeight, kWidthHeight, config, defaul
tFBO->uniqueID()); | 170 kWidthHeight, kWidthHeight, config, defaul
tFBO->uniqueID()); |
172 check_rendertarget(reporter, provider, rtProxy.get(), Sk
BackingFit::kExact); | 171 check_rendertarget(reporter, provider, rtProxy.get(), Sk
BackingFit::kExact); |
173 } | 172 } |
174 | 173 |
175 sk_sp<GrTexture> tex; | 174 sk_sp<GrTexture> tex; |
176 | 175 |
177 // Internal offscreen render target. | 176 // Internal offscreen render target. |
178 if (renderable) { | 177 if (renderable) { |
179 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 178 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
180 tex.reset(provider->createTexture(desc, budgeted)); | 179 tex.reset(provider->createTexture(desc, budgeted)); |
181 sk_sp<GrRenderTarget> rt(sk_ref_sp(tex->asRenderTarget()
)); | 180 sk_sp<GrRenderTarget> rt(sk_ref_sp(tex->asRenderTarget()
)); |
182 REPORTER_ASSERT(reporter, | 181 SkASSERT(caps.maxWindowRectangles() <= 0 || |
183 caps.maxWindowRectangles() == | 182 rt->renderTargetPriv().supportsWindowRectangles(
)); |
184 rt->renderTargetPriv().maxWindowRectangl
es()); | |
185 | 183 |
186 sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::
Make(caps, rt)); | 184 sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::
Make(caps, rt)); |
187 check_surface(reporter, rtProxy.get(), origin, | 185 check_surface(reporter, rtProxy.get(), origin, |
188 kWidthHeight, kWidthHeight, config, rt->un
iqueID()); | 186 kWidthHeight, kWidthHeight, config, rt->un
iqueID()); |
189 check_rendertarget(reporter, provider, rtProxy.get(), Sk
BackingFit::kExact); | 187 check_rendertarget(reporter, provider, rtProxy.get(), Sk
BackingFit::kExact); |
190 } | 188 } |
191 | 189 |
192 if (!tex) { | 190 if (!tex) { |
193 SkASSERT(kNone_GrSurfaceFlags == desc.fFlags ); | 191 SkASSERT(kNone_GrSurfaceFlags == desc.fFlags ); |
194 desc.fSampleCnt = 0; | 192 desc.fSampleCnt = 0; |
195 tex.reset(provider->createTexture(desc, budgeted)); | 193 tex.reset(provider->createTexture(desc, budgeted)); |
196 } | 194 } |
197 | 195 |
198 sk_sp<GrTextureProxy> texProxy(GrTextureProxy::Make(tex)); | 196 sk_sp<GrTextureProxy> texProxy(GrTextureProxy::Make(tex)); |
199 check_surface(reporter, texProxy.get(), origin, | 197 check_surface(reporter, texProxy.get(), origin, |
200 kWidthHeight, kWidthHeight, config, tex->uniqu
eID()); | 198 kWidthHeight, kWidthHeight, config, tex->uniqu
eID()); |
201 check_texture(reporter, provider, texProxy.get(), SkBackingF
it::kExact); | 199 check_texture(reporter, provider, texProxy.get(), SkBackingF
it::kExact); |
202 } | 200 } |
203 } | 201 } |
204 } | 202 } |
205 } | 203 } |
206 } | 204 } |
207 | 205 |
208 #endif | 206 #endif |
OLD | NEW |