#ifndef DESCRIPTORSETHANDLING_H
#define	DESCRIPTORSETHANDLING_H

#include "PathUtils.h"
#include "Utils.h"

/*!
 *	Allocates a new descriptor set of the given layout from the given descriptor pool.
 *	It is not required to cleanup the returned descriptor set explicitly, it will be cleaned up when the descriptor pool is destroyed.
 *	@param	device					Valid handle to the logical device
 *	@param	descriptor_pool			Valid handle to a descriptor pool
 *	@param	descriptor_set_layout	Valid handle to a descriptor set layout
 */
VkDescriptorSet allocDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, VkDescriptorSetLayout descriptor_set_layout);

/*!
 *	Writes the descriptor information to a given descriptor set which describes one uniform buffer at binding = 0.
 *	The given descriptor set must have been created from a descriptor set layout according to this structure.
 *	@param	device					Valid handle to the logical device
 *	@param	descriptor_set			Valid handle to a descriptor set, which concrete descriptor information will be written to.
 *	@param	uniform_buffer			A descriptor for this uniform buffer will be written to binding = 0
 */
void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer uniform_buffer, uint32_t binding);

void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer uniform_buffer);

void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer object_data, VkImageView image_view, VkSampler sampler);


void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer object_data, 
                        VkImageView diffuse_image_view, VkSampler diffuse_sampler,
                        VkImageView specular_image_view, VkSampler specular_sampler,
                        VkImageView normal_image_view, VkSampler normal_sampler);

void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer object_data, VkImageView image_view, VkSampler sampler,
        VkImageView normalImageView, VkSampler normalSampler);

void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer object_data, 
                        VkImageView diffuse_image_view, VkSampler sampler,
                        VkImageView normal_image_view, VkSampler normalSampler,
                        VkImageView height_image_view, VkSampler normalheightSampler);

void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkImageView image_view, VkSampler image_sampler, uint32_t binding, VkImageLayout vkImageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL);

void writeDescriptorSet(VkDevice device, VkDescriptorSet descriptor_set, VkBuffer object_data, 
                        VkImageView diffuse_image_view, VkSampler diffuse_sampler,
                        VkImageView specular_image_view, VkSampler specular_sampler,
                        VkImageView normal_image_view, VkSampler normal_sampler,
                        VkImageView shadow_view, VkSampler shadowsampler);
#endif

