OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_VULKAN_VULKAN_SAMPLER_H_ |
| 6 #define GPU_VULKAN_VULKAN_SAMPLER_H_ |
| 7 |
| 8 #include <float.h> |
| 9 #include <vulkan/vulkan.h> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "gpu/vulkan/vulkan_export.h" |
| 13 |
| 14 namespace gpu { |
| 15 |
| 16 class VulkanDeviceQueue; |
| 17 |
| 18 class VULKAN_EXPORT VulkanSampler { |
| 19 public: |
| 20 struct SamplerOptions { |
| 21 SamplerOptions(); |
| 22 ~SamplerOptions(); |
| 23 |
| 24 VkFilter mag_filter = VK_FILTER_NEAREST; |
| 25 VkFilter min_filter = VK_FILTER_NEAREST; |
| 26 VkSamplerMipmapMode mipmap_mode = VK_SAMPLER_MIPMAP_MODE_NEAREST; |
| 27 VkSamplerAddressMode address_mode_u = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; |
| 28 VkSamplerAddressMode address_mode_v = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; |
| 29 VkSamplerAddressMode address_mode_w = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; |
| 30 float mip_lod_bias = 0.0f; |
| 31 bool anisotropy_enable = false; |
| 32 float max_anisotropy = 1.0f; |
| 33 bool compare_enable = false; |
| 34 VkCompareOp compare_op = VK_COMPARE_OP_NEVER; |
| 35 float min_lod = 0.0f; |
| 36 float max_lod = FLT_MAX; |
| 37 VkBorderColor border_color = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; |
| 38 bool unnormalized_coordinates = false; |
| 39 }; |
| 40 |
| 41 explicit VulkanSampler(VulkanDeviceQueue* device_queue); |
| 42 ~VulkanSampler(); |
| 43 |
| 44 bool Initialize(const SamplerOptions& options); |
| 45 void Destroy(); |
| 46 |
| 47 VkSampler handle() const { return handle_; } |
| 48 |
| 49 private: |
| 50 VulkanDeviceQueue* device_queue_ = nullptr; |
| 51 VkSampler handle_ = VK_NULL_HANDLE; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(VulkanSampler); |
| 54 }; |
| 55 |
| 56 } // namespace gpu |
| 57 |
| 58 #endif // GPU_VULKAN_VULKAN_SAMPLER_H_ |
OLD | NEW |