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 #include "GrVkGpuCommandBuffer.h" | 8 #include "GrVkGpuCommandBuffer.h" |
9 | 9 |
10 #include "GrMesh.h" | 10 #include "GrMesh.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 static void append_sampled_images(const GrProcessor& processor, | 339 static void append_sampled_images(const GrProcessor& processor, |
340 GrVkGpu* gpu, | 340 GrVkGpu* gpu, |
341 SkTArray<GrVkImage*>* sampledImages) { | 341 SkTArray<GrVkImage*>* sampledImages) { |
342 if (int numTextures = processor.numTextures()) { | 342 if (int numTextures = processor.numTextures()) { |
343 GrVkImage** images = sampledImages->push_back_n(numTextures); | 343 GrVkImage** images = sampledImages->push_back_n(numTextures); |
344 int i = 0; | 344 int i = 0; |
345 do { | 345 do { |
346 const GrTextureAccess& texAccess = processor.textureAccess(i); | 346 const GrTextureAccess& texAccess = processor.textureAccess(i); |
347 GrVkTexture* vkTexture = static_cast<GrVkTexture*>(processor.texture
(i)); | 347 GrVkTexture* vkTexture = static_cast<GrVkTexture*>(processor.texture
(i)); |
348 SkASSERT(vkTexture); | 348 SkASSERT(vkTexture); |
| 349 |
| 350 // We may need to resolve the texture first if it is also a render t
arget |
| 351 GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(vkTexture->
asRenderTarget()); |
| 352 if (texRT) { |
| 353 gpu->onResolveRenderTarget(texRT); |
| 354 } |
| 355 |
349 const GrTextureParams& params = texAccess.getParams(); | 356 const GrTextureParams& params = texAccess.getParams(); |
350 // Check if we need to regenerate any mip maps | 357 // Check if we need to regenerate any mip maps |
351 if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) { | 358 if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) { |
352 if (vkTexture->texturePriv().mipMapsAreDirty()) { | 359 if (vkTexture->texturePriv().mipMapsAreDirty()) { |
353 gpu->generateMipmap(vkTexture); | 360 gpu->generateMipmap(vkTexture); |
354 vkTexture->texturePriv().dirtyMipMaps(false); | 361 vkTexture->texturePriv().dirtyMipMaps(false); |
355 } | 362 } |
356 } | 363 } |
357 | 364 |
358 images[i] = vkTexture; | 365 images[i] = vkTexture; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 fGpu->stats()->incNumDraws(); | 437 fGpu->stats()->incNumDraws(); |
431 } while ((nonIdxMesh = iter.next())); | 438 } while ((nonIdxMesh = iter.next())); |
432 } | 439 } |
433 | 440 |
434 // Technically we don't have to call this here (since there is a safety chec
k in | 441 // Technically we don't have to call this here (since there is a safety chec
k in |
435 // pipelineState:setData but this will allow for quicker freeing of resource
s if the | 442 // pipelineState:setData but this will allow for quicker freeing of resource
s if the |
436 // pipelineState sits in a cache for a while. | 443 // pipelineState sits in a cache for a while. |
437 pipelineState->freeTempResources(fGpu); | 444 pipelineState->freeTempResources(fGpu); |
438 } | 445 } |
439 | 446 |
OLD | NEW |