| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 REPORTER_ASSERT(reporter, tex->height() == texProxy->height()); | 69 REPORTER_ASSERT(reporter, tex->height() == texProxy->height()); |
| 70 } else { | 70 } else { |
| 71 REPORTER_ASSERT(reporter, tex->width() >= texProxy->width()); | 71 REPORTER_ASSERT(reporter, tex->width() >= texProxy->width()); |
| 72 REPORTER_ASSERT(reporter, tex->height() >= texProxy->height()); | 72 REPORTER_ASSERT(reporter, tex->height() >= texProxy->height()); |
| 73 } | 73 } |
| 74 REPORTER_ASSERT(reporter, tex->config() == texProxy->config()); | 74 REPORTER_ASSERT(reporter, tex->config() == texProxy->config()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { | 78 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { |
| 79 GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider(); | 79 GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); |
| 80 | 80 |
| 81 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }
) { | 81 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }
) { |
| 82 for (auto widthHeight : { 100, 128 }) { | 82 for (auto widthHeight : { 100, 128 }) { |
| 83 for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfi
g }) { | 83 for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfi
g }) { |
| 84 for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox })
{ | 84 for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox })
{ |
| 85 for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo })
{ | 85 for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo })
{ |
| 86 for (auto numSamples : { 0, 4}) { | 86 for (auto numSamples : { 0, 4}) { |
| 87 bool renderable = ctxInfo.fGrContext->caps()->isConf
igRenderable( | 87 bool renderable = ctxInfo.grContext()->caps()->isCon
figRenderable( |
| 88 config, nu
mSamples > 0) && | 88 config, nu
mSamples > 0) && |
| 89 numSamples <= ctxInfo.fGrContext->caps()->maxC
olorSampleCount(); | 89 numSamples <= ctxInfo.grContext()->caps()->max
ColorSampleCount(); |
| 90 | 90 |
| 91 GrSurfaceDesc desc; | 91 GrSurfaceDesc desc; |
| 92 desc.fOrigin = origin; | 92 desc.fOrigin = origin; |
| 93 desc.fWidth = widthHeight; | 93 desc.fWidth = widthHeight; |
| 94 desc.fHeight = widthHeight; | 94 desc.fHeight = widthHeight; |
| 95 desc.fConfig = config; | 95 desc.fConfig = config; |
| 96 desc.fSampleCnt = numSamples; | 96 desc.fSampleCnt = numSamples; |
| 97 | 97 |
| 98 if (renderable) { | 98 if (renderable) { |
| 99 sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTarge
tProxy::Make( | 99 sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTarge
tProxy::Make( |
| 100 *ctxInfo.fGr
Context->caps(), | 100 *ctxInfo.grC
ontext()->caps(), |
| 101 desc, | 101 desc, |
| 102 fit, | 102 fit, |
| 103 budgeted)); | 103 budgeted)); |
| 104 check_surface(reporter, rtProxy.get(), origin, | 104 check_surface(reporter, rtProxy.get(), origin, |
| 105 widthHeight, widthHeight, config); | 105 widthHeight, widthHeight, config); |
| 106 check_rendertarget(reporter, provider, rtProxy.g
et(), fit); | 106 check_rendertarget(reporter, provider, rtProxy.g
et(), fit); |
| 107 } | 107 } |
| 108 | 108 |
| 109 desc.fSampleCnt = 0; | 109 desc.fSampleCnt = 0; |
| 110 | 110 |
| 111 sk_sp<GrTextureProxy> texProxy(GrTextureProxy::Make(
desc, | 111 sk_sp<GrTextureProxy> texProxy(GrTextureProxy::Make(
desc, |
| 112
fit, | 112
fit, |
| 113
budgeted)); | 113
budgeted)); |
| 114 check_surface(reporter, texProxy.get(), origin, | 114 check_surface(reporter, texProxy.get(), origin, |
| 115 widthHeight, widthHeight, config); | 115 widthHeight, widthHeight, config); |
| 116 check_texture(reporter, provider, texProxy.get(), fi
t); | 116 check_texture(reporter, provider, texProxy.get(), fi
t); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { | 125 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { |
| 126 GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider(); | 126 GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); |
| 127 | 127 |
| 128 static const int kWidthHeight = 100; | 128 static const int kWidthHeight = 100; |
| 129 | 129 |
| 130 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }
) { | 130 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }
) { |
| 131 for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig })
{ | 131 for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig })
{ |
| 132 for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { | 132 for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { |
| 133 for (auto numSamples: { 0, 4}) { | 133 for (auto numSamples: { 0, 4}) { |
| 134 bool renderable = ctxInfo.fGrContext->caps()->isConfigRender
able( | 134 bool renderable = ctxInfo.grContext()->caps()->isConfigRende
rable( |
| 135 config, numSampl
es > 0); | 135 config, numSampl
es > 0); |
| 136 | 136 |
| 137 GrSurfaceDesc desc; | 137 GrSurfaceDesc desc; |
| 138 desc.fOrigin = origin; | 138 desc.fOrigin = origin; |
| 139 desc.fWidth = kWidthHeight; | 139 desc.fWidth = kWidthHeight; |
| 140 desc.fHeight = kWidthHeight; | 140 desc.fHeight = kWidthHeight; |
| 141 desc.fConfig = config; | 141 desc.fConfig = config; |
| 142 desc.fSampleCnt = numSamples; | 142 desc.fSampleCnt = numSamples; |
| 143 | 143 |
| 144 sk_sp<GrTexture> tex; | 144 sk_sp<GrTexture> tex; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 164 check_surface(reporter, texProxy.get(), origin, | 164 check_surface(reporter, texProxy.get(), origin, |
| 165 kWidthHeight, kWidthHeight, config); | 165 kWidthHeight, kWidthHeight, config); |
| 166 check_texture(reporter, provider, texProxy.get(), SkBackingF
it::kExact); | 166 check_texture(reporter, provider, texProxy.get(), SkBackingF
it::kExact); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 #endif | 173 #endif |
| OLD | NEW |