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

Side by Side Diff: src/gpu/vk/GrVkPipelineState.cpp

Issue 1916563002: Add automatic generation of mipmaps to Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 8 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/GrVkImageView.cpp ('k') | src/gpu/vk/GrVkRenderTarget.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"
11 #include "GrTexturePriv.h"
11 #include "GrVkCommandBuffer.h" 12 #include "GrVkCommandBuffer.h"
12 #include "GrVkDescriptorPool.h" 13 #include "GrVkDescriptorPool.h"
13 #include "GrVkGpu.h" 14 #include "GrVkGpu.h"
14 #include "GrVkImageView.h" 15 #include "GrVkImageView.h"
15 #include "GrVkMemory.h" 16 #include "GrVkMemory.h"
16 #include "GrVkPipeline.h" 17 #include "GrVkPipeline.h"
17 #include "GrVkRenderTarget.h" 18 #include "GrVkRenderTarget.h"
18 #include "GrVkSampler.h" 19 #include "GrVkSampler.h"
19 #include "GrVkTexture.h" 20 #include "GrVkTexture.h"
20 #include "GrVkUniformBuffer.h" 21 #include "GrVkUniformBuffer.h"
21 #include "glsl/GrGLSLFragmentProcessor.h" 22 #include "glsl/GrGLSLFragmentProcessor.h"
22 #include "glsl/GrGLSLGeometryProcessor.h" 23 #include "glsl/GrGLSLGeometryProcessor.h"
23 #include "glsl/GrGLSLXferProcessor.h" 24 #include "glsl/GrGLSLXferProcessor.h"
25 #include "SkMipmap.h"
24 26
25 GrVkPipelineState::GrVkPipelineState(GrVkGpu* gpu, 27 GrVkPipelineState::GrVkPipelineState(GrVkGpu* gpu,
26 const GrVkPipelineState::Desc& desc, 28 const GrVkPipelineState::Desc& desc,
27 GrVkPipeline* pipeline, 29 GrVkPipeline* pipeline,
28 VkPipelineLayout layout, 30 VkPipelineLayout layout,
29 VkDescriptorSetLayout dsLayout[2], 31 VkDescriptorSetLayout dsLayout[2],
30 const BuiltinUniformHandles& builtinUniform Handles, 32 const BuiltinUniformHandles& builtinUniform Handles,
31 const UniformInfoArray& uniforms, 33 const UniformInfoArray& uniforms,
32 uint32_t vertexUniformSize, 34 uint32_t vertexUniformSize,
33 uint32_t fragmentUniformSize, 35 uint32_t fragmentUniformSize,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 0, nullptr)); 285 0, nullptr));
284 } 286 }
285 } 287 }
286 288
287 void GrVkPipelineState::writeSamplers(GrVkGpu* gpu, 289 void GrVkPipelineState::writeSamplers(GrVkGpu* gpu,
288 const SkTArray<const GrTextureAccess*>& te xtureBindings) { 290 const SkTArray<const GrTextureAccess*>& te xtureBindings) {
289 SkASSERT(fNumSamplers == textureBindings.count()); 291 SkASSERT(fNumSamplers == textureBindings.count());
290 292
291 for (int i = 0; i < textureBindings.count(); ++i) { 293 for (int i = 0; i < textureBindings.count(); ++i) {
292 const GrTextureParams& params = textureBindings[i]->getParams(); 294 const GrTextureParams& params = textureBindings[i]->getParams();
293 fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(par ams));
294 295
295 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
304 fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(par ams,
305 texture->texturePriv() .maxMipMapLevel()));
296 306
297 const GrVkImage::Resource* textureResource = texture->resource(); 307 const GrVkImage::Resource* textureResource = texture->resource();
298 textureResource->ref(); 308 textureResource->ref();
299 fTextures.push(textureResource); 309 fTextures.push(textureResource);
300 310
301 const GrVkImageView* textureView = texture->textureView(); 311 const GrVkImageView* textureView = texture->textureView();
302 textureView->ref(); 312 textureView->ref();
303 fTextureViews.push(textureView); 313 fTextureViews.push(textureView);
304 314
305 // Change texture layout so it can be read in shader 315 // Change texture layout so it can be read in shader
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 510
501 b.add32(get_blend_info_key(pipeline)); 511 b.add32(get_blend_info_key(pipeline));
502 512
503 b.add32(primitiveType); 513 b.add32(primitiveType);
504 514
505 // Set key length 515 // Set key length
506 int keyLength = key->count(); 516 int keyLength = key->count();
507 SkASSERT(0 == (keyLength % 4)); 517 SkASSERT(0 == (keyLength % 4));
508 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); 518 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
509 } 519 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkImageView.cpp ('k') | src/gpu/vk/GrVkRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698