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

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

Issue 1726403007: Remove Vk files with spurious CRLFs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix gyp Created 4 years, 10 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/GrVkProgramDataManager.h ('k') | src/gpu/vk/GrVkVaryingHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrVkSampler.h"
9
10 #include "GrTextureAccess.h"
11 #include "GrVkGpu.h"
12
13 static inline VkSamplerAddressMode tile_to_vk_sampler_address(SkShader::TileMode tm) {
14 static const VkSamplerAddressMode gWrapModes[] = {
15 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
16 VK_SAMPLER_ADDRESS_MODE_REPEAT,
17 VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT
18 };
19 GR_STATIC_ASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gWrapModes));
20 GR_STATIC_ASSERT(0 == SkShader::kClamp_TileMode);
21 GR_STATIC_ASSERT(1 == SkShader::kRepeat_TileMode);
22 GR_STATIC_ASSERT(2 == SkShader::kMirror_TileMode);
23 return gWrapModes[tm];
24 }
25
26 GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrTextureAccess& text ureAccess) {
27
28 static VkFilter vkMinFilterModes[] = {
29 VK_FILTER_NEAREST,
30 VK_FILTER_LINEAR,
31 VK_FILTER_LINEAR
32 };
33 static VkFilter vkMagFilterModes[] = {
34 VK_FILTER_NEAREST,
35 VK_FILTER_LINEAR,
36 VK_FILTER_LINEAR
37 };
38
39 const GrTextureParams& params = textureAccess.getParams();
40
41 VkSamplerCreateInfo createInfo;
42 memset(&createInfo, 0, sizeof(VkSamplerCreateInfo));
43 createInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
44 createInfo.pNext = 0;
45 createInfo.flags = 0;
46 createInfo.magFilter = vkMagFilterModes[params.filterMode()];
47 createInfo.minFilter = vkMinFilterModes[params.filterMode()];
48 createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST;
49 createInfo.addressModeU = tile_to_vk_sampler_address(params.getTileModeX());
50 createInfo.addressModeV = tile_to_vk_sampler_address(params.getTileModeY());
51 createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; // Shouldn' t matter
52 createInfo.mipLodBias = 0.0f;
53 createInfo.anisotropyEnable = VK_FALSE;
54 createInfo.maxAnisotropy = 1.0f;
55 createInfo.compareEnable = VK_FALSE;
56 createInfo.compareOp = VK_COMPARE_OP_NEVER;
57 createInfo.minLod = 0.0f;
58 createInfo.maxLod = 0.0f;
59 createInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
60 createInfo.unnormalizedCoordinates = VK_FALSE;
61
62 VkSampler sampler;
63 GR_VK_CALL_ERRCHECK(gpu->vkInterface(), CreateSampler(gpu->device(),
64 &createInfo,
65 nullptr,
66 &sampler));
67
68 return new GrVkSampler(sampler);
69 }
70
71 void GrVkSampler::freeGPUData(const GrVkGpu* gpu) const {
72 SkASSERT(fSampler);
73 GR_VK_CALL(gpu->vkInterface(), DestroySampler(gpu->device(), fSampler, nullp tr));
74 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkProgramDataManager.h ('k') | src/gpu/vk/GrVkVaryingHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698