Ben Clayton | eac32c4 | 2019-04-26 11:25:57 +0100 | [diff] [blame] | 1 | // Copyright 2019 The SwiftShader Authors. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Ben Clayton | eac32c4 | 2019-04-26 11:25:57 +0100 | [diff] [blame] | 15 | #include "VkSampler.hpp" |
| 16 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 17 | namespace vk { |
Ben Clayton | eac32c4 | 2019-04-26 11:25:57 +0100 | [diff] [blame] | 18 | |
Nicolas Capens | 8532b0f | 2021-05-20 02:52:30 -0400 | [diff] [blame] | 19 | SamplerState::SamplerState(const VkSamplerCreateInfo *pCreateInfo, const vk::SamplerYcbcrConversion *ycbcrConversion, |
| 20 | VkSamplerFilteringPrecisionModeGOOGLE filteringPrecision, const VkClearColorValue &customBorderColor) |
Nicolas Capens | f948cd1 | 2020-03-23 13:00:43 -0400 | [diff] [blame] | 21 | : Memset(this, 0) |
| 22 | , magFilter(pCreateInfo->magFilter) |
| 23 | , minFilter(pCreateInfo->minFilter) |
| 24 | , mipmapMode(pCreateInfo->mipmapMode) |
| 25 | , addressModeU(pCreateInfo->addressModeU) |
| 26 | , addressModeV(pCreateInfo->addressModeV) |
| 27 | , addressModeW(pCreateInfo->addressModeW) |
| 28 | , mipLodBias(pCreateInfo->mipLodBias) |
| 29 | , anisotropyEnable(pCreateInfo->anisotropyEnable) |
| 30 | , maxAnisotropy(pCreateInfo->maxAnisotropy) |
| 31 | , compareEnable(pCreateInfo->compareEnable) |
| 32 | , compareOp(pCreateInfo->compareOp) |
| 33 | , minLod(ClampLod(pCreateInfo->minLod)) |
| 34 | , maxLod(ClampLod(pCreateInfo->maxLod)) |
| 35 | , borderColor(pCreateInfo->borderColor) |
Nicolas Capens | 8532b0f | 2021-05-20 02:52:30 -0400 | [diff] [blame] | 36 | , customBorderColor(customBorderColor) |
Nicolas Capens | f948cd1 | 2020-03-23 13:00:43 -0400 | [diff] [blame] | 37 | , unnormalizedCoordinates(pCreateInfo->unnormalizedCoordinates) |
Antonio Maiorano | d9ba4b7 | 2020-05-04 14:38:59 -0400 | [diff] [blame] | 38 | , filteringPrecision(filteringPrecision) |
Nicolas Capens | f948cd1 | 2020-03-23 13:00:43 -0400 | [diff] [blame] | 39 | { |
| 40 | if(ycbcrConversion) |
| 41 | { |
| 42 | ycbcrModel = ycbcrConversion->ycbcrModel; |
| 43 | studioSwing = (ycbcrConversion->ycbcrRange == VK_SAMPLER_YCBCR_RANGE_ITU_NARROW); |
| 44 | swappedChroma = (ycbcrConversion->components.r != VK_COMPONENT_SWIZZLE_R); |
| 45 | } |
| 46 | } |
| 47 | |
Nicolas Capens | 73c4a0c | 2020-03-17 17:29:11 -0400 | [diff] [blame] | 48 | Sampler::Sampler(const VkSamplerCreateInfo *pCreateInfo, void *mem, const SamplerState &samplerState, uint32_t samplerID) |
| 49 | : SamplerState(samplerState) |
| 50 | , id(samplerID) |
Nicolas Capens | f948cd1 | 2020-03-23 13:00:43 -0400 | [diff] [blame] | 51 | { |
| 52 | } |
| 53 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 54 | } // namespace vk |