Nebula
Loading...
Searching...
No Matches
vkshader.cc File Reference
#include "vkshader.h"
#include "coregraphics/shaderserver.h"
#include "lowlevel/vk/vksampler.h"
#include "lowlevel/vk/vkvarblock.h"
#include "lowlevel/vk/vkvarbuffer.h"
#include "lowlevel/vk/vkvariable.h"
#include "coregraphics/sampler.h"
#include "coregraphics/resourcetable.h"
#include "vksampler.h"
#include "vkgraphicsdevice.h"

Namespaces

namespace  Vulkan
 Vulkan implementation of GPU acceleration structure.
 
namespace  CoreGraphics
 Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
 

Enumerations

enum  Vulkan::ShaderStages {
  Vulkan::VertexShader , Vulkan::HullShader , Vulkan::DomainShader , Vulkan::GeometryShader ,
  Vulkan::PixelShader , Vulkan::ComputeShader , Vulkan::TaskShader , Vulkan::MeshShader ,
  Vulkan::RayGenerationShader , Vulkan::RayAnyHitShader , Vulkan::RayClosestHitShader , Vulkan::RayMissShader ,
  Vulkan::RayIntersectionShader , Vulkan::CallableShader , Vulkan::NumShaders
}
 

Functions

void Vulkan::UpdateOccupancy (uint32_t *occupancyList, uint32_t &slotsUsed, const CoreGraphics::ShaderVisibility vis)
 
void Vulkan::ShaderSetup (VkDevice dev, const Util::StringAtom &name, AnyFX::ShaderEffect *effect, Util::FixedArray< CoreGraphics::ResourcePipelinePushConstantRange > &constantRange, Util::Array< CoreGraphics::SamplerId > &immutableSamplers, Util::FixedArray< Util::Pair< uint32_t, CoreGraphics::ResourceTableLayoutId > > &setLayouts, Util::Dictionary< uint32_t, uint32_t > &setLayoutMap, CoreGraphics::ResourcePipelineId &pipelineLayout, Util::Dictionary< Util::StringAtom, uint32_t > &resourceSlotMapping, Util::Dictionary< Util::StringAtom, IndexT > &constantBindings)
 create descriptor set layout
 
void Vulkan::ShaderCleanup (VkDevice dev, Util::Array< CoreGraphics::SamplerId > &immutableSamplers, Util::FixedArray< Util::Pair< uint32_t, CoreGraphics::ResourceTableLayoutId > > &setLayouts, Util::Dictionary< Util::StringAtom, CoreGraphics::BufferId > &buffers, CoreGraphics::ResourcePipelineId &pipelineLayout)
 cleanup shader
 
Util::String Vulkan::VkShaderCreateSignature (const VkDescriptorSetLayoutBinding &bind)
 create descriptor layout signature
 
const VkProgramReflectionInfoVulkan::ShaderGetProgramReflection (const CoreGraphics::ShaderProgramId shaderProgramId)
 Use direct resource ids, not the State, Shader or Variable type ids.
 
const ShaderId CoreGraphics::CreateShader (const ShaderCreateInfo &info)
 Create new shader.
 
void CoreGraphics::DeleteShader (const ShaderId id)
 
void CoreGraphics::DestroyShader (const ShaderId id)
 Destroy shader.
 
void CoreGraphics::ReloadShader (const ShaderId id, const AnyFX::ShaderEffect *effect)
 Reload shader.
 
CoreGraphics::ShaderProgramId CoreGraphics::ShaderGetShaderProgram (const CoreGraphics::ShaderId shaderId, const CoreGraphics::ShaderFeature::Mask mask)
 
const ResourceTableId CoreGraphics::ShaderCreateResourceTable (const ShaderId id, const IndexT group, const uint overallocationSize=1)
 create resource table from shader
 
ResourceTableSet CoreGraphics::ShaderCreateResourceTableSet (const ShaderId id, const IndexT group, const uint overallocationSize=1)
 create resource table set from shader
 
const bool CoreGraphics::ShaderHasResourceTable (const ShaderId id, const IndexT group)
 Returns true if there is a resource table for the given group in the shader.
 
const BufferId CoreGraphics::ShaderCreateConstantBuffer (const ShaderId id, const Util::StringAtom &name, BufferAccessMode mode=BufferAccessMode::HostCached)
 create constant buffer from shader using name (don't use too frequently)
 
const BufferId CoreGraphics::ShaderCreateConstantBuffer (const ShaderId id, const IndexT cbIndex, BufferAccessMode mode=BufferAccessMode::HostCached)
 create constant buffer from index
 
const BufferId CoreGraphics::ShaderCreateConstantBuffer (const ShaderId id, const IndexT group, const IndexT cbIndex, BufferAccessMode mode=BufferAccessMode::HostCached)
 create constant buffer from index
 
const uint CoreGraphics::ShaderCalculateConstantBufferIndex (const uint64 bindingMask, const IndexT slot)
 Calculate buffer index using binding mask and slot.
 
const IndexT CoreGraphics::ShaderGetConstantBinding (const ShaderId id, const Util::StringAtom &name)
 get constant buffer binding by name
 
const IndexT CoreGraphics::ShaderGetConstantBinding (const ShaderId id, const IndexT cIndex)
 get constant buffer binding by index
 
const SizeT CoreGraphics::ShaderGetConstantBindingsCount (const ShaderId id)
 get count of constant buffer bindings (for iteration)
 
CoreGraphics::ResourceTableLayoutId CoreGraphics::ShaderGetResourceTableLayout (const ShaderId id, const IndexT group)
 get resource table layout
 
CoreGraphics::ResourcePipelineId CoreGraphics::ShaderGetResourcePipeline (const ShaderId id)
 get pipeline layout for shader
 
const Resources::ResourceName CoreGraphics::ShaderGetName (const ShaderId id)
 Get name of shader.
 
const SizeT CoreGraphics::ShaderGetConstantCount (const ShaderId id)
 get the number of constants from shader
 
const ShaderConstantType CoreGraphics::ShaderGetConstantType (const ShaderId id, const IndexT i)
 get type of variable by index
 
const ShaderConstantType CoreGraphics::ShaderGetConstantType (const ShaderId id, const Util::StringAtom &name)
 get type of variable by index
 
const Util::StringAtom CoreGraphics::ShaderGetConstantBlockName (const ShaderId id, const Util::StringAtom &name)
 get name of constant buffer wherein constant with name resides
 
const Util::StringAtom CoreGraphics::ShaderGetConstantBlockName (const ShaderId id, const IndexT cIndex)
 get name of constant buffer where in constant with index resides
 
const Util::StringAtom CoreGraphics::ShaderGetConstantName (const ShaderId id, const IndexT i)
 get name of variable by index
 
const IndexT CoreGraphics::ShaderGetConstantGroup (const ShaderId id, const Util::StringAtom &name)
 get group to which constant is bound (the constant buffer which it resides in)
 
const IndexT CoreGraphics::ShaderGetConstantSlot (const ShaderId id, const Util::StringAtom &name)
 get binding inside group of the constant buffer the constant lies in
 
const SizeT CoreGraphics::ShaderGetConstantBufferCount (const ShaderId id)
 get the number of constant buffers from shader
 
const SizeT CoreGraphics::ShaderGetConstantBufferSize (const ShaderId id, const IndexT i)
 get size of constant buffer
 
const Util::StringAtom CoreGraphics::ShaderGetConstantBufferName (const ShaderId id, const IndexT i)
 get name of constant buffer
 
const IndexT CoreGraphics::ShaderGetConstantBufferResourceSlot (const ShaderId id, const IndexT i)
 get binding inside group of constant buffer
 
const IndexT CoreGraphics::ShaderGetConstantBufferResourceGroup (const ShaderId id, const IndexT i)
 get group of constant buffer
 
const uint64 CoreGraphics::ShaderGetConstantBufferBindingMask (const ShaderId id, const IndexT group)
 Get mask of constant buffers.
 
const uint64 CoreGraphics::ShaderGetConstantBufferSize (const ShaderId id, const IndexT group, const IndexT i)
 Get size of constant buffer at binding point.
 
const IndexT CoreGraphics::ShaderGetResourceSlot (const ShaderId id, const Util::StringAtom &name)
 get slot of any shader resource
 
const Util::Dictionary< ShaderFeature::Mask, ShaderProgramId > & CoreGraphics::ShaderGetPrograms (const ShaderId id)
 get programs
 
Util::StringAtom CoreGraphics::ShaderGetProgramName (CoreGraphics::ShaderProgramId id)
 
const CoreGraphics::ShaderProgramId CoreGraphics::ShaderGetProgram (const ShaderId id, const CoreGraphics::ShaderFeature::Mask mask)
 get shader program id from masks, this allows us to apply a shader program directly in the future
 

Variables

Util::Dictionary< Util::StringAtom, VkDescriptorSetLayout > Vulkan::VkShaderLayoutCache
 
Util::Dictionary< Util::StringAtom, VkPipelineLayout > Vulkan::VkShaderPipelineCache
 
Util::Dictionary< Util::StringAtom, VkDescriptorSet > Vulkan::VkShaderDescriptorSetCache
 
ShaderAllocator Vulkan::shaderAlloc