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

Side by Side Diff: src/gpu/vk/GrVkPipelineState.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, 6 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/GrVkGpuCommandBuffer.cpp ('k') | src/gpu/vk/GrVkResourceProvider.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 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 void GrVkPipelineState::writeSamplers(GrVkGpu* gpu, 288 void GrVkPipelineState::writeSamplers(GrVkGpu* gpu,
289 const SkTArray<const GrTextureAccess*>& te xtureBindings, 289 const SkTArray<const GrTextureAccess*>& te xtureBindings,
290 bool allowSRGBInputs) { 290 bool allowSRGBInputs) {
291 SkASSERT(fNumSamplers == textureBindings.count()); 291 SkASSERT(fNumSamplers == textureBindings.count());
292 292
293 for (int i = 0; i < textureBindings.count(); ++i) { 293 for (int i = 0; i < textureBindings.count(); ++i) {
294 const GrTextureParams& params = textureBindings[i]->getParams(); 294 const GrTextureParams& params = textureBindings[i]->getParams();
295 295
296 GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->get Texture()); 296 GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->get Texture());
297 if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) {
298 if (texture->texturePriv().mipMapsAreDirty()) {
299 gpu->generateMipmap(texture);
300 texture->texturePriv().dirtyMipMaps(false);
301 }
302 }
303 297
304 fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(par ams, 298 fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(par ams,
305 texture->texturePriv() .maxMipMapLevel())); 299 texture->texturePriv() .maxMipMapLevel()));
306 300
307 const GrVkResource* textureResource = texture->resource(); 301 const GrVkResource* textureResource = texture->resource();
308 textureResource->ref(); 302 textureResource->ref();
309 fTextures.push(textureResource); 303 fTextures.push(textureResource);
310 304
311 const GrVkImageView* textureView = texture->textureView(allowSRGBInputs) ; 305 const GrVkImageView* textureView = texture->textureView(allowSRGBInputs) ;
312 textureView->ref(); 306 textureView->ref();
313 fTextureViews.push(textureView); 307 fTextureViews.push(textureView);
314 308
315 // Change texture layout so it can be read in shader
316 texture->setImageLayout(gpu,
317 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
318 VK_ACCESS_SHADER_READ_BIT,
319 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
320 false);
321
322 VkDescriptorImageInfo imageInfo; 309 VkDescriptorImageInfo imageInfo;
323 memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo)); 310 memset(&imageInfo, 0, sizeof(VkDescriptorImageInfo));
324 imageInfo.sampler = fSamplers[i]->sampler(); 311 imageInfo.sampler = fSamplers[i]->sampler();
325 imageInfo.imageView = textureView->imageView(); 312 imageInfo.imageView = textureView->imageView();
326 imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; 313 imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
327 314
328 VkWriteDescriptorSet writeInfo; 315 VkWriteDescriptorSet writeInfo;
329 memset(&writeInfo, 0, sizeof(VkWriteDescriptorSet)); 316 memset(&writeInfo, 0, sizeof(VkWriteDescriptorSet));
330 writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; 317 writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
331 writeInfo.pNext = nullptr; 318 writeInfo.pNext = nullptr;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 491
505 b.add32(get_blend_info_key(pipeline)); 492 b.add32(get_blend_info_key(pipeline));
506 493
507 b.add32(primitiveType); 494 b.add32(primitiveType);
508 495
509 // Set key length 496 // Set key length
510 int keyLength = key->count(); 497 int keyLength = key->count();
511 SkASSERT(0 == (keyLength % 4)); 498 SkASSERT(0 == (keyLength % 4));
512 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); 499 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
513 } 500 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpuCommandBuffer.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698