aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-07-06 08:51:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-06 08:51:23 -0700
commit2f5792a06c87efd5f9295b7b7bb714aac118bd2a (patch)
tree17829f9bed563851b6eccaaa8bf9d19ea8b58b6d /src
parent97a0918715b621183647d96dbe8fd2eb038ed564 (diff)
Fix vulkan image sampling
Diffstat (limited to 'src')
-rw-r--r--src/gpu/vk/GrVkGpu.cpp3
-rw-r--r--src/gpu/vk/GrVkGpuCommandBuffer.cpp12
-rw-r--r--src/gpu/vk/GrVkSampler.cpp4
3 files changed, 10 insertions, 9 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index c1cec9d96f..e907d8d878 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -784,7 +784,8 @@ void GrVkGpu::generateMipmap(GrVkTexture* tex) const {
// determine if we can blit to and from this format
const GrVkCaps& caps = this->vkCaps();
if (!caps.configCanBeDstofBlit(tex->config(), false) ||
- !caps.configCanBeSrcofBlit(tex->config(), false)) {
+ !caps.configCanBeSrcofBlit(tex->config(), false) ||
+ !caps.mipMapSupport()) {
return;
}
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 6c966b5fa9..2eb1671269 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -371,6 +371,12 @@ void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline,
const GrVkRenderPass* renderPass = vkRT->simpleRenderPass();
SkASSERT(renderPass);
+ append_sampled_images(primProc, fGpu, &fSampledImages);
+ for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
+ append_sampled_images(pipeline.getFragmentProcessor(i), fGpu, &fSampledImages);
+ }
+ append_sampled_images(pipeline.getXferProcessor(), fGpu, &fSampledImages);
+
GrPrimitiveType primitiveType = meshes[0].primitiveType();
sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline,
primProc,
@@ -380,12 +386,6 @@ void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline,
return;
}
- append_sampled_images(primProc, fGpu, &fSampledImages);
- for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
- append_sampled_images(pipeline.getFragmentProcessor(i), fGpu, &fSampledImages);
- }
- append_sampled_images(pipeline.getXferProcessor(), fGpu, &fSampledImages);
-
for (int i = 0; i < meshCount; ++i) {
const GrMesh& mesh = meshes[i];
GrMesh::Iterator iter;
diff --git a/src/gpu/vk/GrVkSampler.cpp b/src/gpu/vk/GrVkSampler.cpp
index cd41fd0f3e..1d4e7066a6 100644
--- a/src/gpu/vk/GrVkSampler.cpp
+++ b/src/gpu/vk/GrVkSampler.cpp
@@ -25,7 +25,6 @@ static inline VkSamplerAddressMode tile_to_vk_sampler_address(SkShader::TileMode
GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrTextureParams& params,
uint32_t mipLevels) {
-
static VkFilter vkMinFilterModes[] = {
VK_FILTER_NEAREST,
VK_FILTER_LINEAR,
@@ -59,7 +58,8 @@ GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrTextureParams& para
// level mip). If the filters weren't the same we could set min = 0 and max = 0.25 to force
// the minFilter on mip level 0.
createInfo.minLod = 0.0f;
- createInfo.maxLod = (mipLevels == 1) ? 0.0f : (float)(mipLevels);
+ bool useMipMaps = GrTextureParams::kMipMap_FilterMode == params.filterMode() && mipLevels > 1;
+ createInfo.maxLod = !useMipMaps ? 0.0f : (float)(mipLevels);
createInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
createInfo.unnormalizedCoordinates = VK_FALSE;