NAP
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BaseShader Class Reference

#include <shader.h>

Public Member Functions

 BaseShader (Core &core)
 
virtual ~BaseShader ()
 
const SamplerDeclarationsgetSamplerDeclarations () const
 
const std::vector< BufferObjectDeclaration > & getUBODeclarations () const
 
const std::vector< BufferObjectDeclaration > & getSSBODeclarations () const
 
const ShaderConstantDeclarationsgetConstantDeclarations () const
 
const std::string & getDisplayName () const
 
VkDescriptorSetLayout getDescriptorSetLayout () const
 
void clear ()
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual bool init (utility::ErrorState &errorState)
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Protected Member Functions

bool initLayout (VkDevice device, nap::utility::ErrorState &errorState)
 
bool verifyShaderVariableDeclarations (utility::ErrorState &errorState)
 

Protected Attributes

RenderServicemRenderService = nullptr
 Handle to render engine. More...
 
std::string mDisplayName
 Filename of shader used as display name. More...
 
BufferObjectDeclarationList mUBODeclarations
 All uniform buffer object declarations. More...
 
BufferObjectDeclarationList mSSBODeclarations
 All storage buffer object declarations. More...
 
SamplerDeclarations mSamplerDeclarations
 All sampler declarations. More...
 
ShaderConstantDeclarations mConstantDeclarations
 All shader constant declarations. More...
 
VkDescriptorSetLayout mDescriptorSetLayout = VK_NULL_HANDLE
 Descriptor set layout. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Description

Base class of all shaders

Inheritance diagram for BaseShader:
[legend]
Collaboration diagram for BaseShader:
[legend]

Constructor & Destructor Documentation

◆ BaseShader()

BaseShader ( Core core)

◆ ~BaseShader()

virtual ~BaseShader ( )
virtual

Member Function Documentation

◆ clear()

void clear ( )

Clears shader declarations and layout information.

◆ getConstantDeclarations()

const ShaderConstantDeclarations& getConstantDeclarations ( ) const
Returns
all Shader Constant declarations.

◆ getDescriptorSetLayout()

VkDescriptorSetLayout getDescriptorSetLayout ( ) const
Returns
Vulkan descriptorSetLayout.

◆ getDisplayName()

const std::string& getDisplayName ( ) const
Returns
shader display name

◆ getSamplerDeclarations()

const SamplerDeclarations& getSamplerDeclarations ( ) const
Returns
all uniform shader attributes

◆ getSSBODeclarations()

const std::vector<BufferObjectDeclaration>& getSSBODeclarations ( ) const
Returns
all Shader Storage Buffer Object declarations.

◆ getUBODeclarations()

const std::vector<BufferObjectDeclaration>& getUBODeclarations ( ) const
Returns
all UniformBufferObject declarations.

◆ initLayout()

bool initLayout ( VkDevice  device,
nap::utility::ErrorState errorState 
)
protected

Initializes the descriptorset layout of this shader.

Parameters
devicethe vulkan device.
errorStatecontains the error if the operation failed.
Returns
whether the descriptorset layout was initialized successfully.

◆ verifyShaderVariableDeclarations()

bool verifyShaderVariableDeclarations ( utility::ErrorState errorState)
protected

Verifies if the shader declarations are in accordance with the API.

Parameters
errorStatecontains the error if the operation failed.
Returns
whether the shader declarations are valid according to the capabilities of the API.

Member Data Documentation

◆ mConstantDeclarations

ShaderConstantDeclarations mConstantDeclarations
protected

All shader constant declarations.

◆ mDescriptorSetLayout

VkDescriptorSetLayout mDescriptorSetLayout = VK_NULL_HANDLE
protected

Descriptor set layout.

◆ mDisplayName

std::string mDisplayName
protected

Filename of shader used as display name.

◆ mRenderService

RenderService* mRenderService = nullptr
protected

Handle to render engine.

◆ mSamplerDeclarations

SamplerDeclarations mSamplerDeclarations
protected

All sampler declarations.

◆ mSSBODeclarations

BufferObjectDeclarationList mSSBODeclarations
protected

All storage buffer object declarations.

◆ mUBODeclarations

BufferObjectDeclarationList mUBODeclarations
protected

All uniform buffer object declarations.