Chromium Code Reviews| Index: src/gpu/vk/GrVkPipelineState.cpp |
| diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp |
| index 0194e290ad351aeb980114885be973768836700e..589dc9984e159e15e385f09de8ea4bfa81b9285e 100644 |
| --- a/src/gpu/vk/GrVkPipelineState.cpp |
| +++ b/src/gpu/vk/GrVkPipelineState.cpp |
| @@ -8,6 +8,7 @@ |
| #include "GrVkPipelineState.h" |
| #include "GrPipeline.h" |
| +#include "GrTexturePriv.h" |
| #include "GrVkCommandBuffer.h" |
| #include "GrVkDescriptorPool.h" |
| #include "GrVkGpu.h" |
| @@ -21,6 +22,7 @@ |
| #include "glsl/GrGLSLFragmentProcessor.h" |
| #include "glsl/GrGLSLGeometryProcessor.h" |
| #include "glsl/GrGLSLXferProcessor.h" |
| +#include "SkMipmap.h" |
| GrVkPipelineState::GrVkPipelineState(GrVkGpu* gpu, |
| const GrVkPipelineState::Desc& desc, |
| @@ -290,9 +292,21 @@ void GrVkPipelineState::writeSamplers(GrVkGpu* gpu, |
| for (int i = 0; i < textureBindings.count(); ++i) { |
| const GrTextureParams& params = textureBindings[i]->getParams(); |
| - fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(params)); |
| GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->getTexture()); |
| + if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) { |
| + if (texture->texturePriv().mipMapsAreDirty()) { |
| + if (gpu->generateMipmap(texture)) { |
| + uint32_t mipLevels = SkMipMap::ComputeLevelCount(texture->width(), |
| + texture->height()); |
| + texture->texturePriv().setMaxMipMapLevel(mipLevels); |
|
egdaniel
2016/04/25 21:01:09
can this be done in generateMipmap? Might be able
jvanverth1
2016/04/26 14:18:26
Done.
|
| + } |
| + texture->texturePriv().dirtyMipMaps(false); |
| + } |
| + } |
| + |
| + fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(params, |
| + texture->texturePriv().maxMipMapLevel())); |
| const GrVkImage::Resource* textureResource = texture->resource(); |
| textureResource->ref(); |