Nebula
Loading...
Searching...
No Matches
vkshader.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
10#include "core/refcounted.h"
11#include "util/tupleutility.h"
12#include "coregraphics/shader.h"
15#include "vkshaderprogram.h"
16
17namespace AnyFX
18{
19class ShaderEffect;
20}
21
22namespace Vulkan
23{
24
25const VkProgramReflectionInfo& ShaderGetProgramReflection(const CoreGraphics::ShaderProgramId shaderProgramId);
26
28void ShaderSetup(
29 VkDevice dev,
30 const Util::StringAtom& name,
31 AnyFX::ShaderEffect* effect,
33 Util::Array<CoreGraphics::SamplerId>& immutableSamplers,
39);
41void ShaderCleanup(
42 VkDevice dev,
43 Util::Array<CoreGraphics::SamplerId>& immutableSamplers,
47);
48
50static Util::String VkShaderCreateSignature(const VkDescriptorSetLayoutBinding& bind);
51
55
56
58{
59 VkDescriptorSet set;
60 VkPipelineLayout layout;
62};
63
65{
66 uint32_t index;
67 uint32_t offset;
68};
69
79
96
123
124enum
125{
130};
131
133typedef Ids::IdAllocator<
134 VkReflectionInfo,
135 VkShaderSetupInfo, //1 setup immutable values
136 VkShaderRuntimeInfo, //2 runtime values
139
141
142} // namespace Vulkan
uint Mask
a shader feature bit mask
Definition shaderfeature.h:31
IndexT Code
binary code for a ModelNodeType
Definition shaderidentifier.h:38
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Nebula's dynamic array class.
Definition array.h:60
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
A StringAtom.
Definition stringatom.h:22
Implements a shader effect (using AnyFX) in Vulkan.
Definition shader.h:37
std::pair< A, B > Pair
Wrap std::pair.
Definition tupleutility.h:47
Vulkan implementation of GPU acceleration structure.
Definition vkaccelerationstructure.cc:15
Util::String VkShaderCreateSignature(const VkDescriptorSetLayoutBinding &bind)
create descriptor layout signature
Definition vkshader.cc:488
Util::Dictionary< CoreGraphics::ShaderFeature::Mask, CoreGraphics::ShaderProgramId > ProgramMap
Definition vkshader.h:72
@ Shader_SetupInfo
Definition vkshader.h:127
@ Shader_RuntimeInfo
Definition vkshader.h:128
@ Shader_Programs
Definition vkshader.h:129
@ Shader_ReflectionInfo
Definition vkshader.h:126
Ids::IdAllocator< VkReflectionInfo, VkShaderSetupInfo, VkShaderRuntimeInfo, Util::Array< CoreGraphics::ShaderProgramId > > ShaderAllocator
this member allocates shaders
Definition vkshader.h:138
Util::Dictionary< Util::StringAtom, VkDescriptorSetLayout > VkShaderLayoutCache
Definition vkshader.cc:21
Util::Dictionary< Util::StringAtom, VkDescriptorSet > VkShaderDescriptorSetCache
Definition vkshader.cc:23
const VkProgramReflectionInfo & ShaderGetProgramReflection(const CoreGraphics::ShaderProgramId shaderProgramId)
Use direct resource ids, not the State, Shader or Variable type ids.
Definition vkshader.cc:498
Util::Dictionary< uint32_t, Util::Array< CoreGraphics::BufferId > > UniformBufferGroupMap
Definition vkshader.h:71
Util::Dictionary< Util::StringAtom, VkPipelineLayout > VkShaderPipelineCache
Definition vkshader.cc:22
void 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
Definition vkshader.cc:72
void 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
Definition vkshader.cc:453
Util::Dictionary< Util::StringAtom, CoreGraphics::BufferId > UniformBufferMap
Definition vkshader.h:70
ShaderAllocator shaderAlloc
Definition vkshader.cc:24
A resource table declares a list of resources (ResourceTable in DX12, DescriptorSet in Vulkan)
Samplers.
A shader represents an entire shader resource, containing several stages and programs.
Definition resourcetable.h:402
Nebula's universal string class.
Definition string.h:50
Definition vkshader.h:65
uint32_t offset
Definition vkshader.h:67
uint32_t index
Definition vkshader.h:66
Definition vkshader.h:58
VkPipelineLayout layout
Definition vkshader.h:60
IndexT slot
Definition vkshader.h:61
VkDescriptorSet set
Definition vkshader.h:59
Util::StringAtom name
Definition vkshader.h:104
uint32_t set
Definition vkshader.h:101
uint32_t byteSize
Definition vkshader.h:103
uint32_t binding
Definition vkshader.h:102
Definition vkshader.h:111
uint32_t blockBinding
Definition vkshader.h:116
uint32_t blockSet
Definition vkshader.h:115
Util::StringAtom name
Definition vkshader.h:113
AnyFX::VariableType type
Definition vkshader.h:112
Util::StringAtom blockName
Definition vkshader.h:114
Definition vkshader.h:98
Util::Dictionary< Util::StringAtom, UniformBuffer > uniformBuffersByName
Definition vkshader.h:107
Util::Array< Variable > variables
Definition vkshader.h:119
Util::Array< Util::Array< UniformBuffer > > uniformBuffersPerSet
Definition vkshader.h:106
Util::Array< UniformBuffer > uniformBuffers
Definition vkshader.h:108
Util::Dictionary< Util::StringAtom, Variable > variablesByName
Definition vkshader.h:118
Util::Array< uint64 > uniformBuffersMask
Definition vkshader.h:121
Definition vkshader.h:74
CoreGraphics::ShaderProgramId activeShaderProgram
Definition vkshader.h:76
CoreGraphics::ShaderFeature::Mask activeMask
Definition vkshader.h:75
ProgramMap programMap
Definition vkshader.h:77
Definition vkshader.h:81
Util::FixedArray< Util::Pair< uint32_t, CoreGraphics::ResourceTableLayoutId > > descriptorSetLayouts
Definition vkshader.h:93
UniformBufferMap uniformBufferMap
Definition vkshader.h:85
CoreGraphics::ResourcePipelineId pipelineLayout
Definition vkshader.h:88
Util::Dictionary< Util::StringAtom, uint32_t > resourceIndexMap
Definition vkshader.h:91
Util::Array< CoreGraphics::SamplerId > immutableSamplers
Definition vkshader.h:90
CoreGraphics::ShaderIdentifier::Code id
Definition vkshader.h:84
UniformBufferGroupMap uniformBufferGroupMap
Definition vkshader.h:86
Util::FixedArray< CoreGraphics::ResourcePipelinePushConstantRange > constantRangeLayout
Definition vkshader.h:89
Util::Dictionary< uint32_t, uint32_t > descriptorSetLayoutMap
Definition vkshader.h:94
Resources::ResourceName name
Definition vkshader.h:83
Util::Dictionary< Util::StringAtom, IndexT > constantBindings
Definition vkshader.h:92
VkDevice dev
Definition vkshader.h:82
int IndexT
Definition types.h:48