| Fling Engine 0.00.1 Fling Engine is a game engine written in Vulkan

Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
Fling::Shader Class Reference

Class that represents what a shader is in the Fling engine. More...

`#include <Shader.h>`

Inherits Fling::Resource.

## Public Member Functions
| Shader (Guid t_ID, LogicalDevice *t_Dev)
| Construct a new Shader object. More...
| ~Shader ()
VkShaderModule | GetShaderModule () const
| Create a Shader Module object. More...
VkShaderStageFlagBits | GetStage () const
| get the Vulkan stage bit flags that we should bind to More...
void | Release ()
| Release any resrources created by this shader (the module) More...
Public Member Functions inherited from Fling::Resource
| Resource (Fling::Guid t_ID)
virtual | ~Resource ()=default
Fling::Guid_Handle | GetGuidHandle () const
| Get GUID handle (just an int) for this resources guid. More...
const std::string & | GetGuidString () const
| Get the human-readable string representation of this GUID. More...
std::string | GetFilepathReleativeToAssets () const
| Returns the full file path that is relative to the assets path based on the GUID of this resource. More...

## Static Public Member Functions
static std::shared_ptr< Fling::Shader > | Create (Guid t_ID, LogicalDevice *t_Dev)
static VkDescriptorSetLayout | CreateSetLayout (VkDevice t_Dev, std::vector< Shader *> &t_Shaders, bool t_SupportPushDescriptor=false)
static VkPipelineLayout | CreatePipelineLayout (VkDevice t_Dev, VkDescriptorSetLayout t_SetLayout, VkShaderStageFlags t_PushConstantStages, size_t t_PushConstantSize)

## Private Member Functions
void | ParseReflectionData (const UINT32 *t_Code, UINT32 t_Size)
| Compiles this shader with SPRIV-Cross. More...
VkResult | CreateShaderModule (std::vector< char > &t_ShaderCode)
| Creates the shader modules. More...

## Static Private Member Functions
static UINT32 | GatherResources (const std::vector< Shader *> &t_Shaders, VkDescriptorType(&t_ResourceTypes)[32])
static std::vector< char > | LoadRawBytes (const std::string &t_FilePath)
| Load the raw shader code in off-disk. More...

## Private Attributes
VkShaderModule | m_Module = VK_NULL_HANDLE
| The shader module created by this shader. More...
UINT32 | m_ResourceMask {}
VkDescriptorType | m_ResourceTypes [32] {}
| The types of descriptors that are used by this shader. More...
VkShaderStageFlagBits | m_Stage = VkShaderStageFlagBits::VK_SHADER_STAGE_VERTEX_BIT
| The stage in the pipeline that this shader is in. More...
const LogicalDevice * | m_Device
bool | m_UsesPushConstants = false
UINT32 | localSizeX {}
UINT32 | localSizeY {}
UINT32 | localSizeZ {}

## Friends
class | ResourceManager

## Additional Inherited Members
Protected Attributes inherited from Fling::Resource
Fling::Guid | m_Guid
std::string | m_HumanReadableName

## Detailed Description

Class that represents what a shader is in the Fling engine.

Performs shader reflection and provides some helper functionality for creating the Vk resources needed(descriptor sets, bindings, and locations)

## Constructor & Destructor Documentation

## ◆ Shader()

Fling::Shader::Shader | ( | Guid | t_ID,
|  | LogicalDevice * | t_Dev
| ) |  |
| explicit

Construct a new Shader object.

Loads from disk and compiles the shader

Parameters

  t_ID | The GUID that represents the file path to this file.

## ◆ ~Shader()

Fling::Shader::~Shader | ( |  | ) |

## Member Function Documentation

## ◆ Create()

std::shared_ptr< Fling::Shader > Fling::Shader::Create | ( | Guid | t_ID,
|  | LogicalDevice * | t_Dev
| ) |  |
| static

## ◆ CreatePipelineLayout()

VkPipelineLayout Fling::Shader::CreatePipelineLayout | ( | VkDevice | t_Dev,
|  | VkDescriptorSetLayout | t_SetLayout,
|  | VkShaderStageFlags | t_PushConstantStages,
|  | size_t | t_PushConstantSize
| ) |  |
| static

## ◆ CreateSetLayout()

VkDescriptorSetLayout Fling::Shader::CreateSetLayout | ( | VkDevice | t_Dev,
|  | std::vector< Shader *> & | t_Shaders,
|  | bool | t_SupportPushDescriptor = `false`
| ) |  |
| static

## ◆ CreateShaderModule()

VkResult Fling::Shader::CreateShaderModule | ( | std::vector< char > & | t_ShaderCode | ) |
| private

Creates the shader modules.

## ◆ GatherResources()

UINT32 Fling::Shader::GatherResources | ( | const std::vector< Shader *> & | t_Shaders,
|  | VkDescriptorType(&) | t_ResourceTypes[32]
| ) |  |
| static private

## ◆ GetShaderModule()

VkShaderModule Fling::Shader::GetShaderModule | ( |  | ) | const
| inline

Create a Shader Module object.

Returns
  VkShaderModule

## ◆ GetStage()

VkShaderStageFlagBits Fling::Shader::GetStage | ( |  | ) | const
| inline

get the Vulkan stage bit flags that we should bind to

## ◆ LoadRawBytes()

std::vector< char > Fling::Shader::LoadRawBytes | ( | const std::string & | t_FilePath | ) |
| static private

Load the raw shader code in off-disk.

## ◆ ParseReflectionData()

void Fling::Shader::ParseReflectionData | ( | const UINT32 * | t_Code,
|  | UINT32 | t_Size
| ) |  |
| private

Compiles this shader with SPRIV-Cross.

## ◆ Release()

void Fling::Shader::Release | ( |  | ) |

Release any resrources created by this shader (the module)

## Friends And Related Function Documentation

## ◆ ResourceManager

friend class ResourceManager
| friend

## Field Documentation

## ◆ localSizeX

UINT32 Fling::Shader::localSizeX {}
| private

## ◆ localSizeY

UINT32 Fling::Shader::localSizeY {}
| private

## ◆ localSizeZ

UINT32 Fling::Shader::localSizeZ {}
| private

## ◆ m_Device

const LogicalDevice* Fling::Shader::m_Device
| private

## ◆ m_Module

VkShaderModule Fling::Shader::m_Module = VK_NULL_HANDLE
| private

The shader module created by this shader.

## ◆ m_ResourceMask

UINT32 Fling::Shader::m_ResourceMask {}
| private

## ◆ m_ResourceTypes

VkDescriptorType Fling::Shader::m_ResourceTypes[32] {}
| private

The types of descriptors that are used by this shader.

## ◆ m_Stage

VkShaderStageFlagBits Fling::Shader::m_Stage = VkShaderStageFlagBits::VK_SHADER_STAGE_VERTEX_BIT
| private

The stage in the pipeline that this shader is in.

## ◆ m_UsesPushConstants

bool Fling::Shader::m_UsesPushConstants = false
| private

The documentation for this class was generated from the following files:

- FlingEngine/Graphics/inc/Shader.h
- FlingEngine/Graphics/src/Shader.cpp