improved docs
This commit is contained in:
parent
c8f1c90f9c
commit
dfe9b1abe9
16 changed files with 315 additions and 40 deletions
|
|
@ -32,12 +32,21 @@ import :VulkanPipeline;
|
|||
import :DescriptorSet;
|
||||
|
||||
namespace Crafter {
|
||||
/**
|
||||
* @brief Creates a sampler for a provided VulkanTexture<PixelType>.
|
||||
* @tparam PixelType The pixeltype to use.
|
||||
*/
|
||||
export template <typename PixelType>
|
||||
class TextureShader {
|
||||
public:
|
||||
private:
|
||||
VkSampler textureSampler;
|
||||
VkDescriptorImageInfo imageInfo;
|
||||
VulkanTexture<PixelType>* texture;
|
||||
public:
|
||||
/**
|
||||
* @brief Creates a sampler for a texture.
|
||||
* @param texture A pointer to the texture to create the sampler for, the texture must remain valid for the lifetime of this object.
|
||||
*/
|
||||
TextureShader(VulkanTexture<PixelType>* texture) : texture(texture) {
|
||||
VkSamplerCreateInfo samplerInfo{};
|
||||
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||
|
|
@ -62,6 +71,10 @@ namespace Crafter {
|
|||
imageInfo.imageView = texture->imageView;
|
||||
imageInfo.sampler = textureSampler;
|
||||
}
|
||||
/**
|
||||
* @brief Writes this class's 1 descriptor to the set, this method must be called before rendering with this shader.
|
||||
* Slot 0: VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER.
|
||||
*/
|
||||
void WriteDescriptors(VkDescriptorSet set) {
|
||||
VkWriteDescriptorSet write = vks::initializers::writeDescriptorSet(set, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 0, &imageInfo);
|
||||
vkUpdateDescriptorSets(VulkanDevice::device, 1, &write, 0, nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue