new descriptor layout 2
This commit is contained in:
parent
74832c6824
commit
d1b8e45fb6
13 changed files with 412 additions and 128 deletions
64
interfaces/Crafter.Graphics-SamplerVulkan.cppm
Normal file
64
interfaces/Crafter.Graphics-SamplerVulkan.cppm
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Crafter®.Graphics
|
||||
Copyright (C) 2026 Catcrafts®
|
||||
catcrafts.net
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 3.0 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
module;
|
||||
|
||||
#ifdef CRAFTER_GRAPHICS_VULKAN
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
|
||||
export module Crafter.Graphics:SamplerVulkan;
|
||||
import std;
|
||||
import :VulkanBuffer;
|
||||
import :ImageVulkan;
|
||||
|
||||
export namespace Crafter {
|
||||
#ifdef CRAFTER_GRAPHICS_VULKAN
|
||||
template <typename PixelType>
|
||||
class SamplerVulkan {
|
||||
public:
|
||||
VkSampler textureSampler;
|
||||
VkDescriptorImageInfo imageInfo;
|
||||
SamplerVulkan(ImageVulkan<PixelType>& texture) {
|
||||
VkSamplerCreateInfo samplerInfo{};
|
||||
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||
samplerInfo.magFilter = VK_FILTER_LINEAR;
|
||||
samplerInfo.minFilter = VK_FILTER_LINEAR;
|
||||
samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||
samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||
samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||
samplerInfo.anisotropyEnable = VK_FALSE;
|
||||
samplerInfo.maxAnisotropy = 1;
|
||||
samplerInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK;
|
||||
samplerInfo.unnormalizedCoordinates = VK_FALSE;
|
||||
samplerInfo.compareEnable = VK_FALSE;
|
||||
samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS;
|
||||
samplerInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
samplerInfo.mipLodBias = 0.0f;
|
||||
samplerInfo.minLod = 0.0f;
|
||||
samplerInfo.maxLod = 0.0f;
|
||||
VulkanDevice::CheckVkResult(vkCreateSampler(VulkanDevice::device, &samplerInfo, nullptr, &textureSampler));
|
||||
|
||||
imageInfo = {
|
||||
.sampler = textureSampler
|
||||
};
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue