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 "GrVkSampler.h" | 8 #include "GrVkSampler.h" |
9 | 9 |
10 #include "GrTextureAccess.h" | 10 #include "GrTextureAccess.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 VK_FILTER_LINEAR | 37 VK_FILTER_LINEAR |
38 }; | 38 }; |
39 | 39 |
40 VkSamplerCreateInfo createInfo; | 40 VkSamplerCreateInfo createInfo; |
41 memset(&createInfo, 0, sizeof(VkSamplerCreateInfo)); | 41 memset(&createInfo, 0, sizeof(VkSamplerCreateInfo)); |
42 createInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; | 42 createInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; |
43 createInfo.pNext = 0; | 43 createInfo.pNext = 0; |
44 createInfo.flags = 0; | 44 createInfo.flags = 0; |
45 createInfo.magFilter = vkMagFilterModes[params.filterMode()]; | 45 createInfo.magFilter = vkMagFilterModes[params.filterMode()]; |
46 createInfo.minFilter = vkMinFilterModes[params.filterMode()]; | 46 createInfo.minFilter = vkMinFilterModes[params.filterMode()]; |
47 createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST; | 47 createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; |
48 createInfo.addressModeU = tile_to_vk_sampler_address(params.getTileModeX()); | 48 createInfo.addressModeU = tile_to_vk_sampler_address(params.getTileModeX()); |
49 createInfo.addressModeV = tile_to_vk_sampler_address(params.getTileModeY()); | 49 createInfo.addressModeV = tile_to_vk_sampler_address(params.getTileModeY()); |
50 createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; // Shouldn'
t matter | 50 createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; // Shouldn'
t matter |
51 createInfo.mipLodBias = 0.0f; | 51 createInfo.mipLodBias = 0.0f; |
52 createInfo.anisotropyEnable = VK_FALSE; | 52 createInfo.anisotropyEnable = VK_FALSE; |
53 createInfo.maxAnisotropy = 1.0f; | 53 createInfo.maxAnisotropy = 1.0f; |
54 createInfo.compareEnable = VK_FALSE; | 54 createInfo.compareEnable = VK_FALSE; |
55 createInfo.compareOp = VK_COMPARE_OP_NEVER; | 55 createInfo.compareOp = VK_COMPARE_OP_NEVER; |
56 // Vulkan doesn't have a direct mapping of GL's nearest or linear filters fo
r minFilter since | 56 // Vulkan doesn't have a direct mapping of GL's nearest or linear filters fo
r minFilter since |
57 // there is always a mipmapMode. To get the same effect as GL we can set min
Lod = maxLod = 0.0. | 57 // there is always a mipmapMode. To get the same effect as GL we can set min
Lod = maxLod = 0.0. |
(...skipping 30 matching lines...) Expand all Loading... |
88 key |= (params.getTileModeX() << kTileModeXShift); | 88 key |= (params.getTileModeX() << kTileModeXShift); |
89 | 89 |
90 GR_STATIC_ASSERT(SkShader::kTileModeCount <= 4); | 90 GR_STATIC_ASSERT(SkShader::kTileModeCount <= 4); |
91 key |= (params.getTileModeY() << kTileModeYShift); | 91 key |= (params.getTileModeY() << kTileModeYShift); |
92 | 92 |
93 SkASSERT(mipLevels < 1024); | 93 SkASSERT(mipLevels < 1024); |
94 key |= (mipLevels << kMipLevelShift); | 94 key |= (mipLevels << kMipLevelShift); |
95 | 95 |
96 return key; | 96 return key; |
97 } | 97 } |
OLD | NEW |