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 "GrVkPipelineState.h" | 8 #include "GrVkPipelineState.h" |
9 | 9 |
10 #include "GrPipeline.h" | 10 #include "GrPipeline.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 const GrVkImage::Resource* textureResource = texture->resource(); | 306 const GrVkImage::Resource* textureResource = texture->resource(); |
307 textureResource->ref(); | 307 textureResource->ref(); |
308 fTextures.push(textureResource); | 308 fTextures.push(textureResource); |
309 | 309 |
310 const GrVkImageView* textureView = texture->textureView(); | 310 const GrVkImageView* textureView = texture->textureView(); |
311 textureView->ref(); | 311 textureView->ref(); |
312 fTextureViews.push(textureView); | 312 fTextureViews.push(textureView); |
313 | 313 |
314 // Change texture layout so it can be read in shader | 314 // Change texture layout so it can be read in shader |
315 VkImageLayout layout = texture->currentLayout(); | |
316 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFla
gs(layout); | |
317 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT; | |
318 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); | |
319 VkAccessFlags dstAccessMask = VK_ACCESS_SHADER_READ_BIT; | |
320 texture->setImageLayout(gpu, | 315 texture->setImageLayout(gpu, |
321 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | 316 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, |
322 srcAccessMask, | 317 VK_ACCESS_SHADER_READ_BIT, |
323 dstAccessMask, | 318 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, |
324 srcStageMask, | |
325 dstStageMask, | |
326 false); | 319 false); |
327 | 320 |
328 VkDescriptorImageInfo imageInfo; | 321 VkDescriptorImageInfo imageInfo; |
329 memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo)); | 322 memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo)); |
330 imageInfo.sampler = fSamplers[i]->sampler(); | 323 imageInfo.sampler = fSamplers[i]->sampler(); |
331 imageInfo.imageView = texture->textureView()->imageView(); | 324 imageInfo.imageView = texture->textureView()->imageView(); |
332 imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; | 325 imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; |
333 | 326 |
334 VkWriteDescriptorSet writeInfo; | 327 VkWriteDescriptorSet writeInfo; |
335 memset(&writeInfo, 0, sizeof(VkWriteDescriptorSet)); | 328 memset(&writeInfo, 0, sizeof(VkWriteDescriptorSet)); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 503 |
511 b.add32(get_blend_info_key(pipeline)); | 504 b.add32(get_blend_info_key(pipeline)); |
512 | 505 |
513 b.add32(primitiveType); | 506 b.add32(primitiveType); |
514 | 507 |
515 // Set key length | 508 // Set key length |
516 int keyLength = key->count(); | 509 int keyLength = key->count(); |
517 SkASSERT(0 == (keyLength % 4)); | 510 SkASSERT(0 == (keyLength % 4)); |
518 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); | 511 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); |
519 } | 512 } |
OLD | NEW |