4#ifndef FCT_SHADERGENERATOR_H
5#define FCT_SHADERGENERATOR_H
29 const std::map<uint32_t, VertexLayout>& vertexLayouts,
31 const std::vector<ConstLayout>& uniformLayouts,
34 const std::string& userCode);
38 const std::vector<ConstLayout>& uniformLayouts,
41 const std::string& userCode);
44 const std::map<uint32_t, VertexLayout>& vertexLayouts,
52 if (pair.first == layout) {
57 return std::make_pair(0, 0);
62 if (pair.first == texture) {
66 ferr <<
"getTextureBinding 返回过 (0,0)" << std::endl;
68 return std::make_pair(0, 0);
74 if (pair.first == sampler) {
79 return std::make_pair(0, 0);
84 if (pair.first.getName() == name) {
95 const std::map<uint32_t, VertexLayout>& layouts,
96 std::map<std::string, uint32_t>& locationMap);
107 const std::map<uint32_t, VertexLayout>& vertexLayouts,
112 const std::vector<SamplerElement>& samplers);
std::string generateTexturesAndSamplers(RHI::ShaderBinary &binary, const std::vector< TextureElement > &textures, const std::vector< SamplerElement > &samplers)
std::string generateVertexShader(const std::map< uint32_t, VertexLayout > &vertexLayouts, const PixelLayout &pixelLayout, const std::vector< ConstLayout > &uniformLayouts, RHI::ShaderBinary &binary, ResourceLayout &resourceLayout, const std::string &userCode)
std::pair< uint32_t, uint32_t > allocateTextureBinding(const TextureElement &texture)
std::string generateShaderOut()
std::string generateShaderIn(const std::map< uint32_t, VertexLayout > &layouts, std::map< std::string, uint32_t > &locationMap)
std::string uniformTypeToShaderType(ConstType type)
std::vector< std::pair< SamplerElement, std::pair< uint32_t, uint32_t > > > m_samplerSetBindings
void ResourceLayoutToElements(ResourceLayout &resourceLayout, std::vector< TextureElement > &textureElements, std::vector< SamplerElement > &samplerElements)
ShaderGenerator()=default
std::vector< std::pair< ConstLayout, std::pair< uint32_t, uint32_t > > > m_layoutSetBindings
std::pair< uint32_t, uint32_t > getLayoutBinding(ConstLayout layout)
std::string generateDefaultPixelMain(const PixelLayout &pixelLayout)
std::string generateDefaultVertexMain(const std::map< uint32_t, VertexLayout > &vertexLayouts, const PixelLayout &pixelLayout)
TextureElement findTextureElementByName(std::string name)
std::string generatePixelShader(const PixelLayout &layout, const std::vector< ConstLayout > &uniformLayouts, RHI::ShaderBinary &binary, ResourceLayout &resourceLayout, const std::string &userCode)
std::pair< uint32_t, uint32_t > allocateSamplerBinding(const SamplerElement &sampler)
std::string generateVertexMain(const std::map< uint32_t, VertexLayout > &vertexLayouts, const PixelLayout &pixelLayout)
std::string generateConstBuffer(RHI::ShaderBinary &binary, const std::vector< ConstLayout > &uniforms)
std::pair< uint32_t, uint32_t > getSamplerBinding(SamplerElement sampler)
std::string generatePixelMain(const PixelLayout &pixelLayout)
std::pair< uint32_t, uint32_t > getTextureBinding(TextureElement texture)
std::vector< std::pair< TextureElement, std::pair< uint32_t, uint32_t > > > m_textureSetBindings
std::string generateFromPixelLayout(const PixelLayout &layout)
std::unordered_map< UpdateFrequency, uint32_t > m_frequencyBindingCount